Manages the handling of HTTP messages and WebSocket upgrade requests in an HTTP connection. More...
#include <HttpSession.hpp>
Inherits enable_shared_from_this< HttpSession >.
Public Member Functions | |
HttpSession (Impl::HttpSessions &httpSessions_, Impl::ClientSessions &clientSessions_, std::shared_ptr< HttpServerConfiguration > serverConfiguration_, TCP::socket &&socket_) | |
Create an HTTP session object with the supplied data. More... | |
void | close () |
Close the session if it is still open. More... | |
HttpServerConfiguration & | configuration () const |
Get the shared state of the http server. More... | |
void | doRead () |
Address | remoteIpAddress () const |
Get the requester's IP address for logging. More... | |
template<typename BodyT > | |
void | sendResponse (Response< BodyT > &&response, const std::string &extraLogging="") |
Send the response back to the client. More... | |
template<typename BodyT > | |
void | sendResponse (Response< BodyT > &&response, const BalauLogger &log, const std::string &extraLogging="") |
Send the response back to the client. More... | |
Manages the handling of HTTP messages and WebSocket upgrade requests in an HTTP connection.
Holds a pointer to the private session information object for the client.
Multiple HTTP sessions may occur within the lifetime of a single client session.
HttpSession | ( | Impl::HttpSessions & | httpSessions_, |
Impl::ClientSessions & | clientSessions_, | ||
std::shared_ptr< HttpServerConfiguration > | serverConfiguration_, | ||
TCP::socket && | socket_ | ||
) |
Create an HTTP session object with the supplied data.
owner_ | the owning HTTP session manager |
clientSessions_ | the HTTP client session manager |
serverConfiguration_ | the configuration of the HTTP server that created this session |
socket_ | the session socket |
void close | ( | ) |
Close the session if it is still open.
|
inline |
Get the shared state of the http server.
void doRead | ( | ) |
NetworkException | if there was an issue reading |
|
inline |
Get the requester's IP address for logging.
|
inline |
Send the response back to the client.
Called by handlers.
|
inline |
Send the response back to the client.
Called by handlers.