You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2012/05/08 21:53:09 UTC

svn commit: r1335724 - in /httpcomponents/httpclient/branches/4.1.x: RELEASE_NOTES.txt httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java

Author: olegk
Date: Tue May  8 19:53:09 2012
New Revision: 1335724

URL: http://svn.apache.org/viewvc?rev=1335724&view=rev
Log:
HTTPCLIENT-1187: If a revalidation response is deemed too old CachingHttpClient fails to consume its content resulting in a connection leak

Modified:
    httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java

Modified: httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt?rev=1335724&r1=1335723&r2=1335724&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt Tue May  8 19:53:09 2012
@@ -1,6 +1,10 @@
 Changes since 4.1.3
 -------------------
 
+* [HTTPCLIENT-1187] If a revalidation response is deemed too old CachingHttpClient fails to  
+  consume its content resulting in a connection leak.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-1186] State of newly created connections in the connection pool is not always 
   correctly updated potentially allowing those connections to be leased to users with a different 
   security context. 

Modified: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java?rev=1335724&r1=1335723&r2=1335724&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java (original)
+++ httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java Tue May  8 19:53:09 2012
@@ -756,6 +756,7 @@ public class CachingHttpClient implement
         HttpCacheEntry matchedEntry = matchingVariant.getEntry();
         
         if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) {
+            EntityUtils.consume(backendResponse.getEntity());
             return retryRequestUnconditionally(target, request, context,
                     matchedEntry);
         }
@@ -826,6 +827,7 @@ public class CachingHttpClient implement
         Date responseDate = getCurrentDate();
 
         if (revalidationResponseIsTooOld(backendResponse, cacheEntry)) {
+            EntityUtils.consume(backendResponse.getEntity());
             HttpRequest unconditional = conditionalRequestBuilder
                 .buildUnconditionalRequest(request, cacheEntry);
             requestDate = getCurrentDate();