diff options
| -rw-r--r-- | ChangeLog | 9 | ||||
| -rw-r--r-- | src/FtpConnection.cc | 3 | ||||
| -rw-r--r-- | src/FtpNegotiationCommand.cc | 29 | ||||
| -rw-r--r-- | src/HttpResponse.cc | 7 | ||||
| -rw-r--r-- | src/HttpResponseCommand.cc | 1 |
5 files changed, 24 insertions, 25 deletions
@@ -1,5 +1,14 @@ 2007-12-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> + Forced download abort when received negative response from http/ftp + server. + * src/HttpResponseCommand.cc + * src/FtpNegotiationCommand.cc + * src/HttpResponse.cc + * src/FtpConnection.cc + +2007-12-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> + Added XML2SAXMetalinkProcessor class, which is a lot faster than the predecessor, Xml2MetalinkParser class. I tested them against 94KB metalink file with 1234 chunk checksums. diff --git a/src/FtpConnection.cc b/src/FtpConnection.cc index cc86e4fc..1395f929 100644 --- a/src/FtpConnection.cc +++ b/src/FtpConnection.cc @@ -40,6 +40,7 @@ #include "AuthConfigFactory.h" #include "AuthConfig.h" #include "DlRetryEx.h" +#include "DlAbortEx.h" FtpConnection::FtpConnection(int32_t cuid, const SocketHandle& socket, const RequestHandle req, const Option* op) @@ -184,7 +185,7 @@ bool FtpConnection::bulkReceiveResponse(pair<int32_t, string>& response) if(strbuf.size() >= 4) { status = getStatus(strbuf); if(status == 0) { - throw new DlRetryEx(EX_INVALID_RESPONSE); + throw new DlAbortEx(EX_INVALID_RESPONSE); } } else { return false; diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 28011751..9f36d44b 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -39,7 +39,6 @@ #include "PieceStorage.h" #include "FtpDownloadCommand.h" #include "DlAbortEx.h" -#include "DlRetryEx.h" #include "message.h" #include "prefs.h" #include "Util.h" @@ -101,7 +100,7 @@ bool FtpNegotiationCommand::recvGreeting() { return false; } if(status != 220) { - throw new DlRetryEx(EX_CONNECTION_FAILED); + throw new DlAbortEx(EX_CONNECTION_FAILED); } sequence = SEQ_SEND_USER; @@ -126,7 +125,7 @@ bool FtpNegotiationCommand::recvUser() { sequence = SEQ_SEND_PASS; break; default: - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } return true; } @@ -143,7 +142,7 @@ bool FtpNegotiationCommand::recvPass() { return false; } if(status != 230) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } sequence = SEQ_SEND_TYPE; return true; @@ -161,7 +160,7 @@ bool FtpNegotiationCommand::recvType() { return false; } if(status != 200) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } sequence = SEQ_SEND_CWD; return true; @@ -179,7 +178,7 @@ bool FtpNegotiationCommand::recvCwd() { return false; } if(status != 250) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } sequence = SEQ_SEND_SIZE; return true; @@ -197,16 +196,8 @@ bool FtpNegotiationCommand::recvSize() { if(status == 0) { return false; } - if(status == 550) { - // If file is not found in a server, then SIZE command fails. - // TODO There exist ftp servers that don't support SIZE command... - // the message "MSG_RESOURCE_NOT_FOUND" may be a little bit confusing. - // Nevertheless, curretly aria2 doesn't support such ftp servers, - // I don't care that. - throw new DlAbortEx(MSG_RESOURCE_NOT_FOUND); - } if(status != 213) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } if(size == INT64_MAX || size < 0) { throw new DlAbortEx(EX_TOO_LARGE_FILE, Util::llitos(size, true).c_str()); @@ -267,7 +258,7 @@ bool FtpNegotiationCommand::recvPort() { return false; } if(status != 200) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } sequence = SEQ_SEND_REST; return true; @@ -286,7 +277,7 @@ bool FtpNegotiationCommand::recvPasv() { return false; } if(status != 227) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } // make a data connection to the server. logger->info(MSG_CONNECTING_TO_SERVER, cuid, @@ -321,7 +312,7 @@ bool FtpNegotiationCommand::recvRest() { } // TODO if we recieve negative response, then we set _requestGroup->getSegmentMan()->splittable = false, and continue. if(status != 350) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } sequence = SEQ_SEND_RETR; return true; @@ -339,7 +330,7 @@ bool FtpNegotiationCommand::recvRetr() { return false; } if(status != 150 && status != 125) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } if(e->option->get(PREF_FTP_PASV) != V_TRUE) { assert(serverSocket->getSockfd() != -1); diff --git a/src/HttpResponse.cc b/src/HttpResponse.cc index c186dbd3..1f62ce96 100644 --- a/src/HttpResponse.cc +++ b/src/HttpResponse.cc @@ -37,7 +37,6 @@ #include "Util.h" #include "message.h" #include "DlAbortEx.h" -#include "DlRetryEx.h" void HttpResponse::validateResponse() const { @@ -48,11 +47,11 @@ void HttpResponse::validateResponse() const throw new DlAbortEx(MSG_RESOURCE_NOT_FOUND); } if(status >= 400) { - throw new DlRetryEx(EX_BAD_STATUS, status); + throw new DlAbortEx(EX_BAD_STATUS, status); } if(status >= 300) { if(!httpHeader->defined("Location")) { - throw new DlRetryEx(EX_LOCATION_HEADER_REQUIRED, + throw new DlAbortEx(EX_LOCATION_HEADER_REQUIRED, status); } } else { @@ -60,7 +59,7 @@ void HttpResponse::validateResponse() const // compare the received range against the requested range RangeHandle responseRange = httpHeader->getRange(); if(!httpRequest->isRangeSatisfied(responseRange)) { - throw new DlRetryEx(EX_INVALID_RANGE_HEADER, + throw new DlAbortEx(EX_INVALID_RANGE_HEADER, Util::llitos(httpRequest->getStartByte(), true).c_str(), Util::llitos(httpRequest->getEndByte(), true).c_str(), Util::llitos(httpRequest->getEntityLength(), true).c_str(), diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index 70b011aa..a11b8f8d 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -38,7 +38,6 @@ #include "HttpConnection.h" #include "SegmentMan.h" #include "DlAbortEx.h" -#include "DlRetryEx.h" #include "HttpDownloadCommand.h" #include "message.h" #include "Util.h" |
