[
https://issues.apache.org/jira/browse/HTTPCLIENT-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230302#comment-13230302
]
Jon Moore commented on HTTPCLIENT-1164:
---------------------------------------
Ok, I just checked a CompressionDecorator into trunk that can be wired in
either under or over the CachingHttpClient. Ended up not needing to change the
existing ContentEncodingHttpClient, although I did reuse the request and
response interceptors. The decorator removes the Content-Length header if it
uncompresses things; will go back to verify the impact on
DefaultConnectionReuseStrategy.
> Compressed entities are not being cached properly
> -------------------------------------------------
>
> Key: HTTPCLIENT-1164
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1164
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: Cache
> Affects Versions: Snapshot
> Reporter: Manish Tripathi
> Assignee: Jon Moore
>
> org.apache.http.impl.client.cache.CacheValidityPolicy.contentLengthHeaderMatchesActualLength()
> returns false for entities decompressed by ContentEncodingHttpClient,
> because the length of decompressed entity stored in cache will be different
> from the length specified in the response header.
> Consequently, gzipped/deflated entities will never be satisfied from the
> cache.
> Proposed fix: introduce new field in HttpCacheEntry() - actualContentLength,
> and populate it with the actual content length rigth before the cache entry
> is stored in the cache. Change the
> org.apache.http.impl.client.cache.CacheValidityPolicy.contentLengthHeaderMatchesActualLength()
> method to compare
> entry.getResource().length() with entry.getActualContentLength()
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]