On Mon, 2011-03-28 at 11:04 -0700, Adam Hahn wrote:
> Hi all,
>
> First of all, I enjoy the library a lot. I have been noticing some strange
> behavior with a chunked gzip response, though, and wanted to run it by some
> users before crying bug.
>
> First, the offending code snippet:
>
> String url = "
> http://173.193.248.156:8080/x/brs1013?aid=eedcd7b2-001a-4388-9415-f2cd697d7608&buid=&ip=209.117.114.63&ua=Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.15)+Gecko/20110303+Firefox/3.6.15&lang=en_US&url=http://minifb-parking.mindjolt.com/fb/game_iframehtmlad.jsp?gkey=FRZ7GJK9OLYE2VMS&gcat=action>itle=Parking+Mania&gdesc=Park+the+car+without+crashing+it.&ts=1299189609250&ad_duration=30&top=true&site=mindjolt.com&pid=9234&frmts=linear15:300x250,linear15&cat=games:casual_games&qual=
> ";
> HttpClient httpClient = new ContentEncodingHttpClient();
> HttpGet get = new HttpGet(url);
> String content = httpClient.execute(get, new BasicResponseHandler());
>
> When calling execute(), the following is thrown:
>
> java.io.IOException: Attempted read from closed stream.
> at
> org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:126)
> at java.util.zip.CheckedInputStream.read(CheckedInputStream.java:42)
> at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:205)
> at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:197)
> at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:136)
> at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
> at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68)
> at
> org.apache.http.client.entity.GzipDecompressingEntity.getContent(GzipDecompressingEntity.java:63)
> at
> org.apache.http.conn.BasicManagedEntity.getContent(BasicManagedEntity.java:88)
> at org.apache.http.util.EntityUtils.consume(EntityUtils.java:65)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:974)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:910)
> at tv.adap.service.HttpPoolTest.testChunkedGzip(HttpPoolTest.java:41)
> ...
>
> As far as I can tell, this is unexpected behavior. The output of:
>
Adam
I am not able to reproduce the problem locally. The url returns a
perfectly valid response body
[DEBUG] SingleClientConnManager - Get connection for route
HttpRoute[{}->http://173.193.248.156:8080]
[DEBUG] DefaultClientConnectionOperator - Connecting
to /173.193.248.156:8080
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] ContentEncodingHttpClient - Attempt 1 to execute request
[DEBUG] DefaultClientConnection - Sending request:
GET
/x/brs1013?aid=eedcd7b2-001a-4388-9415-f2cd697d7608&buid=&ip=209.117.114.63&ua=Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.15)+Gecko/20110303+Firefox/3.6.15&lang=en_US&url=http://minifb-parking.mindjolt.com/fb/game_iframehtmlad.jsp?gkey=FRZ7GJK9OLYE2VMS&gcat=action>itle=Parking+Mania&gdesc=Park+the+car+without+crashing+it.&ts=1299189609250&ad_duration=30&top=true&site=mindjolt.com&pid=9234&frmts=linear15:300x250,linear15&cat=games:casual_games&qual=
HTTP/1.1
[DEBUG] headers - >>
GET
/x/brs1013?aid=eedcd7b2-001a-4388-9415-f2cd697d7608&buid=&ip=209.117.114.63&ua=Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.15)+Gecko/20110303+Firefox/3.6.15&lang=en_US&url=http://minifb-parking.mindjolt.com/fb/game_iframehtmlad.jsp?gkey=FRZ7GJK9OLYE2VMS&gcat=action>itle=Parking+Mania&gdesc=Park+the+car+without+crashing+it.&ts=1299189609250&ad_duration=30&top=true&site=mindjolt.com&pid=9234&frmts=linear15:300x250,linear15&cat=games:casual_games&qual=
HTTP/1.1
[DEBUG] headers - >> Host: 173.193.248.156:8080
[DEBUG] headers - >> Connection: Keep-Alive
[DEBUG] headers - >> User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
[DEBUG] headers - >> Accept-Encoding: gzip,deflate
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 200 OK
[DEBUG] headers - << HTTP/1.1 200 OK
[DEBUG] headers - << Server: Apache-Coyote/1.1
[DEBUG] headers - << character-encoding: UTF-8
[DEBUG] headers - << Content-Type: text/xml;charset=UTF-8
[DEBUG] headers - << Transfer-Encoding: chunked
[DEBUG] headers - << Content-Encoding: gzip
[DEBUG] headers - << Vary: Accept-Encoding
[DEBUG] headers - << Date: Mon, 28 Mar 2011 18:43:49 GMT
[DEBUG] ContentEncodingHttpClient - Connection can be kept alive
indefinitely
[DEBUG] SingleClientConnManager - Releasing connection
org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@1595f51
[DEBUG] DefaultClientConnection - Connection shut down
Can you post a wire / context log of the session that exhibits the
problem?
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]