cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: chunked Transfer-Encoding and spurious \r\n in output

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 21 Feb 2014 20:23:12 +0100 (CET)

On Fri, 21 Feb 2014, Bram de Jong wrote:

> I'm getting a binary file via libcurl (7.35.0) and the server is sending the
> data in chunks to me. In the bytes I get from libcurl I see spurious \r\n's.
>
> Is this normal? Am *I* supposed to strip out the \r\n's from the chunks?

No. libcurl is supposed to hide the transfer related stuff such as content
encoding details. And we do have numerous tests that prove that it mostly
works too.

> See the verbose output below for the next bit: as you can see this is
> actually after a 302/redirect from another server. I set up libcurl to
> follow automatically... It seems weird to me that the first server says that
> the reply will be chunked, but the second doesn't repeat this, even though
> the reply is chunked!

Then the server is sending you a broken response. It doesn't say chunked
encoding but still send the data that way. libcurl will (of course) not
magically assume that there's chunked encoding to deal with in this case.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-21