Rebuild. HTTP/1.1 Web Server (C++20)
Overview
A custom HTTP/1.1 web server written in C++20, designed to replicate core NGINX behavior.
Implements request parsing, routing, CGI execution, file uploads, and multi–virtual-server configuration from scratch.
Source Code
Purpose
- Understand HTTP/1.1 at the protocol level
- Build a production-style network service in modern C++
- Practice system programming, parsing, and resource management
- Design extensible server architecture inspired by real-world web servers
Technical Highlights
- HTTP/1.1 request parsing and response generation
- Multi-server (virtual host) support with custom configuration syntax
- Routing with exact, prefix, and extension-based matching
- CGI execution (RFC 3875) with environment setup and timeouts
- Multipart file uploads with size validation
- Keep-alive connections and chunked transfer encoding
- Comprehensive HTTP error handling (404, 405, 413, 500, 504)
Architecture
- Event-driven server cluster managing multiple listeners
- Clear separation between parsing, routing, execution, and response layers
- RAII-based resource management with minimal heap allocation
- Modular design for handlers, configuration, and utility components