mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-02-04 03:04:14 +00:00
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
@ -2200,6 +2200,8 @@ HTTP downloader
|
||||
=================================================
|
||||
*/
|
||||
|
||||
#define MAX_HTTP_BUFFER_SIZE (BIT( 13 ))
|
||||
|
||||
typedef struct httpserver_s
|
||||
{
|
||||
char host[256];
|
||||
@ -2240,7 +2242,7 @@ typedef struct httpfile_s
|
||||
qboolean process;
|
||||
|
||||
// query or response
|
||||
char buf[BUFSIZ+1];
|
||||
char buf[MAX_HTTP_BUFFER_SIZE+1];
|
||||
int header_size, query_length, bytes_sent;
|
||||
} httpfile_t;
|
||||
|
||||
@ -2385,18 +2387,18 @@ process incoming data
|
||||
*/
|
||||
static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
||||
{
|
||||
char buf[BUFSIZ+1];
|
||||
char buf[sizeof( curfile->buf )];
|
||||
char *begin = 0;
|
||||
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 );
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user