Commit Graph

2592 Commits (41cb7743746a6013c13a425eb9283ee23113ce84)

Author SHA1 Message Date
Tatsuhiro Tsujikawa 5352d76d4f Added reset() API to ParserStateMachine
Not unittested
2012-07-13 00:53:56 +09:00
Tatsuhiro Tsujikawa 70685bd233 Rewritten Xml2XmlParser
Now it is push parser + utility function for file parsing.
2012-07-11 23:20:48 +09:00
Tatsuhiro Tsujikawa cd67e27ca4 Check structure depth when parsing JSON 2012-07-11 23:20:20 +09:00
Tatsuhiro Tsujikawa 57b46d5123 Added streaming parser for structured data format.
Added JSON streaming parser. Note that currently JSON parser ignores
frac and exp parts of number construct.
2012-07-10 01:42:42 +09:00
Tatsuhiro Tsujikawa e3b8c92434 Added TLS SNI support 2012-07-06 23:07:10 +09:00
Tatsuhiro Tsujikawa b00ed1aa30 More http header parser tests 2012-07-06 00:57:18 +09:00
Tatsuhiro Tsujikawa f04090199f Rewritten timegm replacement function
The algorithm is based on Python 2.7 calendar.timegm.
2012-07-06 00:34:37 +09:00
Tatsuhiro Tsujikawa 4046f27ea9 Use system-wide certificates for SSL
Use system-wide certificates for SSL.  For GnuTLS it requires the
latest version, 3.0.20. OpenSSL had it for longer.  This means that if
SSL library is properly configured to locate system-wide certificates
store, the user don't have to use --ca-certificate option. Also
packagers don't have to use --with-ca-bundle configure option.

