diff --git a/CHANGELOG.md b/CHANGELOG.md index 19310b31..e724bf71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ Version XXX: +* Fix TLS SNI handling in websocket_client_async_ssl example. * Fix reuse of sliding window in WebSocket permessage_deflate. * Fix accept error handling in http_server_async example. * Move library-specific docca configuration to Beast. diff --git a/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp index a5b0c61b..5112a7f9 100644 --- a/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -106,11 +106,6 @@ public: 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)); @@ -124,6 +119,11 @@ public: 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,