Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.1

Request #1854 Redirect on Code 301
Submitted: 2004-07-12 14:03 UTC
From: ths Assigned:
Status: Closed Package: HTTP_Client
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 49 - 5 = ?

 
 [2004-07-12 14:03 UTC] ths
Description: ------------ HTTP_Client respond to a redirect containing code 301 with a post request to location. Clients like firefox or IE with a get request. This create a problem when "location" don't expect a post and tells you: "The requested method POST is not allowed for the URL /the_location.html". The patch is easy, but i don't look at the HTTP specs... --- Client.php 12 Dec 2003 15:53:23 -0000 1.2 +++ Client.php 12 Jul 2004 13:58:25 -0000 @@ -245,7 +245,7 @@ // we access the private properties directly, as there are no accessors for them switch ($request->_method) { case HTTP_REQUEST_METHOD_POST: - if (302 == $code || 303 == $code) { + if (301 == $code || 302 == $code || 303 == $code) { return $this->get($url); } else { return $this->post($url, $request->_postData, true);

Comments

 [2004-07-14 16:19 UTC] ths
RFC2616 - 10.3.2 301 Moved Permanently "Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request." Ok, then this is a feature request for simulate broken browsers... ;-)
 [2004-10-04 13:54 UTC] avb
In CVS version of HTTP_Client I added possibility to define a constant 'HTTP_CLIENT_QUIRK_MODE', if it is present then the class will behave just like browsers do, i.e. perform a GET request. If there are other differences between RFC 2616 and its common implementations, then they can be toggled by this constant, too.