HTTP session for api service.
More...
#include <http_session.hpp>
|
void | stop () |
| stops session More...
|
|
template<class Body > |
void | handleRequest (Request< Body > &&request) |
| process http request, compose and execute response More...
|
|
void | asyncRead () |
| asynchronously read http message More...
|
|
template<class Message > |
void | asyncWrite (Message &&message) |
| sends http message More...
|
|
void | onRead (boost::system::error_code ec, std::size_t size) |
| read completion callback More...
|
|
void | onWrite (boost::system::error_code ec, std::size_t, bool close) |
| write completion callback More...
|
|
auto | makeBadResponse (std::string_view message, unsigned version, bool keep_alive) |
| composes bad request message More...
|
|
void | reportError (boost::system::error_code ec, std::string_view message) |
| reports error code and message More...
|
|
|
static constexpr boost::string_view | kServerName = "Kagome" |
|
HTTP session for api service.
Definition at line 22 of file http_session.hpp.
kagome::api::HttpSession::~HttpSession |
( |
| ) |
|
|
overridedefault |
constructor
- Parameters
-
socket | socket instance |
config | session configuration |
Definition at line 14 of file http_session.cpp.
void kagome::api::HttpSession::asyncRead |
( |
| ) |
|
|
private |
template<class Message >
void kagome::api::HttpSession::asyncWrite |
( |
Message && |
message | ) |
|
|
private |
sends http message
- Template Parameters
-
- Parameters
-
Definition at line 69 of file http_session.cpp.
template<class Body >
void kagome::api::HttpSession::handleRequest |
( |
boost::beast::http::request< Body > && |
req | ) |
|
template<class Body >
void kagome::api::HttpSession::handleRequest |
( |
Request< Body > && |
request | ) |
|
|
private |
process http request, compose and execute response
- Template Parameters
-
- Parameters
-
SessionId kagome::api::HttpSession::id |
( |
| ) |
const |
|
inlineoverridevirtual |
auto kagome::api::HttpSession::makeBadResponse |
( |
std::string_view |
message, |
|
|
unsigned |
version, |
|
|
bool |
keep_alive |
|
) |
| |
|
private |
composes bad request
message
- Parameters
-
message | text to send |
version | protocol version |
keep_alive | true if server should keep connection alive, false otherwise |
- Returns
- composed request
Definition at line 29 of file http_session.cpp.
void kagome::api::HttpSession::onRead |
( |
boost::system::error_code |
ec, |
|
|
std::size_t |
size |
|
) |
| |
|
private |
void kagome::api::HttpSession::onWrite |
( |
boost::system::error_code |
ec, |
|
|
std::size_t |
, |
|
|
bool |
close |
|
) |
| |
|
private |
void kagome::api::HttpSession::reportError |
( |
boost::system::error_code |
ec, |
|
|
std::string_view |
message |
|
) |
| |
|
private |
reports error code and message
- Parameters
-
ec | error code |
message | error message |
Definition at line 128 of file http_session.cpp.
void kagome::api::HttpSession::respond |
( |
std::string_view |
response | ) |
|
|
overridevirtual |
Socket& kagome::api::HttpSession::socket |
( |
| ) |
|
|
inlineoverridevirtual |
void kagome::api::HttpSession::start |
( |
| ) |
|
|
overridevirtual |
void kagome::api::HttpSession::stop |
( |
| ) |
|
|
private |
boost::beast::flat_buffer kagome::api::HttpSession::buffer_ |
|
private |
constexpr boost::string_view kagome::api::HttpSession::kServerName = "Kagome" |
|
staticprivate |
std::unique_ptr<Parser> kagome::api::HttpSession::parser_ |
|
private |
boost::asio::strand<boost::asio::io_context::executor_type> kagome::api::HttpSession::strand_ |
|
private |
Strand to ensure the connection's handlers are not called concurrently.
Definition at line 147 of file http_session.hpp.
boost::beast::tcp_stream kagome::api::HttpSession::stream_ |
|
private |
The documentation for this class was generated from the following files: