MySQL 26.7.0
Source Code Documentation
http::server::ServerConnection< Socket > Class Template Reference

#include <connection.h>

Inheritance diagram for http::server::ServerConnection< Socket >:
[legend]

Classes

struct  BodyHeadersValidationResult
 
class  ConnectionStatusCallbacks
 
struct  SessionData
 

Public Types

using Parent = http::base::Connection< Socket >
 
using SessionId = uint32_t
 
- Public Types inherited from http::base::Connection< Socket >
using This = Connection< Socket >
 
using ConnectionStatusCallbacks = http::base::ConnectionStatusCallbacks< This >
 
using Methods = base::method::Bitset
 
using Headers = http::base::Headers
 
using owned_buffer = http::base::details::owned_buffer
 
using ref_buffers = http::base::details::ref_buffers< std::list< owned_buffer > >
 
using IO = Socket
 
- Public Types inherited from http::base::ConnectionInterface
using IOBuffer = http::base::IOBuffer
 
using Headers = http::base::Headers
 

Public Member Functions

 ServerConnection (Socket s, base::method::Bitset *allowed_method, RequestHandlerInterface *rhi, ConnectionStatusCallbacks *connection_handler)
 
bool send (const uint32_t *stream_id_ptr, const int status_code, const std::string &method, const std::string &path, const typename Parent::Headers &headers, const http::base::IOBuffer &data) override
 
- Public Member Functions inherited from http::base::Connection< Socket >
 Connection (Socket s, base::method::Bitset *allowed_method, ConnectionStatusCallbacks *connection_handler, CNO_CONNECTION_KIND kind, CNO_HTTP_VERSION version)
 
 ~Connection () override
 
void shutdown (bool) override
 
bool send (const uint32_t *stream_id_ptr, const int status_code, const std::string &method, const std::string &path, const Headers &headers, const IOBuffer &data) override
 
std::string get_peer_address () const override
 
uint16_t get_peer_port () const override
 
Socket & get_socket ()
 
void start () override
 
- Public Member Functions inherited from http::base::ConnectionInterface
virtual ~ConnectionInterface ()
 
- Public Member Functions inherited from http::cno::CnoInterface
virtual ~CnoInterface ()
 

Static Public Member Functions

static std::optional< uint64_t > parse_content_length (std::string_view content_length_value)
 
static bool body_size_exceeds_limit (uint64_t max_size, uint64_t current_size, size_t next_chunk_size)
 
static bool body_size_exceeds_limit (uint64_t limit, size_t body_size)
 
static void update_body_related_header (std::string_view name, std::string_view value, BodyHeadersValidationResult &result)
 

Private Member Functions

int on_settings () override
 
int on_cno_message_body (const uint32_t session_id, const char *data, const size_t size) override
 
int on_cno_message_tail (const uint32_t session_id, const cno_tail_t *tail) override
 
int on_cno_stream_end (const uint32_t id) override
 
int on_cno_message_head (const uint32_t session_id, const cno_message_t *msg) override
 

Private Attributes

bool first_request_ {true}
 
std::map< SessionId, SessionDatasessions_
 
RequestHandlerInterfacerequest_handler_
 
ConnectionStatusCallbacksconnection_handler_
 

Additional Inherited Members

- Protected Member Functions inherited from http::base::Connection< Socket >
void do_net_send ()
 
void do_net_recv ()
 
Pending on_net_receive (const std::error_code &ec, std::size_t bytes_transferred)
 
Pending on_net_send (const std::error_code &ec, size_t size)
 
void resume ()
 
void suspend ()
 
bool stop_running ()
 Mark the connection that it should stop running. More...
 
virtual void on_output_buffer_empty ()
 
void send_bad_request_and_close ()
 
void prepare_h1_error_response_stream (uint32_t stream_id)
 
int on_cno_writev (const cno_buffer_t *buffer, size_t count) override
 
int on_cno_message_tail (const uint32_t session_id, const cno_tail_t *tail) override
 
int on_cno_stream_start (const uint32_t id) override
 
int on_cno_close () override
 
