cURL / Mailing Lists / curl-library / Single Mail


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

From: Yves Arrouye <>
Date: Thu, 17 Jan 2013 14:59:13 -0800

Thanks. The man page on -X is unclear: it does not mention that -X is
"sticky" across redirections. Maybe that could be improved. The verbose
message saying using GET right before POSTing could also be slightly
conditional so it says the right thing :)

> You should instead get the host name from the struct member that is
> used to create the host header.

Are you talking about the conn->host structure? I started there, but if
there is a custom Host header, I need to use that. So I'd rather let curl
do all the work it wants to do in determining what that header should look
like (using the custom one, using the URL data, properly brace-quoting
IPv6 addresses etc.) and then use that. Is there a reason not to (maybe
it's belowŠ)?

On the topic of Host headers, it seems that libcurl will sometimes set
conn-> to NULL after grabbing the custom header for storing
cookies later on. But there is still a custom Host header then. And then
as libcurl emits headers, it will then emit one of those headers. So, is
the way to know what the host header looks like:

  hosthdr = conn->;
  if(!hosthdr) {
    hosthdr = Curl_checkheaders("Host:");

Or did you have something simpler in mind? Maybe I am reading this wrong...

Learn about GPT services and architectures on Confluence.

On 1/17/13 2:27 PM, "Daniel Stenberg" <> wrote:

>On Wed, 16 Jan 2013, Yves Arrouye wrote:
>> > You hardly ever truly want to use -X.
>> Ok. There are thousands of examples showing that (see resty etc.).
>But if you look again, you'll see that basically none of them are from
>in the curl project or are hosted on the curl site. A bad idea repeated
>times remains a bad idea!
>> If I drop the -X POST, how does curl know to POST? Because I pass a
>> argument to it?
>Yes, that's how you ask for a POST.
>> What about PUT?
>That's what -T makes.
>> Is HEAD assumed when -I is passed?
>All this is documented by the way, this is not some sort of hidden truth!
>> I am implementing the HTTP MAC I-D which requires that the host name is
>> obtained from the host header (I used to get it from the connection's
>> I've fixed the code to move setting it before I need.
>You should instead get the host name from the struct member that is
>used to create the host header.
> /
>List admin:

List admin:
Received on 2013-01-17