LeftHookRoll
An HTTP/1.0 compliant web server, as specified by RFC1945
Loading...
Searching...
No Matches
ServerConf Class Reference

#include <ServerConf.hpp>

Collaboration diagram for ServerConf:

Public Member Functions

 ServerConf ()
 
 ServerConf (const ServerConf &other)
 
ServerConfoperator= (const ServerConf &other)
 
 ~ServerConf ()
 
const std::string & getServerName () const
 
const struct sockaddr_in & getInterfacePortPair () const
 
size_t getMaxBodySize () const
 
const std::vector< LocationConf > & getLocations () const
 
const std::map< std::string, std::string > & getErrorPages () const
 
void setServerName (const std::string &name)
 
void setInterfacePortPair (const struct sockaddr_in &address)
 
void setMaxBodySize (size_t size)
 
void addLocation (const LocationConf &location)
 Adds a parsed LocationConf block to this server.
 
void addErrorPage (const std::string &errorCode, const std::string &errorPagePath)
 Adds a custom error page mapping (e.g., "404" -> "/errors/404.html").
 
std::string getErrorPagePath (const std::string &errorCode) const
 Retrieves the path to a custom error page if one exists.
 
void setDefaults ()
 Set the Defaults config directives.
 

Private Attributes

std::string _serverName
 
struct sockaddr_in _interfacePortPair
 
size_t _maxBodySize
 
std::vector< LocationConf_locations
 
std::map< std::string, std::string > _errorPages
 

Detailed Description

Definition at line 19 of file ServerConf.hpp.

Constructor & Destructor Documentation

◆ ServerConf() [1/2]

ServerConf::ServerConf ( )

Definition at line 5 of file ServerConf.cpp.

◆ ServerConf() [2/2]

ServerConf::ServerConf ( const ServerConf other)

Definition at line 11 of file ServerConf.cpp.

◆ ~ServerConf()

ServerConf::~ServerConf ( )

Definition at line 32 of file ServerConf.cpp.

Member Function Documentation

◆ operator=()

ServerConf & ServerConf::operator= ( const ServerConf other)

Definition at line 19 of file ServerConf.cpp.

◆ getServerName()

const std::string & ServerConf::getServerName ( ) const

Definition at line 35 of file ServerConf.cpp.

◆ getInterfacePortPair()

const struct sockaddr_in & ServerConf::getInterfacePortPair ( ) const

Definition at line 40 of file ServerConf.cpp.

◆ getMaxBodySize()

size_t ServerConf::getMaxBodySize ( ) const

Definition at line 45 of file ServerConf.cpp.

◆ getLocations()

const std::vector< LocationConf > & ServerConf::getLocations ( ) const

Definition at line 50 of file ServerConf.cpp.

◆ getErrorPages()

const std::map< std::string, std::string > & ServerConf::getErrorPages ( ) const

Definition at line 55 of file ServerConf.cpp.

◆ setServerName()

void ServerConf::setServerName ( const std::string &  name)

Definition at line 60 of file ServerConf.cpp.

◆ setInterfacePortPair()

void ServerConf::setInterfacePortPair ( const struct sockaddr_in &  address)

Definition at line 65 of file ServerConf.cpp.

◆ setMaxBodySize()

void ServerConf::setMaxBodySize ( size_t  size)

Definition at line 70 of file ServerConf.cpp.

◆ addLocation()

void ServerConf::addLocation ( const LocationConf location)

Adds a parsed LocationConf block to this server.

Definition at line 75 of file ServerConf.cpp.

◆ addErrorPage()

void ServerConf::addErrorPage ( const std::string &  errorCode,
const std::string &  errorPagePath 
)

Adds a custom error page mapping (e.g., "404" -> "/errors/404.html").

Definition at line 80 of file ServerConf.cpp.

◆ getErrorPagePath()

std::string ServerConf::getErrorPagePath ( const std::string &  errorCode) const

Retrieves the path to a custom error page if one exists.

Parameters
errorCodeThe HTTP error code as a string (e.g., "404").
Returns
The path to the custom error page, or an empty string if none is defined.

Definition at line 85 of file ServerConf.cpp.

◆ setDefaults()

void ServerConf::setDefaults ( )
inline

Set the Defaults config directives.

Definition at line 63 of file ServerConf.hpp.

Member Data Documentation

◆ _serverName

std::string ServerConf::_serverName
private

Definition at line 76 of file ServerConf.hpp.

◆ _interfacePortPair

struct sockaddr_in ServerConf::_interfacePortPair
private

Definition at line 77 of file ServerConf.hpp.

◆ _maxBodySize

size_t ServerConf::_maxBodySize
private

Definition at line 80 of file ServerConf.hpp.

◆ _locations

std::vector<LocationConf> ServerConf::_locations
private

Definition at line 81 of file ServerConf.hpp.

◆ _errorPages

std::map<std::string, std::string> ServerConf::_errorPages
private

Definition at line 82 of file ServerConf.hpp.


The documentation for this class was generated from the following files: