Update host string after SSL_set_tlsext_host_name

This commit is contained in:
Mohammad Nejati
2024-02-14 15:20:31 +00:00
committed by Mohammad Nejati
parent 40c22cbfa7
commit dc154bc0bd

View File

@@ -114,11 +114,6 @@ public:
if(ec) if(ec)
return fail(ec, "connect"); return fail(ec, "connect");
// Update the host_ string. This will provide the value of the
// Host HTTP header during the WebSocket handshake.
// See https://tools.ietf.org/html/rfc7230#section-5.4
host_ += ':' + std::to_string(ep.port());
// Set a timeout on the operation // Set a timeout on the operation
beast::get_lowest_layer(ws_).expires_after(std::chrono::seconds(30)); beast::get_lowest_layer(ws_).expires_after(std::chrono::seconds(30));
@@ -132,6 +127,11 @@ public:
return fail(ec, "connect"); return fail(ec, "connect");
} }
// Update the host_ string. This will provide the value of the
// Host HTTP header during the WebSocket handshake.
// See https://tools.ietf.org/html/rfc7230#section-5.4
host_ += ':' + std::to_string(ep.port());
// Perform the SSL handshake // Perform the SSL handshake
ws_.next_layer().async_handshake( ws_.next_layer().async_handshake(
ssl::stream_base::client, ssl::stream_base::client,