mirror of https://github.com/aria2/aria2
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
parent
b2f27e6548
commit
63fe7874da
|
@ -347,6 +347,12 @@ bool AbstractCommand::prepareForRetry(time_t wait) {
|
||||||
getSegmentMan()->cancelSegment(getCuid());
|
getSegmentMan()->cancelSegment(getCuid());
|
||||||
}
|
}
|
||||||
if(req_) {
|
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_);
|
fileEntry_->poolRequest(req_);
|
||||||
A2_LOG_DEBUG(fmt("CUID#%lld - Pooling request URI=%s",
|
A2_LOG_DEBUG(fmt("CUID#%lld - Pooling request URI=%s",
|
||||||
getCuid(), req_->getUri().c_str()));
|
getCuid(), req_->getUri().c_str()));
|
||||||
|
|
|
@ -169,6 +169,8 @@ bool HttpResponseCommand::executeInternal()
|
||||||
if(getRequest()->isPipeliningEnabled()) {
|
if(getRequest()->isPipeliningEnabled()) {
|
||||||
getRequest()->setMaxPipelinedRequest
|
getRequest()->setMaxPipelinedRequest
|
||||||
(getOption()->getAsInt(PREF_MAX_HTTP_PIPELINING));
|
(getOption()->getAsInt(PREF_MAX_HTTP_PIPELINING));
|
||||||
|
} else {
|
||||||
|
getRequest()->setMaxPipelinedRequest(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int statusCode = httpResponse->getStatusCode();
|
int statusCode = httpResponse->getStatusCode();
|
||||||
|
|
Loading…
Reference in New Issue