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/HttpDownloadCommand.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/HttpDownloadCommand.cc')
| -rw-r--r-- | src/HttpDownloadCommand.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/HttpDownloadCommand.cc b/src/HttpDownloadCommand.cc index 104d0ae1..13fcfffc 100644 --- a/src/HttpDownloadCommand.cc +++ b/src/HttpDownloadCommand.cc @@ -41,6 +41,8 @@ #include "HttpRequest.h" #include "Segment.h" #include "Socket.h" +#include "prefs.h" +#include "Option.h" namespace aria2 { @@ -61,6 +63,17 @@ bool HttpDownloadCommand::prepareForNextSegment() { e->commands.push_back(command); return true; } else { + if(!e->option->getAsBool(PREF_HTTP_PROXY_ENABLED)) { + if(req->isPipeliningEnabled() || + (req->isKeepAliveEnabled() && + ((!transferDecoder.isNull() && _requestGroup->downloadFinished()) || + (uint64_t)_segments.front()->getPositionToWrite() == _requestGroup->getTotalLength()))) { + std::pair<std::string, uint16_t> peerInfo; + socket->getPeerInfo(peerInfo); + e->poolSocket(peerInfo.first, peerInfo.second, socket); + } + } + return DownloadCommand::prepareForNextSegment(); } } |
