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

Bug #2332 [PATCH] redirect() doesn't comply with RFC2616
Submitted: 2004-09-14 20:55 UTC
From: ieure at php dot net Assigned: mike
Status: Closed Package: HTTP
PHP Version: 4.3.8 OS: Linux
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 : 39 - 1 = ?

 
 [2004-09-14 20:55 UTC] ieure at php dot net
Description: ------------ According to RFC2616: "Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s)." This is not the case with PEAR::HTTP. Certain user-agents (such as WAP browsers) do not follow redirects unless there is content returned by the GET request. Patch follows: --- HTTP.php.orig 2004-09-14 13:49:10.000000000 -0700 +++ HTTP.php 2004-09-14 13:52:18.000000000 -0700 @@ -226,6 +226,9 @@ header('Location: '. HTTP::absoluteURI($url)); if ($exit) { + if ($_SERVER['REQUEST_METHOD'] != 'HEAD') { + echo "Redirecting to: <a href="{$url}">{$url}</a>"; + } exit; } return true; Reproduce code: --------------- require_once 'HTTP.php'; HTTP::redirect("http://www.example.com"); Expected result: ---------------- The "Location" HTTP header should be set, and a hypertext note should be sent in the body of the response, in compliance with RFC2616. Actual result: -------------- No body content is sent for GET requests.

Comments

 [2004-09-21 15:18 UTC] mike
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.