engine: network: set HTTP buffer to 8kb on all systems, without depending on random constant like BUFSIZ
This commit is contained in:
parent
68377435c8
commit
7051b844ff
1 changed files with 7 additions and 5 deletions
|
@ -2200,6 +2200,8 @@ HTTP downloader
|
||||||
=================================================
|
=================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define MAX_HTTP_BUFFER_SIZE (BIT( 13 ))
|
||||||
|
|
||||||
typedef struct httpserver_s
|
typedef struct httpserver_s
|
||||||
{
|
{
|
||||||
char host[256];
|
char host[256];
|
||||||
|
@ -2240,7 +2242,7 @@ typedef struct httpfile_s
|
||||||
qboolean process;
|
qboolean process;
|
||||||
|
|
||||||
// query or response
|
// query or response
|
||||||
char buf[BUFSIZ+1];
|
char buf[MAX_HTTP_BUFFER_SIZE+1];
|
||||||
int header_size, query_length, bytes_sent;
|
int header_size, query_length, bytes_sent;
|
||||||
} httpfile_t;
|
} httpfile_t;
|
||||||
|
|
||||||
|
@ -2385,18 +2387,18 @@ process incoming data
|
||||||
*/
|
*/
|
||||||
static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ+1];
|
char buf[sizeof( curfile->buf )];
|
||||||
char *begin = 0;
|
char *begin = 0;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if( curfile->header_size >= BUFSIZ )
|
if( curfile->header_size >= sizeof( buf ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Header to big\n");
|
Con_Reportf( S_ERROR "Header too big, the size is %s\n", curfile->header_size );
|
||||||
HTTP_FreeFile( curfile, true );
|
HTTP_FreeFile( curfile, true );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( ( res = recv( curfile->socket, buf, BUFSIZ - curfile->header_size, 0 )) > 0) // if we got there, we are receiving data
|
while( ( res = recv( curfile->socket, buf, sizeof( buf ) - curfile->header_size, 0 )) > 0) // if we got there, we are receiving data
|
||||||
{
|
{
|
||||||
curfile->blocktime = 0;
|
curfile->blocktime = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue