If-Match header question

   RFC 2068 12.25 says that for the If-Match header, one should  
respond with 412 (precondition failed) if the header doesn't match up  
with the ETag of the resource.  OK, cool.

   However, it goes on to say that if, without the If-Match header,  
the request would have resulted in a 200-series response, that the  
header must be ignored.

   This is a little tricky.  For example, if a PUT request would  
error out due to a filesystem permissions issue, the only way for me  
to find that out is to attempt to write the file.  If that works, I'd  
then have to back out the change and respond with a 412.  That seems  
like a lot of extra work there.

   There are many less expensive to detect error cases, such as  
forbidden do the auth config, etc., which presumably is what this  
line is chasing after, but even these cases seems like a lot of  
code.  Without that requirement, I can do an If-Modified test on all  
resources for all requests right away and respond with a 412 if  
appropriate.  This language seems to imply that I instead have to put  
logic into each method which attempts the request and responds with  
412 instead of a success code after potentially backing out the  
operation.

   Am I reading that wrong?

     -wsv

Received on Thursday, 18 August 2005 16:14:50 UTC