Browse Source

Fixed the bug that caused -c command-line option did not work properly.

Tatsuhiro Tsujikawa 18 years ago
parent
commit
649830316e
5 changed files with 115 additions and 80 deletions
  1. 3 0
      ChangeLog
  2. 4 2
      README
  3. 91 73
      doc/aria2c.1
  4. 15 4
      doc/aria2c.1.txt
  5. 2 1
      src/RequestGroup.cc

+ 3 - 0
ChangeLog

@@ -43,6 +43,9 @@
 	* src/HttpResponseCommand.cc
 	(handleOtherEncoding): Call RequestGroup::shouldCancelDownloadForSafety
 
+	* src/MetalinkRequestInfo.cc: Now -s option is ignored in Metalink
+	download.
+	
 2007-06-09  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Added -j command-line option.

+ 4 - 2
README

@@ -18,7 +18,8 @@ aria2 is in very early development stage. Currently it has following features:
 * FTP support(active, passive mode)
 * FTP through HTTP proxy(GET command or tunneling)
 * Segmented download
-* Cookie support(currently aria2 ignores "expires")
+* Cookie support
+* It can load cookies from file whose format is used by Netscape and Mozilla.
 * It can run as a daemon process.
 * BitTorrent protocol support with fast extension.
 * Selective download in multi-file torrent
@@ -84,7 +85,8 @@ Note:
 *  -o option is used to change the filename of downloaded .torrent file.
 * This version only supports compact peers list format.
 * The ports aria2c uses are 6881-6999.
-* The maximum number of peers is 55.
+* The maximum number of peers is 55. This limit may be exceeded when download
+rate is low.
 * As of release 0.10.0, aria2 stops sending request message after selective
   download completes,
 

+ 91 - 73
doc/aria2c.1

@@ -1,11 +1,11 @@
 .\"     Title: aria2c
 .\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.71.0 <http://docbook.sf.net/>
-.\"      Date: 03/29/2007
+.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
+.\"      Date: 06/10/2007
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "ARIA2C" "1" "03/29/2007" "" ""
+.TH "ARIA2C" "1" "06/10/2007" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -14,7 +14,7 @@
 aria2c \- The high speed download utility
 .SH "SYNOPSIS"
 .sp
-.RS 3n
+.RS 4
 .nf
 aria2c [OPTIONS] URL ...
 aria2c [OPTIONS] \-T TORRENT_FILE FILE ...
@@ -29,29 +29,29 @@ Please visit the project web site at http://aria2.sourceforge.net
 .SH "OPTIONS"
 .PP
 \-d, \-\-dir=DIR
-.RS 3n
+.RS 4
 The directory to store downloaded file.
 .RE
 .PP
 \-o, \-\-out=FILE
-.RS 3n
+.RS 4
 The file name for downloaded file.
 .RE
 .PP
 \-l, \-\-log=LOG
-.RS 3n
+.RS 4
 The file path to store log. If
 \fI\-\fR
 is specified, log is written to stdout.
 .RE
 .PP
 \-D, \-\-daemon
-.RS 3n
+.RS 4
 Run as daemon.
 .RE
 .PP
 \-s, \-\-split=N
-.RS 3n
+.RS 4
 Download a file using
 \fIN\fR
 connections.
@@ -66,7 +66,7 @@ connections. Default:
 .RE
 .PP
 \-\-retry\-wait=SEC
-.RS 3n
+.RS 4
 Set amount of time in second between requests for errors. Specify a value between
 \fI0\fR
 and
@@ -75,13 +75,13 @@ and
 .RE
 .PP
 \-t, \-\-timeout=SEC
-.RS 3n
+.RS 4
 Set timeout in second. Default:
 \fI60\fR
 .RE
 .PP
 \-m, \-\-max\-tries=N
-.RS 3n
+.RS 4
 Set number of tries.
 \fI0\fR
 means unlimited. Default:
@@ -89,32 +89,32 @@ means unlimited. Default:
 .RE
 .PP
 \-\-http\-proxy=HOST:PORT
-.RS 3n
+.RS 4
 Use HTTP proxy server. This affects to all URLs.
 .RE
 .PP
 \-\-http\-user=USER
-.RS 3n
+.RS 4
 Set HTTP user. This affects to all URLs.
 .RE
 .PP
 \-\-http\-passwd=PASSWD
-.RS 3n
+.RS 4
 Set HTTP password. This affects to all URLs.
 .RE
 .PP
 \-\-http\-proxy\-user=USER
-.RS 3n
+.RS 4
 Set HTTP proxy user. This affects to all URLs
 .RE
 .PP
 \-\-http\-proxy\-passwd=PASSWD
