diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-08 10:20:42 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-08 10:20:42 +0000 |
| commit | 6187d6e5066da813e62ea43fc1b2f05e0441136c (patch) | |
| tree | 931405682bc7ce2b251b0637f76b6f0e70a5e788 /src/HttpResponseCommand.cc | |
| parent | c63ceff5dd1ac7bca6aa0f447c2b7648ee16cb5a (diff) | |
2009-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
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
Diffstat (limited to 'src/HttpResponseCommand.cc')
| -rw-r--r-- | src/HttpResponseCommand.cc | 18 |
1 files changed, 18 insertions, 0 deletions
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<Decoder> 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 |
