Webserv
Loading...
Searching...
No Matches
http::Router Class Reference

The central request dispatcher. More...

#include <Router.hpp>

Public Member Functions

 Router (config::ServerConfig const &config, MimeTypes const &mime)
RouterResult route (int port, HttpRequest &request) const
 Determines the correct handler and context for a request.

Private Attributes

config::ServerConfig const & config_
NotFoundHandler const notFound_
StaticFileHandler const staticFile_
CGIHandler const cgi_
DefaultErrorHandler const error_

Detailed Description

The central request dispatcher.

Matches an incoming HttpRequest to a specific handler based on the server configuration.

Constructor & Destructor Documentation

◆ Router()

http::Router::Router ( config::ServerConfig const & config,
MimeTypes const & mime )
inline

Member Function Documentation

◆ route()

RouterResult http::Router::route ( int port,
HttpRequest & request ) const
inline

Determines the correct handler and context for a request.

Parameters
portThe port the connection was received on.
requestThe client's HTTP request.
Returns
A RouterResult containing the matched handler and config blocks.

Member Data Documentation

◆ cgi_

CGIHandler const http::Router::cgi_
private

◆ config_

config::ServerConfig const& http::Router::config_
private

◆ error_

DefaultErrorHandler const http::Router::error_
private

◆ notFound_

NotFoundHandler const http::Router::notFound_
private

◆ staticFile_

StaticFileHandler const http::Router::staticFile_
private

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