cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Overriding outgoing Content-Length on a PUT

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 6 May 2008 22:42:49 +0200 (CEST)

On Mon, 5 May 2008, Charles Duffy wrote:

> However, even if I provide my own value for Content-Length, curl insists on
> providing its own (0-byte) value in addition:

Yeps, this is quite clearly a bug. But also, just making libcurl skip setting
its own header won't be enough to fix this bug since it will also use the
assumed size to know how large upload to expect.

> The second "Content-Length: 0" header overrides the "Content-Length: 7515"
> on my server. How should I avoid this?

I'd suggest you pipe it to stdin and enable chunked encoding as a work-around:

   [command] | curl -H "Transfer-Encoding: chunked" -T - [URL]

... or you store the data in a temp file:

   [command] > dump && curl -T dump [URL] && rm dump

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-05-06