Philip Langdale provided the new CURLOPT_POST301 option for

curl_easy_setopt() that alters how libcurl functions when following
redirects. It makes libcurl obey the RFC2616 when a 301 response is received
after a non-GET request is made. Default libcurl behaviour is to change
method to GET in the subsequent request (like it does for response code 302
- because that's what many/most browsers do), but with this CURLOPT_POST301
option enabled it will do what the spec says and do the next request using
the same method again. I.e keep POST after 301.

The curl tool got this option as --post301

Test case 1011 and 1012 were added to verify.
This commit is contained in:
Daniel Stenberg
2007-09-26 12:44:59 +00:00
parent a6315359d7
commit fd4cf78f36
11 changed files with 213 additions and 19 deletions

View File

@@ -924,6 +924,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->set.maxredirs = va_arg(param, long);
break;
case CURLOPT_POST301:
/*
* Obey RFC 2616/10.3.2 and resubmit a POST as a POST after a 301.
*/
data->set.post301 = (bool)(0 != va_arg(param, long));
break;
case CURLOPT_POST:
/* Does this option serve a purpose anymore? Yes it does, when
CURLOPT_POSTFIELDS isn't used and the POST data is read off the