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


Public Types | |
| using | SPtr = std::shared_ptr< HTTPServer > |
| using | UPtr = std::unique_ptr< HTTPServer > |
| using | WPtr = std::weak_ptr< HTTPServer > |
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 | |
| HTTPServer (const std::string &address="0.0.0.0", const std::string &port="80", const std::filesystem::path &docRoot="./", const size_t numThreads=1, bool ssl=false, const std::filesystem::path &cert="", const std::filesystem::path &key="", const std::map< std::string, std::string > &mimeTypes={}, const std::string &indexFile="index.html", const std::string &serverString="giris_supportlib_http_server") | |
| void | run () |
| HTTPSession::SPtr | getSession () const |
| bool | getSSL () const |
| std::filesystem::path | getCert () const |
| std::filesystem::path | getKey () const |
| std::filesystem::path | getDocRoot () const |
| std::string | getIndexFile () const |
| std::string | getServerString () const |
| std::map< std::string, std::string > | getMimeTypes () const |
| 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) |
Public Member Functions inherited from giri::Observable< HTTPServer > | |
| void | subscribe (const std::weak_ptr< Observer< HTTPServer > > &obs) |
| void | unsubscribe (const std::weak_ptr< Observer< HTTPServer > > &obs) |
| void | unsubscribeAll () |
| void | notify () |
Class representing a HTTP Server.
|
inline |
Constructor for HTTP server.
| address | Adress to bind this server to (defaults to 0.0.0.0 for any). |
| port | Port to listen on (defaults to 80). |
| docRoot | Folder to serve via http (defaults to "./"). |
| numThreads | Number of worker threads (defaults to 1). |
| ssl | Enable or disable ssl encryption (defaults to false). |
| cert | If ssl is true path to certificate *.pem file needs to be passed. |
| key | If ssl is true path to private key *.pem file needs to be passed. |
| 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") |
|
inline |
Add additional mimetypes. Only affects new HTTPSessions.
| mimeTypes | Additional mimetypes to add. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Starts receiving messages asynchrolously. Automatically creates sessions and notifies observers when accepting new connections.
|
inline |
Set doc root path. Only affects new HTTPSessions.
| path | Path to serve html files from. |
|
inline |
Sets default index file to be used. Only affects new HTTPSessions.
| indx | default index file to be used. |
|
inline |
Set server string to be added to the http answers. Only affects new HTTPSessions.
| servstr | server string to be added to the http answers. |