-.RS 3n
+.RS 4
 Set HTTP proxy password. This affects to all URLs.
 .RE
 .PP
 \-\-http\-proxy\-method=METHOD
-.RS 3n
+.RS 4
 Set the method to use in proxy request.
 \fIMETHOD\fR
 is either
@@ -125,7 +125,7 @@ or
 .RE
 .PP
 \-\-http\-auth\-scheme=SCHEME
-.RS 3n
+.RS 4
 Set HTTP authentication scheme. Currently,
 \fIbasic\fR
 is the only supported scheme. Default:
@@ -133,24 +133,24 @@ is the only supported scheme. Default:
 .RE
 .PP
 \-\-referer=REFERER
-.RS 3n
+.RS 4
 Set Referer. This affects to all URLs.
 .RE
 .PP
 \-\-ftp\-user=USER
-.RS 3n
+.RS 4
 Set FTP user. This affects to all URLs. Default:
 \fIanonymous\fR
 .RE
 .PP
 \-\-ftp\-passwd=PASSWD
-.RS 3n
+.RS 4
 Set FTP password. This affects to all URLs. Default:
 \fIARIA2USER@\fR
 .RE
 .PP
 \-\-ftp\-type=TYPE
-.RS 3n
+.RS 4
 Set FTP transfer type. TYPE is either
 \fIbinary\fR
 or
@@ -159,12 +159,12 @@ or
 .RE
 .PP
 \-p, \-\-ftp\-pasv
-.RS 3n
+.RS 4
 Use passive mode in FTP.
 .RE
 .PP
 \-\-ftp\-via\-http\-proxy=METHOD
-.RS 3n
+.RS 4
 Use HTTP proxy in
 \fIFTP\fR.
 \fIMETHOD\fR
@@ -176,7 +176,7 @@ or
 .RE
 .PP
 \-\-lowest\-speed\-limit=SPEED
-.RS 3n
+.RS 4
 Close connection if download speed is lower than or equal to this value(bytes per sec). 0 means aria2 does not care lowest speed limit. You can append
 \fIK\fR
 or
@@ -185,7 +185,7 @@ or
 .RE
 .PP
 \-\-max\-download\-limit=SPEED
-.RS 3n
+.RS 4
 Set max download speed in bytes per sec.
 \fI0\fR
 means unrestricted. You can append
@@ -196,7 +196,7 @@ or
 .RE
 .PP
 \-\-file\-allocation=METHOD
-.RS 3n
+.RS 4
 Specify file allocation method.
 \fIMETHOD\fR
 is either
@@ -211,14 +211,14 @@ pre\-allocates file space before download begins. This may take some time depend
 .RE
 .PP
 \-\-allow\-overwrite=true|false
-.RS 3n
+.RS 4
 If this option set to
 \fIfalse\fR, aria2 doesn't download a file which already exists in the file system but its corresponding .aria2 file doesn't exist. Default:
 \fIfalse\fR
 .RE
 .PP
 \-\-check\-integrity=true|false
-.RS 3n
+.RS 4
 Check file integrity by validating piece hash. This option makes effect in BitTorrent download and Metalink with chunk checksums. Use this option to redownload a damaged portion of file. You may need to specify
 \fI\-\-allow\-overwrite=true\fR
 option if .aria2 file doesn't exist. Default:
@@ -226,33 +226,53 @@ option if .aria2 file doesn't exist. Default:
 .RE
 .PP
 \-\-realtime\-chunk\-checksum=true|false
-.RS 3n
+.RS 4
 Validate chunk checksum while downloading a file in Metalink mode. This option makes effect in Metalink with chunk checksums. Default:
 \fItrue\fR
 .RE
 .PP
 \-c, \-\-continue
-.RS 3n
+.RS 4
 Continue downloading a partially downloaded file. Use this option to resume a download started by web browsers or another programs which download files sequentially from the beginning. Currently this option is applicable to http(s)/ ftp downloads.
 .RE
 .PP
 \-U, \-\-user\-agent=USER_AGENT
-.RS 3n
+.RS 4
 Set user agent for http(s) downloads.
 .RE
 .PP
 \-n, \-\-no\-netrc
-.RS 3n
+.RS 4
 Disables netrc support.
 .RE
 .PP
