cURL / Mailing Lists / curl-users / Single Mail

curl-users

Overriding outgoing Content-Length on a PUT

From: Charles Duffy <Charles_Duffy_at_messageone.com>
Date: Mon, 05 May 2008 17:49:00 -0500

I'm trying to upload from a named pipe using the curl command-line tool.
I know the size of the content coming through the pipe, and want to
provide it in the Content-Length field. However, even if I provide my
own value for Content-Length, curl insists on providing its own (0-byte)
value in addition:

$ curl -vv "URL_REDACTED" \
          -X PUT \
        -T <(bfr -b 20 --speedcap 10 --minimum=10 "${FILE}") \
        -H "Content-Length: $(stat -c '%s' "${FILE}")"
* About to connect() to localhost port 2080 (#0)
* Trying 127.0.1.1... connected
* Connected to localhost (127.0.1.1) port 2080 (#0)
* Server auth using Basic with user 'USER_REDACTED'
> PUT URL_REDACTED HTTP/1.1
> Authorization: REDACTED
> User-Agent: curl/7.18.0 (x86_64-pc-linux-gnu) libcurl/7.18.0
OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1
> Host: localhost:2080
> Accept: */*
> Content-Length: 7515
> Content-Length: 0
> Expect: 100-continue

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