9 #ifndef CPPSERVER_HTTP_HTTPS_SESSION_H
10 #define CPPSERVER_HTTP_HTTPS_SESSION_H
15 #include "cache/filecache.h"
41 CppCommon::FileCache&
cache() noexcept {
return _cache; }
42 const CppCommon::FileCache&
cache() const noexcept {
return _cache; }
94 size_t SendResponseBody(std::string_view body,
const CppCommon::Timespan& timeout) {
return Send(body, timeout); }
102 size_t SendResponseBody(
const void* buffer,
size_t size,
const CppCommon::Timespan& timeout) {
return Send(buffer, size, timeout); }
131 void onReceived(
const void* buffer,
size_t size)
override;
183 CppCommon::FileCache& _cache;
185 void onReceivedRequestInternal(
const HTTPRequest& request);
virtual bool SendAsync(const void *buffer, size_t size)
Send data to the client (asynchronous)
std::shared_ptr< SSLServer > & server() noexcept
Get the server.
virtual size_t Send(const void *buffer, size_t size)
Send data to the client (synchronous)
const std::string & cache() const noexcept
Get the HTTP response cache content.
virtual ~HTTPSSession()=default
bool SendResponseAsync(const HTTPResponse &response)
Send the HTTP response (asynchronous)
void onDisconnected() override
Handle session disconnected notification.
HTTPSSession & operator=(HTTPSSession &&)=delete
size_t SendResponse()
Send the current HTTP response (synchronous)
HTTPSSession(HTTPSSession &&)=delete
virtual void onReceivedRequestHeader(const HTTPRequest &request)
Handle HTTP request header received notification.
size_t SendResponseBody(std::string_view body)
Send the HTTP response body (synchronous)
HTTPSSession(const HTTPSSession &)=delete
bool SendResponseBodyAsync(std::string_view body)
Send the HTTP response body (asynchronous)
size_t SendResponse(const CppCommon::Timespan &timeout)
Send the current HTTP response with timeout (synchronous)
HTTPRequest _request
HTTP request.
size_t SendResponse(const HTTPResponse &response)
Send the HTTP response (synchronous)
HTTPSSession(const std::shared_ptr< HTTPSServer > &server)
size_t SendResponseBody(const void *buffer, size_t size)
Send the HTTP response body (synchronous)
size_t SendResponseBody(const void *buffer, size_t size, const CppCommon::Timespan &timeout)
Send the HTTP response body with timeout (synchronous)
virtual void onReceivedRequestError(const HTTPRequest &request, const std::string &error)
Handle HTTP request error notification.
HTTPResponse & response() noexcept
Get the HTTP response.
virtual void onReceivedRequest(const HTTPRequest &request)
Handle HTTP request received notification.
void onReceived(const void *buffer, size_t size) override
Handle buffer received notification.
HTTPResponse _response
HTTP response.
bool SendResponseAsync()
Send the current HTTP response (asynchronous)
bool SendResponseBodyAsync(const void *buffer, size_t size)
Send the HTTP response body (asynchronous)
CppCommon::FileCache & cache() noexcept
Get the static content cache.
HTTPSSession & operator=(const HTTPSSession &)=delete
const CppCommon::FileCache & cache() const noexcept
size_t SendResponseBody(std::string_view body, const CppCommon::Timespan &timeout)
Send the HTTP response body with timeout (synchronous)
const HTTPResponse & response() const noexcept
size_t SendResponse(const HTTPResponse &response, const CppCommon::Timespan &timeout)
Send the HTTP response with timeout (synchronous)
virtual void onReceivedCachedRequest(const HTTPRequest &request, std::string_view content)
Handle HTTP cached request received notification.
HTTP response definition.
C++ Server project definitions.