curl-library
Re: cURL behavior on 303 does not seem to be what is documented/advertised?
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
>(later)
> 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->allocptr.host 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->allocptr.host;
if(!hosthdr) {
hosthdr = Curl_checkheaders("Host:");
}
Or did you have something simpler in mind? Maybe I am reading this wrong...
YA
Learn about GPT services and architectures on Confluence.
<http://confluence/display/GPT/GPT+Architecture>
On 1/17/13 2:27 PM, "Daniel Stenberg" <daniel_at_haxx.se> 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
>anyone
>in the curl project or are hosted on the curl site. A bad idea repeated
>many
>times remains a bad idea!
>
>> If I drop the -X POST, how does curl know to POST? Because I pass a
>>data
>> 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?
>
>Yes.
>
>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
>>URL).
>> 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
>(later)
>used to create the host header.
>
>--
>
> / daniel.haxx.se
>-------------------------------------------------------------------
>List admin: http://cool.haxx.se/list/listinfo/curl-library
>Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-17