cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to send POST request when follow location

From: xinyi huang <huangxinyi.cn_at_gmail.com>
Date: Wed, 13 Jul 2011 14:07:14 +0800

Thanks very very very much. The CURLOPT_POSTREDIR fix my problem.
And , I changed the error size to CURL_ERROR_SIZE .
Again, thank you:)

2011/7/13 Daniel Stenberg <daniel_at_haxx.se>

> On Tue, 12 Jul 2011, xinyi huang wrote:
>
> I have send a POST request, and set CURLOPT_FOLLOWLOCATION to be TRUE.
>> The peer http url will location to a new https url.
>> Output information shows that curl automatically send a new GET request to
>> the new url.
>>
>
> It depends entirely on the HTTP response code the server returns. libcurl
> is made to (by default) mimic how browsers treat them, which for 301 and 302
> that it will change from POST to GET - contrary to what RFC2616 says we
> should.
>
> You can alter the behavior for both 301 and 302 by the use of the
> CURLOPT_POSTREDIR option.
>
>
> char error[2048] = {0};
>> curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error);
>>
>
> CURL_ERROR_SIZE might be clever to use for the error buffer as it will
> never be larger!
>
> --
>
> / daniel.haxx.se
> ------------------------------**------------------------------**-------
> List admin: http://cool.haxx.se/list/**listinfo/curl-library<http://cool.haxx.se/list/listinfo/curl-library>
> Etiquette: http://curl.haxx.se/mail/**etiquette.html<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 2011-07-13