cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Broken CURLINFO_CONTENT_LENGTH_UPLOAD option?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 22 Mar 2004 23:28:08 +0100 (CET)

On Mon, 22 Mar 2004, Glen Nakamura wrote:

> I think the simple fix is just to remove the "else" and have the clause
> containing Curl_pgrsSetDownloadSize execute outside the conditional.

Yes, I believe this little patch might make things run as they used to:

diff -u -r1.212 transfer.c
--- transfer.c 16 Mar 2004 09:16:38 -0000 1.212
+++ transfer.c 22 Mar 2004 22:29:29 -0000
@@ -507,10 +507,14 @@
                   if(conn->bits.chunk)
                     conn->size=-1;

- if(-1 != conn->size) {
- Curl_pgrsSetDownloadSize(data, conn->size);
- conn->maxdownload = conn->size;
- }
+ }
+ if(-1 != conn->size) {
+ /* We do this operation even if no_body is true, since this
+ data might be retrieved later with curl_easy_getinfo()
+ and its CURLINFO_CONTENT_LENGTH_DOWNLOAD option. */
+
+ Curl_pgrsSetDownloadSize(data, conn->size);
+ conn->maxdownload = conn->size;
                 }
                 /* If max download size is *zero* (nothing) we already
                    have nothing and can safely return ok now! */

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
Received on 2004-03-22