Source: https://greenbytes.com/tech/webdav/draft-ietf-httpbis-p4-conditional-06.html
Timestamp: 2020-01-29 09:20:44
Document Index: 56363440

Matched Legal Cases: ['art6', 'art5', 'art5', 'art6', 'art6', 'art 1', 'art 5', 'art 6', 'art5']

draft-ietf-httpbis-p4-conditional-06
This Internet-Draft will expire on September 10, 2009.¶
The changes in this draft are summarized in Appendix C.7.¶
7.1. Message Header Registration
A.1. Changes from RFC 2616
This document is currently disorganized in order to minimize the changes between drafts and enable reviewers to see the smaller errata changes. The next draft will reorganize the sections to better reflect the content. In particular, the sections on resource metadata will be discussed first and then followed by each conditional request-header, concluding with a definition of precedence and the expectation of ordering strong validator checks before weak validator checks. It is likely that more content from [Part6] will migrate to this part, where appropriate. The current mess reflects how widely dispersed these topics and associated requirements had become in [RFC2616] .¶
Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the ETag (Section 6.1), If-Match (Section 6.2), If-None-Match (Section 6.4), and If-Range (Section 5.3 of [Part5] ) header fields. The definition of how they are used and compared as cache validators is in Section 4. An entity tag consists of an opaque quoted string, possibly prefixed by a weakness indicator.¶
A "strong entity tag" MAY be shared by two entities of a resource only if they are equivalent by octet equality.¶
A "weak entity tag," indicated by the "W/" prefix, MAY be shared by two entities of a resource only if the entities are equivalent and could be substituted for each other with no significant change in semantics. A weak entity tag can only be used for weak comparison.¶
An entity tag MUST be unique across all versions of all entities associated with a particular resource. A given entity tag value MAY be used for entities obtained by requests on different URIs. The use of the same entity tag value in conjunction with entities obtained by requests on different URIs does not imply the equivalence of those entities.¶
The response MUST include the following header fields: ¶
If the conditional GET used a strong cache validator (see Section 4), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers.¶
If a 304 response indicates an entity not currently cached, then the cache MUST disregard the response and repeat the request without the conditional.¶
The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.¶
Since both origin servers and caches will compare two validators to decide if they represent the same or different entities, one normally would expect that if the entity (the entity-body or any entity-headers) changes in any way, then the associated validator would change as well. If this is true, then we call this validator a "strong validator."¶
However, there might be cases when a server prefers to change the validator only on semantically significant changes, and not when insignificant aspects of the entity change. A validator that does not always change when the resource changes is a "weak validator."¶
Entity tags are normally "strong validators," but the protocol provides a mechanism to tag an entity tag as "weak." One can think of a strong validator as one that changes whenever the bits of an entity changes, while a weak value changes whenever the meaning of an entity changes. Alternatively, one can think of a strong validator as part of an identifier for a specific entity, while a weak validator is part of an identifier for a set of semantically equivalent entities. ¶
Strong validators are usable in any context. Weak validators are only usable in contexts that do not depend on exact equality of an entity. For example, either kind is usable for a conditional GET of a full entity. However, only a strong validator is usable for a sub-range retrieval, since otherwise the client might end up with an internally inconsistent entity.¶
The example below shows the results for a set of entity tag pairs, and both the weak and strong comparison function results:¶
An entity tag is strong unless it is explicitly tagged as weak. Section 2 gives the syntax for entity tags.¶
In other words, the preferred behavior for an HTTP/1.1 origin server is to send both a strong entity tag and a Last-Modified value.¶
In order to be legal, a strong entity tag MUST change whenever the associated entity changes in any way. A weak entity tag SHOULD change whenever the associated entity changes in a semantically significant way. ¶
An HTTP/1.1 origin server, upon receiving a conditional request that includes both a Last-Modified date (e.g., in an If-Modified-Since or If-Unmodified-Since header field) and one or more entity tags (e.g., in an If-Match, If-None-Match, or If-Range header field) as cache validators, MUST NOT return a response status of 304 (Not Modified) unless doing so is consistent with all of the conditional header fields in the request.¶
An HTTP/1.1 caching proxy, upon receiving a conditional request that includes both a Last-Modified date and one or more entity tags as cache validators, MUST NOT return a locally cached response to the client unless that cached response is consistent with all of the conditional header fields in the request. ¶
The response-header field "ETag" provides the current value of the entity tag (see Section 2) for the requested variant. The headers used with entity tags are described in Sections 6.2 and 6.4 of this document, and in Section 5.3 of [Part5] . The entity tag MAY be used for comparison with other entities from the same resource (see Section 4).¶
The ETag response-header field value, an entity tag, provides for an "opaque" cache validator. This might allow more reliable validation in situations where it is inconvenient to store modification dates, where the one-second resolution of HTTP date values is not sufficient, or where the origin server wishes to avoid certain paradoxes that might arise from the use of modification dates.¶
The principle behind entity tags is that only the service author knows the semantics of a resource well enough to select an appropriate cache validation mechanism, and the specification of any validator comparison function more complex than byte-equality would open up a can of worms. Thus, comparisons of any other headers (except Last-Modified, for compatibility with HTTP/1.0) are never used for purposes of validating a cache entry.¶
The request-header field "If-Match" is used with a method to make it conditional. A client that has one or more entities previously obtained from the resource can verify that one of those entities is current by including a list of their associated entity tags in the If-Match header field. Entity tags are defined in Section 2. The purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction overhead. It is also used, on updating requests, to prevent inadvertent modification of the wrong version of a resource. As a special case, the value "*" matches any current entity of the resource.¶
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-Match header) on that resource, or if "*" is given and any current entity exists for that resource, then the server MAY perform the requested method as if the If-Match header field did not exist.¶
A server MUST use the strong comparison function (see Section 4) to compare the entity tags in If-Match.¶
If none of the entity tags match, or if "*" is given and no current entity exists, the server MUST NOT perform the requested method, and MUST return a 412 (Precondition Failed) response. This behavior is most useful when the client wants to prevent an updating method, such as PUT, from modifying a resource that has changed since the client last retrieved it.¶
If the request would, without the If-Match header field, result in anything other than a 2xx or 412 status, then the If-Match header MUST be ignored.¶
The meaning of "If-Match: *" is that the method SHOULD be performed if the representation selected by the origin server (or by a cache, possibly using the Vary mechanism, see Section 3.5 of [Part6] ) exists, and MUST NOT be performed if the representation does not exist.¶
A request intended to update a resource (e.g., a PUT) MAY include an If-Match header field to signal that the request method MUST NOT be applied if the entity corresponding to the If-Match value (a single entity tag) is no longer a representation of that resource. This allows the user to indicate that they do not wish the request to be successful if the resource has been changed without their knowledge. Examples:¶
The request-header field "If-Modified-Since" is used with a method to make it conditional: if the requested variant has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (Not Modified) response will be returned without any message-body.¶
A GET method with an If-Modified-Since header and no Range header requests that the identified entity be transferred only if it has been modified since the date given by the If-Modified-Since header. The algorithm for determining this includes the following cases: ¶
The request-header field "If-None-Match" is used with a method to make it conditional. A client that has one or more entities previously obtained from the resource can verify that none of those entities is current by including a list of their associated entity tags in the If-None-Match header field. The purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction overhead. It is also used to prevent a method (e.g. PUT) from inadvertently modifying an existing resource when the client believes that the resource does not exist.¶
As a special case, the value "*" matches any current entity of the resource.¶
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 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).¶
See Section 4 for rules on how to determine if two entity tags match.¶
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.¶
If the request would, without the If-None-Match header field, result in anything other than a 2xx or 304 status, then the If-None-Match header MUST be ignored. (See Section 5 for a discussion of server behavior when both If-Modified-Since and If-None-Match appear in the same request.)¶
The meaning of "If-None-Match: *" is that the method MUST NOT be performed if the representation selected by the origin server (or by a cache, possibly using the Vary mechanism, see Section 3.5 of [Part6] ) exists, and SHOULD be performed if the representation does not exist. This feature is intended to be useful in preventing races between PUT operations.¶
The request-header field "If-Unmodified-Since" is used with a method to make it conditional. If the requested resource has not been modified since the time specified in this field, the server SHOULD perform the requested operation as if the If-Unmodified-Since header were not present.¶
If the requested variant has been modified since the specified time, the server MUST NOT perform the requested operation, and MUST return a 412 (Precondition Failed).¶
If the request normally (i.e., without the If-Unmodified-Since header) would result in anything other than a 2xx or 412 status, the If-Unmodified-Since header SHOULD be ignored.¶
If the specified date is invalid, the header is ignored.¶
The entity-header field "Last-Modified" indicates the date and time at which the origin server believes the variant was last modified.¶
The exact meaning of this header field depends on the implementation of the origin server and the nature of the original resource. For files, it may be just the file system last-modified time. For entities with dynamically included parts, it may be the most recent of the set of last-modify times for its component parts. For database gateways, it may be the last-update time stamp of the record. For virtual objects, it may be the last time the internal state changed.¶
An origin server SHOULD obtain the Last-Modified value of the entity as close as possible to the time that it generates the Date value of its response. This allows a recipient to make an accurate assessment of the entity's modification time, especially if the entity changes near the time that the response is generated.¶
The Last-Modified entity-header field value is often used as a cache validator. In simple terms, a cache entry is considered to be valid if the entity has not been modified since the Last-Modified value.¶
Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., “HTTP/1.1, part 1: URIs, Connections, and Message Parsing”, Internet-Draft draft-ietf-httpbis-p1-messaging-06 (work in progress), March 2009.
Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., “HTTP/1.1, part 5: Range Requests and Partial Responses”, Internet-Draft draft-ietf-httpbis-p5-range-06 (work in progress), March 2009.
Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., “HTTP/1.1, part 6: Caching”, Internet-Draft draft-ietf-httpbis-p6-cache-06 (work in progress), March 2009.
Allow weak entity tags in all requests except range requests (Sections 4 and 6.4).¶
ETag header 2, 6.1, 7.1
ETag 2, 6.1, 7.1
If-Match 2, 6.1, 6.2, 7.1
If-Modified-Since 6.3, 7.1
If-None-Match 2, 6.1, 6.4, 7.1, A.1
If-Unmodified-Since 6.5, 7.1
Last-Modified 6.6, 7.1
If-Match header 2, 6.1, 6.2, 7.1
If-Modified-Since header 6.3, 7.1
If-None-Match header 2, 6.1, 6.4, 7.1, A.1
If-Unmodified-Since header 6.5, 7.1
Last-Modified header 6.6, 7.1
Section 8.3 3.1
Part5 2, 4, 4, 6.1, 6.3, 10.1