You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/05/01 16:04:00 UTC

[jira] [Commented] (HTTPCLIENT-2157) Gzip decompression not applied with Apache CachingHttpClient version 5.0.3

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

ASF subversion and git services commented on HTTPCLIENT-2157:
-------------------------------------------------------------

Commit b151df7e8ccd5dad31193eb8ad7a7f34e14efb07 in httpcomponents-client's branch refs/heads/master from Oleg Kalnichevski
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=b151df7 ]

HTTPCLIENT-2157: response object generated by the classic caching backend is missing the original content encoding


> Gzip decompression not applied with Apache CachingHttpClient version 5.0.3
> --------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2157
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2157
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.0.3
>         Environment: Android
>            Reporter: Gunther Heppner
>            Priority: Major
>
> We are in the process of migrating from Apache HttpClient 4.5 to 5.0.3. Since we want to do client side http caching we are using {{CachingHttpClientBuilder}} to set up the HttpClient. With version 4.5.x this works fine and gzip-encoded responses are automatically decompressed. However, with version 5.0.3, the responses are returned as uncompressed {{ByteArrayEntity}} and the {{Conent-Encoding}} header is missing from the returned {{ByteArrayEntity}}, which prevents the default gzip decompression to be applied.
>  
> Note - I was able to get gzip decompression with the default HttpClient.
>  
> Steps to reproduce:
>  * Run [this code|https://stackoverflow.com/questions/67318260/gzip-decompression-not-working-with-apache-cachinghttpclient-version-5-0-3] with HttpClient 5.0.3
>  * Observe the ` {{responseString}}` returned from ` {{EntityUtils.toString()}}` in the ` {{HttpClientResponseHandler}}`, which will return a mangled string instead of a readable HTLM string
>  
>  
> Based on some debugging, it looks like the bug might be in [CachingExec.convert()|https://github.com/apache/httpcomponents-client/blob/e0c049060b45dcb9b93b7802edee3e5e4301cae5/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java], which generates a {{ClassicHttpResponse}} with a {{ByteArrayEntity}} from a cache entry, dropping the {{conent-encoding}} header in the process.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org