Wednesday, 4 July 2012

The Conditional GET

Web caching can reduce response times,but we have a problem that is the copy of an object residing in the cache may be stale. Which i mean to say object housed in the Web cache may have been modified since the copy was cached at the client. Hence we have the conditional GET.

Conditional GET works as follows:-
1) The request message uses the GET method.
2) The request message includes an IF-Modified-Since: header line.

You may ask how does the conditional get looks like,
Look at the example below

HTTP/1.1 200 OK
Date: Mon, 7 Jul 2008 18:12:15
Server: Apache/1.4
Last-Modified: Wed, 6 Jun 2008 10:29:46
Content-Type: image/gif

(data,data,data, data,data,data...) 

Importantly, the cache also stores the last-modified date along with the object.
There are chances that object may have been modified at the web server so cache will perform an up -to-date check by issuing a conditional GET.

If any modifications are there then the updated object is sent in the response message otherwise unmodified object is sent in the response message.
  

No comments:

Post a Comment