+\-i, \-\-input\-file=FILE
+.RS 4
+Downloads URIs found in
+\fIFILE\fR. You can specify multiple URIs for a single entity: deliminate URIs by Tab in a single line.
+.RE
+.PP
+\-j, \-\-max\-concurrent\-downloads=N
+.RS 4
+Set maximum number of concurrent downloads. Default:
+\fI5\fR
+.RE
+.PP
+\-\-load\-cookies=FILE
+.RS 4
+Load cookies from
+\fIFILE\fR. The format of
+\fIFILE\fR
+is one used by Netscape and Mozilla.
+.RE
+.PP
 \-T, \-\-torrent\-file=TORRENT_FILE
-.RS 3n
+.RS 4
 The file path to .torrent file.
 .RE
 .PP
 \-\-follow\-torrent=true|false
-.RS 3n
+.RS 4
 Setting this option to
 \fIfalse\fR
 prevents aria2 to enter BitTorrent mode even if the filename of downloaded file ends with .torrent. Default:
@@ -260,23 +280,23 @@ prevents aria2 to enter BitTorrent mode even if the filename of downloaded file
 .RE
 .PP
 \-S, \-\-show\-files
-.RS 3n
+.RS 4
 Print file listing of .torrent file and exit.
 .RE
 .PP
 \-\-direct\-file\-mapping=true|false
-.RS 3n
+.RS 4
 Directly read from and write to each file mentioned in .torrent file. Default:
 \fItrue\fR
 .RE
 .PP
 \-\-listen\-port=PORT
-.RS 3n
+.RS 4
 Set port number to listen to for peer connection.
 .RE
 .PP
 \-\-max\-upload\-limit=SPEED
-.RS 3n
+.RS 4
 Set max upload speed in bytes per sec.
 \fI0\fR
 means unrestricted. You can append
@@ -287,7 +307,7 @@ or
 .RE
 .PP
 \-\-select\-file=INDEX\&...
-.RS 3n
+.RS 4
 Set file to download by specifing its index. You can know file index through
 \fI\-\-show\-files\fR
 option. Multiple indexes can be specified by using
@@ -302,14 +322,14 @@ can be used together.
 .RE
 .PP
 \-\-seed\-time=MINUTES
-.RS 3n
+.RS 4
 Specify seeding time in minutes. See also
 \fI\-\-seed\-ratio\fR
 option.
 .RE
 .PP
 \-\-seed\-ratio=RATIO
-.RS 3n
+.RS 4
 Specify share ratio. Seed completed torrents until share ratio reaches
 \fIRATIO\fR.
 \fI1.0\fR
@@ -319,40 +339,38 @@ option is specified along with this option, seeding ends when at least one of th
 .RE
 .PP
 \-M, \-\-metalink\-file=METALINK_FILE
-.RS 3n
+.RS 4
 The file path to .metalink file.
 .RE
 .PP
 \-C, \-\-metalink\-servers=NUM_SERVERS
-.RS 3n
-The number of servers to connect to simultaneously. If more than one connection per server is required, use
-\fI\-s\fR
-option. Default:
-\fI15\fR
+.RS 4
+The number of servers to connect to simultaneously. Default:
+\fI5\fR
 .RE
 .PP
 \-\-metalink\-version=VERSION
-.RS 3n
+.RS 4
 The version of file to download.
 .RE
 .PP
 \-\-metalink\-language=LANGUAGE
-.RS 3n
+.RS 4
 The language of file to download.
 .RE
 .PP
 \-\-metalink\-os=OS
-.RS 3n
+.RS 4
 The operating system the file is targeted.
 .RE
 .PP
 \-\-metalink\-location=LOCATION
-.RS 3n
+.RS 4
 The location of the prefered server.
 .RE
 .PP
 \-\-follow\-metalink=true|false
-.RS 3n
+.RS 4
 Setting this option to
 \fIfalse\fR
 prevents aria2 to enter Metalink mode even if the filename of downloaded file ends with .metalink. Default:
@@ -360,22 +378,22 @@ prevents aria2 to enter Metalink mode even if the filename of downloaded file en
 .RE
 .PP
 \-v, \-\-version
-.RS 3n
+.RS 4
 Print the version number and exit.
 .RE
 .PP
 \-h, \-\-help
-.RS 3n
+.RS 4
 Print this message and exit.
 .RE
 .PP
 URL
-.RS 3n
+.RS 4
 You can specify multiple URLs. All URLs must point to the same file or downloading fails.
 .RE
 .PP
 FILE
-.RS 3n
+.RS 4
 Specify files in multi\-file torrent to download. Use conjunction with
 \fI\-T\fR
 option. This arguments are ignored if you specify
@@ -385,76 +403,76 @@ option.
 .SH "EXAMPLES"
 .PP
 Download a file by 1 connection
