cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl chunk option?

From: Chris Cross <xcross_at_us.ibm.com>
Date: Thu, 3 Sep 2009 09:57:59 -0400

daniel_at_cool.haxx.se wrote on 09/03/2009 03:39:04 AM:

> On Wed, 2 Sep 2009, Chris Cross wrote:
>
> > Daniel, curl certainly appears to be streaming instead of buffering the
> > message
>
> This statement confuses me as well, as -d certainly "buffers" the
> entire thing
> in memory before it gets sent. But once it has buffered the file in ram
it
> will "stream" it to the server.

I mean streaming defined as not buffering, so from your previous
instructions started using -T in lieu of -d.

>
> > but in both cases, -T and -F, the headers say Content-length. Is
> > there an option to force curl to use "Transfer-encoding: chunked" ?
>
> Yes you can, at least with -T. With -F there's simply no point in trying
to
> enforce that, as you won't gain anything due to how (lib)curl will
evaluate
> the full size of what to send before it starts to send anything -
> anyway. With
> -T - or -d @- for example you can force chunked encoding getting used in
the
> request body by using:
>
> -H "Transfer-Encoding: chunked"

I tried this:

   curl -H "Transfer-Encoding: chunked" -T file5M
http://localhost/cgi-bin/chunked-upload

and saw in the packet capture that the the header for the POST was indeed
changed, using "Transfer-Encoding: chunked" instead of Content-length.
However, subsequent packets are continuation with data only and not the
chunked headers one would expect. Am I still missing something?

Thanks,
Chris

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-09-03