Webserv
C++98 HTTP server built around epoll, request parsing, routing, static files, uploads and CGI execution.
Technical demonstration
Context
Webserv is a 42 curriculum project created by leothoma and tstephan. The goal is to implement an HTTP server in C++98 on Linux, with configuration loading, virtual hosts, routing, static files, uploads and CGI.
Visible result
The repository ships a sample configuration on port 8111, demo static content, custom error pages and CGI scripts under cgi-bin/.
Contribution
This was a two-person project. The repository verifies the team members, but does not isolate individual ownership for each subsystem, so the contribution is presented as team work.
Technical difficulty
The hardest part documented in the code is keeping the event loop responsive while regular client sockets and CGI child-process pipes are all watched by epoll. CGI jobs keep their read/write descriptors in the same polling loop, expire after a timeout and then flush the buffered HTTP response back through the client connection.
Technical choices
- C++98, Linux sockets and
epoll - Incremental HTTP request parsing
- Router selection by listen port, Host header and path
- CGI environment building plus fork/exec pipe handling
- Upload handling for configured locations
Validation and limits
The repository includes parser, request, CGI and upload fixtures, plus run_parser_tests.sh. The implementation targets the project scope, not a production HTTP server: HTTP/2, TLS termination and exhaustive RFC coverage are outside this repository.