Subject: etag vs if-* vs range vs content-encoding?

From: PA <[email-masked]>
Date: Thu, 1 Feb 2007 21:59:58 +0100

Hello,

I'm a bit confused on how the different HTTP entity transformations 
work together... or not. In other words, from an HTTP server 
perspective, how does one properly combine things like entity tags, 
conditional requests, ranges and content encoding to name a few?

Even after going through Jeffrey C. Mogul's "Clarifying the 
Fundamentals of HTTP" and such, I'm not the wiser :P

http://www2002.org/CDROM/refereed/444.pdf

At a more practically level, I have a small set of filters 
(ConnectionFilter, GZIPFilter, ETagFilter, ConditionalFilter, 
RangeFilter, MD5Filter, LogFilter) and I would like to make sure they 
are ordered properly.

Any pointers, guidelines, opinions or advises very welcome :)

Thanks in advance.

Cheers,

PA.

---

From: Henrik Nordstrom <[email-masked]>
Date: Fri, 02 Feb 2007 11:42:08 +0100

> conditional requests, ranges and content encoding to name a few?

content-encoding is a property of the entity. If you recode the object
it needs to get assigned a new ETag, and also a new Content-Location (or
none). Content-Encoding is a result of server-driven content negotiation
just as Content-Language etc and is best thought of as a server having
both file and file.gz and selecting which of the two objects to send
based on accept-encoding.

conditionals and range selection should logically be processed when you
have finished processing the request and know what would be the response
without the conditionals. Conditionals never cause a server to return
different content, only short-circuit the response if any of the
conditionals is false. 

A false if-range conditional means you should ignore the Range request
header and process the request just as if the Range request header was
not there.

206 partial content responses is special. These are fragments of the
underlying 200 response send if there was no Range request header.
Entity headers is the same as the 200 response, except for the headers
used to indicate the ranges contained in the response.

There is some disagreement on what Content-MD5 means in a 206 response,
and to keep sanity Content-MD5 is best ignored.

ETag and any other entity headers (if any) sent in a conditional or
range response must be identical to that of a response to the same
request without any conditionals.

Regards
Henrik