From fd4cf78f36e89b8a0913e4fb34fd7a89f5c0cfd4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 26 Sep 2007 12:44:59 +0000 Subject: 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. --- tests/data/test1011 | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/data/test1011 (limited to 'tests/data/test1011') diff --git a/tests/data/test1011 b/tests/data/test1011 new file mode 100644 index 000000000..62ba074a1 --- /dev/null +++ b/tests/data/test1011 @@ -0,0 +1,76 @@ + + + +HTTP +HTTP POST +followlocation + + +# +# Server-side + + +HTTP/1.1 301 OK swsclose +Location: moo.html&testcase=/10110002 +Date: Thu, 09 Nov 2010 14:49:00 GMT +Connection: close + + + +HTTP/1.1 200 OK swsclose +Location: this should be ignored +Date: Thu, 09 Nov 2010 14:49:00 GMT +Connection: close + +body + + +HTTP/1.1 301 OK swsclose +Location: moo.html&testcase=/10110002 +Date: Thu, 09 Nov 2010 14:49:00 GMT +Connection: close + +HTTP/1.1 200 OK swsclose +Location: this should be ignored +Date: Thu, 09 Nov 2010 14:49:00 GMT +Connection: close + +body + + + +# +# Client-side + + +http + + +HTTP POST with 301 redirect + + +http://%HOSTIP:%HTTPPORT/blah/1011 -L -d "moo" + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +POST /blah/1011 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Content-Length: 3 +Content-Type: application/x-www-form-urlencoded + +mooGET /blah/moo.html&testcase=/10110002 HTTP/1.1 +User-Agent: curl/7.10 (i686-pc-linux-gnu) libcurl/7.10 OpenSSL/0.9.6c ipv6 zlib/1.1.3 +Host: %HOSTIP:%HTTPPORT +Accept: */* + + + + -- cgit v1.2.3