|
Giri's C++ Support Library
C++ library providing everything you need to quickly create awesome applications.
|
Class representing one session/connection. More...
#include <HTTPServer.h>


Public Types | |
| using | SPtr = std::shared_ptr< HTTPSession > |
| using | UPtr = std::unique_ptr< HTTPSession > |
| using | WPtr = std::weak_ptr< HTTPSession > |
Public Types inherited from giri::Object< T > | |
| using | SPtr = std::shared_ptr< T > |
| using | UPtr = std::unique_ptr< T > |
| using | WPtr = std::weak_ptr< T > |
Public Member Functions | |
| HTTPSession (tcp::socket socket, const std::filesystem::path &docRoot, const std::map< std::string, std::string > &mimeTypes, const std::string &indexFile, const std::string &serverString, bool ssl, const std::filesystem::path &cert, const std::filesystem::path &key, boost::asio::io_context &ioc) | |
| void | run () |
| bool | getSSL () const |
| boost::system::error_code | getError () const |
| std::string | getClientIP () const |
| std::string | getClientPort () const |
| http::request< http::string_body > | getRequest () const |
| http::response< http::vector_body< char > > | getResult () const |
| std::filesystem::path | getDocRoot () const |
| std::string | getIndexFile () const |
| std::string | getServerString () const |
| std::map< std::string, std::string > | getMimeTypes () const |
| void | setResult (const http::response< http::vector_body< char >> &res) |
| void | setDocRoot (const std::filesystem::path &path) |
| void | setIndexFile (const std::string &indx) |
| void | setServerString (const std::string &servstr) |
| void | addMimeTypes (const std::map< std::string, std::string > &mimeTypes) |
| void | close () |
Public Member Functions inherited from giri::Observable< HTTPSession > | |
| void | subscribe (const std::weak_ptr< Observer< HTTPSession > > &obs) |
| void | unsubscribe (const std::weak_ptr< Observer< HTTPSession > > &obs) |
| void | unsubscribeAll () |
| void | notify () |
Class representing one session/connection.
Created by the server when accepting a client connection.
|
inlineexplicit |
WebSocketSession constructor
| socket | Socket to use. |
| docRoot | Folder to serve via http (defaults to "./") |
| mimeTypes | Mapping containing additional mimetypes. (will be appended to a set of default mimetypes, overrides existing defaults) |
| indexFile | Index file to use if no file was provided by request. (defaults to "index.html") |
| serverString | Server string to be added to the http answers. (defaults to "giris_supportlib_http_server") |
| ssl | true if ssl should be enabled, false otherwise. |
| cert | If ssl is true, path to certificate file in *.pem format. |
| key | If ssl is true path to private key file in *pem format. |
| ioc | I/O context which should be used. |
|
inline |
Add additional mimetypes. Only affects new requests within this HTTPSession.
| mimeTypes | Additional mimetypes to add. |
|
inline |
Close http session.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Starts receiving messages asynchrolously. Automatically notifies subscribed Observer objects on new messages.
|
inline |
Set doc root path. Only affects new requests within this HTTPSession.
| path | Path to serve html files from. |
|
inline |
Sets default index file to be used. Only affects new requests within this HTTPSession.
| indx | default index file to be used. |
|
inline |
Set custom result to be sent back to the client.
| res | Result to be sent back. |
|
inline |
Set server string to be added to the http answers. Only affects new requests within this HTTPSession.
| servstr | server string to be added to the http answers. |