[Boost.Asio] [SSL] Can I set the host name before performing a handshake?
In openssl you call SSL_set_tlsext_host_name to set that Can I do that in boost?
On Sun, 1 May 2022 at 09:11, B Aleck via Boost-users < boost-users@lists.boost.org> wrote:
In openssl you call SSL_set_tlsext_host_name to set that Can I do that in boost?
Yes. Example from one of my projects: asio::awaitable< void > connect(ssl::stream< tcp::socket > &stream, std::string const &host, std::string const &service) { using asio::use_awaitable; co_await connect(stream.next_layer(), host, service); // ==================== Set TLS host name here ==================== if (!SSL_set_tlsext_host_name(stream.native_handle(), host.c_str())) throw sys::system_error(ERR_get_error(), asio::error::get_ssl_category()); // ================================================================ co_await stream.async_handshake(ssl::stream_base::client, use_awaitable); }
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks a lot. It's helpful
________________________________
发件人: Boost-users
participants (2)
-
B Aleck
-
Richard Hodges