How yemreaycicek/webserv works
webserv is a non-blocking HTTP/1.1 server. Its principal workflow is: load and parse configuration, create listening sockets, accept clients, parse requests, select server/location behavior, then return an HTTP response or run CGI. The README documents static files, directory listings, uploads, redirects, error pages, and body limits as additional request-handling capabilities. Source excerpts show the main wiring and CGI streaming; several runtime implementation details are unsampled, so those links are omitted or marked unverified.
Main entry points: Server.cpp Server coordinator · Executor.cpp Request executor · Lexer.cpp Config lexer · Parser.cpp Config parser
Components 15
Configuration
- Config arguments
src/utils/arg.cpp - Config lexer
src/config/Lexer.cpp - Config parser
src/config/Parser.cpp - Server router
src/config/Router.cpp
HTTP Model
- HTTP request
src/http/Request.cpp
Event Runtime
- Client connection
src/exec/Connection.cpp - Poll event loop
src/exec/Poller.cpp - Server coordinator
src/exec/Server.cpp
Request Handling
- Request executor
src/exec/Executor.cpp - Path resolver
src/exec/Resolver.cpp - Response builder
src/exec/ResponseBuilder.cpp - CGI process
src/exec/Cgi.cpp
Networking
- Listening sockets
src/net/ListenSocket.cpp - Socket primitives
src/net/Socket.cpp
Other components
- HTTP client
Connections 16
- HTTP client → Server coordinator: sends requests
- Config arguments → Config lexer: provides config
- Config lexer → Config parser: tokenizes for
- Config parser → Server router: configures
- Server router → Server coordinator: configures
- Server coordinator → Listening sockets: creates listeners
src/exec/Server.cpp - Listening sockets → Socket primitives: extends
- Server coordinator → Poll event loop: registers descriptors
src/exec/Server.cpp - Server coordinator → Client connection: creates connections
src/exec/Server.cpp - Client connection → HTTP request: parses input
- Server coordinator → Request executor: executes requests
src/exec/Server.cpp - Request executor → Path resolver: resolves paths
- Request executor → Response builder: builds responses
- Server coordinator → CGI process: starts and relays
src/exec/Server.cpp - Request executor → CGI process: identifies CGI requests
- Server coordinator → HTTP client: writes responses