fixed connection reuse bug, see HTTPCLIENT-711
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@603812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7477aa3042
commit
4d8e798156
|
@ -373,13 +373,17 @@ public class DefaultClientRequestDirector
|
|||
if (followup == null) {
|
||||
done = true;
|
||||
} else {
|
||||
if (this.reuseStrategy.keepAlive(response, context)) {
|
||||
boolean reuse = reuseStrategy.keepAlive(response, context);
|
||||
if (reuse) {
|
||||
LOG.debug("Connection kept alive");
|
||||
// Make sure the response body is fully consumed, if present
|
||||
HttpEntity entity = response.getEntity();
|
||||
if (entity != null) {
|
||||
entity.consumeContent();
|
||||
}
|
||||
// entity consumed above is not an auto-release entity,
|
||||
// need to mark the connection re-usable explicitly
|
||||
managedConn.markReusable();
|
||||
} else {
|
||||
managedConn.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue