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)    
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 : 28 + 34 = ?

 
 [2007-10-23 03:16 UTC] jstump (Joe Stump)
Description: ------------ So I have a TinyURL (http://tinyurl.com/2c3gzr) that redirects to http://www.joestump.net. 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 http://www.joestump.net works fine. No idea why. Test script: --------------- <?php require_once 'HTTP/Request.php'; // This fails, but http://tinyurl.com/3asshr works $req = new HTTP_Request('http://tinyurl.com/2c3gzr', array( 'readTimeout' => array(20, 0), 'allowRedirects' => true )); $res = $req->sendRequest(); if (PEAR::isError($res)) { echo $res->getMessage() . "\n"; } else { var_dump($req->getResponseCode()); } ?>

Comments

 [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 pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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