diff --git a/ChangeLog b/ChangeLog index 587cfbf8..3d56e0a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-03-25 Tatsuhiro Tsujikawa + + Added --remove-control-file option. This option removes control + file(*.aria2 file) before download. Using with + --allow-overwrite=true, download always starts from scratch. This + will be useful for users behind proxy server which disables + resume. For such proxy user, -C1 is also recommended for Metalink + downloads to avoid establishing unnecessary connections. + * doc/aria2c.1.txt + * src/OptionHandlerFactory.cc + * src/RequestGroup.cc + * src/prefs.cc + * src/prefs.h + * src/usage_text.h + 2010-03-25 Tatsuhiro Tsujikawa Removed arrayLength. Defined A2_ARRAY_LEN as macro to calculate diff --git a/doc/aria2c.1 b/doc/aria2c.1 index bb7dd4c5..afd9170d 100644 --- a/doc/aria2c.1 +++ b/doc/aria2c.1 @@ -2,12 +2,12 @@ .\" Title: aria2c .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 03/19/2010 +.\" Date: 03/25/2010 .\" Manual: Aria2 Manual .\" Source: Aria2 1.9.1a .\" Language: English .\" -.TH "ARIA2C" "1" "03/19/2010" "Aria2 1\&.9\&.1a" "Aria2 Manual" +.TH "ARIA2C" "1" "03/25/2010" "Aria2 1\&.9\&.1a" "Aria2 Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -1243,6 +1243,28 @@ Validate chunk of data by calculating checksum while downloading a file if chunk \fItrue\fR .RE .PP +\fB\-\-remove\-control\-file\fR[=\fItrue\fR|\fIfalse\fR] +.RS 4 +Remove control file before download\&. Using with +\fB\-\-allow\-overwrite\fR=\fItrue\fR, download always starts from scratch\&. This will be useful for users behind proxy server which disables resume\&. +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +For Metalink downloads, \-C1 is recommended for proxy server which disables resume, in order to avoid establishing unnecessary connections\&. +.sp .5v +.RE +.PP \fB\-\-stop\fR=SEC .RS 4 Stop application after SEC seconds has passed\&. If diff --git a/doc/aria2c.1.html b/doc/aria2c.1.html index c001d9ce..dbd7207f 100644 --- a/doc/aria2c.1.html +++ b/doc/aria2c.1.html @@ -2093,6 +2093,29 @@ are also allocated if they share the same piece.

+--remove-control-file[=true|false] +
+
+

+ Remove control file before download. Using with + --allow-overwrite=true, download always starts from + scratch. This will be useful for users behind proxy server which + disables resume. +

+
+ +
+ + + +
+
Note
+
For Metalink downloads, -C1 is recommended for proxy server which +disables resume, in order to avoid establishing unnecessary +connections.
+
+
+
--stop=SEC
@@ -3984,7 +4007,7 @@ files in the program, then also delete it here.


diff --git a/doc/aria2c.1.txt b/doc/aria2c.1.txt index ffb5b373..07b35733 100644 --- a/doc/aria2c.1.txt +++ b/doc/aria2c.1.txt @@ -851,6 +851,20 @@ are also allocated if they share the same piece. chunk checksums are provided. Default: 'true' + +*--remove-control-file*[='true'|'false']:: + + Remove control file before download. Using with + *--allow-overwrite*='true', download always starts from + scratch. This will be useful for users behind proxy server which + disables resume. + +[NOTE] + +For Metalink downloads, -C1 is recommended for proxy server which +disables resume, in order to avoid establishing unnecessary +connections. + *--stop*=SEC:: Stop application after SEC seconds has passed. If '0' is given, this feature is disabled. diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index ee871898..ae2418c6 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -411,6 +411,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() handlers.push_back(op); } #endif // ENABLE_MESSAGE_DIGEST + { + SharedHandle op(new BooleanOptionHandler + (PREF_REMOVE_CONTROL_FILE, + TEXT_REMOVE_CONTROL_FILE, + V_FALSE, + OptionHandler::OPT_ARG)); + op->addTag(TAG_ADVANCED); + handlers.push_back(op); + } { SharedHandle op(new NumberOptionHandler (PREF_STOP, diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 66bd1e2d..e6fee4e0 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -556,7 +556,16 @@ void RequestGroup::adjustFilename { if(!isPreLocalFileCheckEnabled()) { // OK, no need to care about filename. - } else if(infoFile->exists()) { + return; + } + if(!_option->getAsBool(PREF_DRY_RUN) && + _option->getAsBool(PREF_REMOVE_CONTROL_FILE) && + infoFile->exists()) { + infoFile->removeFile(); + _logger->notice("Removed control file for %s because it is requested by" + " user.", infoFile->getFilename().c_str()); + } + if(infoFile->exists()) { // Use current filename } else if(downloadFinishedByFileLength()) { // File was downloaded already, no need to change file name. diff --git a/src/prefs.cc b/src/prefs.cc index d3f723c9..c2f20edf 100644 --- a/src/prefs.cc +++ b/src/prefs.cc @@ -178,6 +178,8 @@ const std::string PREF_INTERFACE("interface"); const std::string PREF_DISABLE_IPV6("disable-ipv6"); // value: true | false const std::string PREF_HUMAN_READABLE("human-readable"); +// value: true | false +const std::string PREF_REMOVE_CONTROL_FILE("remove-control-file"); /** * FTP related preferences diff --git a/src/prefs.h b/src/prefs.h index c23a71d7..01c37dd8 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -182,6 +182,8 @@ extern const std::string PREF_INTERFACE; extern const std::string PREF_DISABLE_IPV6; // value: true | false extern const std::string PREF_HUMAN_READABLE; +// value: true | false +extern const std::string PREF_REMOVE_CONTROL_FILE; /** * FTP related preferences diff --git a/src/usage_text.h b/src/usage_text.h index cd10489c..6363d955 100644 --- a/src/usage_text.h +++ b/src/usage_text.h @@ -635,3 +635,8 @@ _(" --ftp-proxy-user=USER Set user for --ftp-proxy option.") #define TEXT_FTP_PROXY_PASSWD \ _(" --ftp-proxy-passwd=PASSWD Set password for --ftp-proxy option.") +#define TEXT_REMOVE_CONTROL_FILE \ + _(" --remove-control-file[=true|false] Remove control file before download. Using\n" \ + " with --allow-overwrite=true, download always\n" \ + " starts from scratch. This will be useful for\n" \ + " users behind proxy server which disables resume.")