From 6187d6e5066da813e62ea43fc1b2f05e0441136c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 8 Mar 2009 10:20:42 +0000 Subject: 2009-03-08 Tatsuhiro Tsujikawa Added --dry-run option. In this mode, aria2 just checks whether the remote file is available and doesn't download data. This option has effect on HTTP/FTP downloads and BitTorrent downloads are canceled in this mode. * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/HttpResponseCommand.h * src/OptionHandlerFactory.cc * src/RequestGroup.cc * src/RequestGroupMan.cc * src/prefs.cc * src/prefs.h * src/usage_text.h --- src/HttpResponseCommand.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/HttpResponseCommand.cc') diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index c40e0049..1f00d72d 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -197,6 +197,11 @@ bool HttpResponseCommand::handleDefaultEncoding(const HttpResponseHandle& httpRe HttpRequestHandle httpRequest = httpResponse->getHttpRequest(); _requestGroup->initPieceStorage(); + if(e->option->getAsBool(PREF_DRY_RUN)) { + onDryRunFileFound(); + return true; + } + BtProgressInfoFileHandle infoFile(new DefaultBtProgressInfoFile(_requestGroup->getDownloadContext(), _requestGroup->getPieceStorage(), e->option)); if(!infoFile->exists() && _requestGroup->downloadFinishedByFileLength()) { return true; @@ -270,6 +275,13 @@ static SharedHandle getContentEncodingDecoder bool HttpResponseCommand::handleOtherEncoding(const HttpResponseHandle& httpResponse) { // We assume that RequestGroup::getTotalLength() == 0 here HttpRequestHandle httpRequest = httpResponse->getHttpRequest(); + + if(e->option->getAsBool(PREF_DRY_RUN)) { + _requestGroup->initPieceStorage(); + onDryRunFileFound(); + return true; + } + if(req->getMethod() == Request::METHOD_HEAD) { poolConnection(); req->setMethod(Request::METHOD_GET); @@ -359,4 +371,10 @@ void HttpResponseCommand::poolConnection() } } +void HttpResponseCommand::onDryRunFileFound() +{ + _requestGroup->getPieceStorage()->markAllPiecesDone(); + poolConnection(); +} + } // namespace aria2 -- cgit