hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1045360 - in /httpcomponents/httpclient/trunk/httpclient-cache/src: main/java/org/apache/http/impl/client/cache/CachingHttpClient.java test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
Date Mon, 13 Dec 2010 20:25:08 GMT
Author: jonm
Date: Mon Dec 13 20:25:08 2010
New Revision: 1045360

URL: http://svn.apache.org/viewvc?rev=1045360&view=rev
Log:
HTTPCLIENT-1032: caching of 200 origin response from variant
negotiation should be stored w.r.t. original client request.

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java?rev=1045360&r1=1045359&r2=1045360&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
Mon Dec 13 20:25:08 2010
@@ -604,12 +604,13 @@ public class CachingHttpClient implement
         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);
         }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java?rev=1045360&r1=1045359&r2=1045360&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpClient.java
Mon Dec 13 20:25:08 2010
@@ -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);



Mime
View raw message