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

Bug #799 HTTP::Header ignore query params
Submitted: 2004-02-19 16:13 UTC
From: shockflash at web dot de Assigned: pajoye
Status: Closed Package: HTTP
PHP Version: 4.3.4 OS: SuSE Linux 9.0
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 : 7 - 4 = ?

 
 [2004-02-19 16:13 UTC] shockflash at web dot de
Description: ------------ If I call a HTTP::head with a URL that looks like http://www.giata-imagecluster-5.de/kat/showimage.php?vea=ifl&size=800&cid=100013&file=image_396378_030811115148859.jpg the system missed the query part of the url (everything behind the "?") I didn't see why it do this. He splits the url the correct way. If i manually change the code of the function that he used also the query, everything works fine. The GIATA Part of the Header is created by the showimage.php script. If the lokal file was found, the script will write the size of the image, if not found or no params are get, the result is "None". Here, the image exists, but the result is "None". Same URL with mod_gzips Testpage: http://www.schroepl.net/cgi-bin/http_trace.pl?url=http%3A%2F%2Fwww.giata-imagecluster-5.de%2Fkat%2Fshowimage.php%3Fvea%3Difl%26size%3D320%26cid%3D100013%26file%3Difl380522_030626164316812.jpg&method=HEAD&version=HTTP%2F1.0 It works here! Reproduce code: --------------- $URL = 'http://www.giata-imagecluster-5.de/kat/showimage.php?vea=ifl&size=800&cid=100013&file=image_396378_030811115148859.jpg'; $result = HTTP::head(trim($URL)); echo("<pre>"); print_r($result); echo("<//pre>"); Expected result: ---------------- [ 15] HTTP/1.0 200 OK [ 17] Connection: close [ 35] Date: Thu, 19 Feb 2004 15:07:53 GMT [ 58] Server: Apache/1.3.27 (Linux/SuSE) PHP/4.3.1 mod_perl/1.27 [ 24] Content-Type: image/jpeg [ 18] GIATA: Picture=320 [ 23] X-Powered-By: PHP/4.3.1 Actual result: -------------- Array ( [response_code] => 200 [response] => HTTP/1.1 200 OK [Date] => Thu, 19 Feb 2004 15:40:36 GMT [Server] => Apache/1.3.27 (Linux/SuSE) PHP/4.3.1 mod_perl/1.27 [X-Powered-By] => PHP/4.3.1 [GIATA] => None [Connection] => close [Content-Type] => image/jpeg )

Comments

 [2004-02-19 18:39 UTC] mj
The following patch fixes that. Index: HTTP.php =================================================================== RCS file: /repository/pear/HTTP/HTTP.php,v retrieving revision 1.20 diff -u -r1.20 HTTP.php --- HTTP.php 9 Dec 2003 12:27:47 -0000 1.20 +++ HTTP.php 19 Feb 2004 18:45:51 -0000 @@ -151,6 +151,7 @@ return PEAR::raiseError("HTTP::head Error $errstr ($erno)"); } $path = (!empty($purl['path'])) ? $purl['path'] : '/'; + $path .= (!empty($purl['query'])) ? '?' . $purl['query'] : ''; fputs($fp, "HEAD $path HTTP/1.0\r\n"); fputs($fp, "Host: " . $purl['host'] . "\r\n");
 [2004-02-24 10:54 UTC] pajoye
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.