Malloy
Loading...
Searching...
No Matches
malloy::server::http::connection< Derived > Class Template Reference

#include <connection.hpp>

Collaboration diagram for malloy::server::http::connection< Derived >:

Classes

class  request_generator
class  handler
struct  config

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
Here is the call graph for this function:

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
inlinenodiscardnoexcept

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: