From 4c3c3529e964afed74f1bf775ced5b03d2004bdb Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 26 Nov 2023 23:20:46 +0300 Subject: [PATCH] engine: network: rename length variable to something that makes sense. Add usage line to http_addcustomserver --- engine/common/net_ws.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index 752e7cc5..b03273e2 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -2411,7 +2411,7 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile ) if( begin ) // Got full header { int cutheadersize = begin - curfile->buf + 4; // after that begin of data - char *length; + char *content_length_line; Con_Reportf( "HTTP: Got response!\n" ); @@ -2430,10 +2430,13 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile ) } // print size - length = Q_stristr( curfile->buf, "Content-Length: " ); - if( length ) + content_length_line = Q_stristr( curfile->buf, "Content-Length: " ); + if( content_length_line ) { - int size = Q_atoi( length += 16 ); + int size; + + content_length_line += sizeof( "Content-Length: " ) - 1; + size = Q_atoi( content_length_line ); Con_Reportf( "HTTP: File size is %d\n", size ); @@ -2875,6 +2878,10 @@ static void HTTP_AddCustomServer_f( void ) { HTTP_AddCustomServer( Cmd_Argv( 1 )); } + else + { + Con_Printf( S_USAGE "http_addcustomserver \n" ); + } } /*