|
Webserv
|
Represents a single 'location' block from the configuration file. More...
#include <LocationBlock.hpp>
Public Types | |
| enum | MatchType { PREFIX , EXTENSION } |
| Specifies how the location path should be matched against the request URI. More... | |
Public Member Functions | |
| LocationBlock () | |
| bool | hasCgiPass () const |
| Checks if a 'cgi_pass' directive is configured for this location. | |
| std::string const & | path () const |
| Gets the URI path that this location block matches. | |
| MatchType | matchType () const |
| Gets the match type for this location. | |
| std::string const & | extension () const |
| Gets the extension string (including the dot) for EXTENSION match type. | |
| bool | isRegex () const |
| Compatibility wrapper for checking if this is a "regex" (extension) location. | |
| ServerBlock const * | parent () const |
| Gets a pointer to the parent ServerBlock. | |
| LocationBlock & | path (std::string const &) |
| Sets the URI path for this location using a fluent interface. | |
| LocationBlock & | matchType (MatchType) |
| Sets the match type for this location. | |
| LocationBlock & | extension (std::string const &) |
| Sets the extension string for EXTENSION match type. | |
| LocationBlock & | parent (ServerBlock *parent) |
| Sets the parent ServerBlock for this location. | |
| bool | autoIndex () const |
| Gets the autoIndex setting. | |
| LocationBlock & | autoIndex (bool val) |
| Sets the autoIndex setting. | |
| std::string | resolveIndexFile (std::string const &dirPath) const |
| Tries to find an index file in the given directory. | |
| Public Member Functions inherited from config::Block | |
| Block (std::string const &name) | |
| Block (const Block &other) | |
| Block & | operator= (const Block &other) |
| virtual | ~Block () |
| bool | has (std::string const &key) const |
| Checks if a directive exists within the block. | |
| ArgumentVector const & | get (std::string const &key) const |
| Safely gets the values for a directive. | |
| Block & | add (std::string const &key, std::vector< std::string > const &) |
| Adds a directive with multiple values. | |
| Block & | add (std::string const &key, std::string const &) |
| Block & | add (std::string const &key, std::string const &, std::string const &) |
| Block & | add (std::string const &key, ParsedDirectiveArgs const &args) |
| Block & | add (std::string const &key, ArgumentVector const &values) |
| Block & | add (std::string const &key, ArgumentPtr value) |
| Block & | add (std::string const &key, size_t value) |
| std::vector< std::string > | getRawValues (std::string const &key) const |
| std::string | getFirstRawValue (std::string const &key) const |
| std::vector< std::string > | get (std::string const &key, http::Request const &req) const |
| std::string | getFirstEvaluatedString (std::string const &key, http::Request const &req) const |
| std::string const & | name () const |
| Gets the name of the block. | |
| std::string | root () const |
| Gets the root path directive. | |
| std::vector< std::string > | indexFiles () const |
| Gets the index files directive. | |
| Block & | root (std::string const &) |
| Sets the root directive using a fluent interface. | |
| size_t | maxBodySize () const |
| Block & | maxBodySize (size_t) |
Private Attributes | |
| ServerBlock * | parent_ |
| Pointer to the parent ServerBlock. | |
| std::string | path_ |
| The URI path/pattern this location matches. | |
| MatchType | matchType_ |
| How this location matches. | |
| std::string | extension_ |
| The extracted extension if MatchType is EXTENSION. | |
| bool | autoIndex_ |
| Whether directory listing is enabled. | |
Additional Inherited Members | |
| Protected Attributes inherited from config::Block | |
| std::string | name_ |
| The name of the block (e.g., "server", "location"). | |
| DirectiveMap | directives_ |
| Map storing directive names and their values. | |
Represents a single 'location' block from the configuration file.
This class is a strongly-typed container for the directives defined within a location context. It holds settings such as the document root and index files for a specific URI path.
| config::LocationBlock::LocationBlock | ( | ) |
| bool config::LocationBlock::autoIndex | ( | ) | const |
Gets the autoIndex setting.
| LocationBlock & config::LocationBlock::autoIndex | ( | bool | val | ) |
Sets the autoIndex setting.
| val | The new value. |
| std::string const & config::LocationBlock::extension | ( | ) | const |
Gets the extension string (including the dot) for EXTENSION match type.
| LocationBlock & config::LocationBlock::extension | ( | std::string const & | v | ) |
Sets the extension string for EXTENSION match type.
| ext | The extension including the dot (e.g., ".php"). |
| bool config::LocationBlock::hasCgiPass | ( | ) | const |
Checks if a 'cgi_pass' directive is configured for this location.
| bool config::LocationBlock::isRegex | ( | ) | const |
Compatibility wrapper for checking if this is a "regex" (extension) location.
| LocationBlock::MatchType config::LocationBlock::matchType | ( | ) | const |
Gets the match type for this location.
| LocationBlock & config::LocationBlock::matchType | ( | MatchType | v | ) |
Sets the match type for this location.
| ServerBlock const * config::LocationBlock::parent | ( | ) | const |
Gets a pointer to the parent ServerBlock.
| LocationBlock & config::LocationBlock::parent | ( | ServerBlock * | parent | ) |
Sets the parent ServerBlock for this location.
| p | A pointer to the parent ServerBlock. |
| std::string const & config::LocationBlock::path | ( | ) | const |
Gets the URI path that this location block matches.
| LocationBlock & config::LocationBlock::path | ( | std::string const & | v | ) |
Sets the URI path for this location using a fluent interface.
| p | The path to set (e.g., "/images/"). |
| std::string config::LocationBlock::resolveIndexFile | ( | std::string const & | dirPath | ) | const |
Tries to find an index file in the given directory.
| dirPath | The absolute path to the directory. |
|
private |
Whether directory listing is enabled.
|
private |
The extracted extension if MatchType is EXTENSION.
|
private |
How this location matches.
|
private |
Pointer to the parent ServerBlock.
|
private |
The URI path/pattern this location matches.