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

Bug #8245 Empty body (gzip?)in CurrentResponse
Submitted: 2006-07-19 07:03 UTC Modified: 2006-10-24 15:08 UTC
From: mmsmodell at mms-modell dot hu Assigned: avb
Status: Closed Package: HTTP_Request (version 1.1.0)
PHP Version: 5.0.0 OS: Debian
Roadmaps: (Not assigned)    
Subscription  


 [2006-07-19 07:03 UTC] mmsmodell at mms-modell dot hu (Gergely)
Description: ------------ Dear Developers, In some situations HTTP_Client will return an empty body, even though browsers are perfectly capable of reading the given page. Most recently I experienced the problem with an xxx collection messiestfacials.com, but I think more legitimate sites would behave the same. The hader info returned for this address is - Array ( [code] => 200 [headers] => Array ( [date] => Wed, 19 Jul 2006 11:53:50 GMT [server] => Apache/1.3.34 (Unix) PHP/4.4.1 [content-encoding] => gzip [connection] => close [transfer-encoding] => chunked [content-type] => text/html ) [body] => ) Strangely IE will read the page, and the same code works very well for other websites. The code below generates this output. Any Idea? Thank you, waiting for your answer, Test script: --------------- require_once "HTTP/Client.php"; $client = new HTTP_Client(); $url="http://www.messiestfacials.com/"; $client->get($url); $url_a = $client->CurrentResponse(); print_r($url_a); $url_ = $url_a['body']; echo($url_); Expected result: ---------------- I would expect a non-empty body, and the page displayed. Actual result: -------------- Array ( [code] => 200 [headers] => Array ( [date] => Wed, 19 Jul 2006 11:53:50 GMT [server] => Apache/1.3.34 (Unix) PHP/4.4.1 [content-encoding] => gzip [connection] => close [transfer-encoding] => chunked [content-type] => text/html ) [body] => )

Comments

 [2006-10-08 06:11 UTC] avb (Alexey Borzov)
It is indeed a bug with gzip-compressed page within HTTP_Request. The site in question adds a filename after the 10-byte gzip header, therefore gzinflate(substr($this->_body, 10)); does not work. A better implementation of gzip-defalting is in order, which will correctly analyze header.
 [2006-10-24 15:08 UTC] avb (Alexey Borzov)
Fixed in CVS. Added a method to properly analyze the header of gzip-encoded data. The site in question now can be accessed with HTTP_Request (and thus HTTP_Client), though I'm not sure whether it's actually an improvement. :-D