Menu

#1023 curl will reuse old Content-Length if none received

closed-accepted
libcurl (356)
5
2013-06-21
2011-07-19
Ben Winslow
No

curl 7.21.7

When an easy handle is used to download an URI which has no Content-Length header (or equivalent) after downloading an URI which does, the value from the previous transfer is reused and returned by CURLINFO_CONTENT_LENGTH_DOWNLOAD. This is because the progress flags (used to determine whether such a header was received) are not reset between transfers. The quick fix I used is attached.

Discussion

  • Ben Winslow

    Ben Winslow - 2011-07-19

    One-line fix

     
  • Daniel Stenberg

    Daniel Stenberg - 2011-07-19
    • status: open --> open-accepted
     
  • Daniel Stenberg

    Daniel Stenberg - 2011-07-19

    Thanks, this is truly a bug that has been around since the age of dawn!

    If you can provide me with an email address as well, I'll have you credited in git as author of this patch! (by private email to me daniel at haxx.se is fine) you can also select not to and then I'll just credit you in the commit message by name instead.

     
  • Ben Winslow

    Ben Winslow - 2011-07-21

    Sure, why not? My email is rain at bluecherry dot net.

    Thanks!

     
  • Daniel Stenberg

    Daniel Stenberg - 2011-07-22

    Thanks for the report, this problem is now fixed in the git repository.

    To try it out, you either checkout/update your git clone: http://curl.haxx.se/source.html

    or you try tomorrow's daily snapshot: http://curl.haxx.se/snapshots/

     
  • Daniel Stenberg

    Daniel Stenberg - 2011-07-22
    • status: open-accepted --> closed-accepted