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

James Leigh commented on HTTPCLIENT-1370:
-----------------------------------------

Jon, testIsArbitraryMethodServableFromCache does not cover all scenarios.

Take a look at the all the returns statements of 
ResponseCachingPolicy#isResponseCacheable(HttpRequest, HttpResponse). There are 
two conditions that can cause this method to return true. 
testIsArbitraryMethodServableFromCache only tests the one of them. The test in 
the patch tests the other scenario.

For isResponseCacheable(HttpRequest, HttpResponse) to return true either 
hasCacheControlParameterFrom *or* isResponseCacheable(String, HttpResponse) 
must return true. If sharedCache && authNHeaders && 
hasCacheControlParameterFrom are all true, this method never considers 
isResponseCacheable(String, HttpResponse) and therefore never considers the 
request method and therefore will cache the response regardless of the request 
method. This is the bug that this patch is trying to fix.

With the patch applied isResponseCacheable(HttpRequest, HttpResponse) will only 
return true iff isResponseCacheable(String, HttpResponse) returns true.

James
                
> Response to Non-GET Requests Should Never be Cached With the Default Response 
> CachingPolicy
> -------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1370
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1370
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: CacheHttpClient Caching components
>    Affects Versions: 4.3 Beta2
>            Reporter: James Leigh
>              Labels: patch
>             Fix For: 4.3 Beta3
>
>         Attachments: HTTPCLIENT-1370.patch
>
>
> HttpClient caches response to non-GET requests when a shared cache is used 
> and an Authorization header is present with Cache-Control: public.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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]

Reply via email to