We have to use dedicated DiskWriter instead of
(*entryItr_)->getDiskWriter(). This is because
SingleFileAllocationIterator cannot reopen file if file is closed by
OpenedFileCounter.
Use one of the following to provide random bytes:
- Windows CryptGenRandom
- Linux getrandom (syscall interface to urandom, without nasty corner
cases such as file descriptor exhaustion or re-linked /dev/urandom)
- std::device_random (C++ random device, which usually will be urandom)
This also equalizes util::getRandom and SimpleRandomizer (the former
will now use the latter) instead of having essentially two different
PRNG interfaces with potentially different quality.
Closes GH-320
This option requires BitTorrent message payload encryption with
arc4. This is a shorthand of --bt-requre-crypto
--bt-min-crypto-level=arc4. If true is given, deny legacy BitTorrent
handshake and only use Obfuscation handshake and always encrypt
message payload. This option defaults to false.
This option excludes seed only downloads when counting concurrent
active downloads (-j option). This means that if -j3 is given and
this option is turned on and 3 downloads are active and one of those
enters seed mode, then it is excluded from active download count (thus
it becomes 2), and the next download waiting in queue gets started.
But be aware that seeding item is still recognized as active download
in RPC method.
Generally, bitfield is not available for download whose total length
is unknown. We create bitfield when download is completed (usually
connection EOF) so that we can use it to show additional info in RPC
aria2.tellStatus response. Specifically, bitfield is now shown. And
completedLength under files key (or completedLength in
aria2.getFiles() response) is correctly shown.
This commit fixes the bug that aria2.tellStopped RPC method returns
total length and completedLength as 0 when file size is unknown in
advance and turns out > 2GB in the end. This commit and addresses the
performance degradation in this case.
This commit fixes following compiler warning with mingw compiler:
In file included from common.h:63:0,
from util_security.h:42,
from util_security.cc:36:
/usr/share/mingw-w64/include/winsock2.h:15:2: warning: #warning
Please include winsock2.h before windows.h [-Wcpp]
#warning Please include winsock2.h before windows.h
The algorithms the `CryptProv` on Windows supports does not currently
include SHA-224, so there is a "dark spot" in this implementation. Also
on Win XP < SP3, most of the SHA-2 family is not actually supported.
All other implementation provide support for MD5, SHA-1 and all of the
SHA-2 family, hence drop the incomplete WinMessageDigest implementation
in favor of any other supported implementation (at least the internal
implementation is always available at compile-time).
This option pauses downloads created as a result of metadata
download. There are 3 types of metadata downloads in aria2: (1)
downloading .torrent file. (2) downloading torrent metadata using
magnet link. (3) downloading metalink file. These metadata downloads
will generate downloads using their metadata. This option pauses these
subsequent downloads.
Add and use usedCompilerAndPlatform(). This adds compiler information to
INFO logs and the --version output, and may be helpful when trying to
diagnose/reproduce user-reported problems.
Also make INFO logs include usedLibs() output.
Closes#235
DefaultPieceStorage may be referenced by one of DHT task (e.g.,
DHTPeerLookupTask), after RequestGroup was deleted, and even after
RequestGroupMan was deleted. DefaultPieceStorage has a reference to
MultiDiskAdaptor which calls RequestGroupMan object on destruction.
So when DHT task is destroyed, DefaultPieceStorage is destroyed, which
in turn destroys MultiDiskAdaptor. DHT task is destroyed after
RequestGroupMan was destroyed, MultiDiskAdaptor will use now freed
RequestGroupMan object, this is use-after-free.
When the directory is changed via aria2.changeOption RPC method, we
directly change first FileEntry's path using FileEntry::setPath(). If
there is no PREF_OUT option is given, basically file name is unknown,
so we just set empty string and let the next run determine the correct
file name and new directory is applied there. But previous code does
not reset length property of FileEntry, so the unexpected code path is
taken when unpaused and its path expects path is not empty string.
This commit fixes this issue by setting length to 0 using
FileEntry::setLength().
This is a slight optimization not to cause useless disk access. This
only applies to saving session automatically (see
--save-session-interval). aria2.saveSession and serialization at the
end of the session are always performed as before.
When serialization, we first check that whether there is any change
since the last serialization. To do this, we first calculate hash
value of serialized content without writing into file. Then compare
this value to the value of last serialization. If they do not match,
perform serialization.
This is a slight optimization not to cause useless disk access. This
only applies to saving session automatically (see
--save-session-interval). aria2.saveSession and serialization at the
end of the session are always performed as before.
In my quest to explore the code and understand it, why not clean it up
in the progress. Most formatting provided by clang-format. ;)
Aside from formatting, also extracted some method and unnested some
control structs.
Previously we disabled conditional-get if file part is missing in URI.
But we use constant string "index.html" in this case, so we can do the
same to determine the modification time. In this patch, if we have
file part in URI, we are not going to set absolute file path in
FileEntry, since it prevents content-disposition from working.
This change should make token validation more resilient to:
- timing attacks (constant time array compare)
- brute-force/dictionary attacks (PBKDF2)
Closes#220
This is kind what browser do anyway (IE, Firefox, Chrome tested), what
AppleTLS does, what GnuTLS does and what OpenSSL does. Actually, most
browsers will also be OK with the CRL/OCSP provider being offline.
WinTLS will still fail in that case.
Should revocation information be available in the trust chain (CRL or
OCSP) the certificate still will be checked!
"Real" CAs, aka. those provided by the OS or system CA bundle, usually
provide revocation information and are thus still checked.
It should be mostly (only?) custom (organization) CAs that lack
revocation information, but those users might want to use aria2 in their
intranets and VPNs anyway ;)
See #217