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:
parent
a8d2e5e5fa
commit
1b063abfa9
|
@ -1,6 +1,10 @@
|
||||||
Changes since 4.2 BETA1
|
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
|
* [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
|
correctly updated potentially allowing those connections to be leased to users with a different
|
||||||
security context.
|
security context.
|
||||||
|
|
|
@ -769,6 +769,7 @@ public class CachingHttpClient implements HttpClient {
|
||||||
HttpCacheEntry matchedEntry = matchingVariant.getEntry();
|
HttpCacheEntry matchedEntry = matchingVariant.getEntry();
|
||||||
|
|
||||||
if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) {
|
if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) {
|
||||||
|
EntityUtils.consume(backendResponse.getEntity());
|
||||||
return retryRequestUnconditionally(target, request, context,
|
return retryRequestUnconditionally(target, request, context,
|
||||||
matchedEntry);
|
matchedEntry);
|
||||||
}
|
}
|
||||||
|
@ -839,6 +840,7 @@ public class CachingHttpClient implements HttpClient {
|
||||||
Date responseDate = getCurrentDate();
|
Date responseDate = getCurrentDate();
|
||||||
|
|
||||||
if (revalidationResponseIsTooOld(backendResponse, cacheEntry)) {
|
if (revalidationResponseIsTooOld(backendResponse, cacheEntry)) {
|
||||||
|
EntityUtils.consume(backendResponse.getEntity());
|
||||||
HttpRequest unconditional = conditionalRequestBuilder
|
HttpRequest unconditional = conditionalRequestBuilder
|
||||||
.buildUnconditionalRequest(request, cacheEntry);
|
.buildUnconditionalRequest(request, cacheEntry);
|
||||||
requestDate = getCurrentDate();
|
requestDate = getCurrentDate();
|
||||||
|
|
Loading…
Reference in New Issue