From 11907c175d9e3e6f4069df79dade320b6f93cd7f Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 15 Mar 2007 15:07:18 +0000 Subject: 2007-03-15 Tatsuhiro Tsujikawa To handle Segment as SegmentHandle: * src/AbstractCommand.cc (execute): Rewritten. * src/SegmentMan.h: Segment -> SegmentHandle Introducded HttpResponse class, HttpRequest class to improve code extensiveness and make it clear: * src/HttpDownloadCommand.cc: transfer encoders are now managed by HttpResponse class. * src/HttpRequest.h, src/HttpRequest.cc: New class. * src/HttpResponse.h, src/HttpResponse.cc: New class. * src/HttpConnection.cc: Contruction of http request were moved to HttpRequest class. * src/HttpResponseCommand.h, src/HttpResponseCommand.cc: Refactored. * src/HttpRequestCommand.cc (executeInternal): Rewritten. * src/HttpAuthConfig.h: New class. * src/Range.h: New class. To make FtpTunnel{Request, Response}Command and HttpProxy{Request, Response}Command derived from AbstractProxy{Request, Response}Command: * src/FtpTunnelResponseCommand.h, src/FtpTunnelResponseCommand.cc: Derived from AbstractProxyRequestCommand class. * src/FtpTunnelRequestCommand.h, src/FtpTunnelRequestCommand.cc: Derived from AbstractProxyResponseCommand class. * src/HttpProxyRequestCommand.h, src/HttpProxyRequestCommand.cc: Derived from AbstractProxyRequestCommand class. * src/HttpProxyResponseCommand.h, src/HttpProxyResponseCommand.cc: Derived from AbstractProxyResponseCommand class. * src/AbstractProxyRequestCommand.h, src/AbstractProxyRequestCommand.cc : New class. * src/AbstractProxyResponseCommand.h, src/AbstractProxyResponseCommand.cc: New class. To add netrc support: * src/Netrc.h, src/Netrc.cc: New class. * src/Util.h, src/Util.cc (split): New function. * src/HttpHeader.cc (getRange): Fixed so that it inspects "Content-Range" header instead of "Range" header. * src/HttpHeader.h (getStatus): Removed. (setStatus): Removed. * src/Segment.h (getPositionToWrite): New function. --- src/HttpProxyResponseCommand.cc | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/HttpProxyResponseCommand.cc') diff --git a/src/HttpProxyResponseCommand.cc b/src/HttpProxyResponseCommand.cc index e611acc0..23c1fe47 100644 --- a/src/HttpProxyResponseCommand.cc +++ b/src/HttpProxyResponseCommand.cc @@ -34,34 +34,17 @@ /* copyright --> */ #include "HttpProxyResponseCommand.h" #include "HttpRequestCommand.h" -#include "DlRetryEx.h" -#include "message.h" HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid, - const RequestHandle req, + const RequestHandle& req, + const HttpConnectionHandle& httpConnection, DownloadEngine* e, const SocketHandle& s) - :AbstractCommand(cuid, req, e, s) { - http = new HttpConnection(cuid, socket, req, e->option); -} + :AbstractProxyResponseCommand(cuid, req, httpConnection, e, s) {} -HttpProxyResponseCommand::~HttpProxyResponseCommand() { - delete http; -} +HttpProxyResponseCommand::~HttpProxyResponseCommand() {} -bool HttpProxyResponseCommand::executeInternal(Segment& segment) { - HttpHeader headers; - int status = http->receiveResponse(headers); - if(status == 0) { - // we didn't receive all of headers yet. - e->commands.push_back(this); - return false; - } - if(status != 200) { - throw new DlRetryEx(EX_PROXY_CONNECTION_FAILED); - } - HttpRequestCommand* command = new HttpRequestCommand(cuid, req, e, socket); - e->commands.push_back(command); - return true; +Command* HttpProxyResponseCommand::getNextCommand() +{ + return new HttpRequestCommand(cuid, req, e, socket); } - -- cgit