Patch from Cristian Morales Vega
2012-07-05 23:22:34 +09:00
Tatsuhiro Tsujikawa b25d8a9923 Code cleanup 2012-07-04 22:59:15 +09:00
Tatsuhiro Tsujikawa 995c07c184 Fixed base64::decode() return "" if input ends with garbase and no padding 2012-07-04 22:51:41 +09:00
Tatsuhiro Tsujikawa aa944f4ef6 Guarded include of stdint.h and inttypes.h 2012-07-04 00:00:24 +09:00
Tatsuhiro Tsujikawa 98e1c6c580 Code cleanup 2012-07-03 21:56:26 +09:00
Sergey Zolotarev 1c39b9474e Fixed ssize_t error on MinGW 2012-07-03 17:44:48 +06:00
Tatsuhiro Tsujikawa 5d3b6801b1 Changed default Peer ID prefix
The new Peer ID prefix is "A2-$MAJOR-$MINOR-$MICRO-", where $MAJOR,
$MINOR and $MICRO are the major version, the minor version and the
micro version respectively. For instance, 1.15.2 release of aria2 will
use "A2-1-15-2-".
2012-06-29 23:38:12 +09:00
Tatsuhiro Tsujikawa 0c8ec9c325 Merged Android build scripts 2012-06-29 00:51:13 +09:00
Tatsuhiro Tsujikawa f1017d5def Don't percent-decode filename value in Content-Disposition.
We only percent-decode filename* value in Content-Disposition because
the encoding is fully specified. But since filename value is not, so
we just accept it as is.
2012-06-28 23:18:50 +09:00
Tatsuhiro Tsujikawa c30ea8adeb Don't sum in-flight piece which does not intersect filtered ranges
When calculating completed length, don't sum the completed length of
piece which does not intersect filtered ranges.
2012-06-27 23:28:57 +09:00
Tatsuhiro Tsujikawa 68f225de0b Use stack allocation+reference instead of pointer for BufferedFile 2012-06-27 01:38:27 +09:00
Tatsuhiro Tsujikawa a6775db3ca Fixed segmentation fault when logger failed to open log file 2012-06-27 01:38:18 +09:00
Tatsuhiro Tsujikawa 16d395779a Removed static_cast<int64>()s where they are unnecessary 2012-06-25 23:44:52 +09:00
Tatsuhiro Tsujikawa 1b874268a0 Use int64_t instead of off_t
Some classes such as DiskAdaptor, DiskWriter, FileAllocationIterator
and ChecksumValidator are left unchanged.
2012-06-25 23:35:24 +09:00
Tatsuhiro Tsujikawa 4b03634f36 Use PRId64 for int64_t format specifier 2012-06-25 22:43:33 +09:00
Tatsuhiro Tsujikawa 3620d271af Process as many messages as possible in recv buffer 2012-06-25 21:37:55 +09:00
Tatsuhiro Tsujikawa e816c5eee4 Rewritten PeerConnection::receiveMessage()
The old implementation calls at least 2 read(2) (4bytes length and
payload) to receive the message. This change will read as many bytes
as possible in one read(2) call. BtPieceMessage::data_ is now just a
const pointer to the internal buffer of PeerConnection.
2012-06-25 21:35:52 +09:00
Tatsuhiro Tsujikawa 73b75186c7 Handle the case when MINGW32 vsnprintf returns -1
MINGW32 vsnprintf returns -1 if output is truncated.  Increased buffer
for vsnprintf in WinConsoleFile and fmt.
2012-06-24 16:56:34 +09:00
Tatsuhiro Tsujikawa 96720b297d Added --enable-mmap option.
If this option is used, map files into memory using mmap(2).  This
option is experimental.
2012-06-24 16:28:04 +09:00
Tatsuhiro Tsujikawa 38426d744b Code cleanup 2012-06-23 17:50:27 +09:00
Tatsuhiro Tsujikawa 5fc1b1ad29 Rewritten HTTP header parser 2012-06-23 17:34:20 +09:00
Tatsuhiro Tsujikawa 5a0a62c5f4 Added CORS preflight request support.
This change is based on the patch from binux.
2012-06-23 16:26:17 +09:00
Tatsuhiro Tsujikawa 9ba65aea1d Rewritten ChunkedDecodingStreamFilter 2012-06-18 23:42:46 +09:00
Tatsuhiro Tsujikawa afcd95dec7 Return appropriate HTTP status code on RPC failure.
In this change, we return 404 if the request path is neither /json-rpc
nor /rpc. If XML feature is not enabled and /rpc is requested, return
404.  If XML parser failed, return 400. JSON parser failure has been
handled well in the existing code.
2012-05-19 18:36:57 +09:00
Tatsuhiro Tsujikawa 68eb1b6737 Ignore unacceptable options in RPC request instead of throwing error.
This change allows RPC client to send same options for the different
type of downloads.
2012-05-17 22:52:39 +09:00
Tatsuhiro Tsujikawa 92c518a2ba Moved parseAsyncDNSServers() to AsyncNameResolver.cc and refactored.
The parseAsyncDNSServers() now uses net::getBinAddr() internally,
which makes the function simpler. Also added unit test.
2012-05-16 23:05:09 +09:00
Tatsuhiro Tsujikawa 36051cca5e Handle sockaddr_in.sin_len and sockaddr_in6.sin6_len
Check sockaddr_in.sin_len and sockaddr_in6.sin6_len are available and
assign values to them properly.  This change fixes unit test error and
most error related to getnameinfo() on netbsd.
2012-05-16 22:43:25 +09:00
Tatsuhiro Tsujikawa ca60020fa4 Removed dependency on inet_aton
Implemented inetPton as a replacement of inet_aton. inetPton is
implemented using net::getBinAddr.

