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  


 [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.