- From: Dave Kristol <dmk@research.bell-labs.com>
- Date: Wed, 25 Feb 98 14:51:40 EST
- To: http-wg@cuckoo.hpl.hp.com
I've been trying to figure out how to add If-Match (I-M) and If-None-Match (I-N-M) to my server. I'm getting a severe headache as I read and reread the relevant sections and try to understand the interactions between them and If-Modified-Since (I-M-S) and If-Unmodified-Since (I-U-S). (I haven't even got to If-Range yet!) The remarks below apply to a simple server that's trying to respond to a GET. 14.25 If-Match If the request would, without the If-Match header field, result in anything other than a 2xx status, then the If-Match header MUST be ignored. This paragraph implies to me that I should test I-M-S before I-M, because it's possible that I-M-S could produce a 304. (Note that Apache 1.2.5 does the I-M test first, on the theory that I-M is a more accurate test. I'm using Apache as a reference because I'm assuming that Roy had a strong hand in the code. So I would expect it to reflect the desired behavior.) 14.26 If-None-Match If any of the entity tags match the entity tag of the entity that would have been returned in the response to a similar GET request (without the If-None-Match header) on that resource, or if "*" is given and any current entity exists for that resource, then the server MUST NOT perform the requested method, unless required to do so because the resource's modification date fails to match that supplied in an If- Modified-Since header field in the request. Instead, if the request method was GET or HEAD, the server SHOULD respond with a 304 (Not Modified) response, including the cache-related entity-header fields (particularly ETag) of one of the entities that matched. For all other request methods, the server MUST respond with a status of 412 (Precondition Failed). Same remarks here. Same remarks about Apache. The problem is, if I test I-M-S first, then I-N-M, I can run afoul of this part of 14.26: If none of the entity tags match, then the server MAY perform the requested method as if the If-None-Match header field did not exist, but MUST also ignore any If-Modified-Since header field(s) in the request. That is, if no entity tags match, then the server MUST not return a 304 (Not Modified) response. Also, I'm uncertain what the proper behavior is for I-N-M if an Etag match succeeds and there's no I-M-S, or if there's an I-M-S and the file has been modified since the I-M-S date. Return 412 (Precondition Failed)? The response isn't well specified. I'm too confused to ask any further coherent questions, so I'll wait for responses to these. Dave Kristol
Received on Wednesday, 25 February 1998 11:54:46 UTC