This change fixes bug#3525424.
2012-05-14 01:17:50 +09:00
Tatsuhiro Tsujikawa 19798f09ae Fixed typo 2012-05-12 19:33:33 +09:00
Tatsuhiro Tsujikawa a998e32f95 Call ERR_clear_error() before OpenSSL I/O functions.
Use ERR_get_error() with ERR_error_string().
2012-05-08 01:02:18 +09:00
Tatsuhiro Tsujikawa d16071d108 Fixed the bug which prevents --bt-lpd-interface from working.
Fixes bug#3520125
2012-04-22 18:35:43 +09:00
Tatsuhiro Tsujikawa f5d3cd1bb0 Updated copyright year 2012-04-08 21:43:00 +09:00
Tatsuhiro Tsujikawa aee28c8b0d Fixed compile warning with clang 2012-04-08 19:22:23 +09:00
Tatsuhiro Tsujikawa 1e0068e4d4 WebSocket: Check keyword string in comma separeted values in HTTP
header field.
2012-04-08 19:00:07 +09:00
Tatsuhiro Tsujikawa c648ca0c5c Include common.h from a2algo.h and a2functional.h 2012-04-08 18:59:06 +09:00
Tatsuhiro Tsujikawa 52826433d9 Fixed typo 2012-04-08 17:51:01 +09:00
Tatsuhiro Tsujikawa 9e8676af2c Disable IPv6 by default only if MinGW 32bit build. 2012-04-08 17:45:33 +09:00
Tatsuhiro Tsujikawa d9bb24a2e0 Fixed gcc-4.7 warnings 2012-04-08 03:12:29 +09:00
Tatsuhiro Tsujikawa fcbdecfd1e Conditional compile for WebSocket.
WebSocket support depends on Message Digest support.
2012-04-08 00:50:25 +09:00
Tatsuhiro Tsujikawa 7bc2a14d9f Fixed compile error without BitTorrent support 2012-04-08 00:05:42 +09:00
Tatsuhiro Tsujikawa ef86d760cc Use CreateProcessW instead of CreateProcessA 2012-04-07 23:57:49 +09:00
Tatsuhiro Tsujikawa 3f7561b80c Define HAVE_GETADDRINFO only if it is not defined in MinGW build. 2012-04-07 23:56:37 +09:00
Tatsuhiro Tsujikawa fcb102b650 Fixed compile error with i686-w64-mingw32 2012-04-07 21:26:33 +09:00
Tatsuhiro Tsujikawa 840ca5adb6 Check availability of pwd.h 2012-04-07 15:49:22 +09:00
Tatsuhiro Tsujikawa c7c26e67c4 Disable IPv6 for MinGW build by default 2012-04-07 15:40:33 +09:00
Tatsuhiro Tsujikawa 65a20f5070 First check there is wildcard character or not in tls hostname check. 2012-04-01 22:07:01 +09:00
Tatsuhiro Tsujikawa b9471d7452 Compare IPAddress in commonName as string.
Added test for net::verifyHostname().
2012-04-01 16:42:38 +09:00
Tatsuhiro Tsujikawa b68e0a5527 Use net::verifyHostname() with gnutls.
We now don't use gnutls_x509_crt_check_hostname() any more.
2012-03-31 21:21:18 +09:00
Tatsuhiro Tsujikawa e6f04416d9 Don't use locale dependent toupper and tolower. 2012-03-31 00:06:55 +09:00
Tatsuhiro Tsujikawa 0a9abd89c6 Rewritten TLS hostname check based on RFC 6125. 2012-03-30 23:49:14 +09:00
Tatsuhiro Tsujikawa e4e9562c92 Get the home directory of the effective user ID using getpwuid() if
$HOME is not defined.
2012-03-30 01:43:38 +09:00
Tatsuhiro Tsujikawa 25ef6677e9 Added hostname check described in RFC 2818 with OpenSSL. 2012-03-28 23:28:22 +09:00
Tatsuhiro Tsujikawa 06b6bef860 Made WebSocket handshake more strict.
Refactored HttpServer as well.
2012-03-25 22:10:36 +09:00
Tatsuhiro Tsujikawa 8499a47d21 Added --bt-remove-unselected-file option.
Removes the unselected files when download is completed in
BitTorrent. To selecting files, use --select-file option. If it is not
used, all files are assumed to be selected. Please use this option
with care because it will actually remove files from your disk.
This option is default to false.
2012-03-25 19:25:43 +09:00
Tatsuhiro Tsujikawa 2b3469dad9 Use std::set for socketEntries_ and nameResolverEntries_ in PortEventPoll 2012-03-25 00:38:57 +09:00
Tatsuhiro Tsujikawa ae393329f7 Fixed segmentation fault in open solaris in unit test.
This is due to the fact that the maximum value of random() in open
solaris is not RAND_MAX, but (2**31)-1.
2012-03-25 00:28:11 +09:00
Tatsuhiro Tsujikawa 4d8c17d104 Fixed compile error on open solaris
Fixes bug#3497518
2012-03-25 00:27:25 +09:00
Tatsuhiro Tsujikawa d8948056b3 Use std::set for socketEntries_ and nameResolverEntries_ in KqueueEventPoll 2012-03-24 21:19:57 +09:00
Tatsuhiro Tsujikawa eed804baaa Use std::set instead of std::deque if the elements are sorted and
insertions and deletions are frequent.
2012-03-23 01:34:37 +09:00
Tatsuhiro Tsujikawa 332bda83b4 Enable TCP_NODELAY for WebSocket connection. 2012-03-21 02:08:18 +09:00
Tatsuhiro Tsujikawa 0792540bf2 Prefixed notification method name with "aria2." 2012-03-21 01:35:48 +09:00
Tatsuhiro Tsujikawa f4e2c7f060 Added JSON-RPC over WebSocket.
Wslay library must be placed under deps/wslay.
2012-03-20 21:42:09 +09:00
Tatsuhiro Tsujikawa 5bff877eae Fixed assertion failure if Chunked encoding along with Content-Length is used. 2012-03-05 12:45:05 +09:00
Tatsuhiro Tsujikawa e73c3c53ff Fixed clang warning and errors.
Test for the zero-length array with A2_ARRAY_LEN was commented out
since it is only used in unit test code and clang and old gcc 3.4.3
emit error.
2012-03-01 00:02:29 +09:00
Tatsuhiro Tsujikawa 037f1512db Added BufferedFile::getLine() to make reading one line more flexible.
Fixes bug#3495336
2012-02-29 02:50:12 +09:00
Tatsuhiro Tsujikawa c63a524a88 Added .gitignore files 2012-02-27 21:49:01 +09:00
Tatsuhiro Tsujikawa f4e0eae904 Added checkRequiredInteger() to check integer param is in valid range.
Ensure that fileIndex in aria2.changeUri RPC method is greater than or
equal to 1.
2012-02-26 21:49:37 +09:00
Tatsuhiro Tsujikawa ad11d746f0 Only accepts 32 bit integer values from int and i4 elements in XML-RPC.
Fixed overflow in AbstractPaginationRpcMethod::getPaginationRange().
Fixes bug#3494165
2012-02-26 19:45:25 +09:00
Tatsuhiro Tsujikawa 663cfec9f6 Fixed the bug that aria2 does not listen on address given in --interface. 2012-02-22 22:45:01 +09:00
Tatsuhiro Tsujikawa 075ea06ad7 Supported Windows UNC path. 2012-02-19 21:19:11 +09:00
Tatsuhiro Tsujikawa b7dbcea58b Check scheme part in redirected URI more strictly.
The previous implementation mistakenly sees '/abspath?uri=http://foo'
as an absolute URI because it contains '://', but actually it is not.
This change checks scheme part is constructed in the allowed character
set described in RFC 3986 Section 3.1.
2012-02-15 01:40:12 +09:00
Tatsuhiro Tsujikawa 9e302b86df Code cleanup: use empty() to check size() == 0 2012-02-12 23:21:25 +09:00
Tatsuhiro Tsujikawa 7dc2b9ff16 Allow missing params in XML-RPC request.
Now following request is legal:

