Workaround a bug in state management of re-opened connections in HttpCore

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1483844 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-05-17 15:05:16 +00:00
parent 29ffce391c
commit 87d5a1dce9
1 changed files with 5 additions and 5 deletions

View File

@ -274,12 +274,12 @@ public class MainClientExec implements ClientExecChain {
if (needAuthentication(
targetAuthState, proxyAuthState, route, request, response, context)) {
// Make sure the response body is fully consumed, if present
final HttpEntity entity = response.getEntity();
EntityUtils.consume(entity);
if (connHolder.isReusable()) {
// Make sure the response body is fully consumed, if present
final HttpEntity entity = response.getEntity();
EntityUtils.consume(entity);
// entity consumed above is not an auto-release entity,
// need to mark the connection re-usable explicitly
// TODO consume response body on if connection is re-usable
// (requires post 4.3-beta2 bug fix in HttpCore)
} else {
managedConn.close();
if (proxyAuthState.getState() == AuthProtocolState.SUCCESS