Most of us use HTTP every day through a framework. We write a handler, return a response, and the framework deals with the rest. That is the right way to ship software, and it also means many developers have never seen what "the rest" is: how a request is cut out of a stream of bytes, what keep-alive really asks of the server, why Content-Length and Transfer-Encoding together are a security problem.
http-from-scratch is my answer to that gap. It is an HTTP/1.1 server written from the socket up in Rust, twice: once on std::net::TcpListener with a hand-made thread pool, and once on Tokio. Both versions share the same I/O-free parser, handler and connection state machine, so the only difference between them is how bytes move. It is a learning project, not a production server, and this post is about what building it teaches.
What I built
An incremental parser. parser.rs never touches a socket. You feed it the bytes received so far.…