[
https://issues.apache.org/jira/browse/HTTPCLIENT-1370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13688302#comment-13688302
]
James Leigh commented on HTTPCLIENT-1370:
-----------------------------------------
The patch is missing the following test case from TestCachingExecChain (as it
would conflict with HTTPASYNC-46 ).
@Test
public void
testReturns200ForOptionsFollowedByGetIfAuthorizationHeaderAndSharedCache()
throws Exception {
impl = createCachingExecChain(mockBackend, new BasicHttpCache(),
CacheConfig.custom().setSharedCache(true).build());
final Date now = new Date();
final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(new
HttpOptions("http://foo.example.com/"));
req1.setHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new
HttpGet("http://foo.example.com/"));
req2.setHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
HttpStatus.SC_NO_CONTENT, "No Content");
resp1.setHeader("Content-Length", "0");
resp1.setHeader("ETag", "\"options-etag\"");
resp1.setHeader("Date", DateUtils.formatDate(now));
resp1.setHeader("Cache-Control", "public, max-age=3600");
resp1.setHeader("Last-Modified", DateUtils.formatDate(now));
final HttpResponse resp2 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
HttpStatus.SC_OK, "OK");
resp1.setEntity(HttpTestUtils.makeBody(128));
resp1.setHeader("Content-Length", "128");
resp1.setHeader("ETag", "\"get-etag\"");
resp1.setHeader("Date", DateUtils.formatDate(now));
resp1.setHeader("Cache-Control", "public, max-age=3600");
resp1.setHeader("Last-Modified", DateUtils.formatDate(now));
backendExpectsAnyRequestAndReturn(resp1);
backendExpectsAnyRequestAndReturn(resp2);
replayMocks();
impl.execute(route, req1, context, null);
final HttpResponse result = impl.execute(route, req2, context, null);
verifyMocks();
Assert.assertEquals(200, result.getStatusLine().getStatusCode());
}
> 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: HttpCache
> 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]