Write notes on the following: i)Web Caching ii)Cookies

Write notes on the following:
i) Web Caching
ii) Cookies

Answer:-

i) Web Caching:

o A Web cache—also called a proxy server—is a network entity that satisfies HTTP requests on the behalf of an origin Web server.
o The Web cache has its own disk storage and keeps copies of recently requested objects in this storage.
o Once a browser is configured, each browser request for an object is first directed to the Web cache.


> Here is what happens:

  1. The browser establishes a TCP connection to the Web cache and sends an HTTP request for the object to the Web cache.
  2. The Web cache checks to see if it has a copy of the object stored locally. If it does, the Web cache returns the object within an HTTP response message to the client browser.
  3. If the Web cache does not have the object, the Web cache opens a TCP connection to the origin server, that is, to www.someschool.edu . The Web cache then sends an HTTP request for the object into the cache-to-server TCP connection. After receiving this request, the origin server sends the object within an HTTP response to the Web cache.
  4. When the Web cache receives the object, it stores a copy in its local storage and sends a copy, within an HTTP response message, to the client browser (over the existing TCP connection between the client browser and the Web cache).

ii) Cookies:

It is often desirable for a Web site to identify users, either because the server wishes to restrict user access or because it wants to serve content as a function of the user identity. For these purposes, HTTP uses cookies.

Cookie technology has four components:

  • A cookie header line in the HTTP responsemessage;
  • A cookie header line in the HTTP requestmessage;
  • A cookie file kept on the user’s end system and managed by the user’sbrowser,
  • A back-end database at the Website.

Ex:

Suppose a user, who always accesses the Web using Internet Explorer from her home PC, contacts Amazon.com for the first time. Let us suppose that in the past he has already visited the eBay site. When the request comes into the Amazon Web server, the server creates a unique identification number and creates an entry in its back-end database that is indexed by the identification number. The Amazon Web server then responds to Susan’s browser, including in the HTTP response a Set-cookie: header, which contains the identification number.

For example, the header line might be:

Set-cookie: 1678

When users browser receives the HTTP response message, it sees the Set-cookie: header. The browser then appends a line to the special cookie file that it manages. This line includes the hostname of the server and the identification number in the Set-cookie: header.

As user continues to browse the Amazon site, each time he requests a Web page, his browser consults his cookie file, extracts his identification number for this site, and puts a cookie header line that includes the identification number in the HTTP request. Specifically, each of his HTTP requests to the Amazon server includes the header line:

Leave a Reply

Your email address will not be published. Required fields are marked *