summaryrefslogtreecommitdiff
path: root/src/HttpServerResponseCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-01-25 10:55:27 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-01-25 10:55:27 +0000
commit5def96906fd17d9b48e9fda192617c6ad1b95683 (patch)
tree7907dd734fbaa2a43636c2a7fea342bb5ef773e5 /src/HttpServerResponseCommand.cc
parent0742e3921f185613f98c2b31cd03182d8aa1d6f5 (diff)
2009-01-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Persist connection between the built-in HTTP server and a client if a client supports keep-alive. Fixed the bug that aria2 exits when the HTTP server receives EOF from a client. * src/HttpServer.cc * src/HttpServer.h * src/HttpServerCommand.cc * src/HttpServerCommand.h * src/HttpServerResponseCommand.cc
Diffstat (limited to 'src/HttpServerResponseCommand.cc')
-rw-r--r--src/HttpServerResponseCommand.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/HttpServerResponseCommand.cc b/src/HttpServerResponseCommand.cc
index 0578c7a8..ca096b93 100644
--- a/src/HttpServerResponseCommand.cc
+++ b/src/HttpServerResponseCommand.cc
@@ -37,6 +37,8 @@
#include "DownloadEngine.h"
#include "HttpServer.h"
#include "Logger.h"
+#include "HttpServerCommand.h"
+#include "RequestGroupMan.h"
namespace aria2 {
@@ -61,9 +63,17 @@ HttpServerResponseCommand::~HttpServerResponseCommand()
bool HttpServerResponseCommand::execute()
{
+ if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
+ return true;
+ }
_httpServer->sendResponse();
if(_httpServer->sendBufferIsEmpty()) {
logger->info("CUID#%d - HttpServer: all response transmitted.", cuid);
+ if(_httpServer->supportsPersistentConnection()) {
+ logger->info("CUID#%d - Persist connection.", cuid);
+ _e->commands.push_back
+ (new HttpServerCommand(cuid, _httpServer, _e, _socket));
+ }
return true;
} else {
if(_timeout.elapsed(10)) {