3#include "connection.hpp"
4#include "../../core/tcp/stream.hpp"
6#include <boost/beast/ssl/ssl_stream.hpp>
8namespace malloy::client::http
14 template<
typename... ConnArgs>
16 public connection<connection_tls<ConnArgs...>, ConnArgs...>,
17 public std::enable_shared_from_this<connection_tls<ConnArgs...>>
23 std::shared_ptr<spdlog::logger> logger,
24 boost::asio::io_context& io_ctx,
25 boost::asio::ssl::context& tls_ctx,
26 const std::uint64_t body_limit
28 parent_t(std::move(logger), body_limit),
29 m_stream(boost::asio::make_strand(io_ctx), tls_ctx)
35 boost::beast::ssl_stream<malloy::tcp::stream<>>&
43 boost::asio::awaitable<void>
47 parent_t::set_stream_timeout(std::chrono::seconds(30));
48 co_await m_stream.async_handshake(boost::asio::ssl::stream_base::client);
62 const std::string str{ hostname };
65 if (!SSL_set_tlsext_host_name(m_stream.native_handle(), str.c_str()))
66 return {
static_cast<int>(::ERR_get_error()), boost::asio::error::get_ssl_category()};
69 if (!SSL_set1_host(m_stream.native_handle(), str.c_str())) {
70 return {
static_cast<int>(::ERR_get_error()), boost::asio::error::get_ssl_category()};
77 boost::beast::ssl_stream<malloy::tcp::stream<>> m_stream;
Definition: connection_tls.hpp:18
malloy::error_code set_hostname(const std::string_view hostname)
Definition: connection_tls.hpp:59
Definition: connection.hpp:34
boost::beast::error_code error_code
Error code used to signify errors without throwing. Truthy means it holds an error.
Definition: error.hpp:9