cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Yves Arrouye <yarrouye_at_expedia.com>
Date: Wed, 16 Jan 2013 14:36:44 -0800

> 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.

Ok. There are thousands of examples showing that (see resty etc.). If I
drop the -X POST, how does curl know to POST? Because I pass a data
argument to it? What about PUT? Is HEAD assumed when -I is passed?

> >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.

Yes. I'll send a patch in a few days. I've sent some info on it a while
ago on the list (look for a thread where someone was asking about OAuth).

> 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...

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.

YA
ญญญ
Learn about GPT services and architectures on Confluence.
<http://confluence/display/GPT/GPT+Architecture>

On 1/16/13 1:30 PM, "Daniel Stenberg" <daniel_at_haxx.se> wrote:

>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->allocptr.host 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...
>
>--
>
> / 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-16