Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::SslHttpSession< HandlerType > Class Template Reference

Represents a HTTPS connection established by a client. More...

#include <SslHttpSession.hpp>

Inheritance diagram for web::SslHttpSession< HandlerType >:
Collaboration diagram for web::SslHttpSession< HandlerType >:

Public Member Functions

 SslHttpSession (tcp::socket &&socket, std::string const &ip, std::shared_ptr< AdminVerificationStrategy > const &adminVerification, boost::asio::ssl::context &ctx, std::reference_wrapper< util::TagDecoratorFactory const > tagFactory, std::reference_wrapper< dosguard::DOSGuardInterface > dosGuard, std::shared_ptr< HandlerType > const &handler, boost::beast::flat_buffer buffer, std::uint32_t maxWsSendingQueueSize)
 Create a new SSL session.
 
boost::beast::ssl_stream< boost::beast::tcp_stream > & stream ()
 
void run ()
 Initiates the handshake.
 
void onHandshake (boost::beast::error_code ec, std::size_t bytesUsed)
 Handles the handshake.
 
void doClose ()
 Closes the underlying connection.
 
void onShutdown (boost::beast::error_code ec)
 Handles a connection shutdown.
 
void upgrade ()
 Upgrades connection to secure websocket.
 
- Public Member Functions inherited from web::impl::HttpBase< SslHttpSession, HandlerType >
 HttpBase (std::string const &ip, std::reference_wrapper< util::TagDecoratorFactory const > tagFactory, std::shared_ptr< AdminVerificationStrategy > adminVerification, std::reference_wrapper< dosguard::DOSGuardInterface > dosGuard, std::shared_ptr< HandlerType > handler, boost::beast::flat_buffer buffer)
 
void doRead ()
 
void onRead (boost::beast::error_code ec, std::size_t bytesTransferred)
 
void send (std::string &&msg, http::status status=http::status::ok) override
 Send a response to the client The message length will be added to the DOSGuard, if the limit is reached, a warning will be added to the response.
 
SubscriptionContextPtr makeSubscriptionContext (util::TagDecoratorFactory const &) override
 Get the subscription context for this connection.
 
void onWrite (bool close, boost::beast::error_code ec, std::size_t bytesTransferred)
 
- Public Member Functions inherited from web::ConnectionBase
 ConnectionBase (util::TagDecoratorFactory const &tagFactory, std::string ip)
 Create a new connection base.
 
virtual void send (std::shared_ptr< std::string > msg)
 Send via shared_ptr of string, that enables SubscriptionManager to publish to clients.
 
bool dead ()
 Indicates whether the connection had an error and is considered dead.
 
bool isAdmin () const
 Indicates whether the connection has admin privileges.
 
- Public Member Functions inherited from util::Taggable
 Taggable (Taggable &&)=default
 
Taggableoperator= (Taggable &&)=default
 
BaseTagDecorator const & tag () const
 Getter for tag decorator.
 

Additional Inherited Members

- Public Attributes inherited from web::ConnectionBase
std::string const clientIp
 
bool upgraded = false
 
- Protected Member Functions inherited from web::impl::HttpBase< SslHttpSession, HandlerType >
void httpFail (boost::beast::error_code ec, char const *what)
 
- Protected Member Functions inherited from util::Taggable
 Taggable (util::TagDecoratorFactory const &tagFactory)
 New Taggable from a specified factory.
 
- Protected Attributes inherited from web::impl::HttpBase< SslHttpSession, HandlerType >
boost::beast::flat_buffer buffer_
 
http::request< http::string_body > req_
 
std::reference_wrapper< dosguard::DOSGuardInterfacedosGuard_
 
std::shared_ptr< HandlerType > const handler_
 
util::Logger log_
 
util::Logger perfLog_
 
- Protected Attributes inherited from web::ConnectionBase
boost::system::error_code ec_
 
bool isAdmin_ = false
 

Detailed Description

template<SomeServerHandler HandlerType>
class web::SslHttpSession< HandlerType >

Represents a HTTPS connection established by a client.

It will handle the upgrade to secure websocket, pass the ownership of the socket to the upgrade session. Otherwise, it will pass control to the base class.

Template Parameters
HandlerTypeThe type of the server handler to use

Constructor & Destructor Documentation

◆ SslHttpSession()

template<SomeServerHandler HandlerType>
web::SslHttpSession< HandlerType >::SslHttpSession ( tcp::socket && socket,
std::string const & ip,
std::shared_ptr< AdminVerificationStrategy > const & adminVerification,
boost::asio::ssl::context & ctx,
std::reference_wrapper< util::TagDecoratorFactory const > tagFactory,
std::reference_wrapper< dosguard::DOSGuardInterface > dosGuard,
std::shared_ptr< HandlerType > const & handler,
boost::beast::flat_buffer buffer,
std::uint32_t maxWsSendingQueueSize )
inlineexplicit

Create a new SSL session.

Parameters
socketThe socket. Ownership is transferred to HttpSession
ipClient's IP address
adminVerificationThe admin verification strategy to use
ctxThe SSL context
tagFactoryA factory that is used to generate tags to track requests and sessions
dosGuardThe denial of service guard to use
handlerThe server handler to use
bufferBuffer with initial data received from the peer
maxWsSendingQueueSizeThe maximum size of the sending queue for websocket

Member Function Documentation

◆ onHandshake()

template<SomeServerHandler HandlerType>
void web::SslHttpSession< HandlerType >::onHandshake ( boost::beast::error_code ec,
std::size_t bytesUsed )
inline

Handles the handshake.

Parameters
ecError code if any
bytesUsedThe total amount of data read from the stream

◆ onShutdown()

template<SomeServerHandler HandlerType>
void web::SslHttpSession< HandlerType >::onShutdown ( boost::beast::error_code ec)
inline

Handles a connection shutdown.

Parameters
ecError code if any

◆ stream()

template<SomeServerHandler HandlerType>
boost::beast::ssl_stream< boost::beast::tcp_stream > & web::SslHttpSession< HandlerType >::stream ( )
inline
Returns
The SSL stream.

The documentation for this class was generated from the following file: