All workME®03 / 04
03 / Systems / HTTP implementationSystems / network engineering

Webserv

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

Role
Systems design, HTTP implementation, networking, and test-driven debugging.
Stack
C++ / Linux / Networking / HTTP / CGI

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

What it is

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

The problem

The constraint shaped the system.

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

The approach

Responsibilities made explicit.

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

From socket readiness to HTTP response.

Each connection advances through explicit transport, parsing, routing, execution, and response stages without blocking the event loop.

  1. 01Client
  2. 02Request parser
  3. 03Server / location
  4. 04Static / upload / CGI
  5. 05Response
Supporting concerns
  • poll() readiness
  • Keep-alive
  • Range requests
  • Sessions
  • Timeouts
  • Error responses

Protocol correctness under concurrency.

  1. 01

    Event loop

    poll() tracks socket readiness so multiple connections can progress through partial reads and writes without blocking.

  2. 02

    Routing

    Parsed configuration drives server selection and longest-prefix location routing before a response handler is chosen.

  3. 03

    CGI

    CGI execution constructs the required environment and is coordinated without stalling unrelated client connections.

  4. 04

    Connection management

    Keep-alive, payload limits, and timeouts bound connection work and cleanup.

  5. 05

    HTTP behavior

    Uploads, sessions, cookies, Range requests, and explicit error responses extend the core request path.

  • 01HTTP/1.1 parsing
  • 02Non-blocking sockets
  • 03poll() event loop
  • 04Routing & configuration
  • 05CGI execution
  • 06Uploads
  • 07Sessions & cookies
  • 08Range requests
  • 09Keep-alive & timeouts
Stack
  • C++
  • Linux
  • Networking
  • HTTP
  • CGI
Framework abstractions become much easier to judge after implementing the protocol behavior they hide.
Next projectInception