How table-en4/webserv works
Webserv is a lightweight, non-blocking C++ HTTP server. The principal workflow is: load server and location configuration, accept a client request, parse and route it, then produce and send an HTTP response. Its documented capabilities also include static files, directory listings, uploads, redirects, error pages, and CGI execution with timeout handling. The graph reflects the sampled event loop and CGI calls; some response-building and routing details are documented but not fully excerpted, so those links use README evidence. CGI script files are runtime assets, not proof of specific dispatch targets.
Main entry points: ServerManager.cpp Event loop · HttpRespons.cpp Response handling · CgiHandler.cpp CGI handler · main.cpp Program entry
Components 14
Startup and configuration
- Server config
configure.conf - Program entry
srcs/main.cpp - Config parser
srcs/Parser.cpp - Server settings
srcs/ServerConfig.cpp - Location settings
srcs/LocationConfig.cpp
Connection handling
- Event loop
srcs/ServerManager.cpp
HTTP processing
- Request parser
srcs/HttpRequest.cpp - Response handling
srcs/HttpRespons.cpp - Static content
www/index.html - Upload content
www/upload_file/index.html
CGI execution
- CGI handler
srcs/CgiHandler.cpp - CGI interpreter
- CGI script
scripts/me.py
Other components
- HTTP client
Connections 13
- HTTP client → Event loop: sends requests
README.md - Server config → Config parser: loads settings
- Program entry → Config parser: parses config
srcs/main.cpp - Program entry → Event loop: starts servers
srcs/main.cpp - Event loop → Request parser: parses request
srcs/ServerManager.cpp - Event loop → Response handling: resolves path
srcs/ServerManager.cpp - Response handling → Static content: serves files
README.md - Response handling → Upload content: stores uploads
README.md - Event loop → CGI handler: launches CGI
srcs/ServerManager.cpp - CGI handler → CGI interpreter: executes script
srcs/CgiHandler.cpp - Event loop → CGI handler: parses CGI output
srcs/ServerManager.cpp - CGI script → CGI interpreter: runs as script
- Event loop → HTTP client: sends response
README.md