HTTP/1.0 Web Server from Scratch
A single-threaded then forking HTTP server that parses raw HTTP GET requests over TCP sockets, serves static files with correct headers, and handles basic error codes, built without any HTTP library. Learners practice socket programming, the HTTP protocol, and process-based concurrency with fork().
- Estimate
- ~10.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
sys/socket.h · fork() · sys/stat.h
Project roadmap
- 01
Set up socket, bind, and listen
~1hCreate a TCP socket bound to a configurable port and put it into listening mode.
- 02
Parse incoming HTTP request lines
~2hRead raw request bytes and parse the method, path, and HTTP version from the request line.
- 03
Serve static files with correct headers
~2.5hResolve the request path to a file on disk and send Content-Type, Content-Length, and status headers with the body.
- 04
Add fork-based concurrency
~2.5hFork a child process per connection so multiple clients can be served concurrently, reaping zombies with signal handling.
- 05
Implement error responses
~1.5hReturn proper 404 and 400 responses for missing files and malformed requests, plus guard against path traversal.
- 06
Add a simple access log
~1hLog each request's method, path, status, and client IP to a log file.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack