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:
Roland Weber 2007-12-13 04:09:47 +00:00
parent 7477aa3042
commit 4d8e798156
1 changed files with 5 additions and 1 deletions

View File

@ -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();
}