cURL / Mailing Lists / curl-users / Single Mail

curl-users

Broken CURLINFO_CONTENT_LENGTH_UPLOAD option?

From: Glen Nakamura <glen_at_imodulo.com>
Date: Mon, 22 Mar 2004 12:02:39 -1000

Aloha,

curl_easy_getinfo returns 0.0 for CURLINFO_CONTENT_LENGTH_DOWNLOAD
if CURLOPT_NOBODY is set to 1. This worked in 7.10.8 but is broken
in 7.11.0 and 7.11.1.

On line 491 of lib/transfer.c:

                if(data->set.no_body)
                  stop_reading = TRUE;
                else {

                  ... snipped comments ...

                  if(conn->bits.chunk)
                    conn->size=-1;

                  if(-1 != conn->size) {
                    Curl_pgrsSetDownloadSize(data, conn->size);
                    conn->maxdownload = conn->size;
                  }
                }

Notice Curl_pgrsSetDownloadSize is not called if data->set.no_body is true...
Do we really want Curl_pgrsSetDownloadSize in the else clause?

Version 7.10.8 calls Curl_pgrsSetDownloadSize when it parses the
Content-Length header, but this was removed in 7.11.0 because:
    * Content-Length: is ignored when getting chunked Transfer-Encoding

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

- glen
Received on 2004-03-22