You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by McDowell Sean <s_...@yahoo.com.INVALID> on 2014/10/06 16:36:53 UTC

DeflateInputStream does not detect zlib encoded data

I tried a very simple request to our server and we get back a zlib compressed response.I traced the code to DeflateInputStream where it tries to sniff whether the data is zlib or deflate.
It does this by reading the first 6 bytes and trying to decompress the first byte. I found that the inflater will not decompress the first byte with only 6 bytes of input. The code then loops and refeeds the same 6 bytes to the inflater which causes an exception.

I took a copy of that code and found that, for the response I received, I had to increase the amount of data peeked at to 72 bytes before it could successfully read the first character!
Is this a known bug? I am using the IBM 7.0 JRE if that makes a difference.