HTTP: Asking for Pages
- HTTP
- Request & response
If you took Web Foundation I on this platform, its very first lesson told you the web is ordering food: you ask, the kitchen answers. That story was true — and it stood on this course's shoulders the whole time. Today you get the same conversation from underneath: the actual words, on the actual wire.
The request: a structured ask
HTTP (HyperText Transfer Protocol) is the web's rulebook, and it rules a strictly two-beat rhythm: the client asks, the server answers. One ask, one answer, then the conversation is over — the next click starts a fresh one.
Here's an ask, nearly verbatim — this is what your browser writes and sends (as packets, to door 443) when you visit a page:
GET /courses/network-1 HTTP/1.1
Host: learn.example.comRead it like the request slip it is. GET is the method — the
verb of the ask. GET means "send me this thing"; its main sibling,
POST, means "here's something from me" (what a filled-in form rides
on). Then the path of the thing being asked for, then which rulebook
edition the browser speaks, then a line naming the site being
addressed. Terse, plain, and readable by humans — that's HTTP's
style.
The response: an answer with a verdict
The server's reply leads with a verdict before any content:
HTTP/1.1 200 OK
Content-Type: text/html
<the page itself follows here>That three-digit status code is the protocol's honesty policy, and the families are worth knowing: 200 means "here it is, all well." Codes starting 3 mean "it moved — look over there." Codes starting 4 mean "your ask has a problem" — including the celebrity, 404 Not Found: the address led to a real building (the server answered!) but no such door inside. Codes starting 5 mean "your ask was fine; I broke." After the verdict come a few labeled facts (what kind of content this is, how much of it), then the goods themselves.
So the map lesson's "dark house vs. missing listing" gains a third case: DNS fails → no listing. Connection fails → dark house. 404 → the house answered; there's no such room. Three different failures, three different fixes, and you can now tell all three apart from your couch.
One page, a hail of asks
Now the fact that reframes every page load: that response carried one file — the page's HTML skeleton. As the browser reads it, it discovers everything else the page needs — each image, the styles, the scripts, the fonts — and fires a separate HTTP request for every one of them. A typical page is dozens of asks; a heavy one, hundreds. Each ask is its own request-response, its own parcels through the relay.
Which is why pages load the way they do — text popping in first, images filling in after, each as its answer lands — and why Unit 1's latency taxes pages so hard: a hundred asks means paying the road's length a hundred times (browsers overlap the asks to soften it, but the road is the road).
One thing should bother you, though. All of this — your requests, the pages, anything you type into a form — traveled the relay as readable text. A dozen sorting offices you've never met handled it. Who else read it along the way? Next lesson: the sealed envelope that answers exactly that, and why its little padlock became the most important icon on your screen.