summaryrefslogtreecommitdiff
path: root/lib/progress.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2012-03-23 23:42:37 +0100
committerDaniel Stenberg <daniel@haxx.se>2012-04-01 00:07:24 +0200
commitc44d45db86b880df5facd6b560491e03530f876e (patch)
tree97fd94273ca7a3666b720286d2470e3accd5d263 /lib/progress.c
parent7a2647e16237a2771f564d432d96a6f198a0eeb5 (diff)
downloadcurl-c44d45db86b880df5facd6b560491e03530f876e.tar.gz
HTTP: reset expected DL/UL sizes on redirects
With FOLLOWLOCATION enabled. When a 3xx page is downloaded and the download size was known (like with a Content-Length header), but the subsequent URL (transfered after the 3xx page) was chunked encoded, then the previous "known download size" would linger and cause the progress meter to get incorrect information, ie the former value would remain being sent in. This could easily result in downloads that were WAY larger than "expected" and would cause >100% outputs with the curl command line tool. Test case 599 was created and it was used to repeat the bug and then verify the fix. Bug: http://curl.haxx.se/bug/view.cgi?id=3510057 Reported by: Michael Wallner
Diffstat (limited to 'lib/progress.c')
-rw-r--r--lib/progress.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/progress.c b/lib/progress.c
index 1eeb78052..4c9a63acb 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -146,13 +146,16 @@ void Curl_pgrsDone(struct connectdata *conn)
data->progress.speeder_c = 0; /* reset the progress meter display */
}
-/* reset all times except redirect */
-void Curl_pgrsResetTimes(struct SessionHandle *data)
+/* reset all times except redirect, and reset the known transfer sizes */
+void Curl_pgrsResetTimesSizes(struct SessionHandle *data)
{
data->progress.t_nslookup = 0.0;
data->progress.t_connect = 0.0;
data->progress.t_pretransfer = 0.0;
data->progress.t_starttransfer = 0.0;
+
+ Curl_pgrsSetDownloadSize(data, 0);
+ Curl_pgrsSetUploadSize(data, 0);
}
void Curl_pgrsTime(struct SessionHandle *data, timerid timer)