ID:               49571
 Updated by:       srina...@php.net
 Reported By:      info at pcxtra dot nl
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Windows XP
 PHP Version:      5.3.0
 Assigned To:      srinatar
 New Comment:

I am not sure, i completely understand your issue here. 

when you post data to a server returning with 302, curl will by default
return with GET requests (which is non-RFC compliant)

as per HTTP/1.1 spec 10.3.3 in http://www.ietf.org/rfc/rfc2068.txt 

If the 302 status code is received in response to a request other
   than GET or HEAD, the user agent MUST NOT automatically redirect
the
   request unless it can be confirmed by the user, since this might
   change the conditions under which the request was issued.

     Note: When automatically redirecting a POST request after
receiving
     a 302 status code, some existing HTTP/1.0 user agents will
     erroneously change it into a GET request.


curl to provide backward compatibility will by default return with GET
for post requests returning with 301/302 redirects. 

now, if you wanted to stop this behavior, and instead curl to be
standards compliant ,then you need to set this CURL_POSTREDIR option.

as you mentioned, this option makes sense only when used with
CURLOPT_FOLLOWLOCATION.

is this what you are looking for ?


Previous Comments:
------------------------------------------------------------------------

[2009-09-16 13:54:26] info at pcxtra dot nl

Description:
------------
I'd like to use the CURLOPT_POSTREDIR. When I try to POST data to a
page it will return with 302 and CURL will redirect with POST. However I
need to configure this to redirect with GET which can be configured with
CURLOPT_POSTREDIR which is added in curl 7.19.1. (I'm using PHP 5.3 with
Curl 7.19.4)

I also tried 
curl_setopt($ch, 161 , 0);
(also tried 1,2 and 3)
in the hope it would still work, but it didn't.

Reproduce code:
---------------
By POSTing something to an URL which returns 302 and the following
settings:

curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

It will show with curl_getinfo:
[request_header] => POST /Account/MyPortal.aspx HTTP/1.1


Expected result:
----------------
I would have expected (and wanted) 
[request_header] => GET /Account/MyPortal.aspx HTTP/1.1




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49571&edit=1

Reply via email to