Re: #372: refactor conditional header field descriptions

+1

On 11/07/2012, at 6:17 AM, Julian Reschke wrote:

> (see http://trac.tools.ietf.org/wg/httpbis/trac/ticket/372)
> 
> While looking at If-Match and If-None-Match I realized that there's a lot of prose we repeat, and then sometimes do not get it right.
> 
> I'd like to refactor these so that the condition is only defined once.
> 
> Proposal for If-Match:
> 
> diff -r19.43 draft-ietf-httpbis-p4-conditional-latest.unpg.txt
> 630,640c630,641
> <  If any of the entity-tags listed in the If-Match field value match
> <  (as per Section 2.3.2) the entity-tag of the selected representation
> <  for the target resource, or if "*" is given and any current
> <  representation exists for the target resource, then the server MAY
> <  perform the request method as if the If-Match header field was not
> <  present.
> <
> <  Origin servers MUST NOT perform the requested method if none of the
> <  entity-tags match, or if "*" is given and no current representation
> <  exists; instead they MUST respond with the 412 (Precondition Failed)
> <  status code.
> ---
> >  The If-Match condition is met if and only if any of the entity-tags
> >  listed in the If-Match field value match (as per Section 2.3.2) the
> >  entity-tag of the selected representation for the target resource, or
> >  if "*" is given and any current representation exists for the target
> >  resource.
> >
> >  If the condition is met, the server MAY perform the request method as
> >  if the If-Match header field was not present.
> >
> >  Origin servers MUST NOT perform the requested method if the condition
> >  is not met; instead they MUST respond with the 412 (Precondition
> >  Failed) status code.
> 643,644c644
> <  MUST NOT perform the requested method if none of the entity-tags
> <  match, or if "*" is given and no current representation exists;
> ---
> >  MUST NOT perform the requested method if the condition is not met;
> 
> and for If-None-Match:
> 
> <  If any of the entity-tags listed in the If-None-Match field-value
> <  match (as per Section 2.3.2) the entity-tag of the selected
> <  representation, or if "*" is given and any current representation
> <  exists for that resource, then the server MUST NOT perform the
> <  requested method.  Instead, if the request method was GET or HEAD,
> <  the server SHOULD respond with a 304 (Not Modified) status code,
> <  including the cache-related header fields (particularly ETag) of the
> <  selected representation that has a matching entity-tag.  For all
> <  other request methods, the server MUST respond with a 412
> <  (Precondition Failed) status code.
> <
> <  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.
> ---
> >  The If-None-Match condition is met if and only if any of the entity-
> >  tags listed in the If-None-Match field-value match (as per
> >  Section 2.3.2) the entity-tag of the selected representation, or if
> >  "*" is given and any current representation exists for that resource.
> >
> >  If the condition is met, the server MUST NOT perform the requested
> >  method.  Instead, if the request method was GET or HEAD, the server
> >  SHOULD respond with a 304 (Not Modified) status code, including the
> >  cache-related header fields (particularly ETag) of the selected
> >  representation that has a matching entity-tag.  For all other request
> >  methods, the server MUST respond with a 412 (Precondition Failed)
> >  status code.
> >
> >  If the condition is not met, 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.
> 
> (See <http://trac.tools.ietf.org/wg/httpbis/trac/attachment/ticket/372/372.diff>)
> 
> Feedback appreciated,
> 
> Julian
> 

--
Mark Nottingham   http://www.mnot.net/

Received on Thursday, 12 July 2012 04:15:22 UTC