TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

โ† Back to HTTP

๐Ÿ“ฎ HTTP: cheat sheet

๐ŸŽจ The analogyOrdering from a shop by letter: you send a form, and the shop replies with a numbered slip.
๐ŸŽ“ The regular explanationThe request-and-response language of the web. A client sends a method, a path and headers; the server answers with a status code, headers and a body.
Every question gets one answerStep 5 of 5
๐Ÿง’You200 OK๐ŸชThe shop
  1. You'd like the shop's menu. On the order form you write what to do, GET, and which thing, /menu.
  2. Off goes the letter.
  3. The shop reads the form and fetches the menu from the back.
  4. Back comes a reply slip. The number 200 on top means "all good", and the menu is tucked inside.
  5. That's the whole game. One letter, one reply. The pictures on the menu need letters of their own.
Reading the number on the replyStep 5 of 5
๐Ÿง’You๐Ÿš๏ธOld address๐ŸฌNew shop
  1. The old address replies 301, "we moved, try over there". Numbers starting with 3 point you somewhere else.
  2. You try the new shop and get 200. Numbers starting with 2 mean success.
  3. You ask for dragons. 404, "we've never sold those". A 4 means the question itself was the problem.
  4. A shelf collapses in the shop. 500. A 5 means the shop has a problem, so asking again later might work.
  5. All fixed, but you sent a hundred letters in a minute. 429, "slow down please".
Not asking twice for the same thingStep 4 of 4
๐Ÿง’You๐Ÿ“’ Your scrapbookv7, 1 hour๐ŸชThe shop
  1. The shop sends the catalogue with a note, "still good for an hour", and a little version sticker, v7.
  2. Ten minutes later you want it again. It's in your scrapbook and still fresh, so no letter at all.
  3. Two hours later the "good until" time has passed. You write, "I have v7. Has it changed?"
  4. The shop replies with a tiny slip, 304, "nothing new, keep yours". No catalogue needs posting again.
One line, many lettersStep 4 of 4
1 connection, many streams๐Ÿง’You๐ŸชThe shop
  1. In the old way, a delivery van carries one letter at a time, and waits for the reply before taking the next.
  2. To go faster, you hire six vans. That's a lot of vans to start up.
  3. The newer way uses one van, cuts every letter into small pieces, labels each piece and mixes them all in.
  4. Replies come back as soon as each is ready, in any order, and get put back together at your end.

๐Ÿงฉ Key questions

What does the shop always send back for every letter?
A reply slip with a number on top. One letter, one reply, every time.
The reply slip's number starts with 4. What does it mean?
You asked for something wrong. 2 is all good, 3 look elsewhere, 4 you asked wrong, 5 the shop went wrong.
Your copy's hour is up. What do you ask the shop?
"I have version 7, has it changed?", and get a tiny slip if not. Until the hour is up you don't write at all; after that, a tiny check saves the whole catalogue.