[
https://issues.apache.org/jira/browse/HTTPCLIENT-1725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15201625#comment-15201625
]
Charlie Halford commented on HTTPCLIENT-1725:
---------------------------------------------
Terribly sorry, I didn't pick up notification of your comment. Thank you for
the explanation, that makes a lot of sense.
I don't think I'll have the time to generate a patch, but if I do, I'll make
sure I submit it here.
> Heuristic caching does not work for URIs with a query string
> ------------------------------------------------------------
>
> Key: HTTPCLIENT-1725
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1725
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpCache
> Affects Versions: 4.5.1
> Reporter: Charlie Halford
>
> When enabling heuristic caching and setting a default lifetime, the responses
> from the server I am requesting from are not being stored in the cache.
> In org.apache.http.impl.client.cache.ResponseCachingPolicy, line 250
> determines if the URI contains a query string:
> {code}
> request.getRequestLine().getUri().contains("?")
> {code}
> A few lines below, it then checks to see if the response contains cache
> headers:
> {code}
> else if (!isExplicitlyCacheable(response))
> {code}
> As I am attempting to cache a response that I know does not contain cache
> headers, the response should succeed in being cached. However, it fails the
> isExplictlyCachable() check, and thus returns false to the overall
> isResponseCachable() method. The isExplicitlyCachable() method is checked
> later on in the stack, so perhaps it can be safely removed here?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]