<?xml version="1.0"?>
<?xml-stylesheet 
 href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/11246/bug">
    <title>PEAR Bug #11246</title>
    <link>http://pear.php.net/bugs/11246</link>
    <description>[Analyzed] Problem with deflate encoding</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11246"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11246/2007-06-21+06%3A48%3A45#2007-06-21+06%3A48%3A45"/>
     </rdf:Seq>
    </items>
  </channel>
    <item rdf:about="http://pear.php.net/bugs/11246">
      <title>fredericpoeydomenge</title>
      <link>http://pear.php.net/bugs/11246</link>
      <description><![CDATA[<pre>HTTP_Request Feature/Change Request
Reported by fredericpoeydomenge
2007-06-07T11:01:37-00:00
PHP: 5.2.2 OS: Debian Etch 4.0 Package Version: 1.4.1

Description:
------------
The problem comes when requesting the page http://tf1.fr with the &quot;deflate&quot; encoding.

Depending on the User-Agent, the page is not decoded at all (first line addHeader('User-Agent'...) below) , or it is well decoded (second line).

To see this bug in effect, uncomment the second addHeader('User-Agent'...) in the script below.

I suppose that the server is not serving exactly the same content for these two user-agents, and that in one case, HTTP_Request does not know how to decode the result ?

I've been able to make it work by :

1- modifying the &quot;gzipped&quot; boolean (including &quot;deflate&quot; algorithm)

$gzipped = isset($this-&gt;_headers['content-encoding']) &amp;&amp; ('gzip' == $this-&gt;_headers['content-encoding'] || 'deflate' == $this-&gt;_headers['content-encoding']);

2 - replacing _decodeGzip($data) call simply with

gzinflate($data);

That's why I think that HTTP_Request is not decoding the page as it should do, but I am not able to detect where the problem lie...

Test script:
---------------
&lt;?php
require 'HTTP/Request.php';
$request = new HTTP_Request(
    'http://tf1.fr',
    array(
        'method' =&gt; HTTP_REQUEST_METHOD_GET,
        'http' =&gt; HTTP_REQUEST_HTTP_VER_1_1
    )
);
$request-&gt;addHeader('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1)');
//$request-&gt;addHeader('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.3) G*cko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1)');
$request-&gt;addHeader('Accept-Encoding', 'gzip,deflate');
$err = $request-&gt;sendRequest();
if (PEAR::isError($err)) {
    die($err-&gt;getMessage());
} else {
    var_dump($request-&gt;getResponseBody());
}
?&gt;

Expected result:
----------------
decoded page

Actual result:
--------------
encoded page</pre>]]></description>
      <content:encoded><![CDATA[<pre>HTTP_Request Feature/Change Request
Reported by fredericpoeydomenge
2007-06-07T11:01:37-00:00
PHP: 5.2.2 OS: Debian Etch 4.0 Package Version: 1.4.1

Description:
------------
The problem comes when requesting the page http://tf1.fr with the &quot;deflate&quot; encoding.

Depending on the User-Agent, the page is not decoded at all (first line addHeader('User-Agent'...) below) , or it is well decoded (second line).

To see this bug in effect, uncomment the second addHeader('User-Agent'...) in the script below.

I suppose that the server is not serving exactly the same content for these two user-agents, and that in one case, HTTP_Request does not know how to decode the result ?

I've been able to make it work by :

1- modifying the &quot;gzipped&quot; boolean (including &quot;deflate&quot; algorithm)

$gzipped = isset($this-&gt;_headers['content-encoding']) &amp;&amp; ('gzip' == $this-&gt;_headers['content-encoding'] || 'deflate' == $this-&gt;_headers['content-encoding']);

2 - replacing _decodeGzip($data) call simply with

gzinflate($data);

That's why I think that HTTP_Request is not decoding the page as it should do, but I am not able to detect where the problem lie...

Test script:
---------------
&lt;?php
require 'HTTP/Request.php';
$request = new HTTP_Request(
    'http://tf1.fr',
    array(
        'method' =&gt; HTTP_REQUEST_METHOD_GET,
        'http' =&gt; HTTP_REQUEST_HTTP_VER_1_1
    )
);
$request-&gt;addHeader('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1)');
//$request-&gt;addHeader('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.3) G*cko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1)');
$request-&gt;addHeader('Accept-Encoding', 'gzip,deflate');
$err = $request-&gt;sendRequest();
if (PEAR::isError($err)) {
    die($err-&gt;getMessage());
} else {
    var_dump($request-&gt;getResponseBody());
}
?&gt;

Expected result:
----------------
decoded page

Actual result:
--------------
encoded page</pre>]]></content:encoded>
      <dc:date>2007-06-07T11:01:37-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/11246/2007-06-21+06%3A48%3A45#2007-06-21+06%3A48%3A45">
      <title>avb [2007-06-21 10:48]</title>
      <link>http://pear.php.net/bugs/11246#1182422925</link>
      <description><![CDATA[<pre>HTTP_Request never claimed support for 'deflate' Content-Encoding and never automatically added 'Accept-Encoding: deflate' to the request header.

Therefore, strictly speaking, this is the error on your part to add this header and expect HTTP_Request to properly handle the encoded data.

On the other hand, this can be recategorized as feature request, but the implementation should conform to the proper RFCs mentioned in section 3.5 of RFC 2616: &quot;deflate The &quot;zlib&quot; format defined in RFC 1950 in combination with the &quot;deflate&quot; compression mechanism described in RFC 1951.&quot;</pre>]]></description>
      <content:encoded><![CDATA[<pre>HTTP_Request never claimed support for 'deflate' Content-Encoding and never automatically added 'Accept-Encoding: deflate' to the request header.

Therefore, strictly speaking, this is the error on your part to add this header and expect HTTP_Request to properly handle the encoded data.

On the other hand, this can be recategorized as feature request, but the implementation should conform to the proper RFCs mentioned in section 3.5 of RFC 2616: &quot;deflate The &quot;zlib&quot; format defined in RFC 1950 in combination with the &quot;deflate&quot; compression mechanism described in RFC 1951.&quot;</pre>]]></content:encoded>
      <dc:date>2007-06-21T10:48:45-00:00</dc:date>
    </item>
</rdf:RDF>