- Static Protected Member Functions inherited from http::base::Connection< Socket >
static std::optional< std::string_view > invalid_request_body_headers_rejection_reason (const cno_error_t *ec)
 
- Protected Attributes inherited from http::base::Connection< Socket >
bool keep_alive_
 
Socket socket_
 
Methodsallowed_method_
 
cno_connection_t cno_
 
uint8_t input_buffer_ [512]
 
net::mutable_buffer input_mutable_buffer_
 
std::mutex output_buffer_mutex_
 
std::list< owned_bufferoutput_buffers_
 
std::atomic< bool > output_pending_
 
std::atomic< bool > reading_pending_
 
std::atomic< bool > running_
 
std::atomic< bool > suspend_
 
ConnectionStatusCallbacksconnection_handler_
 

Member Typedef Documentation

◆ Parent

◆ SessionId

template<typename Socket >
using http::server::ServerConnection< Socket >::SessionId = uint32_t

Constructor & Destructor Documentation

◆ ServerConnection()

template<typename Socket >
http::server::ServerConnection< Socket >::ServerConnection ( Socket  s,
base::method::Bitset allowed_method,
RequestHandlerInterface rhi,
ConnectionStatusCallbacks connection_handler 
)
inline

Member Function Documentation

◆ body_size_exceeds_limit() [1/2]

template<typename Socket >
static bool http::server::ServerConnection< Socket >::body_size_exceeds_limit ( uint64_t  limit,
size_t  body_size 
)
inlinestatic

◆ body_size_exceeds_limit() [2/2]

template<typename Socket >
static bool http::server::ServerConnection< Socket >::body_size_exceeds_limit ( uint64_t  max_size,
uint64_t  current_size,
size_t  next_chunk_size 
)
inlinestatic

◆ on_cno_message_body()

template<typename Socket >
int http::server::ServerConnection< Socket >::on_cno_message_body ( const uint32_t  session_id,
const char *  data,
const size_t  size 
)
inlineoverrideprivatevirtual

◆ on_cno_message_head()

template<typename Socket >
int http::server::ServerConnection< Socket >::on_cno_message_head ( const uint32_t  session_id,
const cno_message_t *  msg 
)
inlineoverrideprivatevirtual

◆ on_cno_message_tail()

template<typename Socket >
int http::server::ServerConnection< Socket >::on_cno_message_tail ( const uint32_t  session_id,
const cno_tail_t *  tail 
)
inlineoverrideprivatevirtual

◆ on_cno_stream_end()

template<typename Socket >
int http::server::ServerConnection< Socket >::on_cno_stream_end ( const uint32_t  id)
inlineoverrideprivatevirtual

◆ on_settings()

template<typename Socket >
int http::server::ServerConnection< Socket >::on_settings ( )
inlineoverrideprivatevirtual

◆ parse_content_length()

template<typename Socket >
static std::optional< uint64_t > http::server::ServerConnection< Socket >::parse_content_length ( std::string_view  content_length_value)
inlinestatic

◆ send()

template<typename Socket >
bool http::server::ServerConnection< Socket >::send ( const uint32_t *  stream_id_ptr,
const int  status_code,
const std::string &  method,
const std::string &  path,
const typename Parent::Headers headers,
const http::base::IOBuffer data 
)
inlineoverride

◆ update_body_related_header()

template<typename Socket >
static void http::server::ServerConnection< Socket >::update_body_related_header ( std::string_view  name,
std::string_view  value,
BodyHeadersValidationResult result 
)
inlinestatic

Member Data Documentation

◆ connection_handler_

template<typename Socket >
ConnectionStatusCallbacks* http::server::ServerConnection< Socket >::connection_handler_
private

◆ first_request_

template<typename Socket >
bool http::server::ServerConnection< Socket >::first_request_ {true}
private

◆ request_handler_

template<typename Socket >
RequestHandlerInterface* http::server::ServerConnection< Socket >::request_handler_
private

◆ sessions_

template<typename Socket >
std::map<SessionId, SessionData> http::server::ServerConnection< Socket >::sessions_
private

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