Commit Graph

206 Commits (df19921b833d9a46c68fce1da4e54ec677cfa65d)

Author SHA1 Message Date
Tatsuhiro Tsujikawa aa4ea8889c clang-format-3.9 2016-10-15 19:02:54 +09:00
Tatsuhiro Tsujikawa bafbbe7c1d Allow subsecond value in ns cookie.txt file's expiry time field 2016-05-15 18:40:50 +09:00
Tatsuhiro Tsujikawa 1ce6ac0b23 Add error handling for sigaction, signal and strdup 2016-04-23 18:18:06 +09:00
Tatsuhiro Tsujikawa 1126722bd3 mingw: Defer the falloc warning until falloc is specified by option 2016-04-18 22:17:41 +09:00
Tatsuhiro Tsujikawa ce868d75bd Fix issues reported by coverity 2016-04-13 19:20:19 +09:00
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
Nils Maier a3ba5c0588 Make clang (OSX) happy again 2015-06-24 14:26:43 +02:00
Tatsuhiro Tsujikawa 1adef4db0c Fix compile warning with Mingw64 x86 build 2015-06-21 20:53:08 +09:00
Tatsuhiro Tsujikawa 318c804504 Use user-defined literal for k, m, and g (powers of 1024) 2015-06-21 19:29:54 +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
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 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 1dd7409c4e Fix unused function warning about generateRandomDataUrandom in mingw-w64 2014-05-08 16:38:32 +02:00
Nils Maier 010131161e Remove ENABLE_MESSAGE_DIGEST, since we got the internal md, always 2014-04-17 18:02:42 +02:00
Tatsuhiro Tsujikawa 2c566ccb68 Fix bad fork() return value handling 2013-12-06 00:40:08 +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 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
Tatsuhiro Tsujikawa d7d5e8570b Include prefs.h instead of typedef PrefPtr everywhere 2013-09-26 00:15:18 +09:00
Nils Maier 86c61fcf5b Make generateRandomBytes less biased. 2013-09-24 19:07:18 +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 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 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 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
Tatsuhiro Tsujikawa 7e6db8d801 Use std::unique_ptr instead of array_ptr 2013-07-03 23:23:22 +09:00
Tatsuhiro Tsujikawa 74d6d64271 Use std::unique_ptr for MessageDigest 2013-07-03 01:13:13 +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 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 10cdc59297 Remove vbegin and vend in favor of std::begin and std::end 2013-06-24 21:46:42 +09:00
Tatsuhiro Tsujikawa 50dcd6394c Use std::unique_ptr instead of std::shared_ptr 2013-06-22 15:49:41 +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
Nils Maier b7ef53b13d OSX (now) needs signal.h for sigaction 2013-05-17 01:48:53 +02:00
Tatsuhiro Tsujikawa 0fa92911d7 util.cc: Include only signal.h for opensolaris build 2013-03-17 15:42:50 +09:00