previous | start | next

Conditional-GET

Perhaps the most interesting optional request header is "If-modified-since:", which takes an HTTP standard GMT time/date string as its value.
 
For example, in the above example we saw an HTTP response with the following header line:
Last-modified: Fri, 14 Mar 2004 02:22:52 GMT
The browser can cache this object (keep a local copy in case it's requested again soon), and use the local copy instead of going out to the network, possibly causing uneccessary delays. The HTTP request would then look like:
GET /index.html HTTP/1.0
If-modified-since: Fri, 14 Mar 2004 02:22:52 GMT
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:0.9.4)
Host: ironbark.bendigo.latrobe.edu.au
....etc, as before
If the requested page has not, in fact, been modified since the specified time, it won't be returned -- instead, a "304 Not Modified" response is sent, without a response body -- just the headers. We return to the topic of caching in the next lecture.
 
Lecture 05: Applications #3.1: HTML and HTTP Basics Copyright © 2004 P.Scott, La Trobe University Bendigo.



previous | start | next