How enduserrr/webserv works
WEBSERV is a C++ HTTP/1.1 server. Its main workflow is configuration loading, socket polling and client-session handling, HTTP request parsing, routing, then response generation for static content, CGI, or uploads and deletions. Configuration also controls virtual hosts, locations, limits, redirects, and error pages. The graph combines excerpted declarations and SOURCE INDEX references with documented README capabilities; some handler dispatch details were not shown, so those links are marked unverified or omitted.
Main entry points: ServerLoop.cpp Poll Server Loop · Router.cpp Request Router · main.cpp Program Entry · Methods.cpp Method Handling
Components 19
Startup and Configuration
- Server Config
config/default.conf - Program Entry
src/main.cpp - Config Parser
src/ConfParser.cpp - Virtual Server Config
src/ServerBlock.cpp
Connection Runtime
- Poll Server Loop
src/ServerLoop.cpp - Client Sessions
src/ClientSession.cpp
HTTP Processing
- HTTP Parser
src/HttpParser.cpp - Request Context
src/HttpRequest.cpp - Request Router
src/Router.cpp - Method Handling
src/Methods.cpp
Response Services
- Static Content
src/StaticHandler.cpp - CGI Execution
src/CgiHandler.cpp - Upload Handling
src/UploadHandler.cpp
Content and Errors
- Web Content
www - CGI Scripts
www/cgi-bin - Error Pages
www/error_pages - Logging and Errors
src/Logger.cpp - MIME Types
src/Types.cpp
Other components
- Server Operator
Connections 20
- Server Operator → Server Config: provides settings
README.md - Server Operator → Program Entry: starts server
README.md - Program Entry → Config Parser: loads configuration
src/main.cpp - Program Entry → Poll Server Loop: starts runtime
src/main.cpp - Config Parser → Virtual Server Config: builds server blocks
src/ConfParser.cpp - Poll Server Loop → Virtual Server Config: uses configuration
src/ServerLoop.cpp - Poll Server Loop → Client Sessions: tracks clients
- Poll Server Loop → HTTP Parser: parses requests
src/ServerLoop.cpp - HTTP Parser → Request Context: populates request
- Poll Server Loop → Request Router: routes requests
src/ServerLoop.cpp - Request Router → Static Content: dispatches static
- Request Router → CGI Execution: dispatches CGI
- Static Content → Web Content: serves files
README.md - Request Router → Method Handling: selects methods
- Method Handling → Upload Handling: handles uploads
README.md - Method Handling → Web Content: deletes resources
README.md - CGI Execution → CGI Scripts: executes scripts
README.md - CGI Execution → Request Context: reads request data
- Logging and Errors → Error Pages: loads error content
README.md - Static Content → MIME Types: uses content types