Skip to content

Commit

Permalink
Update host string after SSL_set_tlsext_host_name
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Feb 14, 2024
1 parent 40c22cb commit dc154bc
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ class session : public std::enable_shared_from_this<session>
if(ec)
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
beast::get_lowest_layer(ws_).expires_after(std::chrono::seconds(30));

Expand All @@ -132,6 +127,11 @@ class session : public std::enable_shared_from_this<session>
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
ws_.next_layer().async_handshake(
ssl::stream_base::client,
Expand Down

0 comments on commit dc154bc

Please sign in to comment.