The problem
Build a production-grade HTTP/1.1 server from scratch — no third-party libraries, no Node.js, no Python. The goal: understand HTTP, sockets, CGI, and concurrent I/O at the system level.
What I built
An HTTP/1.1-compliant server written in C++98 that:
- Parses raw HTTP requests by hand (request line, headers, body, chunked transfer)
- Handles 50+ concurrent connections via non-blocking sockets and a single-threaded event loop
- Uses
poll()(orepoll/kqueuedepending on platform) for I/O multiplexing - Supports CGI for executing scripts (PHP, Python) per RFC 3875
- Reads NGINX-style configuration files (server blocks, location blocks, error pages, autoindex)
- Implements GET, POST, DELETE methods with file uploads
Architecture decisions
✏️ TODO:
- State machine design for incremental request parsing
- How CGI processes are spawned and their I/O bridged via pipes
- Configuration parser strategy (recursive descent? tokenizer?)
- Memory model — RAII without smart pointers (C++98 constraint)
What I'd do differently
✏️ TODO
Tech stack
C++98 · POSIX sockets · poll / epoll · CGI (RFC 3875) · HTTP/1.1 (RFC 7230)