File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
websocketpp/transport/asio/security Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -235,11 +235,17 @@ class connection : public lib::enable_shared_from_this<connection> {
235235 // For clients on systems with a suitable OpenSSL version, set the
236236 // TLS SNI hostname header so connecting to TLS servers using SNI
237237 // will work.
238- auto host = m_uri->get_host ();
238+ std::string const & host = m_uri->get_host ();
239239 lib::asio::error_code ec_addr;
240- boost::asio::ip::address addr = boost::asio::ip::make_address (host, ec_addr);
240+
241+ // run the hostname through make_address to check if it is a valid IP literal
242+ lib::asio::ip::address addr = lib::asio::ip::make_address (host, ec_addr);
243+
244+ // If the parsing as an IP literal fails, proceed to register the hostname
245+ // with the TLS handshake via SNI.
246+ // The SNI applies only to DNS host names, not for IP addresses
247+ // See RFC3546 Section 3.1
241248 if (ec_addr) {
242- // The SNI applies only to DNS host names, not for IP addresses
243249 long res = SSL_set_tlsext_host_name (
244250 get_socket ().native_handle (), host.c_str ());
245251 if (!(1 == res)) {
You can’t perform that action at this time.
0 commit comments