Re: [Boost.Asio] [SSL] Can I set the host name before performing a handshake?
Richard Hodges via Boost-users <[email protected]>
| Newsgroups | gmane.comp.lib.boost.user |
|---|---|
| Message-ID | <CALvx3hbFTGYssQpmfrodX8tQCyL0kwJEEn6Wn8eV-urpZo3-nQ@mail.gmail.com> |
On Sun, 1 May 2022 at 09:11, B Aleck via Boost-users < [email protected]> 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 > [email protected] > https://lists.boost.org/mailman/listinfo.cgi/boost-users > _______________________________________________ Boost-users mailing list [email protected] https://lists.boost.org/mailman/listinfo.cgi/boost-users