[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15030508#comment-15030508
 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1550:
-----------------------------------------------

https://httpbin.org/deflate works just fine for me. So does http://vk.com. 

{noformat}
[DEBUG] RequestAddCookies - CookieSpec selected: default
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: 
{s}->https://httpbin.org:443][total kept alive: 0; route allocated: 0 of 2; 
total allocated: 0 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: 
{s}->https://httpbin.org:443][total kept alive: 0; route allocated: 1 of 2; 
total allocated: 1 of 20]
[DEBUG] MainClientExec - Opening connection {s}->https://httpbin.org:443
[DEBUG] DefaultHttpClientConnectionOperator - Connecting to 
httpbin.org/54.175.219.8:443
[DEBUG] SSLConnectionSocketFactory - Connecting socket to 
httpbin.org/54.175.219.8:443 with timeout 0
[DEBUG] SSLConnectionSocketFactory - Enabled protocols: [TLSv1]
[DEBUG] SSLConnectionSocketFactory - Enabled cipher 
suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, 
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, 
TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, 
SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, 
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 
TLS_ECDHE_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_RC4_128_SHA, 
TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_ECDH_RSA_WITH_RC4_128_SHA, 
SSL_RSA_WITH_RC4_128_MD5, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
[DEBUG] SSLConnectionSocketFactory - Starting handshake
[DEBUG] SSLConnectionSocketFactory - Secure session established
[DEBUG] SSLConnectionSocketFactory -  negotiated protocol: TLSv1
[DEBUG] SSLConnectionSocketFactory -  negotiated cipher suite: 
TLS_ECDHE_RSA_WITH_RC4_128_SHA
[DEBUG] SSLConnectionSocketFactory -  peer principal: CN=*.httpbin.org, 
OU=EssentialSSL Wildcard, OU=Domain Control Validated
[DEBUG] SSLConnectionSocketFactory -  peer alternative names: [*.httpbin.org, 
httpbin.org]
[DEBUG] SSLConnectionSocketFactory -  issuer principal: CN=COMODO RSA Domain 
Validation Secure Server CA, O=COMODO CA Limited, L=Salford, ST=Greater 
Manchester, C=GB
[DEBUG] DefaultHttpClientConnectionOperator - Connection established 
192.168.1.121:37090<->54.175.219.8:443
[DEBUG] MainClientExec - Executing request GET /deflate HTTP/1.1
[DEBUG] MainClientExec - Target auth state: UNCHALLENGED
[DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-0 >> GET /deflate HTTP/1.1
[DEBUG] headers - http-outgoing-0 >> Host: httpbin.org
[DEBUG] headers - http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.1 
(Java/1.7.0_75)
[DEBUG] headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] headers - http-outgoing-0 << HTTP/1.1 200 OK
[DEBUG] headers - http-outgoing-0 << Server: nginx
[DEBUG] headers - http-outgoing-0 << Date: Sat, 28 Nov 2015 13:28:45 GMT
[DEBUG] headers - http-outgoing-0 << Content-Type: application/json
[DEBUG] headers - http-outgoing-0 << Content-Length: 175
[DEBUG] headers - http-outgoing-0 << Connection: keep-alive
[DEBUG] headers - http-outgoing-0 << Content-Encoding: deflate
[DEBUG] headers - http-outgoing-0 << Access-Control-Allow-Origin: *
[DEBUG] headers - http-outgoing-0 << Access-Control-Allow-Credentials: true
[DEBUG] MainClientExec - Connection can be kept alive indefinitely
[DEBUG] PoolingHttpClientConnectionManager - Connection [id: 0][route: 
{s}->https://httpbin.org:443] can be kept alive indefinitely
[DEBUG] PoolingHttpClientConnectionManager - Connection released: [id: 
0][route: {s}->https://httpbin.org:443][total kept alive: 1; route allocated: 1 
of 2; total allocated: 1 of 20]
{noformat}

Oleg

> "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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to