Boost logo

Boost Users :

From: Richard Hodges (hodges.r_at_[hidden])
Date: 2022-05-01 10:14:33


On Sun, 1 May 2022 at 09:11, B Aleck via Boost-users <
boost-users_at_[hidden]> 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_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net