cURL / Mailing Lists / curl-library / Single Mail


Re: cURL behavior on 303 does not seem to be what is documented/advertised?

From: Daniel Stenberg <>
Date: Wed, 16 Jan 2013 22:30:13 +0100 (CET)

On Wed, 16 Jan 2013, Yves Arrouye wrote:

>> This is because you've explicitly told curl with -X that you want a POST to
>> be used. Why would you do that if you don't want that?
> I do want a POST. Curl did POST to the first URL, and got a 303. It then
> says (and that matches its man page for -L) that because it got a 303 it
> will then do a GET to the new location. It seems to still do a POST though.
> What would be the options that would make curl do a POST first and then a
> GET on the 303?

I guess I wasn't clear enough then: drop the -X POST. It is what destroys your
command. You hardly ever truly want to use -X.

> As for the redundant -H, it is there because I am using HTTP MAC and HTTP
> MAC requires that the host be encoded from the Host header.

Are you talking about using a modified libcurl in which you've added support
for another HTTP authentication method? Last time I checked there's no "HTTP
MAC" in libcurl.

> I thought about defaulting to the host from the connection in my code but
> decided I would rather require a Host header. Can I always rely on
> conn-> being set at the time one generates an Authorization
> header? If so I'll switch to that.

If you're writing code that wants the host name, you should not get it off the
"host header" in my opinion. And if you still have a solid reason for wanting
this, then you should still fix the code to do right rather than weirdly
enforcing the user to set the Host: header...

List admin:
Received on 2013-01-16