Skip to content

Commit 25954be

Browse files
author
Peter Thorson
committed
Additional documentation and adjustment to support standalone asio and c++03 references #924
1 parent 21bc438 commit 25954be

File tree

1 file changed

+9
-3
lines changed
  • websocketpp/transport/asio/security

1 file changed

+9
-3
lines changed

websocketpp/transport/asio/security/tls.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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)) {

0 commit comments

Comments
 (0)