Primeiro inclua o cabeçalho necessário:
enable_tls_sni_boostbeast.cpp
#include <openssl/ssl.h>Após inicializar o boost::beast::ssl_stream, adicione o seguinte código (com host sendo um std::string contendo o hostname para conectar, como api.ipify.org):
tls_sni_set_hostname.cpp
if(!SSL_set_tlsext_host_name(stream.native_handle(), host.c_str())) {
beast::error_code ec{static_cast<int>(::ERR_get_error()), net::error::get_ssl_category()};
throw beast::system_error{ec};
}Fonte original: exemplo oficial de cliente HTTPS do boost::beast
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow