The Web as a Protocol: Requests, State and Caching
HTTP uses independent request and response exchanges. Cookies or tokens let an application identify a session across requests, while caching headers tell browsers and shared caches when a response may be reused.
What a learner can do afterwards
- Read a request and response pair and name the parts that carry meaning
- Explain how a stateless protocol supports a logged-in session
- Say what a caching header changes for a browser and for an intermediate cache
1 · Read
HTTP uses requests and responses. A browser sends a request with a method, a target path, headers, and sometimes a body. The server replies with a status, headers, and sometimes a body. For example, the request GET /news carries the header Host: example.com, and the response 200 OK carries Content-Type: text/html with the page as its body.
HTTP treats each request as an independent exchange. The server cannot rely on the protocol to remember an earlier request. An application can carry state by sending a session identifier in a cookie or token with later requests.
Logging in can set a cookie that contains a session identifier. The browser sends that cookie with a later request. The server uses the identifier to find the session and recognise the account without HTTP remembering the earlier exchange.
Caching rules control reuse. A response can carry a Cache-Control header. The directive max-age=3600 means a stored copy stays fresh for 3600 seconds. The directive private lets the user's own browser store the response but forbids a shared cache, such as a proxy serving many users, from storing it. The directive no-store forbids every cache from storing it. A browser cache keeps copies for one user, while a shared cache sits between many users and the server.
HTTP exchanges stand alone, session identifiers carry application state, and caching rules control stored responses.
Original instructional content authored for os-taxonomy.
2 · Watch
En anglaisTake it off screen
Where it sits
Learn first
Optional connections
8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.