How 42-adbouras/webserv-1337med works
Project type and purpose
• This is a standalone, high-performance HTTP server written in C++.
• Purpose: listen on TCP sockets, parse HTTP requests, serve static files (in webserv/www), execute CGI scripts, handle errors, and send back HTTP responses.
File structure
• Top-level “webserv” directory contains:
• configs/ (config.conf)
• includes/ (public headers: CGI, Config, Lexer, Utils, request/response, serverHeader)
• sources/ (implementation: main, parser, request, response, server, CGI, error handlers)
• www/ (static assets: HTML, CSS, images, default error pages)
• Pattern: clear separation of concerns—configuration parsing, request processing, response building, server networking, CGI handling.
• Build artifacts driven by Makefile under webserv/Makefile.
README
• Confirms: it’s an HTTP server—receives requests, returns web content.
Elements
[Client Browser] → [SocketManager/Listener] → [Request Parser] → [Router] → {Static File Server | CGI Handler} → [Response Builder] → [SocketManager] → [Client]
• Networking (blue)
• Parsing & Config (yellow)
• Business logic (green)
• IO & CGI (orange)
• Interactions (fork/exec, file read, config load).
Final guidance
• Essential modules from the file tree.
• Use consistent naming matching headers/sources (e.g., “Config,” “Lexer,” “Utils”).
• Notes on ports, timeouts, and config locations if needed.