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

2214 Коммитов

Автор SHA1 Сообщение Дата
Billy O'Neal ed94a6cddb
Fix build breaks on GCC 5.4, iOS, and OSX (#894)
* Move up bind_impl so that it can be found by non-MSVC.

* Avoid useless qualification making GCC unhappy.

* Make GZIP/DEFLATE/BROTLI constant chars.

* Remove unneeded ;

* Remove broken qualification attempting to forward declare web::http::compression::decompress_factory.

* Don't use nonstandard for each.

* Remove another unnecessary const.

* Mark unused parameters with (void).

* Guard -Wno-format-truncation from GCC 5.4.

* Fix bogus writtenSize warning from GCC 5.4.

* Attempt to avoid std::make_unique in compression tests.

* Avoid Concurrency::task_group_status because gcc 5.4 hates it for some reason.
2018-10-08 19:25:17 -07:00
Billy O'Neal 74da3723c6
Merge pull request #866 from epistor/compress
Add Transfer-Encoding compression support and extensible compression API
2018-10-04 19:10:23 -07:00
Billy O'Neal 61e4933ae5
Merge pull request #883 from BillyONeal/dev/bion/threadpool
Add API to set the number of threads in the asio thread pool.
2018-10-04 11:52:56 -07:00
Ernie Pistor edc5ad8024 Merge remote-tracking branch 'origin/master' into compress 2018-10-04 02:15:16 -04:00
Ernie Pistor 982793de5f address review comments 2018-10-04 02:10:52 -04:00
Gianfranco Costamagna f897582260 Fix install (#879)
* Fix default installation path

* Fixup previous commit.
This makes the install location not correct for Debian and similar linux distro, but upstream don't plan to change "lib/cpprestsdk" location,
so at least we can override the location with -DCPPREST_EXPORT_DIR=cmake and keep the CMAKE_INSTALL_LIBDIR multiarch location
2018-10-01 16:17:19 -07:00
Wolfgang Stöggl b14f9ff6c4 Use the same cmake_minimum_required version 3.1 (#847)
as in Release/CMakeLists.txt
2018-10-01 15:13:21 -07:00
Rishabh Anand 645637b984 Linkify Visual Studio reference in README.md (#882) 2018-10-01 14:35:47 -07:00
Ernie Pistor cdc2948614 Add Transfer-Encoding compression/decompression support and extensible compress/decompress API 2018-09-12 10:50:15 -04:00
Robert Schumacher 66e50f02dd Fix compiler errors and mint v2.10.6 2018-08-20 16:52:11 -07:00
Gianfranco Costamagna f9f518e4ad Fix another clang build failure (Fixes: #747) (#844)
* Fix another clang build failure (Fixes: #747)

===>  Building for cpprestsdk-2.9.1_5
[1/161] /usr/local/libexec/ccache/c++  -Dcpprest_EXPORTS -Iinclude -isystem /usr/local/include -isystem libs/websocketpp -Isrc/../include -Isrc/pch -O2 -pipe -fstack-protector -fno-strict-aliasing -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration -std=c++11 -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC   -Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs -Werror -pedantic -MD -MT src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o -MF src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o.d -o src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o -c src/pplx/pplx.cpp
FAILED: src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o
/usr/local/libexec/ccache/c++  -Dcpprest_EXPORTS -Iinclude -isystem /usr/local/include -isystem libs/websocketpp -Isrc/../include -Isrc/pch -O2 -pipe -fstack-protector -fno-strict-aliasing -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration -std=c++11 -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC   -Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs -Werror -pedantic -MD -MT src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o -MF src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o.d -o src/CMakeFiles/cpprest.dir/pplx/pplx.cpp.o -c src/pplx/pplx.cpp
In file included from src/pplx/pplx.cpp:14:
In file included from src/pch/stdafx.h:23:
In file included from include/cpprest/details/basic_types.h:16:
In file included from /usr/include/c++/v1/string:477:
In file included from /usr/include/c++/v1/string_view:176:
In file included from /usr/include/c++/v1/__string:56:
In file included from /usr/include/c++/v1/algorithm:643:
/usr/include/c++/v1/memory:3656:5: error: destructor called on non-final 'pplx::details::linux_scheduler' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
    __data_.second().~_Tp();
    ^
/usr/include/c++/v1/memory:3612:5: note: in instantiation of member function 'std::__1::__shared_ptr_emplace<pplx::details::linux_scheduler, std::__1::allocator<pplx::details::linux_scheduler> >::__on_zero_shared' requested here
    __shared_ptr_emplace(_Alloc __a)
    ^
/usr/include/c++/v1/memory:4277:26: note: in instantiation of member function 'std::__1::__shared_ptr_emplace<pplx::details::linux_scheduler, std::__1::allocator<pplx::details::linux_scheduler> >::__shared_ptr_emplace' requested here
    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                         ^
/usr/include/c++/v1/memory:4656:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<pplx::details::linux_scheduler>::make_shared<>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
                            ^
src/pplx/pplx.cpp:94:40: note: in instantiation of function template specialization 'std::__1::make_shared<pplx::details::linux_scheduler>' requested here
                    m_scheduler = std::make_shared< ::pplx::default_scheduler_t>();
                                       ^
/usr/include/c++/v1/memory:3656:23: note: qualify call to silence this warning
    __data_.second().~_Tp();
                      ^
1 error generated.

* Fix apple build, by defining apple_scheduler there.
2018-08-20 10:27:01 -07:00
Robert Schumacher 25d6b26f70 Fix incorrect version.h. Fixes #942 2018-08-17 09:48:34 -07:00
Robert Schumacher 29e23c253b Mint version 2.10.4 2018-08-15 12:40:46 -07:00
Billy O'Neal 4e19c0cfb4 Implement host override of CN checking in the ASIO backend (#832)
* Implement host override of CN checking in the ASIO backend

Add new function calc_cn_host which applies our host header override policy.
Add the CN hostname used to asio_connection. Change the protocol such that the SSL upgrade request needs to come with the target hostname to use.
Replace std::deque in connection pooling with a version that has constant amortized time per insertion. (std::deque is only constant amortized time for insertions in terms of element operations, not overall). Factor out the replacement policy from the overall pool machinery.
Change release() to take shared_ptr&& to make sure the caller has let go.
Enable verify_cert_chain_platform_specific on Windows; otherwise OpenSSL says that the root CAs are untrusted and all SSL tests fail on Windows.
  This accidentially repairs these test cases on Windows:
  **** outside_tests:outside_wikipedia_compressed_http_response FAILED ****
  **** outside_tests:multiple_https_requests FAILED ****
  **** outside_tests:outside_ssl_json FAILED ****

* Add missing std::move.

* Use hot connections instead of cold connections in connection pool.

* Put timer start code back.

* Reset the shared_ptr when it is being dropped.

* Fix end comment broken by merge hell.
2018-08-15 12:22:20 -07:00
Billy O'Neal b569ec3983 Avoid saying constexpr for VS2013. (#834) 2018-08-11 22:36:23 -07:00
Billy O'Neal 6f65e878b3
Implement host override of CN checking in the WinHTTP backend (#824)
* Implement CN overrides via the Host: header in the WinHTTP backend.

* Repair lack of fallback CN verification on Windows.

* Set security settings even for non-HTTPS URIs in WinHTTP, in case we get upgraded to SSL/TLS later.

* Add test to make sure this doesn't explode.

* Repair CPPREST_EXCLUDE_WEBSOCKETS support.

* Move x509_cert_utilities.h out of public headers.
2018-08-09 20:50:09 -07:00
Billy O'Neal f884d916ee Attempt to repair VS2013 builds. (#833) 2018-08-09 17:11:23 -07:00
Billy O'Neal a24ae4737d
Merge pull request #826 from BillyONeal/dev/bion/clang_format
Apply clang-format to the ASIO backend
2018-08-09 13:55:19 -07:00
Billy Robert O'Neal III fcbbfa2b12 Apply clang-format to the asio implementation. 2018-08-09 13:54:23 -07:00
Billy Robert O'Neal III 7d843a896f Set namespace indentation to none. 2018-08-09 13:53:52 -07:00
Billy Robert O'Neal III d92e0fe3e8 Add .clang-format file from vcpkg to cpprestsdk. 2018-08-09 13:51:16 -07:00
Billy O'Neal 633322537e Workaround Apple clang bugs in constexpr evaluation. (#829) 2018-08-06 06:17:23 -07:00
Billy Robert O'Neal III ed2b047229 Use double checked locking instead of call_once on Android due to paranoia. 2018-08-03 17:51:25 -07:00
Billy Robert O'Neal III 4c6abf33b5 Add initialize_with_threads feature to control thread count. 2018-08-03 17:51:25 -07:00
Billy Robert O'Neal III 8111f2f312 Factor shared threadpool setup/teardown behavior out of platform dependent policies. 2018-08-03 17:51:25 -07:00
René Meusel 77e184ac7d set the default open() O_CREAT file permissions to 666 (#736) 2018-08-03 16:14:11 -07:00
Wu Yongwei bcafee3799 Fix a build problem on Clang. (#732)
AND_CAPTURE_MEMBER_FUNCTION_POINTERS workaround had a check for GCC,
but did not exclude Clang.  Clang has a fake GCC version of 4.2, thus
caused problems.
2018-08-02 23:57:51 -07:00
Adam Duskett ae50037e02 fix template whitespace syntax (#715)
Some files don't have a space inbetween the '<' and '::' charachters, which
will cause build failures on older toolchains. Adding a space inbetween these
two characters fixes the issue.

See http://autobuild.buildroot.net/results/797a9b5fdf6ab0f16f2249324b48292dfab61d9f/build-end.log
for more information.
2018-08-02 23:46:05 -07:00
Billy O'Neal 14adc2e631 Various micro perf fixes and cleanup found while implementing CN overrides so far (#818)
* Microperf: Use lock_guard instead of unique_lock.

* Bill hates lock_guard more.

* Ref them connections.

* Demacroize.

* Commonize port and merge some CRLFs into adjacent string literals.

* Add missing template keyword.

* Avoid stringstream in constructing the proxy_str.

* Remove unused forward declarations of some HTTP things.

* Use NOMINMAX instead of undef min and max everywhere.

* Bunch of inheritance hygiene.

* What do you mean you want examples to compile?

* More CR comments from Robert.

* Add static.

* Use existing to_string_t.
2018-08-02 23:45:08 -07:00
Gianfranco Costamagna ecabd2b0e0 Update CMakeLists.txt to install the cmake bindings in the right location (#737)
* Update CMakeLists.txt to install the cmake bindings in the right location

/usr/lib/cpprestsdk is not the correct FHS standard cmake location.
It should be placed in /usr/lib/<triplet>/cmake/cpprestsdk instead.

Same goes for libraries, support multiarch location if we use UNIX

* Revert changes to CPPREST_EXPORT_DIR. Use GNUInstallDirs on all platforms.
2018-08-02 23:39:05 -07:00
VZ 5021303f33 Fix handling of timed out connections kept alive in connection pool under Unix (#762)
* Add asio_connection::was_closed_by_server() to reduce duplication

Reduce code duplication between ssl_proxy_tunnel::handle_status_line()
and the method with the same name in asio_context itself by moving the
common handling of connections closed by server into a new function.

No real changes, this is a pure refactoring.

* Fix checking for server-side closure of HTTPS connections

When an SSL connection times out due to being closed by server, a
different error code is returned, so we need to check for it too in
was_closed_by_server().

Without this, losing connection was not detected at all when using
HTTPS, resulting in "Failed to read HTTP status line" errors whenever
the same http_client was reused after more than the server keep alive
timeout of inactivity.

See #592.

* Fix bug with using re-opened connections with ASIO

Creating a new request when the existing connection being used was
closed by the server didn't work correctly because the associated input
stream was already exhausted, as its contents had been already "sent" to
the server using the now discarded connection, so starting a new request
using the same body stream never worked.

Fix this by explicitly rewinding the stream to the beginning before
using it again.

Note that even with this fix using a custom body stream which is not
positioned at the beginning initially (or which doesn't support
rewinding) still wouldn't work, but at least it fixes the most common
use case.

See #592.

* Reduce duplicate code between ssl_proxy and asio_context in handle_read_status_line.
Avoid increasing public surface with rewind function.
2018-08-02 23:18:05 -07:00
sridhar madhugiri (msft) c8c92277db Improve error handling in on_accept (#750)
* Improve error handling in on_accept

* Move lock to the top of the function

* Lock shared data at the right locations.

* [http_listener] improve refcount and lifetime management by using RAII.
2018-08-02 22:24:23 -07:00
mobileben c214c811b9 #436 Building iOS doesn’t seem to work (#776)
This moves iOS.cmake into the file so there is on need to add it. Also allows for boost to be static libs versus framework
2018-08-02 19:46:23 -07:00
Billy O'Neal 8edc9a474c Deduplicate some code in HTTP headers. (#825) 2018-08-02 19:35:36 -07:00
Robert Schumacher e388a2e523 Update changelog 2018-08-02 15:41:02 -07:00
Robert Schumacher 6b1e9d4770 Push version to 2.10.3 2018-08-02 15:41:02 -07:00
Billy O'Neal a6b41536e0 Unify handling of tolower operations to avoid locale sensitivity. (#822) 2018-08-01 17:14:08 -07:00
Billy O'Neal c55ada9659 Add branchless is_alnum borrowed from MSVC++'s std::regex' _Is_word; should be about 5x faster. (#823)
The _Is_word change resulted in the following results in microbenchmarks; the previous is_alnum looks like branching_ranges.

.\word_character_test.exe
08/01/18 16:33:03
Running .\word_character_test.exe
Run on (12 X 2904 MHz CPU s)
CPU Caches:
  L1 Data 32K (x6)
  L1 Instruction 32K (x6)
  L2 Unified 262K (x6)
  L3 Unified 12582K (x1)
--------------------------------------------------------
Benchmark                 Time           CPU Iterations
--------------------------------------------------------
strchr_search    19426572900 ns 19421875000 ns          1
branching_ranges 7582129000 ns 7578125000 ns          1
branching_search 6592977800 ns 6593750000 ns          1
table_index      1091321300 ns 1078125000 ns          1
2018-08-01 16:39:58 -07:00
Billy O'Neal 35f721d2d9
Merge pull request #687 from ZekeSnider/certificate-revocation-client-config
Disable cert revocation check if cert validation is disabled
2018-08-01 14:06:15 -07:00
Billy O'Neal ee2cde689a Unbreak ASIO build on Windows. (#821) 2018-08-01 14:05:34 -07:00
Billy Robert O'Neal III 074590c8fc Add tests for set_validate_certificates(false). 2018-08-01 14:00:35 -07:00
Zeke Snider 3d5cb468b3 Don't enable certificate revocation check if client config has validate certificates set to false 2018-08-01 13:48:51 -07:00
Robert Schumacher 651bba7d2e Remove empty objects when using CMake on Windows 2018-08-01 03:25:05 -07:00
Robert Schumacher 08de668deb Fix some issues with gcc-5 2018-08-01 03:24:39 -07:00
Alex Moriarty 48ae6d2fa0 [gcc-8][clang++-6] disable more -Werror warnings (#779)
gcc-8: -Wno-format-truncation

clang-6: -Wdelete-non-virtual-dtor
clang-6: -Wunused-lambda-capture

removed duplicated: -Wno-reorder

This fixes #778
2018-08-01 02:09:03 -07:00
Andreas Stieger fac1470f8a Fix gcc8 error/warning -Werror=format-truncation= (#787)
utilities::datetime::to_string(): datetime_str and buf were oversized
for fitting into output without possible trunctation
2018-08-01 02:08:42 -07:00
Gianfranco Costamagna ef7e37e289 Fix boost1.63 build failure Fixes: #813 (#815) 2018-08-01 02:04:41 -07:00
Billy O'Neal aa4065bd24 Delete open() from _http_client_communicator (#819)
* Delete open() from _http_client_communicator and move its functionality into WinHTTP, as that is the only backend using that thing.

* Some CR comments from Robert.
2018-08-01 02:01:01 -07:00
Robert Schumacher 48189bd460 Do not fail on unrecognized content encoding (such as chunked) when compression is enabled. 2018-07-31 22:05:01 -07:00
Robert Schumacher 1d8be69c58 Add root CMakeLists.txt 2018-07-20 16:09:48 -07:00