99template<
typename Lambda >
107template<
typename Lambda >
112 throw exception_t{
"an attempt to call inspect_tls for "
113 "non-TLS-connection" };
118template<
typename Lambda,
typename T >
125 return default_value;
135 typename Timer_Factory,
138 typename Strand = asio_ns::strand< default_asio_executor > >
146 typename Timer_Factory,
160template <
typename Connection,
typename Start_Read_CB,
typename Failed_CB >
165 Start_Read_CB start_read_cb,
166 Failed_CB failed_cb )
169 asio_ns::ssl::stream_base::server,
170 [ start_read_cb = std::move( start_read_cb ),
171 failed_cb = std::move( failed_cb ),
172 con = con.shared_from_this() ](
const asio_ns::error_code & ec ){
188template <
typename Settings >
202 asio_ns::ssl::context context ) &
205 std::move( context ) );
212 asio_ns::ssl::context context ) &&
214 return std::move( this->
tls_context( std::move( context ) ) );
248 std::shared_ptr< asio_ns::ssl::context > shared_context ) &
289 std::shared_ptr< asio_ns::ssl::context > shared_context ) &&
291 return std::move( this->
tls_context( std::move(shared_context) ) );
301 std::shared_ptr< asio_ns::ssl::context >
311 return static_cast< Settings &
>( *this );
315 std::make_shared< asio_ns::ssl::context >(
316 asio_ns::ssl::context::sslv23 )
340 template <
typename Settings >
343 asio_ns::io_context & io_context )
347 m_sockets.reserve( settings.concurrent_accepts_count() );
349 while(
m_sockets.size() < settings.concurrent_accepts_count() )
351 m_sockets.emplace_back( m_io_context, m_tls_context );
decltype(auto) inspect_tls_or_throw(Lambda &&lambda) const
Calls the specified lambda-function if the accepted connection is a TLS-connection.
T inspect_tls_or_default(Lambda &&lambda, T &&default_value) const
Calls the specified lambda-function if the accepted connection is a TLS-connection.
tls_socket_t * m_tls_socket
An optional pointer to TLS-related connection.
void try_inspect_tls(Lambda &&lambda) const
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Accessor to TLS-specific information related to a connection.
tls_accessor_t(tls_socket_t &tls_socket)
auto native_handle() const noexcept
Get the access to native handle behind Asio's ssl_stream.
tls_socket_t & m_tls_socket
Exception class for all exceptions thrown by RESTinio.
asio_ns::io_context & m_io_context
tls_socket_t & socket(std::size_t idx)
virtual ~socket_supplier_t()=default
auto concurrent_accept_sockets_count() const
The number of sockets that can be used for cuncurrent accept operations.
std::shared_ptr< asio_ns::ssl::context > m_tls_context
std::vector< tls_socket_t > m_sockets
auto move_socket(std::size_t idx)
socket_supplier_t(Settings &settings, asio_ns::io_context &io_context)
Socket adapter for asio::ssl::stream< asio::ip::tcp::socket >.
auto async_handshake(Args &&... args)
Settings & tls_context(std::shared_ptr< asio_ns::ssl::context > shared_context) &
Setup a shared TLS-context for server's settings.
socket_type_dependent_settings_t()=default
Settings && tls_context(std::shared_ptr< asio_ns::ssl::context > shared_context) &&
Setup a shared TLS-context for server's settings.
Settings & upcast_reference()
std::shared_ptr< asio_ns::ssl::context > m_tls_context
Settings && tls_context(asio_ns::ssl::context context) &&
Setup an exclusive TLS-context for server's settings.
~socket_type_dependent_settings_t()=default
socket_type_dependent_settings_t(socket_type_dependent_settings_t &&)=default
Settings & tls_context(asio_ns::ssl::context context) &
Setup an exclusive TLS-context for server's settings.
std::shared_ptr< asio_ns::ssl::context > giveaway_tls_context()
Get away the TLS-context from settings.
tls_socket_t * make_tls_socket_pointer_for_state_listener(asio_ns::ip::tcp::socket &) noexcept
std::function< request_handling_status_t(request_handle_t) > default_request_handler_t
traits_t< Timer_Factory, Logger, Request_Handler, Strand, tls_socket_t > tls_traits_t
impl::tls_socket_t tls_socket_t
A public alias for the actual implementation of TLS-socket.
tls_traits_t< asio_timer_manager_t, null_logger_t > default_tls_traits_t
tls_traits_t< Timer_Factory, Logger, Request_Handler, noop_strand_t > single_thread_tls_traits_t
void prepare_connection_and_start_read(tls_socket_t &socket, Connection &con, Start_Read_CB start_read_cb, Failed_CB failed_cb)
Customizes connection init routine with an additional step: perform handshake and only then start rea...