diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-22 08:52:47 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-22 08:52:47 +0000 |
| commit | 5f55bc197ff9aa8b8bbcd030f2c32995661aac07 (patch) | |
| tree | 5cf208048aa83658798fd7658ac67c1ec7551d60 /src/HttpResponseCommand.cc | |
| parent | 1c7c6f989800b10d3820614123dcfc7d90677c85 (diff) | |
2008-04-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Reuse socket if the origin server supports HTTP keep-alive and
--enable-http-keep-alive or --enable-http-pipelining is given.
The current implementation doesn't reuse the connections
established
against proxy server.
* src/AbstractCommand.cc
* src/DownloadEngine.cc
* src/DownloadEngine.h
* src/HttpDownloadCommand.cc
* src/HttpInitiateConnectionCommand.cc
* src/HttpResponseCommand.cc
Diffstat (limited to 'src/HttpResponseCommand.cc')
| -rw-r--r-- | src/HttpResponseCommand.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index 997b17fc..97ab2a79 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -145,7 +145,13 @@ bool HttpResponseCommand::handleDefaultEncoding(const HttpResponseHandle& httpRe File file(_requestGroup->getFilePath()); SegmentHandle segment = _requestGroup->getSegmentMan()->getSegment(cuid, 0); - if(!segment.isNull() && segment->getPositionToWrite() == 0) { + // pipelining requires implicit range specified. But the request for + // this response most likely dones't contains range header. This means + // we can't continue to use this socket because server sends all entity + // body instead of a segment. + // Therefore, we shutdown the socket here if pipelining is enabled. + if(!segment.isNull() && segment->getPositionToWrite() == 0 && + !req->isPipeliningEnabled()) { command = createHttpDownloadCommand(httpResponse); } else { _requestGroup->getSegmentMan()->cancelSegment(cuid); |
