Commit Graph

115 Commits (3a6f39ca7a1e0b6946c4c72f7fa37dbe6c382121)

Author SHA1 Message Date
Tatsuhiro Tsujikawa 5e48e01bf9 Don't inherit file descriptor to child process
For non-Mingw32 build, set FD_CLOEXEC to file descriptors which live
beyond function scope.  For Mingw32 build, just pass false to
bInheritHandles parameter of CreateProcessW.
2016-02-08 00:09:17 +09:00
Tatsuhiro Tsujikawa 25243da039 mingw: Add formatLastError as wrapper function for FormatMessage 2016-01-28 22:25:46 +09:00
Tatsuhiro Tsujikawa aa06a17fda Refactor HttpRequest
This also makes comparison performed when replacing builtin header
field with user-defined one case-insensitive.
2016-01-10 16:59:31 +09:00
Tatsuhiro Tsujikawa ea4d99ea08 Refactor SocketCore::getPeerInfo, getAddrInfo to return Endpoint object 2016-01-09 18:17:04 +09:00
Tatsuhiro Tsujikawa b1132d6b10 make clang-format using clang-format-3.6 2015-12-27 18:40:08 +09:00
Tatsuhiro Tsujikawa 95f2c00c71 Remove unused macros defined in util.h 2015-06-21 17:17:40 +09:00
Tatsuhiro Tsujikawa 2bbec1086d Use std::make_shared 2015-06-11 21:25:19 +09:00
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 649c49dcc6 Mingw: Use _wgetenv to get user's home directory
Fixes GH-342
2015-02-21 01:49:07 +09:00
Tatsuhiro Tsujikawa e1739c8ee7 Fix compile error without SSL/TLS enabled 2015-02-01 21:32:47 +09: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 c0e4381780 util::parseIntSegments: Return SegList<int> 2014-06-04 23:21:01 +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
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
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 d7d5e8570b Include prefs.h instead of typedef PrefPtr everywhere 2013-09-26 00:15:18 +09:00
Nils Maier a76eeb2b81 Introduce PrefPtr typedef 2013-09-19 19:59:33 +02:00
Nils Maier 270f429838 Fix util::nextParam when compiled with recent Apple clang 2013-08-20 20:48:49 +02:00
Nils Maier bf5a940ed4 Define a type for signal handlers 2013-08-18 06:04:20 +02:00
Tatsuhiro Tsujikawa 2761301dfb Rewrite util::divide 2013-06-25 00:07:15 +09:00
Tatsuhiro Tsujikawa b364c2436b toUpper, toLower: Let compiler copy src 2013-06-24 23:23:34 +09:00
Tatsuhiro Tsujikawa 07d270c87e Require -std=c++11 and use std::shared_ptr instead of SharedHandle 2013-06-22 01:10:38 +09:00
Tatsuhiro Tsujikawa 549dd5b2a7 uitos: Fix off-by-one error bug 2013-04-29 23:53:23 +09:00
Tatsuhiro Tsujikawa 61665d2c26 Set sa_mask when setting signal handler 2013-02-14 21:51:30 +09:00
Tatsuhiro Tsujikawa 3b7566faf1 Rewritten util::uitos() 2013-01-16 23:30:02 +09:00
Tatsuhiro Tsujikawa 31189b1222 Made return type of util::parse_content_disposition ssize_t 2012-11-01 22:54:32 +09:00
Tatsuhiro Tsujikawa 118aed9c24 Content-Disposition parser conforming to RFC 6266.
RFC 2231 Continuation is not supported.
2012-10-27 14:51:07 +09:00
Tatsuhiro Tsujikawa 8fc5cdea02 Removed unused functions 2012-09-27 01:03:39 +09:00
Tatsuhiro Tsujikawa 89f18dde85 Use nothrow version of parseInt, parseUInt and parseLLInt 2012-09-27 00:45:32 +09:00
Tatsuhiro Tsujikawa a8c0794640 Made DEFAULT_STRIP_CHARSET const char[] 2012-09-24 23:54:41 +09:00
Tatsuhiro Tsujikawa dd7014a612 Store only interesting HTTP headers in HttpHeader
In this change, we defined HTTP header fields we are interested in.
We only store those headers in HttpHeader object.  Accessing HTTP
headers in HttpHeader object is now done through enum values.
2012-09-23 20:59:34 +09:00
Tatsuhiro Tsujikawa 461a542c5e Rewritten DownloadHandlerConstants
DownloadHandlerConstants was simplified.  MIME type handling in Accept
header was also reworked.  DownloadContext's metalinkServerContacted_
is replaced with acceptMetalink_ and its boolean value is reverted.
RequestGroup and HttpRequest now do not hold vector of accepting
types.  HttpRequest has the flag acceptMetalink_ which will be set by
the same value of DownloadContext::accpetMetalink_ and if it is true,
Metalink MIME types are added to Accept header field.
2012-09-22 23:19:41 +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 5fc1b1ad29 Rewritten HTTP header parser 2012-06-23 17:34:20 +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 25ef6677e9 Added hostname check described in RFC 2818 with OpenSSL. 2012-03-28 23:28:22 +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 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 3b1834e633 Avoid strlen in util::streq, util::strieq, util::startsWith and util::istartsWith 2012-01-11 01:50:35 +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 deb0983ab4 Fixed compile error on android (which does not LFS support) 2011-12-26 00:10:27 +09:00
Tatsuhiro Tsujikawa f0bcfa822e Use int instead of unsigned int where unsigned int is not needed. 2011-12-09 21:39:43 +09:00
Tatsuhiro Tsujikawa 12988e5282 Replaced uint64_t with off_t or int64_t.
Since off_t is int64_t with LFS, we cannot take advantage of extra
capacity of uint64_t.
2011-12-09 21:39:43 +09:00
Tatsuhiro Tsujikawa db5cc4db27 Don't append character to std::string. 2011-11-12 21:27:24 +09:00
Tatsuhiro Tsujikawa 2f4393d17c Rewritten parse*Int 2011-11-12 01:06:52 +09:00
Tatsuhiro Tsujikawa d17ea2837b HttpHeader::fill() now stores header name in lowercase.
Find methods in HttpHeader won't lowercase argument, so use lowercase
letters to get HTTP header field.
2011-11-11 22:50:18 +09:00
Tatsuhiro Tsujikawa 6ed36b73c1 Code cleanup 2011-11-08 23:27:23 +09:00
Tatsuhiro Tsujikawa 30fdb08f40 Rewritten parametered URI handling routine. 2011-11-06 16:37:02 +09:00