Skip to content

Commit

Permalink
Fix reusing ASIO http_client connecting to HTTPS server via proxy (#539)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vadz authored and BillyONeal committed Jun 13, 2019
1 parent 0f45af1 commit 5b32e16
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Release/src/http/client/http_client_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,8 @@ class asio_context final : public request_context, public std::enable_shared_fro
}
};

if (proxy_type == http_proxy_type::ssl_tunnel)
// 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.
if (proxy_type == http_proxy_type::ssl_tunnel && !m_connection->is_reused())
{
// The ssl_tunnel_proxy keeps the context alive and then calls back once the ssl tunnel is established via
// 'start_http_request_flow'
Expand Down

0 comments on commit 5b32e16

Please sign in to comment.