Selaa lähdekoodia

2010-03-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	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
Tatsuhiro Tsujikawa 15 vuotta sitten
vanhempi
commit
8507b5bde4
9 muutettua tiedostoa jossa 105 lisäystä ja 4 poistoa
  1. 15 0
      ChangeLog
  2. 24 2
      doc/aria2c.1
  3. 24 1
      doc/aria2c.1.html
  4. 14 0
      doc/aria2c.1.txt
  5. 9 0
      src/OptionHandlerFactory.cc
  6. 10 1
      src/RequestGroup.cc
  7. 2 0
      src/prefs.cc
  8. 2 0
      src/prefs.h
  9. 5 0
      src/usage_text.h

+ 15 - 0
ChangeLog

@@ -1,3 +1,18 @@
+2010-03-25  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	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  <t-tujikawa@users.sourceforge.net>
 
 	Removed arrayLength. Defined A2_ARRAY_LEN as macro to calculate

+ 24 - 2
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 <http://docbook.sf.net/>
-.\"      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

+ 24 - 1
doc/aria2c.1.html

@@ -2093,6 +2093,29 @@ are also allocated if they share the same piece.</td>
 </p>
 </dd>
 <dt class="hdlist1">
+<strong>--remove-control-file</strong>[=<em>true</em>|<em>false</em>]
+</dt>
+<dd>
+<p>
+   Remove control file before download. Using with
+   <strong>--allow-overwrite</strong>=<em>true</em>, download always starts from
+   scratch. This will be useful for users behind proxy server which
+   disables resume.
+</p>
+</dd>
+</dl></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<div class="title">Note</div>
+</td>
+<td class="content">For Metalink downloads, -C1 is recommended for proxy server which
+disables resume, in order to avoid establishing unnecessary
+connections.</td>
+</tr></table>
+</div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
 <strong>--stop</strong>=SEC
 </dt>
 <dd>
@@ -3984,7 +4007,7 @@ files in the program, then also delete it here.</p></div>
 <div id="footnotes"><hr /></div>
 <div id="footer">
 <div id="footer-text">
-Last updated 2010-03-19 18:13:05 JST
+Last updated 2010-03-25 23:41:17 JST
 </div>
 </div>
 </body>

+ 14 - 0
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.

+ 9 - 0
src/OptionHandlerFactory.cc

@@ -411,6 +411,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
     handlers.push_back(op);
   }
 #endif // ENABLE_MESSAGE_DIGEST
+  {
+    SharedHandle<OptionHandler> 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<OptionHandler> op(new NumberOptionHandler
                                    (PREF_STOP,

+ 10 - 1
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.

+ 2 - 0
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

+ 2 - 0
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

+ 5 - 0
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.")