|
Webserv
|
A strongly-typed data container for a server block's configuration. More...
#include <ServerConfig.hpp>
Public Member Functions | |
| ServerConfig () | |
| ServerConfig (char const *fpath, bool perform_fs_checks=true) | |
| Constructs and builds the configuration from a file path. | |
| ServerConfig (std::string const &content, bool perform_fs_checks=true) | |
| Constructs and builds the configuration from a string. | |
| ServerBlock const * | getServer (int port, http::Request const &req) const |
| Retrieves the server configuration that best matches a port and server name. | |
| void | addServer (ServerBlock const &server) |
| Adds a ServerBlock to the configuration. | |
| ServerBlockMap const & | getServersMap () const |
| Gets read-only access to the map of server blocks. | |
Private Member Functions | |
| void | build (std::string const &content, bool perform_fs_checks) |
Private Attributes | |
| ServerBlockMap | servers_ |
| Map of server blocks, keyed by port number. | |
A strongly-typed data container for a server block's configuration.
This class holds the final, validated settings for a single 'server' block after all parsing and semantic validation is complete. It is the definitive configuration used by the webserver at runtime.
| config::ServerConfig::ServerConfig | ( | ) |
|
explicit |
Constructs and builds the configuration from a file path.
| fpath | Path to the configuration file. |
| perform_fs_checks | If true, validates that file paths in the config exist. |
|
explicit |
Constructs and builds the configuration from a string.
| content | A string containing the full configuration. |
| perform_fs_checks | If true, validates that file paths in the config exist. |
| void config::ServerConfig::addServer | ( | ServerBlock const & | server | ) |
Adds a ServerBlock to the configuration.
| server | The ServerBlock to add. |
|
private |
| ServerBlock const * config::ServerConfig::getServer | ( | int | port, |
| http::Request const & | req ) const |
Retrieves the server configuration that best matches a port and server name.
| port | The port number of the incoming connection. |
| request | The request |
| ServerBlockMap const & config::ServerConfig::getServersMap | ( | ) | const |
Gets read-only access to the map of server blocks.
|
private |
Map of server blocks, keyed by port number.