draft-ietf-httpbis-p4-conditional-26.txt | draft-ietf-httpbis-p4-conditional-latest.txt | |||
---|---|---|---|---|
HTTPbis Working Group R. Fielding, Ed. | HTTPbis Working Group R. Fielding, Ed. | |||
Internet-Draft Adobe | Internet-Draft Adobe | |||
Obsoletes: 2616 (if approved) J. Reschke, Ed. | Obsoletes: 2616 (if approved) J. Reschke, Ed. | |||
Intended status: Standards Track greenbytes | Intended status: Standards Track greenbytes | |||
Expires: August 10, 2014 February 6, 2014 | Expires: December 3, 2014 June 2014 | |||
Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests | Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests | |||
draft-ietf-httpbis-p4-conditional-26 | draft-ietf-httpbis-p4-conditional-latest | |||
Abstract | Abstract | |||
The Hypertext Transfer Protocol (HTTP) is a stateless application- | The Hypertext Transfer Protocol (HTTP) is a stateless application- | |||
level protocol for distributed, collaborative, hypertext information | level protocol for distributed, collaborative, hypertext information | |||
systems. This document defines HTTP/1.1 conditional requests, | systems. This document defines HTTP/1.1 conditional requests, | |||
including metadata header fields for indicating state changes, | including metadata header fields for indicating state changes, | |||
request header fields for making preconditions on such state, and | request header fields for making preconditions on such state, and | |||
rules for constructing the responses to a conditional request when | rules for constructing the responses to a conditional request when | |||
one or more preconditions evaluate to false. | one or more preconditions evaluate to false. | |||
skipping to change at page 1, line 33 ¶ | skipping to change at page 1, line 33 ¶ | |||
Discussion of this draft takes place on the HTTPBIS working group | Discussion of this draft takes place on the HTTPBIS working group | |||
mailing list (ietf-http-wg@w3.org), which is archived at | mailing list (ietf-http-wg@w3.org), which is archived at | |||
<http://lists.w3.org/Archives/Public/ietf-http-wg/>. | <http://lists.w3.org/Archives/Public/ietf-http-wg/>. | |||
The current issues list is at | The current issues list is at | |||
<http://tools.ietf.org/wg/httpbis/trac/report/3> and related | <http://tools.ietf.org/wg/httpbis/trac/report/3> and related | |||
documents (including fancy diffs) can be found at | documents (including fancy diffs) can be found at | |||
<http://tools.ietf.org/wg/httpbis/>. | <http://tools.ietf.org/wg/httpbis/>. | |||
The changes in this draft are summarized in Appendix D.2. | _This is a temporary document for the purpose of tracking the | |||
editorial changes made during the AUTH48 (RFC publication) phase._ | ||||
Status of This Memo | Status of This Memo | |||
This Internet-Draft is submitted in full conformance with the | This Internet-Draft is submitted in full conformance with the | |||
provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
Drafts is at http://datatracker.ietf.org/drafts/current/. | Drafts is at http://datatracker.ietf.org/drafts/current/. | |||
Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
This Internet-Draft will expire on August 10, 2014. | This Internet-Draft will expire on December 3, 2014. | |||
Copyright Notice | Copyright Notice | |||
Copyright (c) 2014 IETF Trust and the persons identified as the | Copyright (c) 2014 IETF Trust and the persons identified as the | |||
document authors. All rights reserved. | document authors. All rights reserved. | |||
This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
(http://trustee.ietf.org/license-info) in effect on the date of | (http://trustee.ietf.org/license-info) in effect on the date of | |||
publication of this document. Please review these documents | publication of this document. Please review these documents | |||
skipping to change at page 3, line 18 ¶ | skipping to change at page 3, line 18 ¶ | |||
1.1. Conformance and Error Handling . . . . . . . . . . . . . . 4 | 1.1. Conformance and Error Handling . . . . . . . . . . . . . . 4 | |||
1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 4 | 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 4 | |||
2. Validators . . . . . . . . . . . . . . . . . . . . . . . . . . 5 | 2. Validators . . . . . . . . . . . . . . . . . . . . . . . . . . 5 | |||
2.1. Weak versus Strong . . . . . . . . . . . . . . . . . . . . 5 | 2.1. Weak versus Strong . . . . . . . . . . . . . . . . . . . . 5 | |||
2.2. Last-Modified . . . . . . . . . . . . . . . . . . . . . . 7 | 2.2. Last-Modified . . . . . . . . . . . . . . . . . . . . . . 7 | |||
2.2.1. Generation . . . . . . . . . . . . . . . . . . . . . . 7 | 2.2.1. Generation . . . . . . . . . . . . . . . . . . . . . . 7 | |||
2.2.2. Comparison . . . . . . . . . . . . . . . . . . . . . . 8 | 2.2.2. Comparison . . . . . . . . . . . . . . . . . . . . . . 8 | |||
2.3. ETag . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 | 2.3. ETag . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
2.3.1. Generation . . . . . . . . . . . . . . . . . . . . . . 10 | 2.3.1. Generation . . . . . . . . . . . . . . . . . . . . . . 10 | |||
2.3.2. Comparison . . . . . . . . . . . . . . . . . . . . . . 10 | 2.3.2. Comparison . . . . . . . . . . . . . . . . . . . . . . 10 | |||
2.3.3. Example: Entity-tags Varying on Content-Negotiated | 2.3.3. Example: Entity-Tags Varying on Content-Negotiated | |||
Resources . . . . . . . . . . . . . . . . . . . . . . 11 | Resources . . . . . . . . . . . . . . . . . . . . . . 11 | |||
2.4. When to Use Entity-tags and Last-Modified Dates . . . . . 12 | 2.4. When to Use Entity-Tags and Last-Modified Dates . . . . . 12 | |||
3. Precondition Header Fields . . . . . . . . . . . . . . . . . . 13 | 3. Precondition Header Fields . . . . . . . . . . . . . . . . . . 13 | |||
3.1. If-Match . . . . . . . . . . . . . . . . . . . . . . . . . 13 | 3.1. If-Match . . . . . . . . . . . . . . . . . . . . . . . . . 13 | |||
3.2. If-None-Match . . . . . . . . . . . . . . . . . . . . . . 14 | 3.2. If-None-Match . . . . . . . . . . . . . . . . . . . . . . 14 | |||
3.3. If-Modified-Since . . . . . . . . . . . . . . . . . . . . 15 | 3.3. If-Modified-Since . . . . . . . . . . . . . . . . . . . . 15 | |||
3.4. If-Unmodified-Since . . . . . . . . . . . . . . . . . . . 16 | 3.4. If-Unmodified-Since . . . . . . . . . . . . . . . . . . . 16 | |||
3.5. If-Range . . . . . . . . . . . . . . . . . . . . . . . . . 18 | 3.5. If-Range . . . . . . . . . . . . . . . . . . . . . . . . . 18 | |||
4. Status Code Definitions . . . . . . . . . . . . . . . . . . . 18 | 4. Status Code Definitions . . . . . . . . . . . . . . . . . . . 18 | |||
4.1. 304 Not Modified . . . . . . . . . . . . . . . . . . . . . 18 | 4.1. 304 Not Modified . . . . . . . . . . . . . . . . . . . . . 18 | |||
4.2. 412 Precondition Failed . . . . . . . . . . . . . . . . . 18 | 4.2. 412 Precondition Failed . . . . . . . . . . . . . . . . . 18 | |||
5. Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 19 | 5. Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 19 | |||
skipping to change at page 3, line 43 ¶ | skipping to change at page 3, line 43 ¶ | |||
7.1. Status Code Registration . . . . . . . . . . . . . . . . . 21 | 7.1. Status Code Registration . . . . . . . . . . . . . . . . . 21 | |||
7.2. Header Field Registration . . . . . . . . . . . . . . . . 21 | 7.2. Header Field Registration . . . . . . . . . . . . . . . . 21 | |||
8. Security Considerations . . . . . . . . . . . . . . . . . . . 22 | 8. Security Considerations . . . . . . . . . . . . . . . . . . . 22 | |||
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 22 | 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 22 | |||
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 23 | 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 23 | |||
10.1. Normative References . . . . . . . . . . . . . . . . . . . 23 | 10.1. Normative References . . . . . . . . . . . . . . . . . . . 23 | |||
10.2. Informative References . . . . . . . . . . . . . . . . . . 23 | 10.2. Informative References . . . . . . . . . . . . . . . . . . 23 | |||
Appendix A. Changes from RFC 2616 . . . . . . . . . . . . . . . . 23 | Appendix A. Changes from RFC 2616 . . . . . . . . . . . . . . . . 23 | |||
Appendix B. Imported ABNF . . . . . . . . . . . . . . . . . . . . 24 | Appendix B. Imported ABNF . . . . . . . . . . . . . . . . . . . . 24 | |||
Appendix C. Collected ABNF . . . . . . . . . . . . . . . . . . . 24 | Appendix C. Collected ABNF . . . . . . . . . . . . . . . . . . . 24 | |||
Appendix D. Change Log (to be removed by RFC Editor before | Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 | |||
publication) . . . . . . . . . . . . . . . . . . . . 25 | ||||
D.1. Since draft-ietf-httpbis-p4-conditional-24 . . . . . . . . 25 | ||||
D.2. Since draft-ietf-httpbis-p4-conditional-25 . . . . . . . . 25 | ||||
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 | ||||
1. Introduction | 1. Introduction | |||
Conditional requests are HTTP requests [Part2] that include one or | Conditional requests are HTTP requests [RFC7231] that include one or | |||
more header fields indicating a precondition to be tested before | more header fields indicating a precondition to be tested before | |||
applying the method semantics to the target resource. This document | applying the method semantics to the target resource. This document | |||
defines the HTTP/1.1 conditional request mechanisms in terms of the | defines the HTTP/1.1 conditional request mechanisms in terms of the | |||
architecture, syntax notation, and conformance criteria defined in | architecture, syntax notation, and conformance criteria defined in | |||
[Part1]. | [RFC7230]. | |||
Conditional GET requests are the most efficient mechanism for HTTP | Conditional GET requests are the most efficient mechanism for HTTP | |||
cache updates [Part6]. Conditionals can also be applied to state- | cache updates [RFC7234]. Conditionals can also be applied to state- | |||
changing methods, such as PUT and DELETE, to prevent the "lost | changing methods, such as PUT and DELETE, to prevent the "lost | |||
update" problem: one client accidentally overwriting the work of | update" problem: one client accidentally overwriting the work of | |||
another client that has been acting in parallel. | another client that has been acting in parallel. | |||
Conditional request preconditions are based on the state of the | Conditional request preconditions are based on the state of the | |||
target resource as a whole (its current value set) or the state as | target resource as a whole (its current value set) or the state as | |||
observed in a previously obtained representation (one value in that | observed in a previously obtained representation (one value in that | |||
set). A resource might have multiple current representations, each | set). A resource might have multiple current representations, each | |||
with its own observable state. The conditional request mechanisms | with its own observable state. The conditional request mechanisms | |||
assume that the mapping of requests to a "selected representation" | assume that the mapping of requests to a "selected representation" | |||
(Section 3 of [Part2]) will be consistent over time if the server | (Section 3 of [RFC7231]) will be consistent over time if the server | |||
intends to take advantage of conditionals. Regardless, if the | intends to take advantage of conditionals. Regardless, if the | |||
mapping is inconsistent and the server is unable to select the | mapping is inconsistent and the server is unable to select the | |||
appropriate representation, then no harm will result when the | appropriate representation, then no harm will result when the | |||
precondition evaluates to false. | precondition evaluates to false. | |||
The conditional request preconditions defined by this specification | The conditional request preconditions defined by this specification | |||
(Section 3) are evaluated when applicable to the recipient | (Section 3) are evaluated when applicable to the recipient | |||
(Section 5) according to their order of precedence (Section 6). | (Section 5) according to their order of precedence (Section 6). | |||
1.1. Conformance and Error Handling | 1.1. Conformance and Error Handling | |||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | |||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | |||
document are to be interpreted as described in [RFC2119]. | document are to be interpreted as described in [RFC2119]. | |||
Conformance criteria and considerations regarding error handling are | Conformance criteria and considerations regarding error handling are | |||
defined in Section 2.5 of [Part1]. | defined in Section 2.5 of [RFC7230]. | |||
1.2. Syntax Notation | 1.2. Syntax Notation | |||
This specification uses the Augmented Backus-Naur Form (ABNF) | This specification uses the Augmented Backus-Naur Form (ABNF) | |||
notation of [RFC5234] with a list extension, defined in Section 7 of | notation of [RFC5234] with a list extension, defined in Section 7 of | |||
[Part1], that allows for compact definition of comma-separated lists | [RFC7230], that allows for compact definition of comma-separated | |||
using a '#' operator (similar to how the '*' operator indicates | lists using a '#' operator (similar to how the '*' operator indicates | |||
repetition). Appendix B describes rules imported from other | repetition). Appendix B describes rules imported from other | |||
documents. Appendix C shows the collected grammar with all list | documents. Appendix C shows the collected grammar with all list | |||
operators expanded to standard ABNF notation. | operators expanded to standard ABNF notation. | |||
2. Validators | 2. Validators | |||
This specification defines two forms of metadata that are commonly | This specification defines two forms of metadata that are commonly | |||
used to observe resource state and test for preconditions: | used to observe resource state and test for preconditions: | |||
modification dates (Section 2.2) and opaque entity tags | modification dates (Section 2.2) and opaque entity tags | |||
(Section 2.3). Additional metadata that reflects resource state has | (Section 2.3). Additional metadata that reflects resource state has | |||
been defined by various extensions of HTTP, such as WebDAV [RFC4918], | been defined by various extensions of HTTP, such as Web Distributed | |||
that are beyond the scope of this specification. A resource metadata | Authoring and Versioning (WebDAV, [RFC4918]), that are beyond the | |||
value is referred to as a ""validator"" when it is used within a | scope of this specification. A resource metadata value is referred | |||
precondition. | to as a ""validator"" when it is used within a precondition. | |||
2.1. Weak versus Strong | 2.1. Weak versus Strong | |||
Validators come in two flavors: strong or weak. Weak validators are | Validators come in two flavors: strong or weak. Weak validators are | |||
easy to generate but are far less useful for comparisons. Strong | easy to generate but are far less useful for comparisons. Strong | |||
validators are ideal for comparisons but can be very difficult (and | validators are ideal for comparisons but can be very difficult (and | |||
occasionally impossible) to generate efficiently. Rather than impose | occasionally impossible) to generate efficiently. Rather than impose | |||
that all forms of resource adhere to the same strength of validator, | that all forms of resource adhere to the same strength of validator, | |||
HTTP exposes the type of validator in use and imposes restrictions on | HTTP exposes the type of validator in use and imposes restrictions on | |||
when weak validators can be used as preconditions. | when weak validators can be used as preconditions. | |||
skipping to change at page 6, line 17 ¶ | skipping to change at page 6, line 17 ¶ | |||
not need to be recalculated every time a validation request is | not need to be recalculated every time a validation request is | |||
received. However, if a resource has distinct representations that | received. However, if a resource has distinct representations that | |||
differ only in their metadata, such as might occur with content | differ only in their metadata, such as might occur with content | |||
negotiation over media types that happen to share the same data | negotiation over media types that happen to share the same data | |||
format, then the origin server needs to incorporate additional | format, then the origin server needs to incorporate additional | |||
information in the validator to distinguish those representations. | information in the validator to distinguish those representations. | |||
In contrast, a "weak validator" is representation metadata that might | In contrast, a "weak validator" is representation metadata that might | |||
not change for every change to the representation data. This | not change for every change to the representation data. This | |||
weakness might be due to limitations in how the value is calculated, | weakness might be due to limitations in how the value is calculated, | |||
such as clock resolution or an inability to ensure uniqueness for all | such as clock resolution, an inability to ensure uniqueness for all | |||
possible representations of the resource, or due to a desire by the | possible representations of the resource, or a desire of the resource | |||
resource owner to group representations by some self-determined set | owner to group representations by some self-determined set of | |||
of equivalency rather than unique sequences of data. An origin | equivalency rather than unique sequences of data. An origin server | |||
server SHOULD change a weak entity-tag whenever it considers prior | SHOULD change a weak entity-tag whenever it considers prior | |||
representations to be unacceptable as a substitute for the current | representations to be unacceptable as a substitute for the current | |||
representation. In other words, a weak entity-tag ought to change | representation. In other words, a weak entity-tag ought to change | |||
whenever the origin server wants caches to invalidate old responses. | whenever the origin server wants caches to invalidate old responses. | |||
For example, the representation of a weather report that changes in | For example, the representation of a weather report that changes in | |||
content every second, based on dynamic measurements, might be grouped | content every second, based on dynamic measurements, might be grouped | |||
into sets of equivalent representations (from the origin server's | into sets of equivalent representations (from the origin server's | |||
perspective) with the same weak validator in order to allow cached | perspective) with the same weak validator in order to allow cached | |||
representations to be valid for a reasonable period of time (perhaps | representations to be valid for a reasonable period of time (perhaps | |||
adjusted dynamically based on server load or weather quality). | adjusted dynamically based on server load or weather quality). | |||
skipping to change at page 7, line 24 ¶ | skipping to change at page 7, line 24 ¶ | |||
An example of its use is | An example of its use is | |||
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT | Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT | |||
2.2.1. Generation | 2.2.1. Generation | |||
An origin server SHOULD send Last-Modified for any selected | An origin server SHOULD send Last-Modified for any selected | |||
representation for which a last modification date can be reasonably | representation for which a last modification date can be reasonably | |||
and consistently determined, since its use in conditional requests | and consistently determined, since its use in conditional requests | |||
and evaluating cache freshness ([Part6]) results in a substantial | and evaluating cache freshness ([RFC7234]) results in a substantial | |||
reduction of HTTP traffic on the Internet and can be a significant | reduction of HTTP traffic on the Internet and can be a significant | |||
factor in improving service scalability and reliability. | factor in improving service scalability and reliability. | |||
A representation is typically the sum of many parts behind the | A representation is typically the sum of many parts behind the | |||
resource interface. The last-modified time would usually be the most | resource interface. The last-modified time would usually be the most | |||
recent time that any of those parts were changed. How that value is | recent time that any of those parts were changed. How that value is | |||
determined for any given resource is an implementation detail beyond | determined for any given resource is an implementation detail beyond | |||
the scope of this specification. What matters to HTTP is how | the scope of this specification. What matters to HTTP is how | |||
recipients of the Last-Modified header field can use its value to | recipients of the Last-Modified header field can use its value to | |||
make conditional requests and test the validity of locally cached | make conditional requests and test the validity of locally cached | |||
skipping to change at page 8, line 25 ¶ | skipping to change at page 8, line 25 ¶ | |||
o The validator is being compared by an origin server to the actual | o The validator is being compared by an origin server to the actual | |||
current validator for the representation and, | current validator for the representation and, | |||
o That origin server reliably knows that the associated | o That origin server reliably knows that the associated | |||
representation did not change twice during the second covered by | representation did not change twice during the second covered by | |||
the presented validator. | the presented validator. | |||
or | or | |||
o The validator is about to be used by a client in an If-Modified- | o The validator is about to be used by a client in an If-Modified- | |||
Since, If-Unmodified-Since header field, because the client has a | Since, If-Unmodified-Since, or If-Range header field, because the | |||
cache entry, or If-Range for the associated representation, and | client has a cache entry for the associated representation, and | |||
o That cache entry includes a Date value, which gives the time when | o That cache entry includes a Date value, which gives the time when | |||
the origin server sent the original response, and | the origin server sent the original response, and | |||
o The presented Last-Modified time is at least 60 seconds before the | o The presented Last-Modified time is at least 60 seconds before the | |||
Date value. | Date value. | |||
or | or | |||
o The validator is being compared by an intermediate cache to the | o The validator is being compared by an intermediate cache to the | |||
skipping to change at page 8, line 50 ¶ | skipping to change at page 8, line 50 ¶ | |||
the origin server sent the original response, and | the origin server sent the original response, and | |||
o The presented Last-Modified time is at least 60 seconds before the | o The presented Last-Modified time is at least 60 seconds before the | |||
Date value. | Date value. | |||
This method relies on the fact that if two different responses were | This method relies on the fact that if two different responses were | |||
sent by the origin server during the same second, but both had the | sent by the origin server during the same second, but both had the | |||
same Last-Modified time, then at least one of those responses would | same Last-Modified time, then at least one of those responses would | |||
have a Date value equal to its Last-Modified time. The arbitrary 60- | have a Date value equal to its Last-Modified time. The arbitrary 60- | |||
second limit guards against the possibility that the Date and Last- | second limit guards against the possibility that the Date and Last- | |||
Modified values are generated from different clocks, or at somewhat | Modified values are generated from different clocks or at somewhat | |||
different times during the preparation of the response. An | different times during the preparation of the response. An | |||
implementation MAY use a value larger than 60 seconds, if it is | implementation MAY use a value larger than 60 seconds, if it is | |||
believed that 60 seconds is too short. | believed that 60 seconds is too short. | |||
2.3. ETag | 2.3. ETag | |||
The "ETag" header field in a response provides the current entity-tag | The "ETag" header field in a response provides the current entity-tag | |||
for the selected representation, as determined at the conclusion of | for the selected representation, as determined at the conclusion of | |||
handling the request. An entity-tag is an opaque validator for | handling the request. An entity-tag is an opaque validator for | |||
differentiating between multiple representations of the same | differentiating between multiple representations of the same | |||
skipping to change at page 9, line 27 ¶ | skipping to change at page 9, line 27 ¶ | |||
ETag = entity-tag | ETag = entity-tag | |||
entity-tag = [ weak ] opaque-tag | entity-tag = [ weak ] opaque-tag | |||
weak = %x57.2F ; "W/", case-sensitive | weak = %x57.2F ; "W/", case-sensitive | |||
opaque-tag = DQUOTE *etagc DQUOTE | opaque-tag = DQUOTE *etagc DQUOTE | |||
etagc = %x21 / %x23-7E / obs-text | etagc = %x21 / %x23-7E / obs-text | |||
; VCHAR except double quotes, plus obs-text | ; VCHAR except double quotes, plus obs-text | |||
Note: Previously, opaque-tag was defined to be a quoted-string | Note: Previously, opaque-tag was defined to be a quoted-string | |||
([RFC2616], Section 3.11), thus some recipients might perform | ([RFC2616], Section 3.11); thus, some recipients might perform | |||
backslash unescaping. Servers therefore ought to avoid backslash | backslash unescaping. Servers therefore ought to avoid backslash | |||
characters in entity tags. | characters in entity tags. | |||
An entity-tag can be more reliable for validation than a modification | An entity-tag can be more reliable for validation than a modification | |||
date in situations where it is inconvenient to store modification | date in situations where it is inconvenient to store modification | |||
dates, where the one-second resolution of HTTP date values is not | dates, where the one-second resolution of HTTP date values is not | |||
sufficient, or where modification dates are not consistently | sufficient, or where modification dates are not consistently | |||
maintained. | maintained. | |||
Examples: | Examples: | |||
skipping to change at page 10, line 22 ¶ | skipping to change at page 10, line 22 ¶ | |||
the client to be aware of how each entity-tag is constructed. | the client to be aware of how each entity-tag is constructed. | |||
For example, a resource that has implementation-specific versioning | For example, a resource that has implementation-specific versioning | |||
applied to all changes might use an internal revision number, perhaps | applied to all changes might use an internal revision number, perhaps | |||
combined with a variance identifier for content negotiation, to | combined with a variance identifier for content negotiation, to | |||
accurately differentiate between representations. Other | accurately differentiate between representations. Other | |||
implementations might use a collision-resistant hash of | implementations might use a collision-resistant hash of | |||
representation content, a combination of various file attributes, or | representation content, a combination of various file attributes, or | |||
a modification timestamp that has sub-second resolution. | a modification timestamp that has sub-second resolution. | |||
An origin server SHOULD send ETag for any selected representation for | An origin server SHOULD send an ETag for any selected representation | |||
which detection of changes can be reasonably and consistently | for which detection of changes can be reasonably and consistently | |||
determined, since the entity-tag's use in conditional requests and | determined, since the entity-tag's use in conditional requests and | |||
evaluating cache freshness ([Part6]) can result in a substantial | evaluating cache freshness ([RFC7234]) can result in a substantial | |||
reduction of HTTP network traffic and can be a significant factor in | reduction of HTTP network traffic and can be a significant factor in | |||
improving service scalability and reliability. | improving service scalability and reliability. | |||
2.3.2. Comparison | 2.3.2. Comparison | |||
There are two entity-tag comparison functions, depending on whether | There are two entity-tag comparison functions, depending on whether | |||
the comparison context allows the use of weak validators or not: | or not the comparison context allows the use of weak validators: | |||
o "Strong comparison": two entity-tags are equivalent if both are | o "Strong comparison": two entity-tags are equivalent if both are | |||
not weak and their opaque-tags match character-by-character. | not weak and their opaque-tags match character-by-character. | |||
o "Weak comparison": two entity-tags are equivalent if their opaque- | o "Weak comparison": two entity-tags are equivalent if their opaque- | |||
tags match character-by-character, regardless of either or both | tags match character-by-character, regardless of either or both | |||
being tagged as "weak". | being tagged as "weak". | |||
The example below shows the results for a set of entity-tag pairs, | The example below shows the results for a set of entity-tag pairs and | |||
and both the weak and strong comparison function results: | both the weak and strong comparison function results: | |||
+--------+--------+-------------------+-----------------+ | +--------+--------+-------------------+-----------------+ | |||
| ETag 1 | ETag 2 | Strong Comparison | Weak Comparison | | | ETag 1 | ETag 2 | Strong Comparison | Weak Comparison | | |||
+--------+--------+-------------------+-----------------+ | +--------+--------+-------------------+-----------------+ | |||
| W/"1" | W/"1" | no match | match | | | W/"1" | W/"1" | no match | match | | |||
| W/"1" | W/"2" | no match | no match | | | W/"1" | W/"2" | no match | no match | | |||
| W/"1" | "1" | no match | match | | | W/"1" | "1" | no match | match | | |||
| "1" | "1" | match | match | | | "1" | "1" | match | match | | |||
+--------+--------+-------------------+-----------------+ | +--------+--------+-------------------+-----------------+ | |||
2.3.3. Example: Entity-tags Varying on Content-Negotiated Resources | 2.3.3. Example: Entity-Tags Varying on Content-Negotiated Resources | |||
Consider a resource that is subject to content negotiation (Section | Consider a resource that is subject to content negotiation (Section | |||
3.4 of [Part2]), and where the representations sent in response to a | 3.4 of [RFC7231]), and where the representations sent in response to | |||
GET request vary based on the Accept-Encoding request header field | a GET request vary based on the Accept-Encoding request header field | |||
(Section 5.3.4 of [Part2]): | (Section 5.3.4 of [RFC7231]): | |||
>> Request: | >> Request: | |||
GET /index HTTP/1.1 | GET /index HTTP/1.1 | |||
Host: www.example.com | Host: www.example.com | |||
Accept-Encoding: gzip | Accept-Encoding: gzip | |||
In this case, the response might or might not use the gzip content | In this case, the response might or might not use the gzip content | |||
coding. If it does not, the response might look like: | coding. If it does not, the response might look like: | |||
skipping to change at page 12, line 9 ¶ | skipping to change at page 12, line 9 ¶ | |||
Vary: Accept-Encoding | Vary: Accept-Encoding | |||
Content-Type: text/plain | Content-Type: text/plain | |||
Content-Encoding: gzip | Content-Encoding: gzip | |||
...binary data... | ...binary data... | |||
Note: Content codings are a property of the representation data, | Note: Content codings are a property of the representation data, | |||
so a strong entity-tag for a content-encoded representation has to | so a strong entity-tag for a content-encoded representation has to | |||
be distinct from the entity tag of an unencoded representation to | be distinct from the entity tag of an unencoded representation to | |||
prevent potential conflicts during cache updates and range | prevent potential conflicts during cache updates and range | |||
requests. In contrast, transfer codings (Section 4 of [Part1]) | requests. In contrast, transfer codings (Section 4 of [RFC7230]) | |||
apply only during message transfer and do not result in distinct | apply only during message transfer and do not result in distinct | |||
entity-tags. | entity-tags. | |||
2.4. When to Use Entity-tags and Last-Modified Dates | 2.4. When to Use Entity-Tags and Last-Modified Dates | |||
In 200 (OK) responses to GET or HEAD, an origin server: | In 200 (OK) responses to GET or HEAD, an origin server: | |||
o SHOULD send an entity-tag validator unless it is not feasible to | o SHOULD send an entity-tag validator unless it is not feasible to | |||
generate one. | generate one. | |||
o MAY send a weak entity-tag instead of a strong entity-tag, if | o MAY send a weak entity-tag instead of a strong entity-tag, if | |||
performance considerations support the use of weak entity-tags, or | performance considerations support the use of weak entity-tags, or | |||
if it is unfeasible to send a strong entity-tag. | if it is unfeasible to send a strong entity-tag. | |||
skipping to change at page 13, line 50 ¶ | skipping to change at page 13, line 50 ¶ | |||
An origin server that receives an If-Match header field MUST evaluate | An origin server that receives an If-Match header field MUST evaluate | |||
the condition prior to performing the method (Section 5). If the | the condition prior to performing the method (Section 5). If the | |||
field-value is "*", the condition is false if the origin server does | field-value is "*", the condition is false if the origin server does | |||
not have a current representation for the target resource. If the | not have a current representation for the target resource. If the | |||
field-value is a list of entity-tags, the condition is false if none | field-value is a list of entity-tags, the condition is false if none | |||
of the listed tags match the entity-tag of the selected | of the listed tags match the entity-tag of the selected | |||
representation. | representation. | |||
An origin server MUST NOT perform the requested method if a received | An origin server MUST NOT perform the requested method if a received | |||
If-Match condition evaluates to false; instead the origin server MUST | If-Match condition evaluates to false; instead, the origin server | |||
respond with either: a) the 412 (Precondition Failed) status code; | MUST respond with either a) the 412 (Precondition Failed) status code | |||
or, b) one of the 2xx (Successful) status codes if the origin server | or b) one of the 2xx (Successful) status codes if the origin server | |||
has verified that a state change is being requested and the final | has verified that a state change is being requested and the final | |||
state is already reflected in the current state of the target | state is already reflected in the current state of the target | |||
resource (i.e., the change requested by the user agent has already | resource (i.e., the change requested by the user agent has already | |||
succeeded, but the user agent might not be aware of it, perhaps | succeeded, but the user agent might not be aware of it, perhaps | |||
because the prior response was lost or a compatible change was made | because the prior response was lost or a compatible change was made | |||
by some other user agent). In the latter case, the origin server | by some other user agent). In the latter case, the origin server | |||
MUST NOT send a validator header field in the response unless it can | MUST NOT send a validator header field in the response unless it can | |||
verify that the request is a duplicate of an immediately prior change | verify that the request is a duplicate of an immediately prior change | |||
made by the same user agent. | made by the same user agent. | |||
skipping to change at page 15, line 5 ¶ | skipping to change at page 15, line 5 ¶ | |||
stored responses that have entity-tags, the client SHOULD generate an | stored responses that have entity-tags, the client SHOULD generate an | |||
If-None-Match header field containing a list of those entity-tags | If-None-Match header field containing a list of those entity-tags | |||
when making a GET request; this allows recipient servers to send a | when making a GET request; this allows recipient servers to send a | |||
304 (Not Modified) response to indicate when one of those stored | 304 (Not Modified) response to indicate when one of those stored | |||
responses matches the selected representation. | responses matches the selected representation. | |||
If-None-Match can also be used with a value of "*" to prevent an | If-None-Match can also be used with a value of "*" to prevent an | |||
unsafe request method (e.g., PUT) from inadvertently modifying an | unsafe request method (e.g., PUT) from inadvertently modifying an | |||
existing representation of the target resource when the client | existing representation of the target resource when the client | |||
believes that the resource does not have a current representation | believes that the resource does not have a current representation | |||
(Section 4.2.1 of [Part2]). This is a variation on the "lost update" | (Section 4.2.1 of [RFC7231]). This is a variation on the "lost | |||
problem that might arise if more than one client attempts to create | update" problem that might arise if more than one client attempts to | |||
an initial representation for the target resource. | create an initial representation for the target resource. | |||
An origin server that receives an If-None-Match header field MUST | An origin server that receives an If-None-Match header field MUST | |||
evaluate the condition prior to performing the method (Section 5). | evaluate the condition prior to performing the method (Section 5). | |||
If the field-value is "*", the condition is false if the origin | If the field-value is "*", the condition is false if the origin | |||
server has a current representation for the target resource. If the | server has a current representation for the target resource. If the | |||
field-value is a list of entity-tags, the condition is false if one | field-value is a list of entity-tags, the condition is false if one | |||
of the listed tags match the entity-tag of the selected | of the listed tags match the entity-tag of the selected | |||
representation. | representation. | |||
An origin server MUST NOT perform the requested method if the | An origin server MUST NOT perform the requested method if the | |||
condition evaluates to false; instead, the origin server MUST respond | condition evaluates to false; instead, the origin server MUST respond | |||
with either a) the 304 (Not Modified) status code if the request | with either a) the 304 (Not Modified) status code if the request | |||
method is GET or HEAD; or, b) the 412 (Precondition Failed) status | method is GET or HEAD or b) the 412 (Precondition Failed) status code | |||
code for all other request methods. | for all other request methods. | |||
Requirements on cache handling of a received If-None-Match header | Requirements on cache handling of a received If-None-Match header | |||
field are defined in Section 4.3.2 of [Part6]. | field are defined in Section 4.3.2 of [RFC7234]. | |||
3.3. If-Modified-Since | 3.3. If-Modified-Since | |||
The "If-Modified-Since" header field makes a GET or HEAD request | The "If-Modified-Since" header field makes a GET or HEAD request | |||
method conditional on the selected representation's modification date | method conditional on the selected representation's modification date | |||
being more recent than the date provided in the field-value. | being more recent than the date provided in the field-value. | |||
Transfer of the selected representation's data is avoided if that | Transfer of the selected representation's data is avoided if that | |||
data has not changed. | data has not changed. | |||
If-Modified-Since = HTTP-date | If-Modified-Since = HTTP-date | |||
An example of the field is: | An example of the field is: | |||
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT | If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT | |||
A recipient MUST ignore If-Modified-Since if the request contains an | A recipient MUST ignore If-Modified-Since if the request contains an | |||
If-None-Match header field; the condition in If-None-Match is | If-None-Match header field; the condition in If-None-Match is | |||
considered to be a more accurate replacement for the condition in If- | considered to be a more accurate replacement for the condition in If- | |||
Modified-Since and the two are only combined for the sake of | Modified-Since, and the two are only combined for the sake of | |||
interoperating with older intermediaries that might not implement If- | interoperating with older intermediaries that might not implement If- | |||
None-Match. | None-Match. | |||
A recipient MUST ignore the If-Modified-Since header field if the | A recipient MUST ignore the If-Modified-Since header field if the | |||
received field-value is not a valid HTTP-date, or if the request | received field-value is not a valid HTTP-date, or if the request | |||
method is neither GET nor HEAD. | method is neither GET nor HEAD. | |||
A recipient MUST interpret an If-Modified-Since field-value's | A recipient MUST interpret an If-Modified-Since field-value's | |||
timestamp in terms of the origin server's clock. | timestamp in terms of the origin server's clock. | |||
If-Modified-Since is typically used for two distinct purposes: 1) to | If-Modified-Since is typically used for two distinct purposes: 1) to | |||
allow efficient updates of a cached representation that does not have | allow efficient updates of a cached representation that does not have | |||
an entity-tag; and, 2) to limit the scope of a web traversal to | an entity-tag and 2) to limit the scope of a web traversal to | |||
resources that have recently changed. | resources that have recently changed. | |||
When used for cache updates, a cache will typically use the value of | When used for cache updates, a cache will typically use the value of | |||
the cached message's Last-Modified field to generate the field value | the cached message's Last-Modified field to generate the field value | |||
of If-Modified-Since. This behavior is most interoperable for cases | of If-Modified-Since. This behavior is most interoperable for cases | |||
where clocks are poorly synchronized or when the server has chosen to | where clocks are poorly synchronized or when the server has chosen to | |||
only honor exact timestamp matches (due to a problem with Last- | only honor exact timestamp matches (due to a problem with Last- | |||
Modified dates that appear to go "back in time" when the origin | Modified dates that appear to go "back in time" when the origin | |||
server's clock is corrected or a representation is restored from an | server's clock is corrected or a representation is restored from an | |||
archived backup). However, caches occasionally generate the field | archived backup). However, caches occasionally generate the field | |||
skipping to change at page 16, line 42 ¶ | skipping to change at page 16, line 42 ¶ | |||
An origin server that receives an If-Modified-Since header field | An origin server that receives an If-Modified-Since header field | |||
SHOULD evaluate the condition prior to performing the method | SHOULD evaluate the condition prior to performing the method | |||
(Section 5). The origin server SHOULD NOT perform the requested | (Section 5). The origin server SHOULD NOT perform the requested | |||
method if the selected representation's last modification date is | method if the selected representation's last modification date is | |||
earlier than or equal to the date provided in the field-value; | earlier than or equal to the date provided in the field-value; | |||
instead, the origin server SHOULD generate a 304 (Not Modified) | instead, the origin server SHOULD generate a 304 (Not Modified) | |||
response, including only those metadata that are useful for | response, including only those metadata that are useful for | |||
identifying or updating a previously cached response. | identifying or updating a previously cached response. | |||
Requirements on cache handling of a received If-Modified-Since header | Requirements on cache handling of a received If-Modified-Since header | |||
field are defined in Section 4.3.2 of [Part6]. | field are defined in Section 4.3.2 of [RFC7234]. | |||
3.4. If-Unmodified-Since | 3.4. If-Unmodified-Since | |||
The "If-Unmodified-Since" header field makes the request method | The "If-Unmodified-Since" header field makes the request method | |||
conditional on the selected representation's last modification date | conditional on the selected representation's last modification date | |||
being earlier than or equal to the date provided in the field-value. | being earlier than or equal to the date provided in the field-value. | |||
This field accomplishes the same purpose as If-Match for cases where | This field accomplishes the same purpose as If-Match for cases where | |||
the user agent does not have an entity-tag for the representation. | the user agent does not have an entity-tag for the representation. | |||
If-Unmodified-Since = HTTP-date | If-Unmodified-Since = HTTP-date | |||
An example of the field is: | An example of the field is: | |||
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT | If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT | |||
A recipient MUST ignore If-Unmodified-Since if the request contains | A recipient MUST ignore If-Unmodified-Since if the request contains | |||
an If-Match header field; the condition in If-Match is considered to | an If-Match header field; the condition in If-Match is considered to | |||
be a more accurate replacement for the condition in If-Unmodified- | be a more accurate replacement for the condition in If-Unmodified- | |||
Since and the two are only combined for the sake of interoperating | Since, and the two are only combined for the sake of interoperating | |||
with older intermediaries that might not implement If-Match. | with older intermediaries that might not implement If-Match. | |||
A recipient MUST ignore the If-Unmodified-Since header field if the | A recipient MUST ignore the If-Unmodified-Since header field if the | |||
received field-value is not a valid HTTP-date. | received field-value is not a valid HTTP-date. | |||
A recipient MUST interpret an If-Unmodified-Since field-value's | A recipient MUST interpret an If-Unmodified-Since field-value's | |||
timestamp in terms of the origin server's clock. | timestamp in terms of the origin server's clock. | |||
If-Unmodified-Since is most often used with state-changing methods | If-Unmodified-Since is most often used with state-changing methods | |||
(e.g., POST, PUT, DELETE) to prevent accidental overwrites when | (e.g., POST, PUT, DELETE) to prevent accidental overwrites when | |||
skipping to change at page 17, line 36 ¶ | skipping to change at page 17, line 36 ¶ | |||
does not supply entity-tags with its representations (i.e., to | does not supply entity-tags with its representations (i.e., to | |||
prevent the "lost update" problem). It can also be used with safe | prevent the "lost update" problem). It can also be used with safe | |||
methods to abort a request if the selected representation does not | methods to abort a request if the selected representation does not | |||
match one already stored (or partially stored) from a prior request. | match one already stored (or partially stored) from a prior request. | |||
An origin server that receives an If-Unmodified-Since header field | An origin server that receives an If-Unmodified-Since header field | |||
MUST evaluate the condition prior to performing the method | MUST evaluate the condition prior to performing the method | |||
(Section 5). The origin server MUST NOT perform the requested method | (Section 5). The origin server MUST NOT perform the requested method | |||
if the selected representation's last modification date is more | if the selected representation's last modification date is more | |||
recent than the date provided in the field-value; instead the origin | recent than the date provided in the field-value; instead the origin | |||
server MUST respond with either: a) the 412 (Precondition Failed) | server MUST respond with either a) the 412 (Precondition Failed) | |||
status code; or, b) one of the 2xx (Successful) status codes if the | status code or b) one of the 2xx (Successful) status codes if the | |||
origin server has verified that a state change is being requested and | origin server has verified that a state change is being requested and | |||
the final state is already reflected in the current state of the | the final state is already reflected in the current state of the | |||
target resource (i.e., the change requested by the user agent has | target resource (i.e., the change requested by the user agent has | |||
already succeeded, but the user agent might not be aware of that | already succeeded, but the user agent might not be aware of that | |||
because the prior response message was lost or a compatible change | because the prior response message was lost or a compatible change | |||
was made by some other user agent). In the latter case, the origin | was made by some other user agent). In the latter case, the origin | |||
server MUST NOT send a validator header field in the response unless | server MUST NOT send a validator header field in the response unless | |||
it can verify that the request is a duplicate of an immediately prior | it can verify that the request is a duplicate of an immediately prior | |||
change made by the same user agent. | change made by the same user agent. | |||
The If-Unmodified-Since header field can be ignored by caches and | The If-Unmodified-Since header field can be ignored by caches and | |||
intermediaries because it is not applicable to a stored response. | intermediaries because it is not applicable to a stored response. | |||
3.5. If-Range | 3.5. If-Range | |||
The "If-Range" header field provides a special conditional request | The "If-Range" header field provides a special conditional request | |||
mechanism that is similar to the If-Match and If-Unmodified-Since | mechanism that is similar to the If-Match and If-Unmodified-Since | |||
header fields but instructs the recipient to ignore the Range header | header fields but that instructs the recipient to ignore the Range | |||
field if the validator doesn't match, resulting in transfer of the | header field if the validator doesn't match, resulting in transfer of | |||
new selected representation instead of a 412 response. If-Range is | the new selected representation instead of a 412 (Precondition | |||
defined in Section 3.2 of [Part5]. | Failed) response. If-Range is defined in Section 3.2 of [RFC7233]. | |||
4. Status Code Definitions | 4. Status Code Definitions | |||
4.1. 304 Not Modified | 4.1. 304 Not Modified | |||
The "304 (Not Modified)" status code indicates that a conditional GET | The "304 (Not Modified)" status code indicates that a conditional GET | |||
or HEAD request has been received and would have resulted in a 200 | or HEAD request has been received and would have resulted in a 200 | |||
(OK) response if it were not for the fact that the condition has | (OK) response if it were not for the fact that the condition | |||
evaluated to false. In other words, there is no need for the server | evaluated to false. In other words, there is no need for the server | |||
to transfer a representation of the target resource because the | to transfer a representation of the target resource because the | |||
request indicates that the client, which made the request | request indicates that the client, which made the request | |||
conditional, already has a valid representation; the server is | conditional, already has a valid representation; the server is | |||
therefore redirecting the client to make use of that stored | therefore redirecting the client to make use of that stored | |||
representation as if it were the payload of a 200 (OK) response. | representation as if it were the payload of a 200 (OK) response. | |||
The server generating a 304 response MUST generate any of the | The server generating a 304 response MUST generate any of the | |||
following header fields that would have been sent in a 200 (OK) | following header fields that would have been sent in a 200 (OK) | |||
response to the same request: Cache-Control, Content-Location, Date, | response to the same request: Cache-Control, Content-Location, Date, | |||
ETag, Expires, and Vary. | ETag, Expires, and Vary. | |||
Since the goal of a 304 response is to minimize information transfer | Since the goal of a 304 response is to minimize information transfer | |||
when the recipient already has one or more cached representations, a | when the recipient already has one or more cached representations, a | |||
sender SHOULD NOT generate representation metadata other than the | sender SHOULD NOT generate representation metadata other than the | |||
above listed fields unless said metadata exists for the purpose of | above listed fields unless said metadata exists for the purpose of | |||
guiding cache updates (e.g., Last-Modified might be useful if the | guiding cache updates (e.g., Last-Modified might be useful if the | |||
response does not have an ETag field). | response does not have an ETag field). | |||
Requirements on a cache that receives a 304 response are defined in | Requirements on a cache that receives a 304 response are defined in | |||
Section 4.3.4 of [Part6]. If the conditional request originated with | Section 4.3.4 of [RFC7234]. If the conditional request originated | |||
an outbound client, such as a user agent with its own cache sending a | with an outbound client, such as a user agent with its own cache | |||
conditional GET to a shared proxy, then the proxy SHOULD forward the | sending a conditional GET to a shared proxy, then the proxy SHOULD | |||
304 response to that client. | forward the 304 response to that client. | |||
A 304 response cannot contain a message-body; it is always terminated | A 304 response cannot contain a message-body; it is always terminated | |||
by the first empty line after the header fields. | by the first empty line after the header fields. | |||
4.2. 412 Precondition Failed | 4.2. 412 Precondition Failed | |||
The "412 (Precondition Failed)" status code indicates that one or | The "412 (Precondition Failed)" status code indicates that one or | |||
more conditions given in the request header fields evaluated to false | more conditions given in the request header fields evaluated to false | |||
when tested on the server. This response code allows the client to | when tested on the server. This response code allows the client to | |||
place preconditions on the current resource state (its current | place preconditions on the current resource state (its current | |||
representations and metadata) and thus prevent the request method | representations and metadata) and, thus, prevent the request method | |||
from being applied if the target resource is in an unexpected state. | from being applied if the target resource is in an unexpected state. | |||
5. Evaluation | 5. Evaluation | |||
Except when excluded below, a recipient cache or origin server MUST | Except when excluded below, a recipient cache or origin server MUST | |||
evaluate received request preconditions after it has successfully | evaluate received request preconditions after it has successfully | |||
performed its normal request checks and just before it would perform | performed its normal request checks and just before it would perform | |||
the action associated with the request method. A server MUST ignore | the action associated with the request method. A server MUST ignore | |||
all received preconditions if its response to the same request | all received preconditions if its response to the same request | |||
without those conditions would have been a status code other than a | without those conditions would have been a status code other than a | |||
2xx or 412 (Precondition Failed). In other words, redirects and | 2xx (Successful) or 412 (Precondition Failed). In other words, | |||
failures take precedence over the evaluation of preconditions in | redirects and failures take precedence over the evaluation of | |||
conditional requests. | preconditions in conditional requests. | |||
A server that is not the origin server for the target resource and | A server that is not the origin server for the target resource and | |||
cannot act as a cache for requests on the target resource MUST NOT | cannot act as a cache for requests on the target resource MUST NOT | |||
evaluate the conditional request header fields defined by this | evaluate the conditional request header fields defined by this | |||
specification, and MUST forward them if the request is forwarded, | specification, and it MUST forward them if the request is forwarded, | |||
since the generating client intends that they be evaluated by a | since the generating client intends that they be evaluated by a | |||
server that can provide a current representation. Likewise, a server | server that can provide a current representation. Likewise, a server | |||
MUST ignore the conditional request header fields defined by this | MUST ignore the conditional request header fields defined by this | |||
specification when received with a request method that does not | specification when received with a request method that does not | |||
involve the selection or modification of a selected representation, | involve the selection or modification of a selected representation, | |||
such as CONNECT, OPTIONS, or TRACE. | such as CONNECT, OPTIONS, or TRACE. | |||
Conditional request header fields that are defined by extensions to | Conditional request header fields that are defined by extensions to | |||
HTTP might place conditions on all recipients, on the state of the | HTTP might place conditions on all recipients, on the state of the | |||
target resource in general, or on a group of resources. For | target resource in general, or on a group of resources. For | |||
skipping to change at page 21, line 7 ¶ | skipping to change at page 21, line 7 ¶ | |||
* if true, continue to step 5 | * if true, continue to step 5 | |||
* if false, respond 304 (Not Modified) | * if false, respond 304 (Not Modified) | |||
5. When the method is GET and both Range and If-Range are present, | 5. When the method is GET and both Range and If-Range are present, | |||
evaluate the If-Range precondition: | evaluate the If-Range precondition: | |||
* if the validator matches and the Range specification is | * if the validator matches and the Range specification is | |||
applicable to the selected representation, respond 206 | applicable to the selected representation, respond 206 | |||
(Partial Content) [Part5] | (Partial Content) [RFC7233] | |||
6. Otherwise, | 6. Otherwise, | |||
* all conditions are met, so perform the requested action and | * all conditions are met, so perform the requested action and | |||
respond according to its success or failure. | respond according to its success or failure. | |||
Any extension to HTTP/1.1 that defines additional conditional request | Any extension to HTTP/1.1 that defines additional conditional request | |||
header fields ought to define its own expectations regarding the | header fields ought to define its own expectations regarding the | |||
order for evaluating such fields in relation to those defined in this | order for evaluating such fields in relation to those defined in this | |||
document and other conditionals that might be found in practice. | document and other conditionals that might be found in practice. | |||
7. IANA Considerations | 7. IANA Considerations | |||
7.1. Status Code Registration | 7.1. Status Code Registration | |||
The HTTP Status Code Registry located at | The "Hypertext Transfer Protocol (HTTP) Status Code Registry" located | |||
<http://www.iana.org/assignments/http-status-codes> shall be updated | at <http://www.iana.org/assignments/http-status-codes> has been | |||
with the registrations below: | updated with the registrations below: | |||
+-------+---------------------+-------------+ | +-------+---------------------+-------------+ | |||
| Value | Description | Reference | | | Value | Description | Reference | | |||
+-------+---------------------+-------------+ | +-------+---------------------+-------------+ | |||
| 304 | Not Modified | Section 4.1 | | | 304 | Not Modified | Section 4.1 | | |||
| 412 | Precondition Failed | Section 4.2 | | | 412 | Precondition Failed | Section 4.2 | | |||
+-------+---------------------+-------------+ | +-------+---------------------+-------------+ | |||
7.2. Header Field Registration | 7.2. Header Field Registration | |||
HTTP header fields are registered within the Message Header Field | HTTP header fields are registered within the "Message Headers" | |||
Registry maintained at <http://www.iana.org/assignments/ | registry maintained at | |||
message-headers/message-header-index.html>. | <http://www.iana.org/assignments/message-headers/>. | |||
This document defines the following HTTP header fields, so their | This document defines the following HTTP header fields, so their | |||
associated registry entries shall be updated according to the | associated registry entries have been updated according to the | |||
permanent registrations below (see [BCP90]): | permanent registrations below (see [BCP90]): | |||
+---------------------+----------+----------+-------------+ | +---------------------+----------+----------+-------------+ | |||
| Header Field Name | Protocol | Status | Reference | | | Header Field Name | Protocol | Status | Reference | | |||
+---------------------+----------+----------+-------------+ | +---------------------+----------+----------+-------------+ | |||
| ETag | http | standard | Section 2.3 | | | ETag | http | standard | Section 2.3 | | |||
| If-Match | http | standard | Section 3.1 | | | If-Match | http | standard | Section 3.1 | | |||
| If-Modified-Since | http | standard | Section 3.3 | | | If-Modified-Since | http | standard | Section 3.3 | | |||
| If-None-Match | http | standard | Section 3.2 | | | If-None-Match | http | standard | Section 3.2 | | |||
| If-Unmodified-Since | http | standard | Section 3.4 | | | If-Unmodified-Since | http | standard | Section 3.4 | | |||
skipping to change at page 22, line 24 ¶ | skipping to change at page 22, line 24 ¶ | |||
+---------------------+----------+----------+-------------+ | +---------------------+----------+----------+-------------+ | |||
The change controller is: "IETF (iesg@ietf.org) - Internet | The change controller is: "IETF (iesg@ietf.org) - Internet | |||
Engineering Task Force". | Engineering Task Force". | |||
8. Security Considerations | 8. Security Considerations | |||
This section is meant to inform developers, information providers, | This section is meant to inform developers, information providers, | |||
and users of known security concerns specific to the HTTP conditional | and users of known security concerns specific to the HTTP conditional | |||
request mechanisms. More general security considerations are | request mechanisms. More general security considerations are | |||
addressed in HTTP messaging [Part1] and semantics [Part2]. | addressed in HTTP "Message Syntax and Routing" [RFC7230] and | |||
"Semantics and Content" [RFC7231]. | ||||
The validators defined by this specification are not intended to | The validators defined by this specification are not intended to | |||
ensure the validity of a representation, guard against malicious | ensure the validity of a representation, guard against malicious | |||
changes, or detect man-in-the-middle attacks. At best, they enable | changes, or detect man-in-the-middle attacks. At best, they enable | |||
more efficient cache updates and optimistic concurrent writes when | more efficient cache updates and optimistic concurrent writes when | |||
all participants are behaving nicely. At worst, the conditions will | all participants are behaving nicely. At worst, the conditions will | |||
fail and the client will receive a response that is no more harmful | fail and the client will receive a response that is no more harmful | |||
than an HTTP exchange without conditional requests. | than an HTTP exchange without conditional requests. | |||
An entity-tag can be abused in ways that create privacy risks. For | An entity-tag can be abused in ways that create privacy risks. For | |||
skipping to change at page 22, line 48 ¶ | skipping to change at page 22, line 49 ¶ | |||
entity-tag in later conditional requests as a means of re-identifying | entity-tag in later conditional requests as a means of re-identifying | |||
that user or user agent. Such an identifying tag would become a | that user or user agent. Such an identifying tag would become a | |||
persistent identifier for as long as the user agent retained the | persistent identifier for as long as the user agent retained the | |||
original cache entry. User agents that cache representations ought | original cache entry. User agents that cache representations ought | |||
to ensure that the cache is cleared or replaced whenever the user | to ensure that the cache is cleared or replaced whenever the user | |||
performs privacy-maintaining actions, such as clearing stored cookies | performs privacy-maintaining actions, such as clearing stored cookies | |||
or changing to a private browsing mode. | or changing to a private browsing mode. | |||
9. Acknowledgments | 9. Acknowledgments | |||
See Section 10 of [Part1]. | See Section 10 of [RFC7230]. | |||
10. References | 10. References | |||
10.1. Normative References | 10.1. Normative References | |||
[Part1] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | |||
Requirement Levels", BCP 14, RFC 2119, March 1997. | ||||
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | ||||
Specifications: ABNF", STD 68, RFC 5234, January 2008. | ||||
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | ||||
Protocol (HTTP/1.1): Message Syntax and Routing", | Protocol (HTTP/1.1): Message Syntax and Routing", | |||
draft-ietf-httpbis-p1-messaging-26 (work in progress), | draft-ietf-httpbis-p1-messaging-latest (work in progress), | |||
February 2014. | June 2014. | |||
[Part2] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | |||
Protocol (HTTP/1.1): Semantics and Content", | Protocol (HTTP/1.1): Semantics and Content", | |||
draft-ietf-httpbis-p2-semantics-26 (work in progress), | draft-ietf-httpbis-p2-semantics-latest (work in progress), | |||
February 2014. | June 2014. | |||
[Part5] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., | [RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., | |||
"Hypertext Transfer Protocol (HTTP/1.1): Range Requests", | "Hypertext Transfer Protocol (HTTP/1.1): Range Requests", | |||
draft-ietf-httpbis-p5-range-26 (work in progress), | draft-ietf-httpbis-p5-range-latest (work in progress), | |||
February 2014. | June 2014. | |||
[Part6] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, | [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, | |||
Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", | Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", | |||
draft-ietf-httpbis-p6-cache-26 (work in progress), | draft-ietf-httpbis-p6-cache-latest (work in progress), | |||
February 2014. | June 2014. | |||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | ||||
Requirement Levels", BCP 14, RFC 2119, March 1997. | ||||
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | ||||
Specifications: ABNF", STD 68, RFC 5234, January 2008. | ||||
10.2. Informative References | 10.2. Informative References | |||
[BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration | [BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration | |||
Procedures for Message Header Fields", BCP 90, RFC 3864, | Procedures for Message Header Fields", BCP 90, RFC 3864, | |||
September 2004. | September 2004. | |||
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., | [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., | |||
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext | Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext | |||
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. | Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. | |||
skipping to change at page 24, line 23 ¶ | skipping to change at page 24, line 23 ¶ | |||
Appendix B. Imported ABNF | Appendix B. Imported ABNF | |||
The following core rules are included by reference, as defined in | The following core rules are included by reference, as defined in | |||
Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), | Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), | |||
CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double | CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double | |||
quote), HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any | quote), HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any | |||
8-bit sequence of data), SP (space), and VCHAR (any visible US-ASCII | 8-bit sequence of data), SP (space), and VCHAR (any visible US-ASCII | |||
character). | character). | |||
The rules below are defined in [Part1]: | The rules below are defined in [RFC7230]: | |||
OWS = <OWS, defined in [Part1], Section 3.2.3> | OWS = <OWS, see [RFC7230], Section 3.2.3> | |||
obs-text = <obs-text, defined in [Part1], Section 3.2.6> | obs-text = <obs-text, see [RFC7230], Section 3.2.6> | |||
The rules below are defined in other parts: | The rules below are defined in other parts: | |||
HTTP-date = <HTTP-date, defined in [Part2], Section 7.1.1.1> | HTTP-date = <HTTP-date, see [RFC7231], Section 7.1.1.1> | |||
Appendix C. Collected ABNF | Appendix C. Collected ABNF | |||
In the collected ABNF below, list rules are expanded as per Section | In the collected ABNF below, list rules are expanded as per Section | |||
1.2 of [Part1]. | 1.2 of [RFC7230]. | |||
ETag = entity-tag | ETag = entity-tag | |||
HTTP-date = <HTTP-date, defined in [Part2], Section 7.1.1.1> | HTTP-date = <HTTP-date, see [RFC7231], Section 7.1.1.1> | |||
If-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS | If-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS | |||
entity-tag ] ) ) | entity-tag ] ) ) | |||
If-Modified-Since = HTTP-date | If-Modified-Since = HTTP-date | |||
If-None-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS | If-None-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS | |||
entity-tag ] ) ) | entity-tag ] ) ) | |||
If-Unmodified-Since = HTTP-date | If-Unmodified-Since = HTTP-date | |||
Last-Modified = HTTP-date | Last-Modified = HTTP-date | |||
OWS = <OWS, defined in [Part1], Section 3.2.3> | OWS = <OWS, see [RFC7230], Section 3.2.3> | |||
entity-tag = [ weak ] opaque-tag | entity-tag = [ weak ] opaque-tag | |||
etagc = "!" / %x23-7E ; '#'-'~' | etagc = "!" / %x23-7E ; '#'-'~' | |||
/ obs-text | / obs-text | |||
obs-text = <obs-text, defined in [Part1], Section 3.2.6> | obs-text = <obs-text, see [RFC7230], Section 3.2.6> | |||
opaque-tag = DQUOTE *etagc DQUOTE | opaque-tag = DQUOTE *etagc DQUOTE | |||
weak = %x57.2F ; W/ | weak = %x57.2F ; W/ | |||
Appendix D. Change Log (to be removed by RFC Editor before publication) | ||||
Changes up to the IETF Last Call draft are summarized in <http:// | ||||
tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-24#appendix-D>. | ||||
D.1. Since draft-ietf-httpbis-p4-conditional-24 | ||||
Closed issues: | ||||
o <http://tools.ietf.org/wg/httpbis/trac/ticket/518>: "APPSDIR | ||||
review of draft-ietf-httpbis-p4-conditional-24" | ||||
D.2. Since draft-ietf-httpbis-p4-conditional-25 | ||||
Closed issues: | ||||
o <http://tools.ietf.org/wg/httpbis/trac/ticket/538>: "add | ||||
'stateless' to Abstract" | ||||
o <http://tools.ietf.org/wg/httpbis/trac/ticket/542>: "improve | ||||
introduction of list rule" | ||||
o <http://tools.ietf.org/wg/httpbis/trac/ticket/549>: "augment | ||||
security considerations with pointers to current research" | ||||
Index | Index | |||
3 | 3 | |||
304 Not Modified (status code) 18 | 304 Not Modified (status code) 18 | |||
4 | 4 | |||
412 Precondition Failed (status code) 18 | 412 Precondition Failed (status code) 18 | |||
E | E | |||
ETag header field 9 | ETag header field 9 | |||
End of changes. 64 change blocks. | ||||
134 lines changed or deleted | 107 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |