In getGeomMissingUnusedIndex(), use index if isBitSet() is false
instead of finding isUseBitSet() == true and cancel. Added doc for
getGeomMissingUnusedIndex(). Renamed confusing names in bitfield.h.
Added --checksum=TYPE=DIGEST option. This option sets checksum. TYPE
is hash type. The supported hash type is listed in "Hash Algorithms"
in "aria2c -v". DIGEST is hex digest. For example, setting sha-1
digest looks like this: sha-1=0192ba11326fe2298c8cb4de616f4d4140213838
This option applies only to HTTP(S)/FTP downloads.
Added --hash-check-only opiton. If true is given, after hash check
using --check-integrity option, abort download whether or not download
is complete. The default value is false.
Added --download-result=OPT option. This option changes the way
"Download Results" is formatted. If OPT is 'default', print GID,
status, average download speed and path/URI. If multiple files are
involved, path/URI of first requested file is printed and remaining
ones are omitted. If OPT is 'full', print GID, status, average
download speed, percentage of progress and path/URI. The percentage of
progress and path/URI are printed for each requested file in each row.
MinGW32 lacks random(), so we use CryptGenRandom() as a replacement.
In the implementation, SimpleRandomizer::getRandomNumber() returns the
random number in range [0, INT32_MAX]. Thus,
simpleRandomizer::getMaxRandomNumber() returns INT32_MAX.
libnettle and libgmp is used by default. Old implementation uses
libgcrypt as default. If more and more Linux distributions offer
libnettle linked GnuTLS, then this change decrease library dependency
against libgcrypt and libgpg-error. The current library detection for
libnettle and libgmp is very simple, just use AC_SEARCH_LIBS.
util::generateRandomData() was written using SimpleRandomizer, thus no
external library dependency from this function.
aria2 downloads meta files such as .torrent and .metalink file in
memory using ByteArrayWriter. To prevent accidentally download big
file, we set the maximum length that ByteArrayWriter can hold. The
default is 5MiB and it is reasonable because most .torrent and
.metalink file are much smaller than that.
Don't use sorted deque for requestSlots_. For the most time, first
data requested is sent back first. So using std::deque, we find
received RequestSlot by O(1), while sorted std::deque requires
O(logN).
Simplified PieceStatMan and RarestPieceSelector, but computation order
to select piece index is still O(N) and unchanged. Updating piece
stat is improved to O(N) for bitfield update and O(1) for single
index update, while old implementation needs O(NlogN) and O(N)
respectively.
We replaced most of std::cerr with global::cerr. windows.h is now
included from common.h. Before including it, we define WINVER. We
renamed some variable name because some macros in windows.h collide
with them.
In MinGW32 build, global::cout is WinConsoleFile. When outputing to
console, it uses WriteConsoleW, so Unicode characters are written.
Fixed memory leak in WChar<->MultiByte conversion functions. The
portion of code which uses std::cout is rewritten to use global::cout.
Percent-encode non-printable ASCII and non-ASCII chars in URI using
util::percentEncodeMini() when URI is added to FileEntry. Removed
percent-encode from Request. Also do percent-encoding when setting
referer and redirected URI.
We relied initialization of libgcrypt on gnutls_global_init(), but
recent change in gnutls, which changes default crypto backend from
libgcrypt to libnettle, leaves libgcrypt uninitialized if it uses
libnettle as backend(and this is likely because libnettle is chosen by
default). To fix this issue, we simply initialize libgcrypt on our
own.
When --http-auth-challenge=true, aria2 only sends basic auth header
when requested. Old implementation sends basic auth header to service
operated in different port in successive request. This change avoid
this bug.
Link header fields from first Metalink server is utilized as described
in rfc6249. We only set digest from Digest header field to
DownloadContext only when PieceStorage is not initialized(in other
words, before file size is known). After PieceStorage is initialized,
Digest header field is used to check the value is the same in digest
in DownloadContext. Current implementation only handles
rel=duplicate.
RequestGroup holds a poitner to btRuntime_ and peerStorage_. After
removing them from BtRegistry, we failed to set 0 to them. When
program access them, it goes undefined world, such as random crash.
We found this bug when pasuing download and valgrind warned memory
corruption.
Because BitTorrent TCP server port is global configuration, it is not
preferable that per download resource BtRuntime holds it. We also
refactored and eliminated ugly static variable in PeerListenCommand.
If TCP port is necessary, we inject it to them directly.
Previous implementation does not store information which Command cuid
uses which Piece. Mark Piece acquired by SegmentMan by setting
Piece::setUsedBySegment(true).
This option pauses download after added. This option is effective only
when --enable-rpc=true is given. When --save-session option is used
and there are paused downloads, they are saved with --pause=true so
that it will become paused state when the session is recovered.
This option truncates console readout to fit in a single line. This
is default. Give false value to this option to tell aria2 not to
truncate console readout.
This option specifies piece selection algorithm used in HTTP/FTP
download. Piece means fixed length segment which is downloaded in
parallel in segmented download. If 'default' is given, aria2 selects
piece so that it reduces the number of establishing connection. This
is reasonable default behaviour because establishing connection is an
expensive operation. If 'inorder' is given, aria2 selects piece which
has minimum index. Index=0 means first of the file. This will be
useful to view movie while downloading it. --enable-http-pipelining
option may be useful to reduce reconnection overhead. Please note
that aria2 honors --min-split-size option, so it will be necessary to
specify a reasonable value to --min-split-size option.
We use SetFilePointerEx and SetEndOfFile to allocate extents. This
only works with NTFS. To enable this feature, --file-allocation=falloc
must be given.
+ DownloadFailureException.
Throwing DownloadFailureException may stop download unexpectedly when
--reuse-uri is false. Using CreateRequestCommand with STATUS_INACTIVE,
they can be executed next iteration with
DownloadEngine::setRefreshInterval(0).
The delay is caused because some Commands are only called in certain
interval(called refreshInterval, default, 1000ms). In aria2 download
stops when all Commands associated to it are stopped. Since some
Commands are called in each 1000ms by default, as mentioned before, we
have to wait for them. To fix this issue, we call
DownloadEngine::setRefreshInterval(0) when pausing/stopping downloads.
DownloadEngine::setRefreshInterval(0) makes refreshInterval 0 in one
shot.
When all segments are ignored, now DownloadFailureException is thrown.
And stop the download immediately. As described earlier, we call
DownloadEngine::setRefreshInterval(0) in catch block of
DownloadFailureException to eliminate delay.
--metalink-uri option specifies base URI to resolve relative URI in
metalink file stored in local disk. If URI points to a directory, URI
must end with '/'.
It seems that we have to specify the full path to cmd.exe in the first
argument of CreateProcess() to run batch file in proper manner. We
first determine the full path to cmd.exe. To do this, we get windir
environment variable and concatenate it with "\system32\cmd.exe".
If relative URI is found in Metalink file, aria2 resolves its full URI
contatenating the URI from which Metalink file is retrieved and
relative URI in Metalink file. This feature is not available if
Metalink file in local disk is specified in command line.
--enable-rpc and --rpc-* option instead.
--enable-xml-rpc and --xml-rpc-* option can be used but warning
message will be shown. The help tag #xml-rpc was replaced with #rpc.
time.
Checking serialized time does not work if you stop aria2 as soon as it
started DHT. The serialized time in dht.dat will be updated, but
buckets are not updated and still old. When you restart aria2 again,
it does not refresh buckets because serialized time is recent.
To eliminate unresponsive node, we have to contact them 5
times. Therefore the maximum number of retry is 10. It is very
annoying when it takes some time to get first peer, so retry quickly
(5 seconds delay).
--save-session file.
Uploaded data are saved as file named hex string of sha1 hash of
uploaded data plus extension(".torrent" for torrent and ".metalink"
for metalink). For example,
0a3893293e27ac0490424c06de4d09242215f0a6.torrent. The directory where
these files are saved is specified by --dir option. These file paths
are written in --save-session file.
get user's home directory in MinGW32 build.
Usually HOME environment variable is defined in *nix like OSes, but
not in Windows. So in MinGW32 build, if HOME is not defined, we also
look for USERPROFILE and the combination of HOMEDRIVE and HOMEPATH.
This option accepts comma separated list of DNS server address used in
asynchronous DNS resolver. Usually asynchronous DNS resolver reads DNS
server addresses from /etc/resolv.conf. When this option is used, it
uses DNS servers specified in this option instead of ones in
/etc/resolv.conf. You can specify both IPv4 and IPv6 address. This
option is useful when the system does not have /etc/resolv.conf and
user does not have the permission to create it.
Inside calculateStatistics(), global::wallclock is used and if
calculateStatistics() is called after waitData(), it may use quite old
global::wallclock value.
The method signature is aria2.removeDownloadResult(gid). This method
removes completed/error/removed download denoted by gid from
memory. This method returns "OK" for success.
This option was once existed in aria2 but erased on 2009-09-20. Now
it is resurrected once again. We choose 2 as default value, but there
is no good theory behind it. Now we retry HTTP download when remote
server returns 503 Service Unavailable if --retry-wait > 0. We also
added error code 29: HTTP_SERVICE_UNAVAILABLE.
after several pipelined requests.
We call Request::setMaxPipelinedRequest(1) if Connection: close is
received. Also call Request::supportsPersistentConnection(true) and
Request::setMaxPipelinedRequest(1) when closing the connection.
We introduced SocketRecvBuffer which buffers received bytes. Since
HTTP response header and response body are divided with \r\n, we have
to buffer up several bytes to find this delimiter. We use
SocketRecvBuffer to hold these bytes and only consumes header and
passes SocketRecvBuffer, which may contain head of response body, to
next Command. Since FTPConnection doesn't use SocketCore::peekData(),
we left it as is.
We simplified PeerConnection::receiveHandshake().
DefaultBtMessageReceiver and PeerReceiverHandshakeCommand look
PeerConnection's buffer and do NAT check handling themselves.