-.RS 3n
+.RS 4
 aria2c http://AAA.BBB.CCC/file.zip
 .RE
 .PP
 Download a file by 2 connections
-.RS 3n
+.RS 4
 aria2c \-s 2 http://AAA.BBB.CCC/file.zip
 .RE
 .PP
 Download a file by 2 connections, each connects to a different server
-.RS 3n
+.RS 4
 aria2c http://AAA.BBB.CCC/file.zip http://DDD.EEE.FFF/GGG/file.zip
 .RE
 .PP
 You can mix up different protocols
-.RS 3n
+.RS 4
 aria2c http://AAA.BBB.CCC/file.zip ftp://DDD.EEE.FFF/GGG/file.zip
 .RE
 .PP
 Download a torrent
-.RS 3n
+.RS 4
 aria2c \-o test.torrent http://AAA.BBB.CCC/file.torrent
 .RE
 .PP
 Download a torrent using local .torrent file
-.RS 3n
+.RS 4
 aria2c \-T test.torrent
 .RE
 .PP
 Download only selected files
-.RS 3n
+.RS 4
 aria2c \-T test.torrent dir/file1.zip dir/file2.zip
 .RE
 .PP
 Print file listing of .torrent file
-.RS 3n
+.RS 4
 aria2c \-T test.torrent \-S
 .RE
 .PP
 Metalink downloading
-.RS 3n
+.RS 4
 aria2c \-\-lowest\-speed\-limit 10K http://AAA.BBB.CCC/file.metalink
 .RE
 .PP
 Download a file using local .metalink file
-.RS 3n
+.RS 4
 aria2c \-M test.metalink
 .RE
 .PP
 Metalink downloading with preferences
-.RS 3n
+.RS 4
 aria2c \-M test.metalink \-\-metalink\-version=1.1.1 \-\-metalink\-language=en\-US
 .RE
 .SH "FILES"
 .PP
 aria2.conf
-.RS 3n
+.RS 4
 User configuration file. It must be placed under ~/.aria2 and must be named as aria2.conf. In each line, there is 1 parameter whose syntax is name=value pair, where name is the long command\-line option name without
 \fI\-\-\fR
 prefix. The lines beginning
 \fI#\fR
 are treated as comments.
 .sp
-.RS 3n
+.RS 4
 .nf
-Examples:
+Example:
 .fi
 .RE
 .sp
-.RS 3n
+.RS 4
 .nf
 # sample configuration file for aria2c
 file\-allocation=prealloc

+ 15 - 4
doc/aria2c.1.txt

@@ -169,6 +169,18 @@ OPTIONS
  -n, --no-netrc::
                Disables netrc support.
 
+ -i, --input-file=FILE::
+        Downloads URIs found in 'FILE'. You can specify
+                              multiple URIs for a single entity: deliminate
+                              URIs by Tab in a single line.
+
+ -j, --max-concurrent-downloads=N::
+         Set maximum number of concurrent downloads.
+         Default: '5'
+
+ --load-cookies=FILE::
+          Load cookies from 'FILE'. The format of 'FILE' is
+                              one used by Netscape and Mozilla.
 
  -T, --torrent-file=TORRENT_FILE::
   The file path to .torrent file.
@@ -219,10 +231,9 @@ OPTIONS
  The file path to .metalink file.
 
  -C, --metalink-servers=NUM_SERVERS::
- The number of servers to connect to
-                              simultaneously. If more than one connection per
-                              server is required, use '-s' option.
-                              Default: '15'
+   The number of servers to connect to
+                              simultaneously.
+                              Default: '5'
 
  --metalink-version=VERSION::
    The version of file to download.

+ 2 - 1
src/RequestGroup.cc

@@ -164,6 +164,7 @@ void RequestGroup::loadAndOpenFile()
     }
     initBitfield();
     openExistingFile();
+    _segmentMan->markPieceDone(existingFile.size());
   } else {
     shouldCancelDownloadForSafety();
     initBitfield();
@@ -205,7 +206,7 @@ void RequestGroup::prepareForNextAction(int cuid, const RequestHandle& req, Down
     CheckIntegrityCommand* command = new CheckIntegrityCommand(cuid, this, e, entry);
     e->commands.push_back(command);
   } else if(needsFileAllocation()) {
-    FileAllocationEntryHandle entry = new FileAllocationEntry(cuid, req, this);
+    FileAllocationEntryHandle entry = new FileAllocationEntry(cuid, req, this, existingFile.size());
     entry->setNextDownloadCommand(downloadCommand);
     e->_fileAllocationMan->pushFileAllocationEntry(entry);
   } else {