Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Test pull request via rebase #1

Merged
merged 183 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
8144234
Fix for compilation with MSVC permissive- (#809)
robert-andrzejuk Jul 17, 2018
3839196
Fix test issues under /permissive-
ras0219-msft Jul 17, 2018
1d8be69
Add root CMakeLists.txt
ras0219-msft Jul 20, 2018
48189bd
Do not fail on unrecognized content encoding (such as chunked) when c…
ras0219-msft Jul 11, 2018
aa4065b
Delete open() from _http_client_communicator (#819)
BillyONeal Aug 1, 2018
ef7e37e
Fix boost1.63 build failure Fixes: #813 (#815)
LocutusOfBorg Aug 1, 2018
fac1470
Fix gcc8 error/warning -Werror=format-truncation= (#787)
andreasstieger Aug 1, 2018
48ae6d2
[gcc-8][clang++-6] disable more -Werror warnings (#779)
moriarty Aug 1, 2018
08de668
Fix some issues with gcc-5
ras0219-msft Aug 1, 2018
651bba7
Remove empty objects when using CMake on Windows
ras0219-msft Aug 1, 2018
3d5cb46
Don't enable certificate revocation check if client config has valida…
Feb 3, 2018
074590c
Add tests for set_validate_certificates(false).
BillyONeal Aug 1, 2018
ee2cde6
Unbreak ASIO build on Windows. (#821)
BillyONeal Aug 1, 2018
35f721d
Merge pull request #687 from ZekeSnider/certificate-revocation-client…
BillyONeal Aug 1, 2018
c55ada9
Add branchless is_alnum borrowed from MSVC++'s std::regex' _Is_word; …
BillyONeal Aug 1, 2018
a6b4153
Unify handling of tolower operations to avoid locale sensitivity. (#822)
BillyONeal Aug 2, 2018
6b1e9d4
Push version to 2.10.3
ras0219-msft Aug 1, 2018
e388a2e
Update changelog
ras0219-msft Aug 2, 2018
8edc9a4
Deduplicate some code in HTTP headers. (#825)
BillyONeal Aug 3, 2018
c214c81
#436 Building iOS doesn’t seem to work (#776)
mobileben Aug 3, 2018
c8c9227
Improve error handling in on_accept (#750)
sridmad Aug 3, 2018
5021303
Fix handling of timed out connections kept alive in connection pool u…
vadz Aug 3, 2018
ecabd2b
Update CMakeLists.txt to install the cmake bindings in the right loca…
LocutusOfBorg Aug 3, 2018
14adc2e
Various micro perf fixes and cleanup found while implementing CN over…
BillyONeal Aug 3, 2018
ae50037
fix template whitespace syntax (#715)
aduskett Aug 3, 2018
bcafee3
Fix a build problem on Clang. (#732)
adah1972 Aug 3, 2018
77e184a
set the default open() O_CREAT file permissions to 666 (#736)
reneme Aug 3, 2018
8111f2f
Factor shared threadpool setup/teardown behavior out of platform depe…
BillyONeal Aug 1, 2018
4c6abf3
Add initialize_with_threads feature to control thread count.
BillyONeal Aug 1, 2018
ed2b047
Use double checked locking instead of call_once on Android due to par…
BillyONeal Aug 1, 2018
6333225
Workaround Apple clang bugs in constexpr evaluation. (#829)
BillyONeal Aug 6, 2018
d92e0fe
Add .clang-format file from vcpkg to cpprestsdk.
BillyONeal Aug 9, 2018
7d843a8
Set namespace indentation to none.
BillyONeal Aug 9, 2018
fcbbfa2
Apply clang-format to the asio implementation.
BillyONeal Aug 9, 2018
a24ae47
Merge pull request #826 from BillyONeal/dev/bion/clang_format
BillyONeal Aug 9, 2018
f884d91
Attempt to repair VS2013 builds. (#833)
BillyONeal Aug 10, 2018
6f65e87
Implement host override of CN checking in the WinHTTP backend (#824)
BillyONeal Aug 10, 2018
b569ec3
Avoid saying constexpr for VS2013. (#834)
BillyONeal Aug 12, 2018
4e19c0c
Implement host override of CN checking in the ASIO backend (#832)
BillyONeal Aug 15, 2018
29e23c2
Mint version 2.10.4
ras0219-msft Aug 15, 2018
25d6b26
Fix incorrect version.h. Fixes #942
ras0219-msft Aug 17, 2018
f9f518e
Fix another clang build failure (Fixes: #747) (#844)
LocutusOfBorg Aug 20, 2018
66e50f0
Fix compiler errors and mint v2.10.6
ras0219-msft Aug 20, 2018
cdc2948
Add Transfer-Encoding compression/decompression support and extensibl…
epistor Sep 12, 2018
645637b
Linkify Visual Studio reference in README.md (#882)
19ANDY Oct 1, 2018
b14f9ff
Use the same cmake_minimum_required version 3.1 (#847)
c72578 Oct 1, 2018
f897582
Fix install (#879)
LocutusOfBorg Oct 1, 2018
982793d
address review comments
epistor Oct 4, 2018
edc5ad8
Merge remote-tracking branch 'origin/master' into compress
epistor Oct 4, 2018
61e4933
Merge pull request #883 from BillyONeal/dev/bion/threadpool
BillyONeal Oct 4, 2018
74da372
Merge pull request #866 from epistor/compress
BillyONeal Oct 5, 2018
ed94a6c
Fix build breaks on GCC 5.4, iOS, and OSX (#894)
BillyONeal Oct 9, 2018
fba9a59
typo a an -> an (#886)
copterquad Oct 9, 2018
98550a4
Correct exception messages and comments in asyncrt_utils (#889)
chris0x44 Oct 9, 2018
948b70b
Various fixes on #866 which broke building for iOS and Mac (#888)
mobileben Oct 9, 2018
b211145
Fix narrowing conversion warnings on Windows. (#895)
BillyONeal Oct 9, 2018
eadff24
Harden winrt_encryption slightly and avoid a potential reallocation. …
BillyONeal Oct 9, 2018
40eb6d2
Remove unused variables to avoid warnings in some compilers (#855)
whoan Oct 9, 2018
81eb4cf
Enable multi-processor compilation (#890)
chris0x44 Oct 9, 2018
2aa4a64
Enable precompiled headers for test/functional (#891)
chris0x44 Oct 9, 2018
19c9f1c
Add Ubuntu 16.04 Azure Pipelines Validation (#898)
BillyONeal Oct 9, 2018
625c666
Add Azure Pipelines badge.
BillyONeal Oct 9, 2018
b0ebae3
Added URI resolution according to RFC3986 (#897)
toughengineer Oct 10, 2018
c6377e9
Add MacOS pipelines build support. (#902)
BillyONeal Oct 10, 2018
1049491
Adding test runs to Azure Pipelines. (#899)
BillyONeal Oct 11, 2018
5a9f3bc
Move dotSegment and dotDotSegment back into local variables, as sugge…
BillyONeal Oct 11, 2018
8484f5d
Revert "Enable precompiled headers for test/functional (#891)" (#904)
BillyONeal Oct 11, 2018
acd96cf
Burninate internal use of ostringstream, and done a ref (#905)
BillyONeal Oct 11, 2018
b9dd8ea
Reduce stdafx.h header inclusion to avoid running out of memory on *n…
BillyONeal Oct 11, 2018
a072579
Add Windows CI to Pipelines using vcpkg for dependencies; merge debug…
BillyONeal Oct 12, 2018
61b1699
Enable Brotli in CI. (#912)
BillyONeal Oct 12, 2018
8a1eec8
Restore PCHes and delete unmaintained / broken legacy project files. …
BillyONeal Oct 14, 2018
b209ac1
Add vcpkg based dependency resolution for *nix platforms. (#913)
BillyONeal Oct 15, 2018
ada8e57
Correct .gitmodules to point to upstream vcpkg.
BillyONeal Oct 15, 2018
943c6f8
Add install instructions for Fedora (#919)
watersalesman Oct 16, 2018
9c8e0d4
Fix off-by-one error in connection pooling introduced with asio certi…
BillyONeal Oct 16, 2018
06619a7
Update embedded websockets to 0.8.1 and use submodule instead of chec…
BillyONeal Oct 16, 2018
a2d2d3c
Re-enable no-unused-lamda-capture and no-format-trucation (#923)
moriarty Oct 17, 2018
14b439c
Enable build for iOS in Pipelines. (#925)
BillyONeal Oct 17, 2018
3a140eb
Reduce intermittent test failures in CI by fixing bugs found by asan …
BillyONeal Oct 18, 2018
328646a
Enable Android build in CI, update NDK to 17c. (#922)
BillyONeal Oct 18, 2018
95409c5
Deal with even more flaky tests! (#928)
BillyONeal Oct 18, 2018
6a9f497
Add message for missing submodule if websocketspp is missing. (#930)
BillyONeal Oct 24, 2018
4c554bf
Update NDK to r18b, as that's what's in Pipelines. (#931)
BillyONeal Oct 24, 2018
f4c08f0
Fix VS 2013 builds. (#932)
BillyONeal Oct 26, 2018
b3a7141
Improve utf8_to_utf16 speed for common path (#892)
chris0x44 Oct 26, 2018
e5c6d84
Export methods to set/get the ambient scheduler in cpprest dll (#670)
chakrab-msft Oct 27, 2018
ab5ced9
Fix spelling mistakes across the library (#935)
ioannis-e Oct 27, 2018
bcccf54
Use pplx namespace consistently (#936)
ioannis-e Oct 30, 2018
ab6d3fe
Remove _ASYNCRTIMP from ~http_listener() and implement inline (#937)
ioannis-e Oct 31, 2018
2f149ca
blackjack sample: use vector instead of shared pointer for array (#943)
0x17de Oct 31, 2018
2a19d84
Avoid using identifiers reserved by C++ in header guards (#940)
micheal-o Oct 31, 2018
c4cef12
Mint 2.10.7. (#933)
BillyONeal Oct 31, 2018
1aeab07
Allow ppltasks.h and pplxtasks.h to co-exist (#938)
ioannis-e Nov 3, 2018
5027cab
Fix incorrect const in reinterpret_cast (#950) (#951)
chris0x44 Nov 7, 2018
b72a910
Fix UWP missing header (#955)
BillyONeal Nov 7, 2018
4c3edd6
Adds support for OpenSSL 1.1.1 (#956)
cpsauer Nov 7, 2018
7467b79
fix anroid build issue by remove the crossplt name space before andro…
zixincheng Nov 7, 2018
b0b2fc4
Update vcpkg to latest master to fix VS2015 build. (#960)
BillyONeal Nov 10, 2018
aabec3c
Fix string size for error message generated by windows_category (#966)
chris0x44 Nov 11, 2018
19d2ebb
Add uri_builder::append_path_raw(...) to allow adding elements to pat…
dangrif Nov 12, 2018
f3824aa
cmake: add code to detect system brotli library (#952)
LocutusOfBorg Nov 12, 2018
0864365
Fix Brotli compress_helper early termination issue (#963)
epistor Nov 12, 2018
7222fa2
Fixes iOS builds and makes it more future proof (#961)
leetal Nov 12, 2018
204a526
Mint 2.10.8. (#970)
BillyONeal Nov 14, 2018
7368961
Address gcc warnings-as-errors in compression code, test improvements…
epistor Nov 30, 2018
744f33b
Prevent infinite loop during proxy authentication (#986)
trevorlacey-msft Dec 4, 2018
65267c6
Remove use of aligned_union that broke CentOS 7. (#987)
BillyONeal Dec 7, 2018
452afce
Update vcpkg dependencies. (#997)
BillyONeal Dec 15, 2018
62af5c0
Add tests reported in Github issues. (#1001)
BillyONeal Dec 19, 2018
00f4843
#993, #1002: Add flexibility for iOS building. Adds command line args…
mobileben Dec 20, 2018
57a7ff2
clang-format cpprestsdk (#1005)
BillyONeal Dec 21, 2018
21a609b
gcc: Fix compilation with -fno-operator-names (#1009)
KindDragon Jan 9, 2019
be5d43f
FIX: crash with std::logic_error when reusing a connection that timed…
reneme Jan 16, 2019
c5ebc28
#1020 handle null bytes when parsing utf8 (#1021)
alnkpa Jan 16, 2019
0f766a0
#1015 Add in support for adding i386 slice when building for 32-bit t…
mobileben Jan 17, 2019
e6498b2
http_compression.cpp: fix build with gcc 4.7 (#1024)
ffontaine Jan 18, 2019
c66f84d
Resolve double free when WinHttpSendRequest fails (#1022)
BillyONeal Jan 19, 2019
8f0393d
Mint 2.10.9. (#1025)
BillyONeal Jan 19, 2019
5a885dd
Handle multi-byte unicode characters in json parsing (#1023)
Tymolc Jan 28, 2019
4ddaec3
Temporary fix for VS2013. (#1033)
BillyONeal Jan 28, 2019
91f66c6
Mint 2.10.10 to unblock Azure storage folks. (#1034)
BillyONeal Jan 30, 2019
a2b9a05
Disable WINHTTP_AUTOPROXY_OPTIONS machinery when using WINHTTP_ACCESS…
BillyONeal Feb 11, 2019
f940d55
Fix HTTP/1.0 'Keep-Alive' handling in http_client (#1032)
garethsb Feb 11, 2019
886855b
Add exception handling for the ssl_context_callback so it has a means…
garethsb Feb 27, 2019
bc77da3
Fix upgrade to SSL after a proxy connect (hostname is required)
garethsb Feb 27, 2019
43773b9
Add the obvious missing constructor from a std::error_code and 'what'…
garethsb Mar 5, 2019
572ab7c
Update vcpkg. (#1053)
BillyONeal Mar 6, 2019
3f6f844
Returns int64 value in function of seeking to file end on x64 Windows…
EmmaZhu Mar 15, 2019
9d3b5cd
Don't close the output stream when reporting errors reading the body.…
BillyONeal Mar 19, 2019
bf116c5
Enable testing from root directory (#1064)
mohd-akram Mar 19, 2019
b914ad9
Add --vcpkg-root to repair UWP.
BillyONeal Mar 19, 2019
355889b
Update Boost_for_android for Android R19 (#1041)
BillyONeal Mar 19, 2019
7d2b63c
Merge remote-tracking branch 'origin/master' into fix_uwp
BillyONeal Mar 19, 2019
a917bd4
Add --vcpkg-root to repair UWP. (#1071)
BillyONeal Mar 19, 2019
6225905
Merge remote-tracking branch 'origin/master' into garethsb-http-ssl_c…
BillyONeal Mar 19, 2019
0387cb9
Merge pull request #1051 from garethsb-sony/garethsb-http-ssl_context…
BillyONeal Mar 20, 2019
fac2ff7
Gate stdext::checked_array_iterator usage on _ITERATOR_DEBUG_LEVEL (#…
bryan-lipinski Mar 20, 2019
ea4eff7
Add the missing ssl::context callback in websocket_client_config (#1049)
garethsb Mar 20, 2019
1131678
Move get_jvm_env back into the crossplat namespace (#1073)
BillyONeal Mar 20, 2019
a325079
Mint v2.10.11. (#1074)
BillyONeal Mar 20, 2019
f10d9f8
Rewrite date formatting and parsing (#1076)
BillyONeal Mar 21, 2019
9b670e5
Fix oauth nonces containing nulls. (#1084)
BillyONeal Mar 26, 2019
42a6e76
Workaround data-race on websocketpp's _htonll function (#1082)
whoan Mar 26, 2019
275b9c1
Fix thread not joined (#1080)
whoan Mar 26, 2019
23901dc
Fix data race, GitHub #1085 (#1088)
BillyONeal Mar 27, 2019
d4fb1cf
Mint v2.10.12. (#1089)
BillyONeal Mar 27, 2019
74d3e8d
Don't initialize atomic_flag with 0. (#1093)
BillyONeal Mar 28, 2019
621f47a
Avoid tripping over 32 bit time_t mistakes. (#1094)
BillyONeal Mar 30, 2019
c328c70
Allow error handling for time out in http_client_asio handle_connect …
rkubes Apr 9, 2019
5583fbb
Update request_timeout_microsecond timeout (#1101)
LocutusOfBorg Apr 9, 2019
c9707ef
Paranoia for overflow of sprintf buffer in the year 10000 (#1106)
BillyONeal Apr 9, 2019
e2818b8
Parse and emit years from 1900 to 9999, and remove environment variab…
BillyONeal Apr 19, 2019
b7d3e8b
Remove needless cast.
BillyONeal Apr 20, 2019
7c8f624
Fix off by one error in leap years before year 2000, and bad day name…
BillyONeal Apr 24, 2019
9d8f544
Mint v2.10.13. (#1122)
BillyONeal Apr 25, 2019
7536ae5
Add switches to make apiscan happy. (#1133)
BillyONeal May 7, 2019
e037858
json: {"meow"} is not a valid object (#1130)
garethsb May 7, 2019
ce50b8c
Undefine compress if it is defined by zconf.h (#1150)
bryan-lipinski Jun 10, 2019
0e9fef8
Fix broken CI Builds (#1156)
BillyONeal Jun 13, 2019
be807d4
Use EVP_MAX_MD_SIZE instead of HMAC_MAX_MD_CBLOCK (#1155)
bryan-lipinski Jun 13, 2019
36e030a
Remove the address_configured flag on tcp::resolver::query (#1145)
robhancocksed Jun 13, 2019
0f45af1
add ping and pong to message handler (#1143)
Jun 13, 2019
5b32e16
Fix reusing ASIO http_client connecting to HTTPS server via proxy (#539)
vadz Jun 13, 2019
06aeb8e
Fix issue #1171: Order of object destruction (#1175)
Jul 12, 2019
47cd408
FIX: SSL proxy tunnel support with basic auth (#1183)
reneme Jul 12, 2019
951e269
Fix profile being set on the compiler instead of the linker. (#1184)
BillyONeal Jul 12, 2019
643dc60
Update boost-for-android for Android NDK r20 and disable macOS Homebr…
BillyONeal Jul 12, 2019
a718c5b
Remove invalid nondependent static assert (#1186)
BillyONeal Jul 12, 2019
bed8fa5
Replace CPPREST_TARGET_XP with version checks, remove ""s, and other …
BillyONeal Jul 13, 2019
60e067e
Remove proxy settings detection behavior in "default proxy mode." (#1…
BillyONeal Jul 16, 2019
6f602be
Mint v2.10.14. (#1193)
BillyONeal Jul 16, 2019
a40a286
Missed one defence against no NOMINMAX in bed8fa538c862a8297cb02c99d8…
garethsb Jul 23, 2019
44c4918
Workarounds for two GCC 4.7.2 bugs with lambda functions (#1209)
garethsb Aug 2, 2019
265d681
fix SxS debug-release builds with Visual Studio (#1220)
jason-ha Aug 23, 2019
f7065f4
Fix "Data" to "Date" in the HTTP Server API mapping, and clarify that…
garethsb Aug 23, 2019
2a8c17e
Fixing of connections_and_errors::cancel_with_error test which someti…
miherius Aug 23, 2019
ce96a31
Trim whitespace and nulls the same way. (#1233)
BillyONeal Aug 28, 2019
c4f37e7
Avoid using permissive- with ZW which breaks VS2019 (#1248)
BillyONeal Sep 27, 2019
f4c863b
Support for WinHTTPAL curl-to-WinHTTP adapter (#1182)
franksinankaya Sep 27, 2019
7e50b51
http_server_httpsys.cpp requires linking against httpapi.lib, http_cl…
garethsb Oct 29, 2019
ce443d5
Update README.md (#1256)
aceash98 Oct 29, 2019
fd6aa00
remove trailing slash on websocketpp submodule url, which causes chec…
kevin-- Oct 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Release/include/cpprest/http_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,28 @@ class http_exception : public std::exception
m_msg = m_errorCode.message();
}

/// <summary>
/// Creates an <c>http_exception</c> with from a error code with a category, and a string message.
/// </summary>
/// <param name="errorCode">Error code value.</param>
/// <param name="whatArg">Error message string.</param>
http_exception(std::error_code errorCode, const utility::string_t& whatArg)
: m_errorCode(std::move(errorCode)), m_msg(utility::conversions::to_utf8string(whatArg))
{
}

#ifdef _WIN32
/// <summary>
/// Creates an <c>http_exception</c> with from a error code with a category, and a string message.
/// </summary>
/// <param name="errorCode">Error code value.</param>
/// <param name="whatArg">Error message string.</param>
http_exception(std::error_code errorCode, std::string whatArg)
: m_errorCode(std::move(errorCode)), m_msg(std::move(whatArg))
{
}
#endif

/// <summary>
/// Gets a string identifying the cause of the exception.
/// </summary>
Expand Down
66 changes: 51 additions & 15 deletions Release/src/http/client/http_client_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@ namespace
{
const std::string CRLF("\r\n");

std::string calc_cn_host(const bool secure,
const web::http::uri& baseUri,
std::string calc_cn_host(const web::http::uri& baseUri,
const web::http::http_headers& requestHeaders)
{
std::string result;
if (secure)
if (baseUri.scheme() == U("https"))
{
const utility::string_t* encResult;
const auto hostHeader = requestHeaders.find(_XPLATSTR("Host"));
Expand Down Expand Up @@ -472,7 +471,6 @@ class asio_client final : public _http_client_communicator
: _http_client_communicator(std::move(address), std::move(client_config))
, m_resolver(crossplat::threadpool::shared_instance().service())
, m_pool(std::make_shared<asio_connection_pool>())
, m_start_with_ssl(base_uri().scheme() == U("https") && !this->client_config().proxy().is_specified())
{
}

Expand All @@ -482,13 +480,13 @@ class asio_client final : public _http_client_communicator

std::shared_ptr<asio_connection> obtain_connection(const http_request& req)
{
std::string cn_host = calc_cn_host(m_start_with_ssl, base_uri(), req.headers());
std::string cn_host = calc_cn_host(base_uri(), req.headers());
std::shared_ptr<asio_connection> conn = m_pool->try_acquire(cn_host);
if (conn == nullptr)
{
// Pool was empty. Create a new connection
conn = std::make_shared<asio_connection>(crossplat::threadpool::shared_instance().service());
if (m_start_with_ssl)
if (base_uri().scheme() == U("https") && !this->client_config().proxy().is_specified())
{
conn->upgrade_to_ssl(std::move(cn_host), this->client_config().get_ssl_context_callback());
}
Expand All @@ -499,13 +497,10 @@ class asio_client final : public _http_client_communicator

virtual pplx::task<http_response> propagate(http_request request) override;

bool start_with_ssl() const CPPREST_NOEXCEPT { return m_start_with_ssl; }

tcp::resolver m_resolver;

private:
const std::shared_ptr<asio_connection_pool> m_pool;
const bool m_start_with_ssl;
};

class asio_context final : public request_context, public std::enable_shared_from_this<asio_context>
Expand Down Expand Up @@ -631,7 +626,15 @@ class asio_context final : public request_context, public std::enable_shared_fro
m_context->m_timer.reset();
//// Replace the connection. This causes old connection object to go out of scope.
auto client = std::static_pointer_cast<asio_client>(m_context->m_http_client);
m_context->m_connection = client->obtain_connection(m_context->m_request);
try
{
m_context->m_connection = client->obtain_connection(m_context->m_request);
}
catch (...)
{
m_context->report_exception(std::current_exception());
return;
}

auto endpoint = *endpoints;
m_context->m_connection->async_connect(endpoint,
Expand Down Expand Up @@ -688,7 +691,15 @@ class asio_context final : public request_context, public std::enable_shared_fro
return;
}

m_context->upgrade_to_ssl();
try
{
m_context->upgrade_to_ssl();
}
catch (...)
{
m_context->report_exception(std::current_exception());
return;
}

m_ssl_tunnel_established(m_context);
}
Expand Down Expand Up @@ -925,7 +936,7 @@ class asio_context final : public request_context, public std::enable_shared_fro
void upgrade_to_ssl()
{
auto& client = static_cast<asio_client&>(*m_http_client);
m_connection->upgrade_to_ssl(calc_cn_host(client.start_with_ssl(), client.base_uri(), m_request.headers()),
m_connection->upgrade_to_ssl(calc_cn_host(client.base_uri(), m_request.headers()),
client.client_config().get_ssl_context_callback());
}

Expand Down Expand Up @@ -1009,7 +1020,15 @@ class asio_context final : public request_context, public std::enable_shared_fro
{
// Replace the connection. This causes old connection object to go out of scope.
auto client = std::static_pointer_cast<asio_client>(m_http_client);
m_connection = client->obtain_connection(m_request);
try
{
m_connection = client->obtain_connection(m_request);
}
catch (...)
{
request_context::report_exception(std::current_exception());
return;
}

auto endpoint = *endpoints;
m_connection->async_connect(
Expand Down Expand Up @@ -1330,7 +1349,16 @@ class asio_context final : public request_context, public std::enable_shared_fro
// Create a new context and copy the request object, completion event and
// cancellation registration to maintain the old state.
// This also obtains a new connection from pool.
auto new_ctx = create_request_context(m_http_client, m_request);
std::shared_ptr<request_context> new_ctx;
try
{
new_ctx = create_request_context(m_http_client, m_request);
}
catch (...)
{
report_exception(std::current_exception());
return;
}

// If the request contains a valid instream, we try to rewind it to
// replay the just-failed request. Otherwise we assume that no data
Expand Down Expand Up @@ -1940,7 +1968,15 @@ void asio_client::send_request(const std::shared_ptr<request_context>& request_c
pplx::task<http_response> asio_client::propagate(http_request request)
{
auto self = std::static_pointer_cast<_http_client_communicator>(shared_from_this());
auto context = details::asio_context::create_request_context(self, request);
std::shared_ptr<request_context> context;
try
{
context = details::asio_context::create_request_context(self, request);
}
catch (...)
{
return pplx::task_from_exception<http_response>(std::current_exception());
}

// Use a task to externally signal the final result and completion of the task.
auto result_task = pplx::create_task(context->m_request_completion);
Expand Down