All workME®03 / 04

Systems / network engineering

Webserv

The web stack, reduced to sockets, bytes, state, and careful failure handling.

  • C++
  • Linux
  • Networking
  • HTTP
  • CGI
Overview

An HTTP/1.1 server written from scratch in C++, built to understand the machinery below familiar web frameworks.

My role

Systems design, HTTP implementation, networking, and test-driven debugging.

01 / The challenge

Designing for the real constraints.

A server must handle many partial, malformed, and concurrent requests without blocking or losing protocol correctness.

02 / The solution

A system with explicit boundaries.

A non-blocking event loop separates connection state, request parsing, routing, response construction, and resource cleanup into explicit stages.

Capabilities

What the system covers

01HTTP/1.1 parsing

02Non-blocking sockets

03poll() event loop

04Routing & configuration

05CGI execution

06Uploads

07Sessions & cookies

08Range requests

09Keep-alive & timeouts

Technical decisions

Engineering choices with consequences.

  1. Track every connection as an explicit state machine
  2. Treat partial reads and writes as normal
  3. Bound work with timeouts and payload limits
  4. Keep parsing independent from transport
What I learned
Framework abstractions become much easier to judge after implementing the protocol behavior they hide.
Next case studyInception