From e6a7c952d1e1812f36968e8c44454c36e10461e2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 1 Jul 2009 13:45:28 +0000 Subject: [PATCH] 2009-07-01 Tatsuhiro Tsujikawa Get proxy download working * src/AbstractProxyRequestCommand.cc * src/AbstractProxyRequestCommand.h * src/AbstractProxyResponseCommand.cc * src/AbstractProxyResponseCommand.h * src/FtpInitiateConnectionCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelRequestCommand.h * src/FtpTunnelResponseCommand.cc * src/FtpTunnelResponseCommand.h * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyRequestCommand.h * src/HttpProxyResponseCommand.cc * src/HttpProxyResponseCommand.h --- ChangeLog | 18 ++++++++++++++++++ src/AbstractProxyRequestCommand.cc | 3 ++- src/AbstractProxyRequestCommand.h | 1 + src/AbstractProxyResponseCommand.cc | 16 +++++++++------- src/AbstractProxyResponseCommand.h | 15 +++++++++------ src/FtpInitiateConnectionCommand.cc | 3 ++- src/FtpTunnelRequestCommand.cc | 8 ++++++-- src/FtpTunnelRequestCommand.h | 1 + src/FtpTunnelResponseCommand.cc | 18 +++++++++++------- src/FtpTunnelResponseCommand.h | 1 + src/HttpInitiateConnectionCommand.cc | 3 ++- src/HttpProxyRequestCommand.cc | 8 ++++++-- src/HttpProxyRequestCommand.h | 1 + src/HttpProxyResponseCommand.cc | 18 +++++++++++------- src/HttpProxyResponseCommand.h | 1 + 15 files changed, 81 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index adef9fcf..d8cf03c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2009-07-01 Tatsuhiro Tsujikawa + + Get proxy download working + * src/AbstractProxyRequestCommand.cc + * src/AbstractProxyRequestCommand.h + * src/AbstractProxyResponseCommand.cc + * src/AbstractProxyResponseCommand.h + * src/FtpInitiateConnectionCommand.cc + * src/FtpTunnelRequestCommand.cc + * src/FtpTunnelRequestCommand.h + * src/FtpTunnelResponseCommand.cc + * src/FtpTunnelResponseCommand.h + * src/HttpInitiateConnectionCommand.cc + * src/HttpProxyRequestCommand.cc + * src/HttpProxyRequestCommand.h + * src/HttpProxyResponseCommand.cc + * src/HttpProxyResponseCommand.h + 2009-07-01 Tatsuhiro Tsujikawa Use SegmentMan::getSegment(cuid) for single file download. diff --git a/src/AbstractProxyRequestCommand.cc b/src/AbstractProxyRequestCommand.cc index 698f5bb4..bff67fad 100644 --- a/src/AbstractProxyRequestCommand.cc +++ b/src/AbstractProxyRequestCommand.cc @@ -52,12 +52,13 @@ namespace aria2 { AbstractProxyRequestCommand::AbstractProxyRequestCommand (int cuid, const RequestHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& proxyRequest, const SocketHandle& s) : - AbstractCommand(cuid, req, requestGroup, e, s), + AbstractCommand(cuid, req, fileEntry, requestGroup, e, s), _proxyRequest(proxyRequest), httpConnection(new HttpConnection(cuid, s, getOption().get())) { diff --git a/src/AbstractProxyRequestCommand.h b/src/AbstractProxyRequestCommand.h index c67318dd..d613924a 100644 --- a/src/AbstractProxyRequestCommand.h +++ b/src/AbstractProxyRequestCommand.h @@ -52,6 +52,7 @@ protected: public: AbstractProxyRequestCommand(int cuid, const SharedHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& proxyRequest, diff --git a/src/AbstractProxyResponseCommand.cc b/src/AbstractProxyResponseCommand.cc index f6b1ac13..248a7bd3 100644 --- a/src/AbstractProxyResponseCommand.cc +++ b/src/AbstractProxyResponseCommand.cc @@ -49,13 +49,15 @@ namespace aria2 { -AbstractProxyResponseCommand::AbstractProxyResponseCommand(int cuid, - const RequestHandle& req, - RequestGroup* requestGroup, - const HttpConnectionHandle& httpConnection, - DownloadEngine* e, - const SocketHandle& s) - :AbstractCommand(cuid, req, requestGroup, e, s), +AbstractProxyResponseCommand::AbstractProxyResponseCommand +(int cuid, + const RequestHandle& req, + const SharedHandle& fileEntry, + RequestGroup* requestGroup, + const HttpConnectionHandle& httpConnection, + DownloadEngine* e, + const SocketHandle& s) + :AbstractCommand(cuid, req, fileEntry, requestGroup, e, s), httpConnection(httpConnection) {} AbstractProxyResponseCommand::~AbstractProxyResponseCommand() {} diff --git a/src/AbstractProxyResponseCommand.h b/src/AbstractProxyResponseCommand.h index 28c00c99..bc6ee33a 100644 --- a/src/AbstractProxyResponseCommand.h +++ b/src/AbstractProxyResponseCommand.h @@ -48,12 +48,15 @@ protected: virtual bool executeInternal(); public: - AbstractProxyResponseCommand(int cuid, - const SharedHandle& req, - RequestGroup* requestGroup, - const SharedHandle& httpConnection, - DownloadEngine* e, - const SharedHandle& s); + AbstractProxyResponseCommand + (int cuid, + const SharedHandle& req, + const SharedHandle& fileEntry, + RequestGroup* requestGroup, + const SharedHandle& httpConnection, + DownloadEngine* e, + const SharedHandle& s); + virtual ~AbstractProxyResponseCommand(); virtual Command* getNextCommand() = 0; diff --git a/src/FtpInitiateConnectionCommand.cc b/src/FtpInitiateConnectionCommand.cc index dcfcde6b..8fc880ca 100644 --- a/src/FtpInitiateConnectionCommand.cc +++ b/src/FtpInitiateConnectionCommand.cc @@ -93,7 +93,8 @@ Command* FtpInitiateConnectionCommand::createNextCommand c->setProxyRequest(proxyRequest); command = c; } else if(proxyMethod == V_TUNNEL) { - command = new FtpTunnelRequestCommand(cuid, req, _requestGroup, e, + command = new FtpTunnelRequestCommand(cuid, req, _fileEntry, + _requestGroup, e, proxyRequest, socket); } else { // TODO diff --git a/src/FtpTunnelRequestCommand.cc b/src/FtpTunnelRequestCommand.cc index 73e5ed9c..6df82183 100644 --- a/src/FtpTunnelRequestCommand.cc +++ b/src/FtpTunnelRequestCommand.cc @@ -43,18 +43,22 @@ namespace aria2 { FtpTunnelRequestCommand::FtpTunnelRequestCommand (int cuid, const RequestHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& proxyRequest, const SocketHandle& s) : - AbstractProxyRequestCommand(cuid, req, requestGroup, e, proxyRequest, s) {} + AbstractProxyRequestCommand(cuid, req, fileEntry, requestGroup, e, + proxyRequest, s) +{} FtpTunnelRequestCommand::~FtpTunnelRequestCommand() {} Command* FtpTunnelRequestCommand::getNextCommand() { - return new FtpTunnelResponseCommand(cuid, req, _requestGroup, httpConnection, e, socket); + return new FtpTunnelResponseCommand + (cuid, req, _fileEntry, _requestGroup, httpConnection, e, socket); } } // namespace aria2 diff --git a/src/FtpTunnelRequestCommand.h b/src/FtpTunnelRequestCommand.h index 9a7fc96f..338a2bab 100644 --- a/src/FtpTunnelRequestCommand.h +++ b/src/FtpTunnelRequestCommand.h @@ -45,6 +45,7 @@ class FtpTunnelRequestCommand : public AbstractProxyRequestCommand { public: FtpTunnelRequestCommand(int cuid, const SharedHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& proxyRequest, diff --git a/src/FtpTunnelResponseCommand.cc b/src/FtpTunnelResponseCommand.cc index 0ecb3bd0..de1d4c55 100644 --- a/src/FtpTunnelResponseCommand.cc +++ b/src/FtpTunnelResponseCommand.cc @@ -43,13 +43,17 @@ namespace aria2 { -FtpTunnelResponseCommand::FtpTunnelResponseCommand(int cuid, - const RequestHandle& req, - RequestGroup* requestGroup, - const HttpConnectionHandle& httpConnection, - DownloadEngine* e, - const SocketHandle& s) - :AbstractProxyResponseCommand(cuid, req, requestGroup, httpConnection,e, s) {} +FtpTunnelResponseCommand::FtpTunnelResponseCommand +(int cuid, + const RequestHandle& req, + const SharedHandle& fileEntry, + RequestGroup* requestGroup, + const HttpConnectionHandle& httpConnection, + DownloadEngine* e, + const SocketHandle& s) + :AbstractProxyResponseCommand(cuid, req, fileEntry, requestGroup, + httpConnection,e, s) +{} FtpTunnelResponseCommand::~FtpTunnelResponseCommand() {} diff --git a/src/FtpTunnelResponseCommand.h b/src/FtpTunnelResponseCommand.h index 1b5c8a8c..704a5dca 100644 --- a/src/FtpTunnelResponseCommand.h +++ b/src/FtpTunnelResponseCommand.h @@ -45,6 +45,7 @@ class FtpTunnelResponseCommand : public AbstractProxyResponseCommand { public: FtpTunnelResponseCommand(int cuid, const SharedHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, const SharedHandle& httpConnection, DownloadEngine* e, diff --git a/src/HttpInitiateConnectionCommand.cc b/src/HttpInitiateConnectionCommand.cc index 4245403a..b34c7aaf 100644 --- a/src/HttpInitiateConnectionCommand.cc +++ b/src/HttpInitiateConnectionCommand.cc @@ -78,7 +78,8 @@ Command* HttpInitiateConnectionCommand::createNextCommand proxyRequest->getPort()); if(proxyMethod == V_TUNNEL) { - command = new HttpProxyRequestCommand(cuid, req, _requestGroup, e, + command = new HttpProxyRequestCommand(cuid, req, _fileEntry, + _requestGroup, e, proxyRequest, socket); } else if(proxyMethod == V_GET) { SharedHandle httpConnection diff --git a/src/HttpProxyRequestCommand.cc b/src/HttpProxyRequestCommand.cc index 04e534ee..f55fcc34 100644 --- a/src/HttpProxyRequestCommand.cc +++ b/src/HttpProxyRequestCommand.cc @@ -43,18 +43,22 @@ namespace aria2 { HttpProxyRequestCommand::HttpProxyRequestCommand (int cuid, const RequestHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& proxyRequest, const SocketHandle& s) : - AbstractProxyRequestCommand(cuid, req, requestGroup, e, proxyRequest, s) {} + AbstractProxyRequestCommand(cuid, req, fileEntry, requestGroup, e, + proxyRequest, s) +{} HttpProxyRequestCommand::~HttpProxyRequestCommand() {} Command* HttpProxyRequestCommand::getNextCommand() { - return new HttpProxyResponseCommand(cuid, req, _requestGroup, httpConnection, e, socket); + return new HttpProxyResponseCommand + (cuid, req, _fileEntry, _requestGroup, httpConnection, e, socket); } } // namespace aria2 diff --git a/src/HttpProxyRequestCommand.h b/src/HttpProxyRequestCommand.h index 31360e80..25dc686c 100644 --- a/src/HttpProxyRequestCommand.h +++ b/src/HttpProxyRequestCommand.h @@ -45,6 +45,7 @@ class HttpProxyRequestCommand : public AbstractProxyRequestCommand { public: HttpProxyRequestCommand(int cuid, const SharedHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& proxyRequest, diff --git a/src/HttpProxyResponseCommand.cc b/src/HttpProxyResponseCommand.cc index be6a58ff..6bf4be5d 100644 --- a/src/HttpProxyResponseCommand.cc +++ b/src/HttpProxyResponseCommand.cc @@ -43,13 +43,17 @@ namespace aria2 { -HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid, - const RequestHandle& req, - RequestGroup* requestGroup, - const HttpConnectionHandle& httpConnection, - DownloadEngine* e, - const SocketHandle& s) - :AbstractProxyResponseCommand(cuid, req, requestGroup, httpConnection, e, s) {} +HttpProxyResponseCommand::HttpProxyResponseCommand +(int cuid, + const RequestHandle& req, + const SharedHandle& fileEntry, + RequestGroup* requestGroup, + const HttpConnectionHandle& httpConnection, + DownloadEngine* e, + const SocketHandle& s) + :AbstractProxyResponseCommand(cuid, req, fileEntry, requestGroup, + httpConnection, e, s) +{} HttpProxyResponseCommand::~HttpProxyResponseCommand() {} diff --git a/src/HttpProxyResponseCommand.h b/src/HttpProxyResponseCommand.h index 2d9a081f..679f9a17 100644 --- a/src/HttpProxyResponseCommand.h +++ b/src/HttpProxyResponseCommand.h @@ -45,6 +45,7 @@ class HttpProxyResponseCommand : public AbstractProxyResponseCommand { public: HttpProxyResponseCommand(int cuid, const SharedHandle& req, + const SharedHandle& fileEntry, RequestGroup* requestGroup, const SharedHandle& httpConnection, DownloadEngine* e,