Skip to content

Commit 5b32e16

Browse files
vadzBillyONeal
authored andcommitted
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.
1 parent 0f45af1 commit 5b32e16

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Release/src/http/client/http_client_asio.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,8 @@ class asio_context final : public request_context, public std::enable_shared_fro
905905
}
906906
};
907907

908-
if (proxy_type == http_proxy_type::ssl_tunnel)
908+
// Note that we must not try to CONNECT using an already established connection via proxy -- this would send CONNECT to the end server which is definitely not what we want.
909+
if (proxy_type == http_proxy_type::ssl_tunnel && !m_connection->is_reused())
909910
{
910911
// The ssl_tunnel_proxy keeps the context alive and then calls back once the ssl tunnel is established via
911912
// 'start_http_request_flow'

0 commit comments

Comments
 (0)