HTTP at a glance
Key idea
HTTP is a conversation of one question and one answer. The browser sends a request saying what it wants; the server sends back a response saying how it went and, usually, the content. Each exchange stands alone: the server doesn't remember you from one request to the next unless something reminds it.
A URL, taken apart
https://shop.example.com/cart?coupon=SPRING has four parts, and each is used at a different hop:
https, the scheme: encrypt the connection (module 7), on port 443.shop.example.com, the host: looked up in DNS, then sent again inside the request./cart, the path: which page or resource on that site.?coupon=SPRING, the query: extra values for the server to use.
The exchange
Anatomy of an HTTP exchange
Cookie: session=7f3a
The Host header matters more than it looks. Many sites can share one IP address, and the Host header is how the server knows which one you meant.
The method says what you want to do. GET fetches and POST sends data; the next lesson covers the rest, and the status codes.
One page, many requests
Loading a page is rarely one exchange. The browser fetches the HTML, reads it, then makes a request for every stylesheet, script, image and font it mentions, often dozens. Open your browser's developer tools on the Network tab and reload any page to watch them.
"Stands alone" is why logins need help. The server can't tell your second request from a stranger's unless the request carries something that identifies you, usually a cookie (lesson 1.6.3).
HTTP/1.1, HTTP/2 and HTTP/3
The diagram shows HTTP/1.1, which is plain text. HTTP/2 and HTTP/3 carry the same parts (method, path, headers, status, body) in a binary format, and send many requests at once over one connection. What each part means doesn't change, so you read them the same way; the Host header just travels under the name :authority. Tools like curl show which version was used.
Check yourself