<methodCall>
  <methodName>aria2.getVersion</methodName>
</methodCall>
2012-02-12 23:13:21 +09:00
Tatsuhiro Tsujikawa 9b7e4219d9 Reserve PeerConnection's buffer capacity according to number of pieces.
If the number of pieces gets bigger, the length of Bitfield message
payload exceeds the initial buffer capacity of PeerConnection, which
is MAX_PAYLOAD_LEN.  We expand buffer as necessary so that
PeerConnection can receive the Bitfield message.
2012-02-09 01:51:42 +09:00
Tatsuhiro Tsujikawa f2d55f0edc Added --deferred-input option.
If true is given to --deferred-input option, aria2 does not read all
URIs and options from file specified by -i option at startup, but it
reads one by one when it needs later. This may reduce memory usage if
input file contains a lot of URIs to download. If false is given,
aria2 reads all URIs and options at startup. This option defaults to
false.
2012-02-05 18:57:16 +09:00
Tatsuhiro Tsujikawa a6803c21b5 Support network-path reference in HTTP redirect. 2012-01-11 02:17:38 +09:00
Tatsuhiro Tsujikawa 2997fa0631 Refactored splitNsName 2012-01-11 02:04:20 +09:00
Tatsuhiro Tsujikawa 3b1834e633 Avoid strlen in util::streq, util::strieq, util::startsWith and util::istartsWith 2012-01-11 01:50:35 +09:00
Tatsuhiro Tsujikawa b340c25164 Code cleanup 2012-01-11 01:23:24 +09:00
Tatsuhiro Tsujikawa b6fd4366fe Use short form of util::startsWith and util::endsWith 2012-01-11 01:17:51 +09:00
Tatsuhiro Tsujikawa 9331f6a43d Removed static const char[] as much as possible.
Provided convenient functions for streq, strieq, startsWith,
istartsWith, endsWith, iendsWith to support this move.
2012-01-11 01:03:38 +09:00
Tatsuhiro Tsujikawa db86ffbca9 Fixed compile error without libnettle, libgcrypt and openssl 2012-01-08 19:10:55 +09:00
Tatsuhiro Tsujikawa 1c292f469e aria2 now doesn't assume download's completed just because file size matched
The only exception is zero-length file.  If server tells file is
zero-length and --checksum option is given, aria2 now correctly checks
its checksum. There is one known issue: If downloaded file is
zero-length file and .aria2 file exists, it will not be deleted on
successful verification, because .aria2 file is not loaded.
2012-01-08 17:46:03 +09:00
Tatsuhiro Tsujikawa b6f8a3dbb3 Use std::ifstream instead of file descriptor for generateRandomDataUrandom()
Usually required random bytes are short, it is advantageous to use
std::ifstream which is buffered I/O rather than read() syscall.
2012-01-08 01:21:42 +09:00
Tatsuhiro Tsujikawa 46e59c4cc3 Fixed the bug that --checksum is not working. 2012-01-08 01:15:58 +09:00
Tatsuhiro Tsujikawa 4ff29f802f Moved PeerConnection.{h,cc} to BitTorrent resources 2012-01-08 01:09:58 +09:00
Tatsuhiro Tsujikawa 63325cfd06 Fixed compile error without libnettle, libgcrypt and openssl. 2012-01-08 01:00:02 +09:00
Tatsuhiro Tsujikawa e6c44871c8 Fixed the bug that log file is not created if there is warning before log open
Use LogFactory::reconfigure() to reopen log file after setting log
filename from option.
2011-12-27 17:14:29 +09:00
Tatsuhiro Tsujikawa 973e0df748 Fixed compile error on openbsd 2011-12-26 01:00:15 +09:00
Tatsuhiro Tsujikawa deb0983ab4 Fixed compile error on android (which does not LFS support) 2011-12-26 00:10:27 +09:00
Tatsuhiro Tsujikawa 52155b1860 No retry for close() with EINTR. Also reverted changes in d5ffa253. 2011-12-25 23:38:36 +09:00
ITriskTI aa070bc683 Update src/version_usage.cc 2011-12-12 16:09:45 +03:00
Tatsuhiro Tsujikawa d4e9b07719 Fixed compile error without BitTorrent support 2011-12-11 03:13:33 +09:00