hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Moore (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1164) Compressed entities are not being cached properly
Date Sat, 03 Mar 2012 18:31:57 GMT

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

Jon Moore commented on HTTPCLIENT-1164:
---------------------------------------

Here's another thought: perhaps the DecompressingEntity should remove the Content-Length header
if it exists? It already returns -1 for getContentLength() as it accurately indicates the
length of decompressed body is unknown. I think if we did this, then you could successfully
plug a ContentEncodingHttpClient as the backend for the CachingHttpClient. Since it would
appear that the DecompressingEntity is modifying the response to keep it semantically unchanged
(e.g. by removing Content-Encoding as well), this might actually be what we want.


                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message