Handle the situation when remote server returns Connection: close

after several pipelined requests.

We call Request::setMaxPipelinedRequest(1) if Connection: close is
received. Also call Request::supportsPersistentConnection(true) and
Request::setMaxPipelinedRequest(1) when closing the connection.
pull/1/head
Tatsuhiro Tsujikawa 2011-01-16 18:12:14 +09:00
parent b2f27e6548
commit 63fe7874da
2 changed files with 8 additions and 0 deletions

View File

@ -347,6 +347,12 @@ bool AbstractCommand::prepareForRetry(time_t wait) {
getSegmentMan()->cancelSegment(getCuid());
}
if(req_) {
// Reset persistentConnection and maxPipelinedRequest to handle
// the situation where remote server returns Connection: close
// after several pipelined requests.
req_->supportsPersistentConnection(true);
req_->setMaxPipelinedRequest(1);
fileEntry_->poolRequest(req_);
A2_LOG_DEBUG(fmt("CUID#%lld - Pooling request URI=%s",
getCuid(), req_->getUri().c_str()));

View File

@ -169,6 +169,8 @@ bool HttpResponseCommand::executeInternal()
if(getRequest()->isPipeliningEnabled()) {
getRequest()->setMaxPipelinedRequest
(getOption()->getAsInt(PREF_MAX_HTTP_PIPELINING));
} else {
getRequest()->setMaxPipelinedRequest(1);
}
int statusCode = httpResponse->getStatusCode();