From 7f9e70e5c85031fe0b35b7326562eadf1f90728e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 13 Sep 2010 11:53:38 +0000 Subject: [PATCH] 2010-09-13 Tatsuhiro Tsujikawa Updated doc * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/RequestGroup.cc --- ChangeLog | 7 +++++++ src/FtpNegotiationCommand.cc | 7 +++++-- src/HttpResponseCommand.cc | 6 +++++- src/RequestGroup.cc | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb0d2ab6..31ff992a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-09-13 Tatsuhiro Tsujikawa + + Updated doc + * src/FtpNegotiationCommand.cc + * src/HttpResponseCommand.cc + * src/RequestGroup.cc + 2010-09-13 Tatsuhiro Tsujikawa Fixed the bug that error occurs when downloading zero-length file. diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 91edbfa0..e6379e47 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -405,10 +405,13 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength) if(getDownloadContext()->knowsTotalLength() && getRequestGroup()->downloadFinishedByFileLength()) { + // TODO If metalink file does not contain size and it contains + // hash and file is not zero length, but remote server says the + // file size is 0, no hash check is performed in the current + // implementation. See also + // HttpResponseCommand::handleOtherEncoding() getRequestGroup()->initPieceStorage(); getPieceStorage()->markAllPiecesDone(); - // TODO It would be good to issue ChecksumCheckIntegrity here - // instead of just pretending checksum verification is done. getDownloadContext()->setChecksumVerified(true); sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED; getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED, diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index e3f278f9..32404ba1 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -390,9 +390,13 @@ bool HttpResponseCommand::handleOtherEncoding // For zero-length file, check existing file comparing its size if(!chunkedUsed && getDownloadContext()->knowsTotalLength() && getRequestGroup()->downloadFinishedByFileLength()) { + // TODO If metalink file does not contain size and it contains + // hash and file is not zero length, but remote server says the + // file size is 0, no hash check is performed in the current + // implementation. See also + // FtpNegotiationCommand::onFileSizeDetermined() getRequestGroup()->initPieceStorage(); getPieceStorage()->markAllPiecesDone(); - // This is zero-size file, so hash check is no use. getDownloadContext()->setChecksumVerified(true); getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED, util::itos(getRequestGroup()->getGID()).c_str(), diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 6a5a6487..8dcea974 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -542,6 +542,8 @@ void RequestGroup::initPieceStorage() { SharedHandle tempPieceStorage; if(downloadContext_->knowsTotalLength() && + // Following conditions are needed for chunked encoding with + // content-length = 0. Google's dl server used this before. (downloadContext_->getTotalLength() > 0 #ifdef ENABLE_BITTORRENT || downloadContext_->hasAttribute(bittorrent::BITTORRENT)