HTTrack Website Copier
Free software offline browser - FORUM
Subject: Re: how to turn on and use etags
Author: Xavier Roche
Date: 12/14/2003 15:00
> Now that we have an ETag being presented in the head
> command, how do we make use of this to see if a page has
> been updated.

See RFC2616:

- When generating a page, send in the headers an Etag 
field, such as:
Etag: f71dbe52628a3f83a77ab494817525c6

The "f71dbe52628a3f83a77ab494817525c6" can be replaced by 
any string relevant for your server. I personnally use md5 
hashing of the output generated by the script, but it can 
be any string representing the "page entropy" (name/ 
content identifier ..)

- When responding to a request, check if the client sent a 
field named "If-None-Match" ; such as:
If-None-Match: "f71dbe52628a3f83a77ab494817525c6"

If so, compute internally the Etag you would give if 
replying to the request, compare it to the If-None-Match 
given, and reply either with a 200 (OK) with full content 
(and new Etag!), or a 304 (Not modified) response if the 
page is identical.

Etag lets you cache any content, including any dynamically 
generated content, POST data, cookies/password/session 
related data.. and it is a system powerful enough to be 
considered as an independent "layer" between HTTP layer and 
Client layer (hence you can even develop a totally 
transparent etag "proxy" for etag unaware webservers that 
will be fully RFC compliant)
Reply Create subthread

All articles

Subject Author Date
how to turn on and use etags

12/12/2003 03:44
Re: how to turn on and use etags

12/14/2003 15:00
Re: how to turn on and use etags

12/17/2003 01:38


Created with FORUM 2.0.11