2008-06-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

If FTP server returns negative response with REST raw command 
and
	requested range is not 0, throw exception. If requested range is 
0,
	continue download a file from 0 byte.
	* src/FtpNegotiationCommand.cc
	* src/FtpNegotiationCommand.h
pull/1/head
Tatsuhiro Tsujikawa 2008-06-24 14:43:27 +00:00
parent 3e12ebf78f
commit 68b5ae7d86
3 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2008-06-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
If FTP server returns negative response with REST raw command and
requested range is not 0, throw exception. If requested range is 0,
continue download a file from 0 byte.
* src/FtpNegotiationCommand.cc
* src/FtpNegotiationCommand.h
2008-06-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Supported FTP server which don't recognize SIZE raw command.

View File

@ -383,14 +383,17 @@ bool FtpNegotiationCommand::sendRest(const SegmentHandle& segment) {
return false;
}
bool FtpNegotiationCommand::recvRest() {
bool FtpNegotiationCommand::recvRest(const SharedHandle<Segment>& segment) {
unsigned int status = ftp->receiveResponse();
if(status == 0) {
return false;
}
// TODO if we recieve negative response, then we set _requestGroup->getSegmentMan()->splittable = false, and continue.
// If we recieve negative response and requested file position is not 0,
// then throw exception here.
if(status != 350) {
throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
if(!segment.isNull() && segment->getPositionToWrite() != 0) {
throw DlAbortEx("FTP server doesn't support resuming.");
}
}
sequence = SEQ_SEND_RETR;
return true;
@ -480,7 +483,7 @@ bool FtpNegotiationCommand::processSequence(const SegmentHandle& segment) {
case SEQ_SEND_REST:
return sendRest(segment);
case SEQ_RECV_REST:
return recvRest();
return recvRest(segment);
case SEQ_SEND_RETR:
return sendRetr();
case SEQ_RECV_RETR:

View File

@ -92,7 +92,7 @@ private:
bool recvPasv();
bool sendRest(const SharedHandle<Segment>& segment);
bool sendRestPasv(const SharedHandle<Segment>& segment);
bool recvRest();
bool recvRest(const SharedHandle<Segment>& segment);
bool sendRetr();
bool recvRetr();
bool waitConnection();