[SOLVED] Last-Modified and ETag implementation
Posted: Sun Aug 19, 2007 3:57 pm
Does anyone know, in simple terms what a client sends in it's HTTP request when making use of the ETag header, then what the server does with that value? Is it something like this?
1. Client sends first request for file
2. Server gets "checksum" for that file, sends it in the ETag field followed by the file
3. Client caches that ETag
4. Client request file at a later date and sends the ETag in the request
5. Server sees that the ETag matches so doesnt send entire file back again
The Last-modified header is simple as far as I know:
1. Client requests file for first time
2. Server sends Last-modified time with the response
3. Client caches the last-modified time
4. Client request file at a later date but sends a If-Modified-Since header
5. Server compares dates and only sends full file if that date is newer.
This is basically for a little part of a Java servlet I'm writing which intercepts geniune request for files.
The main thing that I'm not clear about is what header the client sends when it wants to compare with an ETag.
1. Client sends first request for file
2. Server gets "checksum" for that file, sends it in the ETag field followed by the file
3. Client caches that ETag
4. Client request file at a later date and sends the ETag in the request
5. Server sees that the ETag matches so doesnt send entire file back again
The Last-modified header is simple as far as I know:
1. Client requests file for first time
2. Server sends Last-modified time with the response
3. Client caches the last-modified time
4. Client request file at a later date but sends a If-Modified-Since header
5. Server compares dates and only sends full file if that date is newer.
This is basically for a little part of a Java servlet I'm writing which intercepts geniune request for files.
The main thing that I'm not clear about is what header the client sends when it wants to compare with an ETag.