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

[jira] [Resolved] (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:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-2157.
-------------------------------------------
    Fix Version/s: 5.1-beta2
                   5.0.4
       Resolution: Fixed

[~Gunther H] Fixed in 5.0.x and master.

Oleg

> 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
>             Fix For: 5.0.4, 5.1-beta2
>
>
> 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