From c815c72a23be534af3b63f5b3030559cea07af6a Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 4 Oct 2005 18:06:49 +0000 Subject: [PATCH] A small tweek that tracks download sizes proprly with chunked/file downloads. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1411 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/http/httpclient.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/http/httpclient.c b/engine/http/httpclient.c index 0e1100a9e..83d48eecd 100644 --- a/engine/http/httpclient.c +++ b/engine/http/httpclient.c @@ -77,6 +77,8 @@ typedef struct { int bufferused; int bufferlen; + int totalreceived; //useful when we're just dumping to a file. + qboolean chunking; int chunksize; int chunked; @@ -309,6 +311,7 @@ static qboolean HTTP_CL_Run(http_con_t *con) } + con->totalreceived+=con->chunked; if (con->file && con->chunked) //we've got a chunk in the buffer { //write it IWebFWrite(con->buffer, con->chunked, 1, con->file); @@ -320,6 +323,7 @@ static qboolean HTTP_CL_Run(http_con_t *con) } else { + con->totalreceived+=ammount; if (con->file) //we've got a chunk in the buffer { //write it IWebFWrite(con->buffer, con->bufferused, 1, con->file); @@ -399,7 +403,7 @@ void HTTP_CL_Think(void) else if (con->contentlength <= 0) cls.downloadpercent = 50; else - cls.downloadpercent = con->bufferused*100.0f/con->contentlength; + cls.downloadpercent = con->totalreceived*100.0f/con->contentlength; } } }