HTTPCLIENT-1187: If a revalidation response is deemed too old CachingHttpClient fails to consume its content resulting in a connection leak

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1335726 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2012-05-08 19:54:27 +00:00
parent a8d2e5e5fa
commit 1b063abfa9
2 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,10 @@
Changes since 4.2 BETA1
-------------------
* [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.

View File

@ -769,6 +769,7 @@ public class CachingHttpClient implements HttpClient {
HttpCacheEntry matchedEntry = matchingVariant.getEntry();
if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) {
EntityUtils.consume(backendResponse.getEntity());
return retryRequestUnconditionally(target, request, context,
matchedEntry);
}
@ -839,6 +840,7 @@ public class CachingHttpClient implements HttpClient {
Date responseDate = getCurrentDate();
if (revalidationResponseIsTooOld(backendResponse, cacheEntry)) {
EntityUtils.consume(backendResponse.getEntity());
HttpRequest unconditional = conditionalRequestBuilder
.buildUnconditionalRequest(request, cacheEntry);
requestDate = getCurrentDate();