cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Wrong for "Content-Range: " in HTTP Resume Uploading with Digest Authentication

From: Song Ma <songmash_at_gmail.com>
Date: Thu, 9 Aug 2007 02:02:24 +0800

> Can you just check 'data->state.this_is_a_follow' and skip the
> re-calculation
> if that is true?
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html

Yes "data->state.this_is_a_follow" gives me the elegant answer to fix this
problem. I've been searching in the structures of "conn" and "data" to try
to find a flag to use. Somehow I missed it :)

Here is the patch based on curl-7.17.0-20070807:
--- http.c.orig 2007-08-09 01:53:57.000000000 +0800
+++ http.c 2007-08-09 01:55:28.000000000 +0800
@@ -1993,7 +1993,7 @@
        data->reqdata.resume_from = 0;
     }

- if(data->reqdata.resume_from) {
+ if(data->reqdata.resume_from && !data->state.this_is_a_follow) {
       /* do we still game? */
       curl_off_t passed=0;

@@ -2049,6 +2049,10 @@
     else if((httpreq != HTTPREQ_GET) &&
             !checkheaders(data, "Content-Range:")) {

+ /* if a line like this was already allocated, free the previous one
*/
+ if(conn->allocptr.rangeline)
+ free(conn->allocptr.rangeline);
+
       if(data->reqdata.resume_from) {
         /* This is because "resume" was selected */
         curl_off_t total_expected_size=

Please refer to the attached test cases that can detect this problem.

  • application/octet-stream attachment: test5320
  • application/octet-stream attachment: test5322
Received on 2007-08-08