Replace SSL_set1_host with asio::ssl::host_name_verification

`SSL_set1_host` fails when host is an IP address
This commit is contained in:
Mohammad Nejati authored and Mohammad Nejati committed 2025-02-13 20:09:44 +03:30
1 parent ea38d841b0
commit ee2b5b2ff9
9 files changed
+34 -74

No files matched your search

@@ -81,12 +81,7 @@ int main(int argc, char** argv)
}
// Set the expected hostname in the peer certificate for verification
if(! SSL_set1_host(ws.next_layer().native_handle(), host.c_str()))
{
throw beast::system_error(
static_cast<int>(::ERR_get_error()),
net::error::get_ssl_category());
}
ws.next_layer().set_verify_callback(ssl::host_name_verification(host));
// Update the host_ string. This will provide the value of the
// Host HTTP header during the WebSocket handshake.