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

Bug #12308 Malformed GET requests on redirects when no trailing slash
Submitted: 2007-10-23 03:16 UTC
From: jstump Assigned: avb
Status: Closed Package: HTTP_Request (version 1.4.1)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    

 [2007-10-23 03:16 UTC] jstump (Joe Stump)
Description: ------------ So I have a TinyURL ( that redirects to I was getting malformed responses from HTTP_Request and couldn't figure out why until I found out that it was sending "GET HTTP/1.1\r\n". The reason is because on line 880 of HTTP/Request.php $url is empty. This appears to be happening because, on redirect, the URL doesn't have a proxy and, on top of that, the $querystring is empty. Now that I think about it it's entirely possible this is a bug in Net_URL. At any rate, I added if (!strlen($url)) { $url = '/'; } after line 880 and it works now. This *only* happens when redirecting. A raw HTTP_Request to works fine. No idea why. Test script: --------------- <?php require_once 'HTTP/Request.php'; // This fails, but works $req = new HTTP_Request('', array( 'readTimeout' => array(20, 0), 'allowRedirects' => true )); $res = $req->sendRequest(); if (PEAR::isError($res)) { echo $res->getMessage() . "\n"; } else { var_dump($req->getResponseCode()); } ?>


 [2007-10-24 19:25 UTC] avb (Alexey Borzov)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Applied patch from request #12335