cURL / Mailing Lists / curl-library / Single Mail


Re: question about chunked encoding and CURLINFO_SIZE_DOWNLOAD

From: Daniel Stenberg <>
Date: Fri, 16 May 2014 08:39:47 +0200 (CEST)

On Thu, 15 May 2014, Ryan Braud wrote:

> "Pass a pointer to a double to receive the total amount of bytes that were
> downloaded. The amount is only for the latest transfer and will be reset
> again for each new transfer."

I think this can be clarified somewhat. I would like it to say that it counts
the number of bytes considered part of the "payload", "body" or "data" or
whatever generic name we use to identify the data that is meant for the
application. All meta information and headers excluded.

> So, I thought this would be the # of bytes transferred over the wire for a
> request. However, when using CURLOPT_WRITEFUNCTION and comparing the number
> of bytes passed to it with the value returned from CURLINFO_SIZE_DOWNLOAD,
> they are the same, even if the response was returned with chunked encoding.
> Shouldn't the wire size of a chunked response be different than the actual
> page size, due to the encoding process?

I think that would cause problems with those existing applications that made
assumptions like in the style I mentioned above.

We already separate the header size with CURLINFO_HEADER_SIZE and even if it
isn't quite clear how we'd count chunked-encoded meta-data I would rather have
us count that as headers rather than body.

List admin:
Received on 2014-05-16