LightMySky
به انگلیسی

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.

شروع یادگیری این موضوعبه حساب کاربری نیازی نیست. پیشرفت در همین مرورگر ذخیره می‌شود.

کارهایی که یادگیرنده بعد از این درس می‌تواند انجام دهد

  • 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

۱ · بخوان

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.

Try it together

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.

login responsecookie storedcookie sentsession found
The cookie carries the session identifier back with later requests.

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.

۲ · ببین

به انگلیسی

دور از صفحه‌نمایش

چاپ کاربرگکاغذ A4، با یک صفحهٔ جواب‌ها برای بزرگ‌ترها. بدون صفحه‌نمایش، بدون اینترنت.

جایگاه این موضوع

اول این‌ها را یاد بگیر

پیوندهای اختیاری

این موضوع راه این‌ها را باز می‌کند

سپس تمرین

۸ سؤال پشت این درس منتظرند، هر کدام با پاسخ توضیح‌داده‌شده. هر پاسخ آسمان را پر می‌کند: ستاره‌ها هنگام یادگیری روشن می‌شوند و وقتی زمان برگشتن است کمرنگ می‌شوند.

شروع یادگیری این موضوع