Skip to content

Commit 21217ab

Browse files
committed
Fix SNI host for tls protocol over proxy
1 parent bdda9e0 commit 21217ab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/RequestImpl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,13 @@ class RequestImpl : public Request {
857857
});
858858
}
859859

860+
const string sni_host = (protocol_type == Connection::Type::HTTPS)
861+
? parsed_url_.GetHost().to_string()
862+
: address_it->host_name();
863+
860864
RESTC_CPP_LOG_TRACE_("RequestImpl::Connect: calling AsyncConnect --> " << endpoint);
861865
connection->GetSocket().AsyncConnect(
862-
endpoint, address_it->host_name(),
866+
endpoint, sni_host,
863867
properties_->tcpNodelay, ctx.GetYield());
864868
RESTC_CPP_LOG_TRACE_("RequestImpl::Connect: OK AsyncConnect --> " << endpoint);
865869
return connection;
@@ -869,7 +873,7 @@ class RequestImpl : public Request {
869873
connection->GetSocket().GetSocket().close();
870874

871875
if (ex.code() == boost::system::errc::resource_unavailable_try_again) {
872-
if ( retries < 8) {
876+
if ( retries < 8 ) {
873877
RESTC_CPP_LOG_DEBUG_(
874878
"RequestImpl::Connect:: Caught boost::system::system_error exception: \""
875879
<< ex.what()

0 commit comments

Comments
 (0)