HTTPCLIENT-1032: caching of 200 origin response from variant

negotiation should be stored w.r.t. original client request.


git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1045360 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Moore 2010-12-13 20:25:08 +00:00
parent 24a5f0c060
commit ae8764760b
2 changed files with 5 additions and 5 deletions

View File

@ -604,12 +604,13 @@ public class CachingHttpClient implements HttpClient {
backendResponse.addHeader("Via", generateViaHeader(backendResponse));
if (backendResponse.getStatusLine().getStatusCode() != HttpStatus.SC_NOT_MODIFIED) {
return handleBackendResponse(target, conditionalRequest, requestDate, responseDate, backendResponse);
return handleBackendResponse(target, request, requestDate, responseDate, backendResponse);
// return handleBackendResponse(target, conditionalRequest, requestDate, responseDate, backendResponse);
}
Header resultEtagHeader = backendResponse.getFirstHeader(HeaderConstants.ETAG);
if (resultEtagHeader == null) {
log.debug("304 response did not contain ETag");
log.warn("304 response did not contain ETag");
return callBackend(target, request, context);
}

View File

@ -1662,9 +1662,8 @@ public class TestCachingHttpClient {
responsePolicyAllowsCaching(true);
EasyMock.expect(mockCache.getCacheEntry(host, variantConditionalRequest)).andReturn(cacheEntry);
EasyMock.expect(mockCache.cacheAndReturnResponse(EasyMock.same(host), EasyMock.same(variantConditionalRequest), EasyMock.same(originResponse), EasyMock.isA(Date.class), EasyMock.isA(Date.class))).andReturn(response);
EasyMock.expect(mockCache.getCacheEntry(host, request)).andReturn(cacheEntry);
EasyMock.expect(mockCache.cacheAndReturnResponse(EasyMock.same(host), EasyMock.same(request), EasyMock.same(originResponse), EasyMock.isA(Date.class), EasyMock.isA(Date.class))).andReturn(response);
replayMocks();
HttpResponse resp = impl.negotiateResponseFromVariants(host, request, context, variants);