forked from boostorg/beast
Update WebSocket examples to set TLS SNI
This commit is contained in:
@@ -114,6 +114,16 @@ public:
|
||||
// Set a timeout on the operation
|
||||
beast::get_lowest_layer(ws_).expires_after(std::chrono::seconds(30));
|
||||
|
||||
// Set SNI Hostname (many hosts need this to handshake successfully)
|
||||
if(! SSL_set_tlsext_host_name(
|
||||
ws_.next_layer().native_handle(),
|
||||
host_.c_str()))
|
||||
{
|
||||
ec = beast::error_code(static_cast<int>(::ERR_get_error()),
|
||||
net::error::get_ssl_category());
|
||||
return fail(ec, "connect");
|
||||
}
|
||||
|
||||
// Perform the SSL handshake
|
||||
ws_.next_layer().async_handshake(
|
||||
ssl::stream_base::client,
|
||||
|
||||
Reference in New Issue
Block a user