diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-09-15 11:46:25 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-09-15 11:46:25 +0000 |
| commit | a27968bedadaca57e1792ae410d1a946fd936646 (patch) | |
| tree | e8ac4ebc9981f2ffdc145bc5d259b850bc479a5d /src/HttpResponseCommand.cc | |
| parent | 7f92e32e485cfd99cce33568c04775e2413b5517 (diff) | |
2010-09-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that a file gets overwritten if -V is given and no
hash is provided. Fixed the bug that --dry-run leads download
error. Added RequestGroup::createCheckIntegrityEntry() which
correctly creates CheckIntegrityEntry objects and open files based
on -V option and the existence of control file.
* src/AbstractCommand.cc
* src/AbstractCommand.h
* src/ChecksumCheckIntegrityEntry.cc
* src/DownloadContext.cc
* src/DownloadContext.h
* src/FtpNegotiationCommand.cc
* src/HttpResponseCommand.cc
* src/PieceHashCheckIntegrityEntry.cc
* src/RequestGroup.cc
* src/RequestGroup.h
* src/RequestGroupEntry.cc
* src/RequestGroupEntry.h
Diffstat (limited to 'src/HttpResponseCommand.cc')
| -rw-r--r-- | src/HttpResponseCommand.cc | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index 32fb6dbb..ae741fc3 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -265,23 +265,11 @@ bool HttpResponseCommand::handleDefaultEncoding return true; } - BtProgressInfoFileHandle infoFile - (new DefaultBtProgressInfoFile(getDownloadContext(), - getPieceStorage(), - getOption().get())); - if(!infoFile->exists() && getRequestGroup()->downloadFinishedByFileLength()) { - getPieceStorage()->markAllPiecesDone(); - // See also RequestGroup::createInitialCommand() - if(!getOption()->getAsBool(PREF_CHECK_INTEGRITY) || - !getDownloadContext()->isChecksumVerificationNeeded()) { - getDownloadContext()->setChecksumVerified(true); - getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED, - util::itos(getRequestGroup()->getGID()).c_str(), - getRequestGroup()->getFirstFilePath().c_str()); - return true; - } + SharedHandle<CheckIntegrityEntry> checkEntry = + getRequestGroup()->createCheckIntegrityEntry(); + if(checkEntry.isNull()) { + return true; } - getRequestGroup()->loadAndOpenFile(infoFile); File file(getRequestGroup()->getFirstFilePath()); // We have to make sure that command that has Request object must // have segment after PieceStorage is initialized. See @@ -306,8 +294,11 @@ bool HttpResponseCommand::handleDefaultEncoding } // After command is passed to prepareForNextAction(), it is managed // by CheckIntegrityEntry. - prepareForNextAction(command); + checkEntry->pushNextCommand(command); command = 0; + + prepareForNextAction(checkEntry); + if(getRequest()->getMethod() == Request::METHOD_HEAD) { poolConnection(); getRequest()->setMethod(Request::METHOD_GET); @@ -506,6 +497,7 @@ void HttpResponseCommand::poolConnection() void HttpResponseCommand::onDryRunFileFound() { getPieceStorage()->markAllPiecesDone(); + getDownloadContext()->setChecksumVerified(true); poolConnection(); } |
