Malloy
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
malloy::server::http::connection< Derived > Class Template Reference

#include <connection.hpp>

Collaboration diagram for malloy::server::http::connection< Derived >:
Collaboration graph
[legend]

Classes

struct  config
 
class  handler
 
class  request_generator
 

Public Member Functions

 connection (std::shared_ptr< spdlog::logger > logger, boost::beast::flat_buffer buffer, std::shared_ptr< handler > router, std::shared_ptr< const std::filesystem::path > http_doc_root)
 
std::shared_ptr< spdlog::logger > logger () const noexcept
 
template<bool isRequest, class Body , class Fields >
void do_write (boost::beast::http::message< isRequest, Body, Fields > &&msg)
 
void do_read ()
 

Public Attributes

struct config cfg
 

Protected Member Functions

void report_err (malloy::error_code ec, std::string_view context)
 

Protected Attributes

boost::beast::flat_buffer m_buffer
 

Friends

class request_generator
 

Detailed Description

template<class Derived>
class malloy::server::http::connection< Derived >

An HTTP server connection.

Note
This uses CRTP to allow using the same code for different connection types (eg. plain or TLS).
See also
connection_plain
connection_tls

Constructor & Destructor Documentation

◆ connection()

template<class Derived >
malloy::server::http::connection< Derived >::connection ( std::shared_ptr< spdlog::logger >  logger,
boost::beast::flat_buffer  buffer,
std::shared_ptr< handler router,
std::shared_ptr< const std::filesystem::path >  http_doc_root 
)
inline

Constructor

Parameters
logger
buffer
router
http_doc_root

Member Function Documentation

◆ do_write()

template<class Derived >
template<bool isRequest, class Body , class Fields >
void malloy::server::http::connection< Derived >::do_write ( boost::beast::http::message< isRequest, Body, Fields > &&  msg)
inline

Perform an asynchronous write.

Template Parameters
isRequestWhether the message is a request (or a response).
BodyThe request body type.
FieldsThe request fields type.
Parameters
msgThe request.

◆ logger()

template<class Derived >
std::shared_ptr< spdlog::logger > malloy::server::http::connection< Derived >::logger ( ) const
inlinenoexcept

Get the logger instance.

This allows different components to log to the connection specific logger.

Returns
The logger instance.

Member Data Documentation

◆ cfg

template<class Derived >
struct config malloy::server::http::connection< Derived >::cfg

The connection configuration.


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