ennouini.dev
All posts

Mar 2, 2026

What writing an HTTP server in C++ taught me about web frameworks

Before frameworks, there are sockets. Building an HTTP/1.1 server in C++ for Webserv meant implementing by hand everything a framework hides.

Parsing is the hard part

HTTP looks simple until you handle chunked transfer encoding, header edge cases, and clients that disconnect mid-request. Most framework "magic" is just careful parsing.

Concurrency is a choice, not a default

We used non-blocking I/O with a single event loop. When I later read about the Node.js event loop, it was familiar: I had built a small version of it.

Why this matters for web work

When a NestJS route hangs or a Next.js response streams strangely, I can reason about what the runtime is actually doing underneath. That intuition comes from having built the layer below.