Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 03 · From Scratch · HTTP Server · with code: Go · about 25 min to read

Play it as a journeyTutor comes with a plan

HTTP 08: Everything

Everything
Everything · Open board

The finale board. No new mechanism: one ordinary request, followed through everything this build has already made, closing the build begun in Build Your Own HTTP Server, From Scratch.

Before you start. This series has been building a small HTTP server, a program that answers a browser’s request for a page the same way every real website does. By now it can do seven things, one per earlier lesson:

  • Hang up on a caller who never finishes asking, instead of waiting forever.
  • Find where a request’s opening line and labels end, even when the bytes (single characters, roughly) arrive in pieces.
  • Work out whether anything follows those labels, and how long it runs.
  • Send an address like /users/42 to the right piece of code.
  • Keep the line open and answer a second request on it.
  • Refuse to hold more than so many lines open, so a flood cannot sink it.
  • Send back a reply whose length it doesn’t know yet, piece by piece.

This lesson adds no new piece: it sends one ordinary request through all seven, in order.

Lesson 21 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 2015: HTTP gets rewritten, and the question doesn’t change
  • Desk seven, not desk one
  • The clock that starts before a byte arrives
  • The bytes have no edges
  • Does this message have anything left to say
  • Which desk answers, and what it says back
  • A reply whose length nobody knows yet
  • Back to the same line, waiting for an eighth
  • Seven jobs, one question
  • Desk seven, quantified
  • The clock, precisely
  • Where the head ends
  • The framing rule, precisely
  • Routing and the status code, precisely
  • The reply, precisely
  • One request, traced
  • What breaks, and which piece explains it
  • What layers on top, and what changes the picture
  • Run the whole thing
  • Check every stage

Terms it explains: deadline, framing, routing, chunked, keep-alive, TLS.

Review From Scratch