[ https://issues.apache.org/jira/browse/HTTPCLIENT-1550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15029906#comment-15029906 ]
Pierre N. edited comment on HTTPCLIENT-1550 at 11/27/15 2:12 PM: ----------------------------------------------------------------- It will also fail on the following populars websites when you use deflate : {code} https://twitter.com|-1|java.util.zip.ZipException: invalid stored block lengths http://vk.com|-1|java.util.zip.ZipException: invalid stored block lengths http://edition.cnn.com|-1|java.util.zip.ZipException: invalid stored block lengths {code} I don't have any problem to access these websites using deflate with curl : {code} curl --header "Accept-Encoding: deflate" https://twitter.com --compressed {code} was (Author: pierz): It will also fail on the following populars websites when you use deflate : {code} https://twitter.com|-1|java.util.zip.ZipException: invalid stored block lengths http://vk.com|-1|java.util.zip.ZipException: invalid stored block lengths http://edition.cnn.com|-1|java.util.zip.ZipException: invalid stored block lengths {code} I don't have any problem to access this website using deflate with curl : {code} curl --header "Accept-Encoding: deflate" https://twitter.com --compressed {code} > "deflate" encoding issue : java.util.zip.ZipException: invalid stored block > lengths > ----------------------------------------------------------------------------------- > > Key: HTTPCLIENT-1550 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1550 > Project: HttpComponents HttpClient > Issue Type: Bug > Affects Versions: 4.3.5 > Environment: Windows > Reporter: Guillaume Serre > Priority: Minor > > When trying to GET any nzb files from http://nzbindex.nl with a httpclient > request, a ZipException is raised. > {code:title=JunitTestFailing.java} > @Test > public void testDeflateIssueFailing() throws ClientProtocolException, > IOException { > HttpGet httpget = new > HttpGet("http://nzbindex.nl/download/72441827/BackTrack5R3.Gnome.iSO.32bit-LiNUX-0171-bt5r2gis32.par2.nzb"); > HttpClient client = HttpClientBuilder.create().build(); > HttpResponse response = client.execute(httpget); > HttpEntity entity = response.getEntity(); > byte[] data = EntityUtils.toByteArray( entity ); > Assert.assertEquals( data.length, 423548 ); > } > {code} > The complete stack trace I get is this: > {code} > java.util.zip.ZipException: invalid stored block lengths > at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164) > at java.io.FilterInputStream.read(FilterInputStream.java:107) > at > org.apache.http.client.entity.DeflateInputStream.read(DeflateInputStream.java:144) > at > org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:68) > at org.apache.http.util.EntityUtils.toByteArray(EntityUtils.java:136) > at > hclient.HTTPClientTest.testDeflateIssueFailing(HTTPClientTest.java:39) > {code} > A workaround I found is to set the Accept-Encoding header to only accept > gzip, as follows: > {code:title=JunitTestWorking.java} > > @Test > public void testDeflateIssueWorking() throws ClientProtocolException, > IOException { > HttpGet httpget = new > HttpGet("http://nzbindex.nl/download/72441827/BackTrack5R3.Gnome.iSO.32bit-LiNUX-0171-bt5r2gis32.par2.nzb"); > httpget.setHeader("Accept-Encoding", "gzip"); > HttpClient client = HttpClientBuilder.create().build(); > HttpResponse response = client.execute(httpget); > HttpEntity entity = response.getEntity(); > byte[] data = EntityUtils.toByteArray( entity ); > Assert.assertEquals( data.length, 423548 ); > } > {code} > Thanks -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org