mirror of
https://github.com/aria2/aria2.git
synced 2025-04-06 05:57:36 +03:00
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
This commit is contained in:
parent
7f92e32e48
commit
a27968beda
13 changed files with 156 additions and 112 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue