Vasilij Schneidermann
8bc1d37b3a
Make config and cache files conform to XDG
...
See http://standards.freedesktop.org/basedir-spec/latest/ for further
details. This implementation decides the default based on whether a
file exists at the legacy location, if it doesn't, it picks the
XDG-conforming location instead.
2015-06-02 15:54:27 +02:00
Tatsuhiro Tsujikawa
bb8df11d7e
ftp, sftp: Fix heap-after-free bug on exception
2015-05-28 22:15:25 +09:00
Tatsuhiro Tsujikawa
70541498d8
ftp: Fix timeout when reusing FTP connection
2015-05-28 22:14:43 +09:00
Tatsuhiro Tsujikawa
e30becdbed
Fix uninitialized field bug in WebSocketSession
2015-05-23 21:17:47 +09:00
Tatsuhiro Tsujikawa
fa3401dcb2
Update copyright year in -v output
2015-05-21 00:52:49 +09:00
Tatsuhiro Tsujikawa
ee12923122
Arrange #ifdef guard so that formatter does not get fooled
2015-05-16 20:58:51 +09:00
Tatsuhiro Tsujikawa
c26da09687
Add --ssh-host-key-md option
...
Set checksum for SSH host public key. Use same syntax with --checksum
option. TYPE is hash type. The supported hash type is sha-1 or
md5. DIGEST is hex digest. For example:
sha-1=b030503d4de4539dc7885e6f0f5e256704edf4c3. This option can be
used to validate server's public key when SFTP is used. If this
option is not set, which is default, no validation takes place.
2015-05-16 19:43:11 +09:00
Ryan Steinmetz
ceee04cfe8
Allow netrc-path to be specified in the config file
2015-05-14 21:20:11 +09:00
multisnow
e84176d1f0
fix build error without libssh2
2015-05-14 08:44:17 +08:00
Tatsuhiro Tsujikawa
3855205026
Exit with 32 status code if checksum verification failed
2015-05-12 23:08:10 +09:00
Tatsuhiro Tsujikawa
62826d691d
ftp: Fix accessing first element in empty segments vector
2015-05-12 22:42:26 +09:00
Tatsuhiro Tsujikawa
5723f4211a
sftp: Seek to the correct position to resume, fix slow start of transfer
2015-05-12 22:31:14 +09:00
Tatsuhiro Tsujikawa
2758fba10c
sftp: Add SFTP and libssh2 to feature summary, and add tests
2015-05-12 00:52:50 +09:00
Tatsuhiro Tsujikawa
46595e77d7
sftp: Guard sftp code with HAVE_LIBSSH2
2015-05-12 00:37:21 +09:00
Tatsuhiro Tsujikawa
21c328fc11
sftp: Make sftp works through HTTP proxy
2015-05-12 00:32:30 +09:00
Tatsuhiro Tsujikawa
d0ad7033c3
sftp: basic download works
...
This commits implements basic downloading feature for sftp URI. This
includes segmented downloads, and connection (sftp session) pooling.
Download via HTTP proxy has not been implemented yet.
2015-05-12 00:31:57 +09:00
Tatsuhiro Tsujikawa
82ba003209
Add basic ssh/sftp code to SocketCore and introduce SSHSession
...
We use libssh2 to implement sftp feature. SSHSession is closely
designed to TLSSession, but it differs in several aspects. In this
code, we only implements read part of sftp, since aria2 won't offer
uploading feature. Adding SSH/sftp to SocketCore is a bit bloat. But
by doing this we can reuse DownloadCommand, without mostly no
modification. We can just create SSHDownloadCommand by inheriting it,
just like existing ftp.
2015-05-10 00:00:23 +09:00
Tatsuhiro Tsujikawa
0ab23e7a8d
Document --multiple-interface option
...
Thic commit documents --multiple-interface option, and move option
handler for it to the place alphabetical order as we do usually
2015-04-22 22:48:49 +09:00
Tatsuhiro Tsujikawa
45199d3691
Merge branch 'master' of https://github.com/sarim/aria2 into sarim-master
2015-04-22 00:08:57 +09:00
Sarim Khan
34d773a465
multiple interface support for link aggregation
...
fix: wrong variable
2015-04-21 20:59:38 +06:00
Tatsuhiro Tsujikawa
692a674fe0
SocketRecvBuffer: Eliminate memmove
...
Since we don't try to read into buffer if buffer is not empty, we
don't have to memmove things. This commit mostly rewrites
SocketRecvBuffer.
2015-04-14 00:25:23 +09:00
David Macek
20a04c1b8d
Fix linking with libintl on MinGW-w64
2015-04-03 00:40:06 +02:00
Tatsuhiro Tsujikawa
8ed8ac0fe8
Remove extra space between # and define
...
Fixes GH-356
2015-03-23 23:38:31 +09:00
Tatsuhiro Tsujikawa
d03c7b32c6
Refactor MultiDiskAdaptor::closeFile() and add assert for debugging
2015-03-22 18:38:50 +09:00
Tatsuhiro Tsujikawa
b324be70ad
Run on-bt-download-complete command when -V reports download finished
...
See GH-355
2015-03-22 17:58:13 +09:00
Tatsuhiro Tsujikawa
7f9bb0e2da
Use dedicated DiskWriter in MultiDiskFileAllocationIterator
...
We have to use dedicated DiskWriter instead of
(*entryItr_)->getDiskWriter(). This is because
SingleFileAllocationIterator cannot reopen file if file is closed by
OpenedFileCounter.
2015-03-22 01:32:38 +09:00
Nils Maier
c248d456d1
Comment getrandom code a bit
2015-03-18 01:46:26 +01:00
Nils Maier
ee63dff225
Fix getrandom for system with libc not including errno or systems
...
not supporting ENOSYS in the first place.
Fixes GH-347
2015-03-18 01:46:21 +01:00
Tatsuhiro Tsujikawa
c17b98a9fc
Don't send back rpc-secret option value in aria2.getGlobalOption RPC method
2015-03-13 01:09:01 +09:00
Tatsuhiro Tsujikawa
762ab15450
Avoid copy
2015-03-13 00:18:14 +09:00
Tatsuhiro Tsujikawa
cb5ccf6a7a
SocketBuffer: Keep sending until blocked
...
See GH-345
2015-03-08 21:15:12 +09:00
Tatsuhiro Tsujikawa
649c49dcc6
Mingw: Use _wgetenv to get user's home directory
...
Fixes GH-342
2015-02-21 01:49:07 +09:00
Tatsuhiro Tsujikawa
c63fc414c3
Add --stream-piece-selector=random
2015-02-14 18:33:37 +09:00
Nils Maier
ba0e32abae
Handle linux getrandom returning EINTR on interrupts/signals
...
Also handle ENOTSUP failures where aria2 was build with linux headers
newer than the actual running kernel.
Fixes GH-336
2015-02-07 17:18:45 +01:00
Tatsuhiro Tsujikawa
9d577b0ad7
Fix adjustAnnounceUri parameter is not passed
2015-02-07 00:39:33 +09:00
Tatsuhiro Tsujikawa
4cf0bb742f
Shuffle web-seeding URIs
2015-02-07 00:38:03 +09:00
Tatsuhiro Tsujikawa
e1739c8ee7
Fix compile error without SSL/TLS enabled
2015-02-01 21:32:47 +09:00
Tatsuhiro Tsujikawa
d5d21d20d7
Support HTTP date ending "+0000" as well as "GMT".
2015-01-26 21:31:47 +09:00
Nils Maier
81bdd5f61a
Revise getRandom facilities
...
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
2015-01-20 22:37:24 +01:00
Tatsuhiro Tsujikawa
bec6461262
Merge branch 'comments' of https://github.com/dfandrich/aria2 into dfandrich-comments
2015-01-16 21:36:22 +09:00
Dan Fandrich
0538aa40da
Fixed some typos in code comments
2015-01-16 01:17:35 +01:00
Dan Fandrich
8c53e37c21
Added debug log of all Metalink URLs with final priorities
2015-01-16 00:29:17 +01:00
Tatsuhiro Tsujikawa
d0c20e158e
Fix typo
2015-01-13 23:41:59 +09:00
Tatsuhiro Tsujikawa
9f4e76d1b7
Fix indentation in usage output
2015-01-12 17:49:45 +09:00
Tatsuhiro Tsujikawa
c653c72dc8
Add --bt-force-encryption option
...
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.
2015-01-12 17:46:20 +09:00
Nils Maier
0895008e5c
Fix SSLv3 warnings being issued on connection reuse.
...
And also improve tlsHandshake code a bit in the process, mostly by being
more explicit about error conditions.
2014-12-30 22:36:24 +01:00
Nils Maier
590aa21c68
Add backward-compatible libuv defs
2014-12-30 22:36:24 +01:00
Nils Maier
e0812d5ad1
Fix another printf related warning
2014-12-29 03:15:50 +01:00
Tatsuhiro Tsujikawa
ff2a630efe
GNUTLS: Remove ifdef for GNUTLS_TLS* since they are not macros
...
Since they are not macros, we get always TLS_PROTO_NONE (otherwise you
are using SSLv3 and you will get warning nonetheless) and get warning.
2014-12-26 18:08:41 +09:00
Tatsuhiro Tsujikawa
d755df2505
TLS: Fix memory leak with OpenSSL
...
Based on the patch submitted by midnight2k
2014-12-26 18:04:50 +09:00
Tatsuhiro Tsujikawa
701e5df790
Merge branch 'master' into warn-ssl3
2014-12-15 23:44:41 +09:00
Nils Maier
48bcb47a30
Refine messages to include peer info
2014-12-14 10:34:09 +01:00
Nils Maier
3c8704178a
Move warn logic into SocketCore
...
Also fiddle a bit with the WinTLS implementation, forcing "strong"
crypto only for > SSLv3.
2014-12-14 10:34:09 +01:00
Nils Maier
b0cdbfe9e7
Fix ASYNC_DNS code in LibuvEventPoll
2014-12-13 08:14:07 +01:00
Nils Maier
c5c38bf3a4
Warn about insecure SSL connections.
...
Fixed GH-313
2014-12-12 18:24:19 +01:00
Nils Maier
811c0f758d
Port poll changes to LibuvEventPoll
2014-12-12 12:21:39 +01:00
Nils Maier
6f9ea555c2
Fix compiler warning
2014-12-12 10:34:53 +01:00
Nils Maier
46aa2f6af3
Fix AppleTLSContext protocol selection
2014-12-12 09:29:33 +01:00
Nils Maier
0e5ed611d1
AppleTLS: Set error state when handshake fails...
...
+ some minor formatting issues.
2014-12-11 12:12:04 +01:00
Tatsuhiro Tsujikawa
73d752fb1c
Add --min-tls-version option
...
The --min-tls-version option specifies minimum SSL/TLS version to
enable. Possible Values: SSLv3, TLSv1, TLSv1.1, TLSv1.2 Default: TLSv1
2014-12-06 17:50:35 +09:00
Tatsuhiro Tsujikawa
62fba76666
Compile with old OpenSSL
2014-12-05 22:43:16 +09:00
Tatsuhiro Tsujikawa
6d3bd60905
LibgnuTLSSession: Disable SSLv3
2014-11-29 20:00:46 +09:00
Tatsuhiro Tsujikawa
71d8424318
LibsslTLSContext: Disable SSLv3 and enable ECDHE cipher suites
2014-11-29 19:33:50 +09:00
Tatsuhiro Tsujikawa
bb6fae2f00
LibsslTLSSession: Strict clean shutdown detection
2014-11-14 21:46:06 +09:00
Tatsuhiro Tsujikawa
2cec9df2a2
Fix crash when JSON batch response vector is empty
2014-10-16 22:56:23 +09:00
Tatsuhiro Tsujikawa
f72a303b8d
Add --bt-detach-seed-only option
...
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.
2014-10-14 00:13:29 +09:00
Tatsuhiro Tsujikawa
09d7956537
mingw: Use MoveFileExW for better atomic move
2014-10-10 23:49:53 +09:00
David Macek
784d0e5e51
Work around libintl's vprintf macro messing with OutputFile::vprintf
2014-10-05 11:27:17 +02:00
Tatsuhiro Tsujikawa
d8cde1f499
Rewrite auto_deleter_r with defer function template
2014-09-16 23:49:50 +09:00
Tatsuhiro Tsujikawa
fa5998ba85
Rewrite expression template to make it a bit easier
2014-09-16 21:53:35 +09:00
Tatsuhiro Tsujikawa
b63c1dce08
SessionSerializer: Use std::unique_ptr instead of std::shared_ptr
2014-09-15 16:43:46 +09:00
Tatsuhiro Tsujikawa
306d92a1da
Move req
2014-09-15 14:23:00 +09:00
Tatsuhiro Tsujikawa
9a931e7c61
Fix crash on OSX when proxy is used
...
See GH-275
2014-09-15 14:19:59 +09:00
Tatsuhiro Tsujikawa
9b84727324
Use std::make_shared and make_unique where possible, part 2
2014-09-13 18:37:57 +09:00
Tatsuhiro Tsujikawa
596e5c6162
Refactor event poll classes so that we don't have to allocate memory on query
...
I left Port and libuv classes, since I don't have them compiled.
So they were updated minimally.
2014-09-13 17:33:22 +09:00
Tatsuhiro Tsujikawa
f55c16c7ed
Use std::unique_ptr for DHTBucketTree's left and right pointers
2014-09-13 00:49:08 +09:00
Tatsuhiro Tsujikawa
e18e8aeeaa
Support Adler32 checksum
...
Adler32 checksum is available for --checksum option and hash element
in Metalink files. Currently, we use Adler32 implementation in Zlib.
2014-09-13 00:08:07 +09:00
Tatsuhiro Tsujikawa
d91f7dc721
Use lambda
2014-09-13 00:08:07 +09:00
Tatsuhiro Tsujikawa
2807258279
Use std::make_shared and make_unique where possible, part 1
2014-09-13 00:07:21 +09:00
Tatsuhiro Tsujikawa
bee7a8317c
Update doc
2014-09-12 02:02:33 +09:00
Tatsuhiro Tsujikawa
c0b8b471ab
Fix hash function comparator
2014-09-11 23:54:17 +09:00
Nils Maier
e0d6d04fe8
WinTLS: Fix abrupt connection closing and closing in general.
...
Fixes GH-277
2014-09-10 16:26:34 +02:00
Tatsuhiro Tsujikawa
04f875e273
WinTLS: Return 0 if eof_ is true and decBuf_ is empty
2014-09-10 21:45:08 +09:00
Tatsuhiro Tsujikawa
83c78c497b
LibsslTLSSession: Treat 0 from readData as EOF
2014-09-10 21:26:06 +09:00
Tatsuhiro Tsujikawa
e7e80e5ec6
WinTLS: Fix busy loop on EOF
...
Fixes gh#277
2014-09-10 01:11:57 +09:00
Nils Maier
0f805fb962
Silence some compiler warnings in SessionSerializer.
2014-08-30 02:03:57 +02:00
Nils Maier
bd29fd2c30
Always include raw OS version number on Windows
2014-08-30 01:15:40 +02:00
Nils Maier
bc5d9e5466
Fix typo in FeatureConfig/OS detection
2014-08-30 01:03:58 +02:00
Tatsuhiro Tsujikawa
ae631513f3
Replace A2_ARRAY_LEN with constexpr arraySize
2014-08-29 23:37:31 +09:00
Tatsuhiro Tsujikawa
e74b39deaf
Fix crash in OpenedFileCounter::ensureMaxOpenFileLimit()
...
The crash happens if PieceStorage and/or DiskAdaptor are not
initialized in one of active RequestGroups.
2014-07-30 22:31:48 +09:00
Tatsuhiro Tsujikawa
bd0a3960df
mingw32: Fix bug that aria2 does not read piped stdin
2014-07-30 00:38:45 +09:00
Tatsuhiro Tsujikawa
c659fe939d
Fix std::length_error when no_proxy is used
...
This is regression introduced in 8cada497 .
2014-07-26 16:12:10 +09:00
Nils Maier
8732a24433
Try to set sane limits for RLIMIT_NO_FILE
...
E.g. on OSX the default is 256, which isn't exactly compatible with
torrent downloads.
Closes GH-257
2014-07-22 21:58:31 +02:00
Nils Maier
70a80b1455
Remove request pre-authorization again
2014-07-22 21:58:30 +02:00
Nils Maier
8f2af33b6d
Delay auth failures instead of PBKDF2
...
Closes GH-256
2014-07-22 21:58:30 +02:00
diadistis
9b1667fe81
Fixed segfault unsupported encodings
2014-07-20 18:06:09 +03:00
Tatsuhiro Tsujikawa
d69764879e
Fix regression 100% CPU utility when -V is used and download is multi-file BT
...
This is regression of a3426821c8
2014-07-20 18:36:52 +09:00
Tatsuhiro Tsujikawa
b611cd2bdc
UnknownLengthPieceStorage: Use std::make_shared
2014-07-15 23:48:32 +09:00
Tatsuhiro Tsujikawa
a6b7bd0342
Show bitfield for unknown length download in aria2.tellStatus 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.
2014-07-15 23:36:10 +09:00
Tatsuhiro Tsujikawa
98681552fc
Fix compile error on big endian platform
2014-07-14 21:32:48 +09:00
Tatsuhiro Tsujikawa
04caefa406
Fix test failure with --enable-libaria2
2014-07-14 00:06:32 +09:00
Tatsuhiro Tsujikawa
7fbd8a50ef
Fix compile error and warning with clang
2014-07-12 17:44:43 +09:00
Tatsuhiro Tsujikawa
3aaa5a7344
Fix file length information in RPC response when length > 2GB is unknown
...
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.
2014-07-12 17:01:46 +09:00
Nils Maier
84bd18b9a1
Merge crypto_* from upstream
...
Revert "Fix typo"
This reverts commit 4dfd8b8847 .
Revert "MinGW: Fix compiler warning with -Wstrict-aliasing"
This reverts commit 897f0e87f4 .
2014-07-11 04:11:03 +02:00
Tatsuhiro Tsujikawa
897f0e87f4
MinGW: Fix compiler warning with -Wstrict-aliasing
...
The error message is:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
2014-07-10 00:28:16 +09:00
Tatsuhiro Tsujikawa
4dfd8b8847
Fix typo
2014-07-10 00:28:06 +09:00
Tatsuhiro Tsujikawa
852f2fb99a
MinGW: Fix compiler warning about winsock2.h and windows.h
...
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
2014-07-10 00:04:28 +09:00
Tatsuhiro Tsujikawa
a3426821c8
MultiDiskAdaptor: Handle short read
2014-07-02 00:05:44 +09:00
Tatsuhiro Tsujikawa
8750d7be99
Disard cache when checking checksum
...
This will slow down checksum checking but does not thrash cache.
2014-07-02 00:05:43 +09:00
Nils Maier
0b6501043a
Compat with libuv 0.11 (Unstable)
...
Fixes #241
2014-07-01 13:48:19 +02:00
Nils Maier
0c8a2659ea
Drop WinMessageDigestImpl.
...
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).
2014-06-24 20:45:12 +02:00
Nils Maier
8587669995
Fix big endianess support in InternalMessageDigest and PBKDF2
...
- Replace sha1/md5 implementation by ones from https://github.com/nmaier/crypto
- Add endianess functionality fro https://github.com/nmaier/crypto
Closes GH-239
2014-06-24 20:45:05 +02:00
Tatsuhiro Tsujikawa
06a8bf6e0a
Pause download only when RPC is enabled
2014-06-21 00:58:21 +09:00
Tatsuhiro Tsujikawa
e2932608fc
Add --pause-metadata option
...
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.
2014-06-21 00:58:21 +09:00
Nils Maier
2b02fac2d5
Improve compiler/platform/libs information in logs
...
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
2014-06-10 11:28:34 +02:00
Tatsuhiro Tsujikawa
570bc24fb9
Fix use-after-free on exit with multi-file torrent download + DHT
...
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.
2014-06-08 17:03:34 +09:00
Tatsuhiro Tsujikawa
442e460055
Fix bug that zero length file is not opened when flushing cache
...
This bug was only seen when MultiDiskAdaptor was used.
2014-06-08 16:43:22 +09:00
Tatsuhiro Tsujikawa
e2ff45f326
AnnounceList, AnnounceTier: Code cleanup using C++11 features
2014-06-06 00:04:37 +09:00
Tatsuhiro Tsujikawa
aff92b5115
SocketRecvBuffer: Cleanup with C++11 features
2014-06-05 23:40:19 +09:00
Tatsuhiro Tsujikawa
0ee8104953
Small code cleanup for SocketBuffer
2014-06-05 23:33:58 +09:00
Tatsuhiro Tsujikawa
c0e4381780
util::parseIntSegments: Return SegList<int>
2014-06-04 23:21:01 +09:00
Tatsuhiro Tsujikawa
007b890fe4
bittorrent::computeFastSet: Return std::vector
2014-06-04 22:50:39 +09:00
Tatsuhiro Tsujikawa
d1d5ea5b21
DownloadContext, FileEntry: Use move semantics to path parameter in ctor
2014-06-04 22:43:29 +09:00
Tatsuhiro Tsujikawa
9b54272190
FileEntry::getUris: Return std::vector<std::string>
2014-06-04 22:33:46 +09:00
Tatsuhiro Tsujikawa
4f3c526dcd
Support PREF_DIR change for Metalink files
...
Reworked previous commit adeead6f03 , and
now support changing PREF_DIR for Metalink downloads.
2014-06-04 21:45:12 +09:00
Tatsuhiro Tsujikawa
adeead6f03
Revert to existing "proper" coding style
...
The rule is simple: don't try to change the coding style of the
existing codebase.
2014-06-03 23:41:30 +09:00
Tatsuhiro Tsujikawa
83f4bced07
Fix assertion failure when dir option of paused HTTP/FTP download is changed
...
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().
2014-06-03 23:09:28 +09:00
Tatsuhiro Tsujikawa
631f37433a
Save session only when there is change since the last 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.
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.
2014-05-31 16:19:57 +09:00
Tatsuhiro Tsujikawa
998fba3264
Revert "Save session only when there is change since the last serialization"
...
This reverts commit 1944d8db58 .
2014-05-31 15:28:26 +09:00
Tatsuhiro Tsujikawa
1944d8db58
Save session only when there is change since the last 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.
2014-05-30 23:20:13 +09:00
Nils Maier
d2e38aab36
Use _setmode to set binary mode in mingw
...
The _CRT_fmode stuff was never working correctly anyway, and is entirely
unsupported in mingw-w64 these days, it seems.
2014-05-29 19:38:34 +02:00
Nils Maier
3c55400d23
Silence deprecation warning about daemon() on OSX
2014-05-29 19:38:34 +02:00
Nils Maier
b9fe4119c0
New round of clang-modernize
2014-05-29 19:38:34 +02:00
Nils Maier
c8ccb43428
Consistent style in util_security
2014-05-29 19:38:34 +02:00
Nils Maier
77f0f1395c
Consistent style in the platform TLS implementations
2014-05-29 19:38:33 +02:00
Nils Maier
8cada49765
Cleanup AbstractCommand take 2
...
Decided to keep the 'if(' -> 'if (' stuff, as I formatted the whole file
and so it is internally consistent within the file. Also, too much
hassle.
2014-05-29 18:39:53 +02:00
Nils Maier
e57d330111
Cleanup HttpHeaderProcessor take 2
...
Decided to keep the 'if(' -> 'if (' stuff, as I formatted the whole file
and so it is internally consistent within the file. Also, too much
hassle.
2014-05-29 18:29:37 +02:00
Nils Maier
48ec56a64d
Revert "Cleanup HttpHeaderProcessor::parse"
...
This reverts commit 047b49b7a0 .
2014-05-29 18:29:37 +02:00
Nils Maier
6240345fd5
Revert "Cleanup AbstractCommand"
...
This reverts commit 0465aa5455 .
2014-05-29 18:29:37 +02:00
Nils Maier
0465aa5455
Cleanup AbstractCommand
...
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.
2014-05-27 21:37:15 +02:00
Nils Maier
6e546245e4
Sort and cleanup src/Makefile.am
2014-05-27 21:35:42 +02:00
Nils Maier
047b49b7a0
Cleanup HttpHeaderProcessor::parse
2014-05-27 19:46:54 +02:00
Nils Maier
d72df551ba
Document setUri() in FileEntry does not need to check the return value.
2014-05-27 19:10:14 +02:00
Nils Maier
15cb9e12b2
Remove unused variable in LibgcryptMessageDigestImpl
2014-05-27 19:10:14 +02:00
Nils Maier
fd8dc921fe
Initialize DownloadEngine::tokenAverageDuration_ to something.
2014-05-27 19:10:14 +02:00
Nils Maier
f8db60e54e
OSX: Use F_NOCACHE instead of F_GLOBAL_NOCACHE
...
The latter persists for the lifetime of the file, while the former
affects only the current descriptor.
2014-05-26 21:34:49 +02:00
Nils Maier
dd8e4b0ad0
Remove spurious CXX11_OVERRIDE to make cov-build happy.
2014-05-26 01:34:26 +02:00
Nils Maier
a82f08765e
Fix (unknown length) downloads larger than 2GiB
...
Closes #215
2014-05-25 14:49:29 +02:00
Nils Maier
64b1fefb78
Add missing include in util_security.h
...
Fixes #231
2014-05-23 18:44:10 +02:00
Nils Maier
f7cc24d6cf
Internally use HMAC in http auth
...
To at least get constant time compare.
Also fix incorrect parsing of the creds (were incorrectly stripped).
Also add unit tests.
2014-05-22 15:24:20 +02:00
Nils Maier
d02ee723bd
Improve aria2.rst and usage texts a bit.
...
(Keep in mind that I'm not a native speaker either)
- Fix some typos.
- Fix some grammar stuff.
- Clarify some things.
- Add a new paragraph or two...
2014-05-20 18:02:47 +02:00
Nils Maier
855dfa0e2f
Authorize RPC multicalls only once.
...
Cache the auth status afterwards and just assume the token still matches
(within the same request, of course).
2014-05-20 12:53:39 +02:00
Nils Maier
88b61f2eb9
Adjust RPC token processing time
...
Make it consume a bit less time.
2014-05-20 12:53:38 +02:00
Nils Maier
bb50de1336
Improve write cache failures error reporting
2014-05-20 12:52:26 +02:00
Nils Maier
5c07f0109e
Fix F_PREALLOC based allocation on some OSX versions
2014-05-08 16:40:09 +02:00
Nils Maier
1dd7409c4e
Fix unused function warning about generateRandomDataUrandom in mingw-w64
2014-05-08 16:38:32 +02:00
Nils Maier
a0f275a9f1
Remove unused function getWin32Handle
2014-05-08 16:38:32 +02:00
Tatsuhiro Tsujikawa
f60e55cece
Use index.html as filename for conditional-get when file is missing in URI
...
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.
2014-05-08 21:49:04 +09:00
Tatsuhiro Tsujikawa
84f1a15e10
Check negative number from Integer::i() where it is not allowed
2014-05-01 11:34:27 +09:00
Tatsuhiro Tsujikawa
4c2ad69a75
Ignore negative metadata size in extended handshake
2014-04-30 23:46:27 +09:00
Nils Maier
82dad90ff3
Validate token using PBKDF2-HMAC-SHA1.
...
This change should make token validation more resilient to:
- timing attacks (constant time array compare)
- brute-force/dictionary attacks (PBKDF2)
Closes #220
2014-04-19 19:10:06 +02:00
Nils Maier
98ba096951
Add util::security (compare, HMAC, PBKDF2)
...
See #220
2014-04-19 19:07:38 +02:00
Nils Maier
010131161e
Remove ENABLE_MESSAGE_DIGEST, since we got the internal md, always
2014-04-17 18:02:42 +02:00
Nils Maier
aa02545fba
Use mpz_pown_sec where available
2014-04-13 18:51:06 +02:00
Nils Maier
c694a05797
Fix some warnings
2014-04-13 18:51:05 +02:00
Nils Maier
18c35f56b8
AppleTLS: Enable BEAST mitigations in ST
...
Only available in 10.9+, but since we might be building on a previous
version but running on 10.9+, always try to set the option.
2014-04-13 18:51:05 +02:00
Nils Maier
e195dc5f00
AppleTLS: Update cipher suites
...
Also make the suite selection more sane.
2014-04-13 18:51:05 +02:00
Nils Maier
39d66bd560
WinTLS: Improve error reporting
2014-04-13 18:51:05 +02:00
Nils Maier
51beb4bfa7
WinTLS: Move some defines out of the header
2014-04-13 18:51:04 +02:00
Nils Maier
219fd5b4b7
WinTLS: Make ca-file rejection a warning
2014-04-13 18:51:04 +02:00
Nils Maier
8d55e30561
WinTLS: Use SCH_USE_STRONG_CRYPTO
...
See: #217
2014-04-13 18:50:54 +02:00
Nils Maier
0a51b8d172
WinTLS: Accept chains with no revocation information.
...
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
2014-04-13 18:50:38 +02:00
Nils Maier
13a202df07
Fix GnuTLS 2.x compatiblity
...
Closes GH-216
2014-04-12 02:55:31 +02:00
Nils Maier
2d9bf0f374
AppleTLS: Use newer, non-deprecated API in 10.8+
2014-04-12 02:55:31 +02:00
Nils Maier
7600886d3d
Implement falloc equivalent in OSX
2014-04-12 02:55:31 +02:00
Tatsuhiro Tsujikawa
f0473dc34d
Ignore error when setting DSCP value
...
Setting DSCP is additional feature and failure to enable it should not
abort download entirely. This change fixes the bug that windows build
does not perform bittorrent downloads.
2014-03-30 14:14:28 +09:00
Tatsuhiro Tsujikawa
551adc5133
mingw: Undef localtime_r and asctime_r
2014-03-24 01:11:30 +09:00
Tatsuhiro Tsujikawa
1188e4f1a2
Fix mingw32 build with gcc 4.8.2
...
Now mingw-w64 C++ compiler defines __USE_MINGW_ANSI_STDIO to 1, we
have to follow it as well. We hope that mingw version of stdio
function behaves like Linux ones. We have not tested them thoroughly
yet. pthread for windows defines its own HAVE_STRUCT_TIMESPEC macro.
To avoid warning, we rename our version of it as
HAVE_A2_STRUCT_TIMESPEC.
2014-03-24 00:37:30 +09:00
Alexander Amanuel
dccd8192a4
Added DSCP support for IPv6 sockets
2014-03-12 15:22:46 +04:00
Tatsuhiro Tsujikawa
a8319a8b78
Add aria2.saveSession RPC method
...
This method saves the current session to a file specified by
--save-session option. This method returns "OK" if it succeeds.
2014-02-19 22:02:50 +09:00
Tatsuhiro Tsujikawa
1a24020e63
Don't allow empty string for --rpc-secret option
2014-02-19 21:46:06 +09:00
Tatsuhiro Tsujikawa
de4cd8b59b
Warn if neither --rpc-secret nor a combination of --rpc-user/rpc-passwd is set
2014-02-19 21:37:11 +09:00
Nils Maier
00e690a4d1
Add some missing includes to AnnounceList.h
2014-02-19 03:09:59 +01:00
Tatsuhiro Tsujikawa
1462d6536a
Add numStoppedTotal key to aria2.getGlobalStat() RPC method response
...
It shows the number of stopped downloads in the current session and
not capped by --max-download-result option. On the other hand, the
existing numStopped key also shows the number of stopped downloads,
but it is capped by --max-download-result option.
2014-02-15 19:10:48 +09:00
Tatsuhiro Tsujikawa
b18e62dba7
Treat 30X response without Location header field as error
...
This is required to make segmented download work.
2014-02-05 21:20:09 +09:00
Tatsuhiro Tsujikawa
ec4b729704
Better handling of 30X HTTP status codes
...
Reference: http://greenbytes.de/tech/tc/httpredirects/
2014-02-05 00:32:43 +09:00
Tatsuhiro Tsujikawa
06bb6d1ac0
Fix longer line in --dscp option help
2014-02-04 21:52:28 +09:00
Tatsuhiro Tsujikawa
1438933c97
Merge branch 'dscp-support' of https://github.com/iavael/aria2 into iavael-dscp-support
...
Conflicts:
src/prefs.cc
src/prefs.h
src/usage_text.h
2014-02-04 21:42:00 +09:00
Alexander Amanuel
a7182b9ee4
Improved dscp parameter description
2014-02-03 17:53:07 +04:00
Tatsuhiro Tsujikawa
7d1aa887ee
Add future deprecation warning to --rpc-user and --rpc-passwd
2014-02-02 17:58:56 +09:00
Tatsuhiro Tsujikawa
7f6987a4b4
Implement new RPC authorization using --rpc-secret option
2014-02-02 17:34:07 +09:00
Alexander Amanuel
96a77e42d1
Minor DSCP-related improvements
...
- Improved usage annotation
- Shifted DSCP value to set not whole DS field, but only it's DSCP part
2014-01-29 20:17:22 +04:00
Tatsuhiro Tsujikawa
30e4077440
Add --enable-color option to enable/disable terminal color output
2014-01-30 00:15:05 +09:00
Alexander Amanuel
46a251e346
Refactored DSCP-related code a bit
2014-01-28 23:09:21 +04:00
Alexander Amanuel
924feb12b0
Added DSCP support
2014-01-28 00:13:15 +04:00
Tatsuhiro Tsujikawa
542064c69b
gnutls: Use SECURE128 priority keyword
2014-01-13 23:11:27 +09:00
Nils Maier
c2ab2f2208
Log an error when session fails to save.
...
Instead of a notice.
2014-01-08 15:58:27 +01:00
Tatsuhiro Tsujikawa
e81dd84641
gnutls: Don't fail handshake if returned error is not fatal
2014-01-08 23:11:56 +09:00
Tatsuhiro Tsujikawa
3c789294b7
gnutls: Handle GNUTLS_E_INTERRUPTED as well as GNUTLS_E_AGAIN
2014-01-08 23:01:36 +09:00
Tatsuhiro Tsujikawa
2f02946b70
Add workaround GnuTLS bug with OCSP status extension and non-blocking socket
...
GnuTLS version 3.1.3 - 3.1.18 and 3.2.0 - 3.2.8, inclusive, has this
bug. For these versions, we disable OCSP status extension.
2014-01-08 22:53:56 +09:00
Nils Maier
4dab854e08
GnuTLS: Refine debug logging
2014-01-06 17:46:21 +01:00
Nils Maier
3194174d4b
Make GnuTLS log level dependent on the aria2 ones
...
Closes GH-180
2014-01-06 17:46:21 +01:00
Nils Maier
7777e1cb37
GnuTLS: Setup logging
2014-01-06 13:40:51 +01:00
Tatsuhiro Tsujikawa
2571bf4a36
Update copyright year to 2014
2014-01-05 20:54:52 +09:00
Tatsuhiro Tsujikawa
dcf98d519f
Fix crash if unpause failed before assigning BtProgressInfoFile object
2014-01-05 20:41:19 +09:00
Tatsuhiro Tsujikawa
b706722c59
Fix unitest crash
2014-01-05 19:16:49 +09:00
Tatsuhiro Tsujikawa
8216bdba79
Fix bug that numOpenFile_ is not reduced when MultiDiskAdaptor is deleted
...
This bug caused assertion error in RequestGroupMan::ensureMaxOpenFileLimit
2013-12-31 22:57:11 +09:00
Nils Maier
a44c71586a
Fix crash in HttpSkipResponseCommand ctor
...
(Regression from the memory holes stuff; missed to commit :p)
2013-12-24 23:14:26 +01:00
Tatsuhiro Tsujikawa
c881f9fcad
Run DHT if torrent is private; but don't use DHT for that torrent
2013-12-20 21:39:30 +09:00
Tatsuhiro Tsujikawa
a21a868af0
FileEntry: Pass by value for simple setter functions
2013-12-15 19:20:31 +09:00
Nils Maier
32e569ab16
Fix broken EXTRA_DIST
2013-12-09 16:38:45 +01:00
Nils Maier
2db0c81fc8
Stuff memory holes
...
Padding changes on x86_64:
- RequestGroup: 29 -> 5 bytes
- DownloadContext: 25 -> 1 bytes
- Cookie: 20 -> 4 bytes
- Command: 8 -> 0 bytes (affects many derived as well)
- HttpRequest: 20 -> 4 bytes
- DownloadCommand: 18 -> 2 bytes
- TimeBasedCommand: 14 -> 6 bytes
- AbstractCommand: 13 -> 5 bytes
- HttpSkipResponseCommand: 12 -> 4 bytes
- FileEntry: 10 -> 2 bytes
- DownloadResult: 15 -> 7 bytes
- UriStruct: 12 -> 4 bytes
- Piece: 11 -> 3 bytes
- BitfieldMan -> 11 -> 3 bytes
2013-12-09 15:41:43 +01:00
Nils Maier
1323048ab1
Remove a dead store in Piece
2013-12-09 15:41:43 +01:00
Nils Maier
ff9607d6a9
Add WinTLS to FeatureConfig::usedLibs
2013-12-09 08:28:56 +01:00
Nils Maier
766209cf2e
It is AppleTLS (everywhere else)
2013-12-09 08:28:56 +01:00
Nils Maier
6a8fb5744c
Fix warning in AppleTLS
2013-12-09 08:28:56 +01:00
Tatsuhiro Tsujikawa
705dadb32b
Fix crash when metaurl contains unsupported URI or text
2013-12-07 01:16:47 +09:00
Tatsuhiro Tsujikawa
2c566ccb68
Fix bad fork() return value handling
2013-12-06 00:40:08 +09:00
Tatsuhiro Tsujikawa
03d5b4627b
ColorizedStreamBuf::str: Append character prefix to stream directly
2013-11-23 15:34:43 +09:00
Nils Maier
80528aa9ce
Use some colors in progress reports (where available)
2013-11-21 15:42:42 +01:00
Nils Maier
87ea4904a0
Implement basic color support for the Windows console
...
Only \033[*m (SGR) is supported, with a 16+16 color terminal.
2013-11-21 15:34:34 +01:00
Nils Maier
a476fb352e
AppleTLS: Implement PKCS12 loading.
2013-11-20 10:48:15 +01:00
Tatsuhiro Tsujikawa
4d105a2686
Limit number of opened file globally with --bt-max-open-files option
...
This change changes the behavior of --bt-max-open-files. Previously,
it specifies the maximum number of opened files for each multi-file
download. Since it is more useful to limit the number globally, the
option now specifies the global limit. This change suggests that
aria2.changeOption() method now ignores --bt-max-open-files and
aria2.changeGlobalOption now reads it and dynamically change the
limit.
2013-11-17 19:33:18 +09:00
Tatsuhiro Tsujikawa
c4334ec579
Use move for XML parser
2013-11-10 20:39:31 +09:00
Tatsuhiro Tsujikawa
9e52483c04
Refactor DownloadHandlerFactory
2013-11-10 18:19:02 +09:00
Tatsuhiro Tsujikawa
ba3b823a66
Code cleanup
2013-11-10 15:36:37 +09:00
Tatsuhiro Tsujikawa
e1e6bb1ec5
Don't fail multiple concurrent dl same file if auto-file-renaming is enabled
2013-11-08 00:59:57 +09:00
Tatsuhiro Tsujikawa
2aa8e01836
Fix typo
2013-11-06 23:40:59 +09:00
Tatsuhiro Tsujikawa
9f5fdb4e10
Code cleanup
2013-11-01 22:10:24 +09:00
Tatsuhiro Tsujikawa
fd0136259c
Remove nativeToUtf8 and utf8ToNative
...
They are now not needed since we use Windows specific command-line
argument converter.
2013-11-01 22:06:13 +09:00
Tatsuhiro Tsujikawa
3a8e8f8e8a
mingw32: Use CommandLineToArgvW() and GetCommandLineW() to read cmd-line args
...
This change enables aria2 to read unicode characters in command-line.
2013-11-01 00:16:35 +09:00
Tatsuhiro Tsujikawa
b759725a61
Peer: Use std::unique_ptr for res_
2013-10-26 21:38:17 +09:00
Tatsuhiro Tsujikawa
6d2dd2ab18
DefaultPeerStorage: Code cleanup
2013-10-26 21:28:58 +09:00
Tatsuhiro Tsujikawa
234dd76cd4
DefaultPeerStorage: Add warn log when Peer::usedBy is non zero on checkoutPeer
2013-10-26 20:02:48 +09:00
Tatsuhiro Tsujikawa
12fe61820a
DefaultPeerStorage: Log origPort in checkoutPeer and returnPeer
...
Also make the log level warning when the returned peer is not found.
2013-10-26 19:58:53 +09:00
Tatsuhiro Tsujikawa
2548cd4d6e
Fix missing sha1.h and md5.h in Makefile.am
2013-10-20 19:09:49 +09:00
Tatsuhiro Tsujikawa
218dc89be9
Update doc
2013-10-20 16:04:09 +09:00
Tatsuhiro Tsujikawa
065979cda4
Remove log message "TLS else" as this function called repeatedly
2013-10-08 21:28:32 +09:00
Tatsuhiro Tsujikawa
33293bcd5a
LibsslTLSContext: Remove weak cipher suite
2013-10-08 21:26:13 +09:00
Tatsuhiro Tsujikawa
98d88ec6d5
Don't log "TLS Handshaking" twice or more
2013-10-07 23:01:51 +09:00
Tatsuhiro Tsujikawa
3080af7370
Request: Remove previousUri_
...
Historically, the previousUri_ has different meaning from referer_,
but in the course of development, they have the same value. This
change remove previousUri_ in favor of referer_.
2013-10-01 21:53:28 +09:00
Nils Maier
3b35887827
WinTLS: Enable --certifcate support
2013-09-30 16:37:09 +02:00
Nils Maier
3b9a385305
AppleTLS: Enable --certificate
...
Tested against self-signed CA with nginx
2013-09-30 16:37:01 +02:00
Nils Maier
4c84af31be
WinTLS: Fix PKCS12 loading
...
It appears that, contrary to most documentation, CERT_CONTEXT* is eaten
alive by AcquireCredentialsHandle(). Hence you cannot really reuse that.
2013-09-30 16:36:15 +02:00
Tatsuhiro Tsujikawa
50ac6afe36
util.cc: Remove uselss inline static
2013-09-30 21:50:51 +09:00
Tatsuhiro Tsujikawa
b772aa6a5e
util::percentEncodeMini: Fix regression bug removed unsignedness
...
srange-based for around std::string is convenient but several
functions depend unsigned char for correctness and readability.
2013-09-30 21:32:57 +09:00
Nils Maier
00dd83b461
Implement WinTLS
2013-09-30 13:53:21 +02:00
Nils Maier
3f1d293ed1
WinMessgeDigestImpl: gcc-4.6 does not support .emplace() yet
2013-09-29 15:47:22 +02:00
Tatsuhiro Tsujikawa
40e53de908
MessageDigestImpl.h: Simplify hash_info_t access
2013-09-28 23:40:06 +09:00
Tatsuhiro Tsujikawa
6f6a17bff7
Randomizer: Remove unused interfaces
2013-09-28 22:55:05 +09:00
Tatsuhiro Tsujikawa
986f69e5bf
SimpleRandomizer: Use std::random
2013-09-28 22:00:37 +09:00
Tatsuhiro Tsujikawa
44479c910e
Log exception; throw error if loading private key and/or certificate failed
2013-09-26 00:56:23 +09:00
Tatsuhiro Tsujikawa
7f18494a8c
SimpleRandmizer: Fix certain bits generated by getRandomBytes are always 0
...
This is because in Linux RAND_MAX is 2**31-1 and we used int32_t to
hold random number from random() and got each bytes. This means that
highest bit is always unset. In little endian system, every 4n-th (n
>=0) byte has highest bit is unset. To fix this, we just use lower 2
bytes of random().
2013-09-26 00:41:33 +09:00
Tatsuhiro Tsujikawa
ac996737e5
Move OpenSSL_add_all_algorithms() to Platform::setUp()
2013-09-26 00:17:59 +09:00
Tatsuhiro Tsujikawa
d7d5e8570b
Include prefs.h instead of typedef PrefPtr everywhere
2013-09-26 00:15:18 +09:00
Tatsuhiro Tsujikawa
8536f13cff
uri.cc: Use auto instead of adhoc typedef
2013-09-26 00:15:18 +09:00
Tatsuhiro Tsujikawa
d2af91ed08
InternalDHKeyExchange: Remove unused dtor
2013-09-26 00:13:25 +09:00
Tatsuhiro Tsujikawa
da278225c1
InternalARC4Encryptor: Fix compiler warning and remove no use ctor/dtor
2013-09-26 00:11:10 +09:00
Tatsuhiro Tsujikawa
f2a1d241c2
Merge branch 'master' into bignum-arc4
2013-09-26 00:00:24 +09:00
Tatsuhiro Tsujikawa
c81fd8e194
InternalMessageDigestImpl: Fix memory leak
2013-09-25 23:58:59 +09:00
Tatsuhiro Tsujikawa
7dc5567cad
InternalMessageDigestImpl: Code cleanup
2013-09-25 23:57:03 +09:00
Tatsuhiro Tsujikawa
77b7747ca8
Ensure that Commands are cleaned up before RequestGroupMan is deleted
2013-09-25 23:35:18 +09:00
Tatsuhiro Tsujikawa
ca8ac6e7d3
bignum.h: Fix compile error
2013-09-25 22:43:48 +09:00
Tatsuhiro Tsujikawa
6198b607e9
Merge branch 'master' into bignum-arc4
2013-09-25 21:55:32 +09:00
Nils Maier
99f170b888
Provide internal ARC4 implementation
...
Now you can build bittorrent support without without external
libraries, meaning you can skip libnettle, libgmp, libgcrypt, GnuTLS and
OpenSSL on OSX (for now).
2013-09-24 19:11:26 +02:00
Nils Maier
e854463b2d
Internal implementation of DHKeyExchange
...
Reusing a bignum (well, unsigned very-long) implementation I had lying
around for years and just cleaned up a bit and brought to C++11 land.
It might not be the most performant implementation, but it shoud be fast
enough for our purposes and will go a long way of removing gcrypt,
nettle, gmp, openssl dependencies when using AppleTLS and WinTLS
(upcoming).
2013-09-24 19:11:00 +02:00
Nils Maier
86c61fcf5b
Make generateRandomBytes less biased.
2013-09-24 19:07:18 +02:00
Nils Maier
e5644a7188
Revert OptionHandlerFactory changes
2013-09-24 16:17:15 +02:00
Nils Maier
d1ae9f87fd
using to typedef to make gcc-4.6 happy
2013-09-24 16:14:35 +02:00
Nils Maier
4a1d186962
Better error messages when PKCS12 import fails
2013-09-24 01:05:58 +02:00
Nils Maier
063451f0c9
TLS: Minor code cleanups
2013-09-23 15:43:11 +02:00
Nils Maier
d560bf0e6f
TLS: Fix dangling str() pointers
2013-09-23 15:10:53 +02:00
Nils Maier
37f9c668ff
Teach GnuTLS backend to load .p12 files
2013-09-22 12:55:27 +02:00
Nils Maier
f7b0fbbf53
Teach Libssl backend to load .p12 files
2013-09-22 12:55:27 +02:00
Nils Maier
38bdea4e06
Add internal md5 and sha1 message digests
2013-09-20 23:06:50 +02:00
Nils Maier
fa30fe4b15
One MessageDigestImpl.h to rule them all.
2013-09-20 23:06:49 +02:00
Nils Maier
a4e29303ef
WinTLS: Implement messsage digest using the Cryptography Provider
2013-09-20 23:06:49 +02:00
Nils Maier
b678bc5e10
Fix AppleMessageDigestImpl use with large data
2013-09-20 23:06:49 +02:00
Nils Maier
7738063100
AppleTLS: Remove unused variables
2013-09-20 23:06:49 +02:00
Nils Maier
3b9988251f
clang-modernize -add-override on headers
2013-09-20 23:06:49 +02:00
Nils Maier
e2700f50a5
Code cleanup in Http*
2013-09-20 23:06:49 +02:00
Nils Maier
29d569eef9
Cleanup RequestGroup code a bit
2013-09-20 23:06:49 +02:00
Nils Maier
3590077d5c
More auto-converts by cpp11-migrate
2013-09-20 23:06:49 +02:00
Nils Maier
a76eeb2b81
Introduce PrefPtr typedef
2013-09-19 19:59:33 +02:00
Nils Maier
8e6e46dfcf
More code cleanups
2013-09-19 19:59:33 +02:00
Tatsuhiro Tsujikawa
9e7579b475
Set old cookie's creation-time to new cookie on replacement
...
As described in http://tools.ietf.org/html/rfc6265#section-5.3
2013-09-20 00:24:03 +09:00
Tatsuhiro Tsujikawa
e3a41a51da
Fix link error with Android NDK r9
...
Since Android ndk r9, __set_errno is deprecated. It is now defined as
inline function in errno.h. The syscall assembly calls __set_errno,
but since libc.so does not export it, the link fails. To workaround
this, replace all occurrences of __set_errno with a2_set_errno and
define it as normal C function.
2013-09-18 23:10:25 +09:00
Tatsuhiro Tsujikawa
fa09dc9115
Clean up if defined style
2013-09-17 23:17:08 +09:00
Tatsuhiro Tsujikawa
acd2af82d0
util::htmlEscape: Optimize a bit
...
The cause of slowness of the first implementation is the memory
allocation overhead and appending character by character. In this
implementation, the output buffer is reserved the same size of input.
This is reasonable because most likely no replacement happens in
practice. And the unmodified region is copied using iterator range to
speed up a bit.
2013-08-29 01:09:15 +09:00
Nils Maier
75e61ee3d0
Fast-path for percentEncodeMini(string&)
2013-08-24 22:25:29 +02:00
Nils Maier
b2da75ca33
Optimize htmlEscape implementation a bit
2013-08-24 21:54:56 +02:00
Nils Maier
1b8de6bb18
Add fast-path to percentEncode(string&)
2013-08-24 21:54:36 +02:00
Nils Maier
4418ebdedc
AppleTLSSession: Remove unused private member
2013-08-24 20:08:15 +02:00
Nils Maier
522ae80fd4
Fix no-return warning in FtpInitiateConnectionCommand
...
... and untangle code a bit while at it.
2013-08-24 20:02:13 +02:00
Tatsuhiro Tsujikawa
ee2e21150b
Use std::unordered_map in IndexedList for faster speed
...
Because mingw cross compiler g++-4.6.3 does not support
std::unordered_map::emplace and std::deque::emplace, traditional
insert member function is used instead.
2013-08-21 23:46:16 +09:00
Nils Maier
cf6f58ceec
More code cleanups
2013-08-21 07:32:01 +02:00
Nils Maier
8526ceeb45
Convert to autos and ranged loops
2013-08-21 05:56:17 +02:00
Nils Maier
d8f44ef4f6
Convert most 0/NULL pointers to nullptr
...
Courtesy of llvm cpp11-migrate 3.3
2013-08-20 21:28:24 +02:00
Nils Maier
9da17424c6
Fix json::decodeGetParams when compiled with recent Apple clang
2013-08-20 20:48:49 +02:00
Nils Maier
270f429838
Fix util::nextParam when compiled with recent Apple clang
2013-08-20 20:48:49 +02:00
Tatsuhiro Tsujikawa
c26c1e234a
Move GHR outside of function and provide ctor to suppress compiler warning
...
Without ctor, compiler emits warning "unused variable ghr".
2013-08-19 23:54:54 +09:00
Tatsuhiro Tsujikawa
b6d84c0160
Use nullptr for std::shared_ptr and unique_ptr default parameter
2013-08-19 23:50:58 +09:00
Tatsuhiro Tsujikawa
5ba7150333
Code cleanup
2013-08-19 23:50:14 +09:00
Tatsuhiro Tsujikawa
7b04c841d6
Code cleanup
2013-08-19 23:40:28 +09:00
Tatsuhiro Tsujikawa
7f049dc2a4
Fix bad use of std::move
...
In the original code, std::move(cookieDomain) may be performed before
util::isNumericHost(cookieDomain), which is unintentional.
2013-08-19 23:29:08 +09:00
Nils Maier
bf5a940ed4
Define a type for signal handlers
2013-08-18 06:04:20 +02:00
Nils Maier
79fcafc31f
Win: Use SetConsoleCtrlHandler for SIGINT/SIGTERM
2013-08-18 06:04:20 +02:00
Nils Maier
9e25335850
Implement a simple resource lock (threading)
...
In this initial implementation Locks are no-ops on platforms other than
Windows.
2013-08-18 06:01:52 +02:00
Nils Maier
a982dee961
Switch CA_BUNDLE to AC_DEFINE
2013-08-16 22:32:16 +02:00
Nils Maier
303f987ee9
Add --with-disk-cache configure option
...
Enables packagers more fine grained control over the default value
without having to mess with config files.
See GH-115
2013-08-16 22:31:56 +02:00
Nils Maier
90c39522a2
Libuv: Compatiblity fix with master
2013-08-16 22:29:14 +02:00
Nils Maier
4be7ec380f
Change defaults: Enable 16M disk cache by default.
2013-08-12 20:51:19 +02:00
Tatsuhiro Tsujikawa
732ed1fb8b
Fix broken XMLRPC method call
2013-08-12 10:55:50 +09:00
Tatsuhiro Tsujikawa
8d62682202
Fix segmentation fault if RpcMethod::process throws exception
2013-08-04 00:02:52 +09:00
Tatsuhiro Tsujikawa
de55569de5
Always save control file if --force-save is given
2013-07-28 18:07:29 +09:00
Tatsuhiro Tsujikawa
41121e09f7
Use std::unique_ptr for Metalink objects
2013-07-12 23:09:23 +09:00
Tatsuhiro Tsujikawa
59e63d956e
Rewrite RPC method factory function
2013-07-11 21:50:47 +09:00
Tatsuhiro Tsujikawa
7c06b903f3
Use std::unique_ptr for ValueBase object hierarchy
2013-07-11 21:09:51 +09:00
Tatsuhiro Tsujikawa
7a57ecc5f8
DefaultBtMessageDispatcher: Remove unused members peerStorage_, pieceStorage_
2013-07-07 23:28:51 +09:00
Tatsuhiro Tsujikawa
cf8cfeefbc
DHTInteractionCommand: Use std::unique_ptr for DHTConnection
...
Remove DHTConnection from DHTMessageReceiver because it is not used.
2013-07-07 23:28:51 +09:00
Nils Maier
fc6318d23f
Fix a bad std::move in HttpConnection
...
C++ Standard says that the order of evaluation of arguments is
unspecified. Even if it wasn't, std::move would run first, invalidating
the httpRequest smartptr, so that httpRequest->createRequest() would be
executed on the invalid ptr.
Some compilers might be smart enough to correct this error, clang XCode
Edition surely is not (not should it).
2013-07-07 14:42:36 +02:00
Tatsuhiro Tsujikawa
3f5f1e26d9
Refactor PeerInterationCommand ctor
2013-07-06 22:03:37 +09:00
Tatsuhiro Tsujikawa
3c66c18489
TrackerWatcherCommand: Use std::unique_ptr for trackerRequest_
2013-07-06 21:00:57 +09:00
Tatsuhiro Tsujikawa
5378ed8c43
MultiUrlRequestFactory: Use std::unique_ptr for DownloadEngine
2013-07-06 19:45:01 +09:00
Tatsuhiro Tsujikawa
00e27e4fa4
DownloadEngine: Use std::unique_ptr for eventPoll_
2013-07-06 19:39:16 +09:00
Tatsuhiro Tsujikawa
f83b0fcfa3
Refactor MultiUrlRequestInfo ctor
...
StatCalc creation is moved to MultiUrlRequestInfo. The summary output
is done only when PREF_QUIET is false and it is always to
global::cout(), so remove summaryOut_ and just use global::cout() in
that case. Also use std::unique_ptr for statCalc_ in DownloadEngine.
2013-07-06 19:26:30 +09:00
Tatsuhiro Tsujikawa
162c138362
BtRegistry: Use std::unique_ptr for BtObject
2013-07-06 19:09:39 +09:00
Tatsuhiro Tsujikawa
cc3cd8a58b
DownloadEngine: Use std::unique_ptr for btRegistry_
2013-07-06 18:42:57 +09:00
Tatsuhiro Tsujikawa
3a3ac4ef9b
DownloadEngine: Use std::unique_ptr for dnsCache_
2013-07-06 18:38:18 +09:00
Tatsuhiro Tsujikawa
9130dc6776
DownloadEngine:: Use std::unique_ptr for webSocketSessionMan_
...
Notifier::addDownloadEventListener now takes pointer to
DownloadEventListener. Session holds unique_ptr to
ApiCallbackDownloadEventListener object.
2013-07-06 18:33:59 +09:00
Tatsuhiro Tsujikawa
81f46fbf92
Use CXX11_OVERRIDE
2013-07-06 18:15:09 +09:00
Tatsuhiro Tsujikawa
5c4f97b8a9
MultiUrlRequestInfo: Remove virtual from dtor
2013-07-06 18:14:36 +09:00
Tatsuhiro Tsujikawa
68f2a33355
DownloadEngine: Use std::unique_ptr for RequestGroupMan
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
697c1008f7
DownloadEngine: Use std::unique_ptr for checkIntegrityMan_, fileAllocationMan_
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
6b397c8125
Use std::unique_ptr for CheckIntegrityEntry and FileAllocationEntry
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
c9e58779e1
Use std::unique_ptr for IteratableValidator
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
d3a04d10a7
DefaultPieceStorage::initStorage: Clean up
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
ae84ff26e2
AbstractSingleDiskAdaptor: Use std::unique_ptr for diskWriter_
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
f8d305fe63
Use std::unique_ptr for FileAllocationIterator
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
345ba415a5
MultiDiskWriter: Rewrite resetDiskWriterEntries() using simpler algorithm
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
f000fd0cab
MultiDiskAdaptor: Use std::unique_ptr for DiskWriterEntry and DiskWriter
...
MultiFileAllocationIterator is also rewritten so that it does not
requre copying DiskWriterEntry objects.
2013-07-06 15:56:08 +09:00
Tatsuhiro Tsujikawa
28d5c7408f
Check that C++ compiler supports override keyword
...
If the compiler supports override, define CXX11_OVERRIDE as override,
otherwise define it as empty. Use CXX11_OVERRIDE instead of override.
2013-07-06 15:54:03 +09:00
Tatsuhiro Tsujikawa
cce5b3206a
Merge branch 'fix-streamfilters' of https://github.com/nmaier/aria2 into nmaier-fix-streamfilters
2013-07-06 14:39:57 +09:00
Nils Maier
093ea1de44
Fix bogus virtual override in StreamFilters
2013-07-05 20:15:55 +02:00
Nils Maier
d4044306f3
AppleTLS: Fix MessageDigestImpl
2013-07-05 20:14:49 +02:00
Nils Maier
59ba3c99f6
AppleTLS: Fix session CFRelease stuff
2013-07-05 02:00:21 +02:00
Tatsuhiro Tsujikawa
c6a733378f
Use std::unique_ptr to receive BtMessage
2013-07-04 22:35:41 +09:00
Tatsuhiro Tsujikawa
0cdeaa8177
Return nullptr directly where std::shared_ptr is expected
...
The constructor of std::shared_ptr which takes nullptr is not explicit
so we can return nullptr directly.
2013-07-04 21:44:09 +09:00
Tatsuhiro Tsujikawa
107de58997
Return nullptr directly where std::unique_ptr is expected
...
The constructor of std::unique_ptr which takes nullptr is not explicit
so we can return nullptr directly.
2013-07-04 21:33:36 +09:00
Tatsuhiro Tsujikawa
6ba1725e0f
Use std::unique_ptr for ARC4Encryptor in PeerConnection and MSEHandshake
2013-07-04 21:13:14 +09:00
Tatsuhiro Tsujikawa
b4ae039702
BinExpr, UnExpr: Make copies of args so that we can use them with rvalues
2013-07-04 03:04:50 +09:00
Tatsuhiro Tsujikawa
05d75ed218
Fix array version make_unique is invoked for 1 size_t arg accidentally
2013-07-04 03:02:33 +09:00
Tatsuhiro Tsujikawa
bc6aa3073b
Use std::unique_ptr for StreamPieceSelector instead of std::shared_ptr
2013-07-04 01:41:12 +09:00
Tatsuhiro Tsujikawa
128783cf86
Use std::unique_ptr for PieceSelector instead of std::shared_ptr
2013-07-04 01:38:24 +09:00
Tatsuhiro Tsujikawa
a479473949
Use std::unique_ptr for URISelector instead of std::shared_ptr
2013-07-04 01:16:48 +09:00
Tatsuhiro Tsujikawa
c36370ef60
Use std::unique_ptr for LpdMessage instead of std::shared_ptr
2013-07-04 00:56:29 +09:00
Tatsuhiro Tsujikawa
57f1902ee1
Use std::unique_ptr for StreamFilter instead of std::shared_ptr
2013-07-04 00:39:11 +09:00
Tatsuhiro Tsujikawa
cb205a207c
Use std::unique_ptr for HttpRequest instead of std::shared_ptr
2013-07-04 00:13:15 +09:00
Tatsuhiro Tsujikawa
9a38c102dc
Use std::unique_ptr for HttpResponse instead of std::shared_ptr
2013-07-03 23:42:55 +09:00
Tatsuhiro Tsujikawa
7e6db8d801
Use std::unique_ptr instead of array_ptr
2013-07-03 23:23:22 +09:00
Tatsuhiro Tsujikawa
c2e62cdb81
Fix compile error with i686-w64-mingw32-g++ 4.6
...
Which does not support constructor delegate
2013-07-03 23:21:47 +09:00
Tatsuhiro Tsujikawa
211f685add
BitfieldMan: Rewrite getCompletedLength and countMissingBlockNow
...
Rewritten so that no memory allocation is required for these
functions.
2013-07-03 22:40:28 +09:00
Tatsuhiro Tsujikawa
0d85fb0df3
Use std::unique_ptr for AsyncResolverMan
2013-07-03 01:30:01 +09:00
Tatsuhiro Tsujikawa
74d6d64271
Use std::unique_ptr for MessageDigest
2013-07-03 01:13:13 +09:00
Tatsuhiro Tsujikawa
f2d85c38cc
Fix segmentaion fault
2013-07-03 00:02:27 +09:00
Tatsuhiro Tsujikawa
f022402dc9
Use std::unique_ptr in DHTRegistry
2013-07-02 23:52:40 +09:00
Tatsuhiro Tsujikawa
1a5d75e819
Use std::unique_ptr to store DHTMessages instead of std::shared_ptr
2013-07-02 22:58:20 +09:00
Tatsuhiro Tsujikawa
4f7d1c395b
Use std::unique_ptr for ProgressUpdate instead of raw pointer
2013-07-01 21:59:54 +09:00
Tatsuhiro Tsujikawa
529b9fdceb
Use std::unique_ptr for ExtensionMessage
2013-07-01 21:42:51 +09:00
Tatsuhiro Tsujikawa
9e35750bb8
Code cleanup
2013-06-30 22:59:07 +09:00
Tatsuhiro Tsujikawa
098f1571be
Wrap BtMessage objects by std::unique_ptr instead of std::shared_ptr
2013-06-30 22:55:43 +09:00
Tatsuhiro Tsujikawa
abcb0745ed
Fix unitest compile error
2013-06-30 01:03:39 +09:00
Tatsuhiro Tsujikawa
03ae308faa
Use RequestSlot as pointer to avoid copying
2013-06-30 00:31:50 +09:00
Tatsuhiro Tsujikawa
d128a39fb6
HttpServer: Return bool for receiveHeader, use std::unique_ptr for headers
2013-06-29 23:20:43 +09:00
Tatsuhiro Tsujikawa
6a3e26a34d
Remove accidentally added const
2013-06-29 23:11:14 +09:00
Tatsuhiro Tsujikawa
5a223115e0
Rewrite CookieStorage
2013-06-29 23:09:09 +09:00
Tatsuhiro Tsujikawa
0b1e05b13b
Fix compile error
2013-06-27 00:20:48 +09:00
Tatsuhiro Tsujikawa
da7400ef5c
Return std::unique_ptr member as const ref
...
Returning raw pointer has a risk that it may be stolen by
std::shared_ptr in accident.
2013-06-26 23:56:43 +09:00
Tatsuhiro Tsujikawa
47402c5f29
Refactor HttpConnection and its neighbor objects
2013-06-26 23:19:15 +09:00
Tatsuhiro Tsujikawa
d485c8e767
Rewrite AuthConfig objects using std::unique_ptr
2013-06-26 21:45:29 +09:00
Tatsuhiro Tsujikawa
a4cf50914d
HttpRequest: Use raw non-owning pointer for cookieStorage_
2013-06-25 23:01:00 +09:00
Tatsuhiro Tsujikawa
4803482a51
HttpRequest: Store non-owning raw pointer for authConfigFactory_
2013-06-25 22:06:29 +09:00
Tatsuhiro Tsujikawa
6bcf33a69e
Fix compile error with clang
2013-06-25 02:57:48 +09:00
Tatsuhiro Tsujikawa
2761301dfb
Rewrite util::divide
2013-06-25 00:07:15 +09:00
Tatsuhiro Tsujikawa
2f6eff3821
download_helper: Cleanup
2013-06-24 23:49:49 +09:00
Tatsuhiro Tsujikawa
b364c2436b
toUpper, toLower: Let compiler copy src
2013-06-24 23:23:34 +09:00
Tatsuhiro Tsujikawa
10cdc59297
Remove vbegin and vend in favor of std::begin and std::end
2013-06-24 21:46:42 +09:00
Tatsuhiro Tsujikawa
d2ec57057e
HttpServer: Use std::unique_ptr for lastBody_ and headerProcessor_
2013-06-23 23:44:38 +09:00
Tatsuhiro Tsujikawa
fba7e7ee8b
Use move to send string data into SocketBuffer::pushStr
2013-06-23 23:31:07 +09:00
Tatsuhiro Tsujikawa
508109edbb
SocketBuffer: Use std::unique_ptr to store BufEntry
2013-06-23 23:06:12 +09:00
Tatsuhiro Tsujikawa
c0b60eb087
Use std::unique_ptr for UnionSeedCriteria
2013-06-23 22:07:25 +09:00
Tatsuhiro Tsujikawa
fa9f3fb5a3
Wrap Command object in std::unique_ptr
2013-06-23 21:55:52 +09:00
Tatsuhiro Tsujikawa
bb5b7eeedb
Move RequestGroup vector from Context to RequestGroupMan
2013-06-23 16:35:14 +09:00
Tatsuhiro Tsujikawa
28c84148e4
Pass std::unique_ptr by value
2013-06-23 16:24:47 +09:00
Tatsuhiro Tsujikawa
23086b6e21
AbstractBtMessage: Use std::unique_ptr for validator
2013-06-23 16:12:19 +09:00
Tatsuhiro Tsujikawa
a18bba7c66
DefaultBtMessageReceiver: Use raw pointer for non-owning object
2013-06-23 12:29:18 +09:00
Tatsuhiro Tsujikawa
85f5134626
DefaultBtMessageDispatcher: Use raw pointers for non-owning objects
2013-06-23 12:25:58 +09:00
Tatsuhiro Tsujikawa
9db01bed71
DefaultBtAnnounce: Use non-owning raw pointer for downloadContext_
2013-06-23 12:14:17 +09:00
Tatsuhiro Tsujikawa
bfb732c5d4
DefaultBtRequestFactory: Use raw pointer for pieceStorage_
2013-06-23 12:02:36 +09:00
Tatsuhiro Tsujikawa
bef6236da8
DownloadContext::attrs_ now holds std::unique_ptr
...
DownloadContext::getAttribute() returns a raw pointer.
2013-06-23 00:59:55 +09:00