Граф коммитов

2214 Коммитов

Автор SHA1 Сообщение Дата
Gareth Sylvester-Bradley 1d7550f5d4
Fix more http test build fails in certain configurations (#1332) 2020-03-31 16:22:47 -07:00
Gareth Sylvester-Bradley 6d0e2b73af
Remove redundant std::move noted by gcc 9.2 (-Wredundant-move) (#1370) 2020-03-31 16:21:51 -07:00
Dmitry Tsarevich 927afad909
Static analyzer (PVS Studio) fixes (#1372)
* [init] Initialize stream mode to in by default

* [leak] Fix memory leak of server api ptr

Should call delete on pointer instead of releasing it to the caller.

* [macro] Ensure priority of macro computation

Enclose macro args in round brackets to ensure operators priority.

* [prep] Fix comment after preprocessor macro

* [ub] Use typed pointer in delete operation

* Delete of void pointer is UB.  See section 5.3.5/3.  SO question:
https://stackoverflow.com/questions/941832/is-it-safe-to-delete-a-void-pointer
* Windows APIs used here return FALSE in case of failure, and
non-FALSE on success.  There is no info in spec that only TRUE
value indicates success.  Correct way to implement check for
success call is to compare with false like result != FALSE.

* [fmt] Fix military RFC1123 time format parsing

Ensure + or - sign is used for time zone offset in RFC1123 military
time format.

* Remove redundant != FALSE.

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2020-03-31 16:02:07 -07:00
Gareth Sylvester-Bradley cdae258bfb
[#1349] Expose json::value::parse for UTF8 string on Windows (#1350) 2020-03-02 15:00:16 -08:00
Fabrice Fontaine cb7ca74e5f
libcpprestsdk: fix building as a static library (#1344)
On Unix, try to use pkg-config to find OpenSSL. This will automatically
find any dependent libraries and put them in the correct order for
linking. If pkg-config is not available or system is not UNIX, fallback
on current mechanism

Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Retrieved (and slightly updated) from:
https://git.buildroot.net/buildroot/tree/package/libcpprestsdk/0001-libcpprestsdk-fix-building-as-a-static-library.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-03-02 14:51:12 -08:00
Billy O'Neal b94bc32ff8
Mint v2.10.15. (#1336) 2020-02-23 20:33:51 -08:00
Billy O'Neal 0886fcc138
Fix tcp::resolver data race in the asio backend and be defensive against empty results (#1339)
* Move TCP resolver to asio_context rather than asio_client, as that type is not safe to touch from multiple threads.

* Defend against empty responses from async_resolve.

Co-authored-by: Jinming Hu jinming.hu@microsoft.com
2020-02-23 10:51:19 -08:00
VZ 43f6f3424f
Use C++11 synchronization classes under macOS too (#1342)
There doesn't seem to be any reason to prefer using Boost libraries to
standard C++ classes under macOS, so use the latter ones unconditionally
on this platform too, just as it was already done for the other Unix
systems.

This notably avoids dependencies on the compiled Boost libraries, which
don't have to be compiled before building C++ REST SDK any more.
2020-02-23 09:38:17 -08:00
Billy O'Neal 23e4c6197f
Add Ubuntu 18.04 testing. (#1340) 2020-02-22 05:11:51 -08:00
Arkady Shapkin 1f97f54652
Enable HTTP compression support on all platforms (#1322) 2020-02-21 11:56:35 -08:00
Billy O'Neal d29cfa1b7c
Turn VS2015 back on now that vcpkg is fixed. (#1335) 2020-02-19 18:27:12 -08:00
Gareth Sylvester-Bradley f43bf646de
Add TCP_NODELAY to disable Nagle's algorithm in Boost.ASIO-based http_client (#1310)
* Add TCP_NODELAY to disable Nagle's algorithm to avoid waiting for ACK for HTTP request headers before transmitting the request body, in order to significantly improve performance for requests with bodies (see #1201)

* Also add TCP_NODELAY on the server-side, to disable Nagle's algorithm to avoid waiting for ACK for HTTP response headers before transmitting the response body (see #1201)
2020-02-19 18:00:34 -08:00
Gareth Sylvester-Bradley a835bfac35
Use LC_ALL_MASK rather than LC_ALL when calling newlocale (#1330)
Resolves #1329 as @jason-ha suggests
2020-02-19 17:18:56 -08:00
Gianfranco Costamagna feb0755637
Change default installation directory for cmake files to cmake/cpprestsdk (#1306) 2020-02-19 16:38:05 -08:00
Billy O'Neal 40dad5c674
Update vcpkg and boost on Android (#1334)
* websocketpp appears a lost cause, disable websockets for Android

Also fixes #1333 as a drive-by :)
2020-02-19 16:16:23 -08:00
Gavin Halliday 96e7d20e39 Fix various warnings reported by gcc 9.3, and possibly earlier versions (#1289)
Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
2019-12-19 13:10:21 -08:00
Jonathan Saylor 53dcf8b34f Added comparison overrides to utility::datetime (#1276)
I was trying to compare timestamps and noticed that the code doesn't support this so std::max and std::min don't work with datetime timestamps. I've added less/greater/less-or-equal/greater-or-equal operators.
2019-12-18 16:14:04 -08:00
Gareth Sylvester-Bradley e7c6b08b88 Fix test case broken by commit f4c863bcf5 (#1288) 2019-12-18 16:13:30 -08:00
Billy O'Neal c9f91156e3
Update vcpkg and remove tests that look for web servers that no longer exist (#1293) 2019-12-18 13:41:42 -08:00
kevin-- fd6aa00c18 remove trailing slash on websocketpp submodule url, which causes checkout failure on CircleCI with git 2.22.0 (#1263) 2019-10-28 18:41:24 -07:00
ASHISH BHARDWAJ ce443d567f Update README.md (#1256) 2019-10-28 18:41:03 -07:00
Gareth Sylvester-Bradley 7e50b51339 http_server_httpsys.cpp requires linking against httpapi.lib, http_client_winhttp.cpp does not. (#1253) 2019-10-28 18:40:35 -07:00
Sinan Kaya f4c863bcf5 Support for WinHTTPAL curl-to-WinHTTP adapter (#1182) 2019-09-27 16:27:44 -07:00
Billy O'Neal c4f37e7a04
Avoid using permissive- with ZW which breaks VS2019 (#1248)
* Also add VS2019 configurations to Azure Pipelines.
* Also turn on vcpkg caching from @lukka
2019-09-27 14:08:02 -07:00
Billy O'Neal ce96a318b1
Trim whitespace and nulls the same way. (#1233) 2019-08-28 12:39:31 -07:00
Michael Khlopin 2a8c17e7bb Fixing of connections_and_errors::cancel_with_error test which sometimes fires false positive error "There are no pending calls to next_request." (#1196) 2019-08-22 19:36:07 -07:00
Gareth Sylvester-Bradley f7065f48a3 Fix "Data" to "Date" in the HTTP Server API mapping, and clarify that the indices of these values match the HTTP_HEADER_ID values for HTTP_REQUEST_HEADERS but *not* HTTP_RESPONSE_HEADERS (#1219) 2019-08-22 19:34:39 -07:00
Jason Hartman 265d681743 fix SxS debug-release builds with Visual Studio (#1220)
* On basic_string_view_support: fix SxS debug-release builds with Visual Studio
place precompiled header implicitly in Debug/Release path with VS and explicitly in bin dir otherwise
standardize pch setup across libraries with helper function

* nudge pipeline to rerun
2019-08-22 19:33:30 -07:00
Gareth Sylvester-Bradley 44c491889d Workarounds for two GCC 4.7.2 bugs with lambda functions (#1209)
* Workarounds for two GCC 4.7.2 bugs with lambda functions using implicit this, surfacing as incorrect const-qualification and an internal compiler error. Resolves immediate issues identified in #1200.

* Restore compatibility with modern compilers
2019-08-02 12:27:46 -07:00
Gareth Sylvester-Bradley a40a28610d Missed one defence against no NOMINMAX in bed8fa538c. (#1202) 2019-07-23 10:54:40 -07:00
Billy O'Neal 6f602bee67
Mint v2.10.14. (#1193) 2019-07-16 12:07:11 -07:00
Billy O'Neal 60e067e71a
Remove proxy settings detection behavior in "default proxy mode." (#1188)
* Remove proxy settings detection behavior in "default proxy mode."

This commit partially reverts eb108ada1a in order to work around a reliability problem with WinHttpGetProxyForUrl. That function hangs unless there is an available thread pool thread to complete the WPAD request. As a result, if a customer issued ~512 concurrent HTTP requests, or otherwise needed that many thread pool threads, there would not be a thread available for WinHTTP to complete the operation, and the program would deadlock.

Moreover this call to WinHttpGetDefaultProxyConfiguration is extremely expensive, taking ~20% of overall CPU for the entire program for some Azure Storage SDK customers.

The function WinHttpGetProxyForUrlEx is supposed to help with this problem by being asynchronous, but that function was added in Windows 8, so we can't use it unconditionally. And on Windows 8.1 we already are using WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY instead of trying to do proxy autodetect ourselves.
2019-07-16 07:55:55 -07:00
Billy O'Neal bed8fa538c
Replace CPPREST_TARGET_XP with version checks, remove ""s, and other cleanup (#1187)
* Audit for "" and use std::string default ctor instead.

* Fix Linux ambiguity.

* Exclude common build directories.

* Replace CPPREST_TARGET_XP with checks against _WIN32_WINNT to allow more fine grained controls going forward (e.g. assume Win10).

Also fix a few typos.

* Delete CASABLANCA_UNREFERENCED_PARAMETER and attempt Linux compile fix.

* Defend NOMINMAX.

* Another _WIN32 guard.

* With && this time.

* Fix more spelling errors.

* Optimize trim_nulls slightly.

* And actually make the optimization correct this time.

* Fix unit test failure.

* clang-format
2019-07-12 18:05:14 -07:00
Billy O'Neal a718c5bcf4
Remove invalid nondependent static assert (#1186)
* Remove invalid static_assert(false).

* Turn on permissive-.

* clang-format
2019-07-12 16:27:44 -07:00
Billy O'Neal 643dc60703
Update boost-for-android for Android NDK r20 and disable macOS Homebrew. (#1185)
* Update boost-for-android for Android NDK r20.

* Also disable homebrew.

* I mean homebrew I said!

* Apparently Android isn't ready for Boost 1.70 yet.
2019-07-12 13:14:55 -07:00
Billy O'Neal 951e269923
Fix profile being set on the compiler instead of the linker. (#1184) 2019-07-11 18:59:47 -07:00
René Meusel 47cd408966 FIX: SSL proxy tunnel support with basic auth (#1183) 2019-07-11 18:16:57 -07:00
dejaniv 06aeb8ea9f Fix issue #1171: Order of object destruction (#1175)
- Connection object is now destroyed before client object
- Client is destroyed only when wspp_callback_client is destroyed to prevent race condition with the destructor
2019-07-11 18:15:21 -07:00
VZ 5b32e16f5e Fix reusing ASIO http_client connecting to HTTPS server via proxy (#539)
Calling request() twice on the same client configured to connect to a
server via HTTPS didn't work under Unix because we issues CONNECT for
every request, meaning that, for the second one, we sent CONNECT via an
already established connection to the end server itself which,
unsurprisingly, didn't work at all.

Fix this by only setting up SSL tunnelling for a new connection but not
for the already used one.
2019-06-13 12:41:11 -07:00
Kumamon38 0f45af1513 add ping and pong to message handler (#1143)
Add ping and pong to message handler, and optional pong timeout
2019-06-13 12:40:00 -07:00
Robert Hancock 36e030a5ed Remove the address_configured flag on tcp::resolver::query (#1145)
The default behavior for tcp::resolver::query uses the
address_configured flag, which only returns addresses if a non-loopback
address is available on the system. If this is called before a real network
interface is brought up, then resolution will fail and the server won't
be functional, even for requests on the loopback interface.

Explicitly set the flags to default so that the address_configured flag
is not specified. This allows the server to start up normally even when
the system has no active network interfaces.
2019-06-13 12:39:12 -07:00
Bryan Lipinski be807d42c2 Use EVP_MAX_MD_SIZE instead of HMAC_MAX_MD_CBLOCK (#1155) 2019-06-12 20:11:29 -07:00
Billy O'Neal 0e9fef8159
Fix broken CI Builds (#1156)
* Update vcpkg.

* Attempt to fix Ubuntu apt and update MacOS.

* Workaround Azure Pipelines forcing an updated copy of boost that doesn't work with default Ubuntu libs.

* Add test runs back.

* Update boost-for-android and block Boost 1.69 on the image.

* Update boost and openssl on iOS.

* Use right path to test binaries.

* Shut off iOS builds.
2019-06-12 18:43:31 -07:00
Bryan Lipinski ce50b8cd9d Undefine compress if it is defined by zconf.h (#1150) 2019-06-10 13:45:33 -07:00
Gareth Sylvester-Bradley e037858d62 json: {"meow"} is not a valid object (#1130)
* json: {"meow"} is not a valid object

* Add to contributors - eighteenth PR seemed like the time! :-)
2019-05-07 10:43:33 -07:00
Billy O'Neal 7536ae5799
Add switches to make apiscan happy. (#1133) 2019-05-07 10:37:14 -07:00
Billy O'Neal 9d8f544001
Mint v2.10.13. (#1122) 2019-04-24 22:16:37 -07:00
Billy O'Neal 7c8f6241f5
Fix off by one error in leap years before year 2000, and bad day names (#1120) 2019-04-23 20:52:41 -07:00
Billy Robert O'Neal III b7d3e8b900 Remove needless cast. 2019-04-19 17:07:22 -07:00
Billy O'Neal e2818b8d6e
Parse and emit years from 1900 to 9999, and remove environment variable dependence on Android (#1117)
Update date formatting and parsing to accept all years between 1900 and 9999.

This unblocks the Azure Storage SDK which uses 9999-12-31 as a sentinel value for "no expiration time" which was broken by the locale insensitive date formatting's dependence on _mkgmtime, with its 1970-3000 range. By morally reimplementing _mkgmtime, this change also lets us remove the Android workaround of changing the TZ environment variable.

Release\tests\functional\utils\datetime.cpp

Turn on tests for values that would need 64 bits represented as a time_t, even for 32 bit time_t platforms.
Add year 1900 and 9999 test cases, and remove year 3000+ and 1969- negative tests.
Release\tests\functional\http*

Drive by fix for new VS2019 warnings about narrowing.
Release\src\utilities\asyncrt_utils.cpp

Remove dependence on _mkgmtime and gmtime_r/gmtime_s by implementing replacements loosely inspired by both the C runtime's date operations and .NET's handling of the Gregorian calendar's 400 year cycle.
2019-04-19 16:50:15 -07:00