cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl -d option and no data is send

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 2 Apr 2008 11:51:00 +0200 (CEST)

On Mon, 31 Mar 2008, Karin Mustermann wrote:

> I´m trying to send data via post method to a webserver in my intranet from
> the commandline with following options:
>
> curl --data "pin=CP5&value=0&set=Submit" --digest -v --user admin:pass
> xx.yy.zz

> < HTTP/1.1 400 Bad Request: Invalid Content Length

Interesting. Your server seem to verify the request before it verifies the
authentication. curl sends a zero length POST when it knows it won't be
accepted and thus it won't have to send any data in vein.

You can probably work around this problem by using --anyauth instead of
--digest.

> I tried the -F option too, the output is the same.

-F is not interchangable with -d at your will anyway.

> It seems that curl does not include the data, my Content-Length is always 0.

Indeed, since Digest is a challenge-response based concept curl knows it won't
send anything in that first POST so it has no intention of sending any data at
that point.

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