source: draft-ietf-httpbis/24/draft-ietf-httpbis-p4-conditional-24.xml @ 2568

Last change on this file since 2568 was 2414, checked in by julian.reschke@…, 7 years ago

Prepare release of -24 on Sept 25

  • Property svn:mime-type set to text/xml
File size: 67.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    This XML document is the output of clean-for-DTD.xslt; a tool that strips
4    extensions to RFC2629(bis) from documents for processing with xml2rfc.
5-->
6<?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?>
7<?rfc toc="yes" ?>
8<?rfc symrefs="yes" ?>
9<?rfc sortrefs="yes" ?>
10<?rfc compact="yes"?>
11<?rfc subcompact="no" ?>
12<?rfc linkmailto="no" ?>
13<?rfc editing="no" ?>
14<?rfc comments="yes"?>
15<?rfc inline="yes"?>
16<?rfc rfcedstyle="yes"?>
17<!DOCTYPE rfc
18  PUBLIC "" "rfc2629.dtd">
19<rfc obsoletes="2616" category="std" ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p4-conditional-24">
20
21
22
23<front>
24
25  <title abbrev="HTTP/1.1 Conditional Requests">Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
26
27  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
28    <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
29    <address>
30      <postal>
31        <street>345 Park Ave</street>
32        <city>San Jose</city>
33        <region>CA</region>
34        <code>95110</code>
35        <country>USA</country>
36      </postal>
37      <email>fielding@gbiv.com</email>
38      <uri>http://roy.gbiv.com/</uri>
39    </address>
40  </author>
41
42  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
43    <organization abbrev="greenbytes">greenbytes GmbH</organization>
44    <address>
45      <postal>
46        <street>Hafenweg 16</street>
47        <city>Muenster</city><region>NW</region><code>48155</code>
48        <country>Germany</country>
49      </postal>
50      <email>julian.reschke@greenbytes.de</email>
51      <uri>http://greenbytes.de/tech/webdav/</uri>
52    </address>
53  </author>
54
55  <date month="September" year="2013" day="25"/>
56  <workgroup>HTTPbis Working Group</workgroup>
57
58<abstract>
59<t>
60   The Hypertext Transfer Protocol (HTTP) is an application-level protocol for
61   distributed, collaborative, hypertext information systems. This document
62   defines HTTP/1.1 conditional requests, including metadata header fields
63   for indicating state changes, request header fields for making
64   preconditions on such state, and rules for constructing the responses to a
65   conditional request when one or more preconditions evaluate to false.
66</t>
67</abstract>
68
69<note title="Editorial Note (To be removed by RFC Editor)">
70  <t>
71    Discussion of this draft takes place on the HTTPBIS working group
72    mailing list (ietf-http-wg@w3.org), which is archived at
73    <eref target="http://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
74  </t>
75  <t>
76    The current issues list is at
77    <eref target="http://tools.ietf.org/wg/httpbis/trac/report/3"/> and related
78    documents (including fancy diffs) can be found at
79    <eref target="http://tools.ietf.org/wg/httpbis/"/>.
80  </t>
81  <t>
82    The changes in this draft are summarized in <xref target="changes.since.23"/>.
83  </t>
84</note>
85</front>
86
87<middle>
88<section title="Introduction" anchor="introduction">
89<t>
90   Conditional requests are HTTP requests <xref target="Part2"/> that include
91   one or more header fields indicating a precondition to be tested before
92   applying the method semantics to the target resource.
93   This document defines the HTTP/1.1 conditional request mechanisms in terms
94   of the architecture, syntax notation, and conformance criteria defined in
95   <xref target="Part1"/>.
96</t>
97<t>
98   Conditional GET requests are the most efficient mechanism for HTTP
99   cache updates <xref target="Part6"/>.  Conditionals can also be
100   applied to state-changing methods, such as PUT and DELETE, to prevent
101   the "lost update" problem: one client accidentally overwriting
102   the work of another client that has been acting in parallel.
103</t>
104<t><iref primary="true" item="selected representation"/>
105   Conditional request preconditions are based on the state of the target
106   resource as a whole (its current value set) or the state as observed
107   in a previously obtained representation (one value in that set).
108   A resource might have multiple current representations, each with its
109   own observable state.  The conditional request mechanisms assume that
110   the mapping of requests to a "selected representation" (Section 3 of <xref target="Part2"/>)
111   will be consistent over time if the server intends to take advantage of
112   conditionals. Regardless, if the mapping is inconsistent and the server is
113   unable to select the appropriate representation, then no harm will result
114   when the precondition evaluates to false.
115</t>
116<t>
117   The conditional request preconditions defined by this specification
118   (<xref target="preconditions"/>) are evaluated when applicable to the
119   recipient (<xref target="evaluation"/>) according to their order of
120   precedence (<xref target="precedence"/>).
121</t>
122
123<section title="Conformance and Error Handling" anchor="conformance">
124<t>
125   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
126   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
127   document are to be interpreted as described in <xref target="RFC2119"/>.
128</t>
129<t>
130   Conformance criteria and considerations regarding error handling
131   are defined in Section 2.5 of <xref target="Part1"/>.
132</t>
133</section>
134
135<section title="Syntax Notation" anchor="notation">
136<t>
137   This specification uses the Augmented Backus-Naur Form (ABNF) notation
138   of <xref target="RFC5234"/> with the list rule extension defined in
139   Section 7 of <xref target="Part1"/>. <xref target="imported.abnf"/> describes rules imported from
140   other documents. <xref target="collected.abnf"/> shows the collected ABNF
141   with the list rule expanded.
142</t>
143</section>
144</section>
145
146<section title="Validators" anchor="validators">
147   <iref primary="true" item="metadata"/>
148   <iref primary="true" item="validator"/>
149<t>
150   This specification defines two forms of metadata that are commonly used
151   to observe resource state and test for preconditions: modification dates
152   (<xref target="header.last-modified"/>) and opaque entity tags
153   (<xref target="header.etag"/>).  Additional metadata that reflects resource state
154   has been defined by various extensions of HTTP, such as WebDAV
155   <xref target="RFC4918"/>, that are beyond the scope of this specification.
156   A resource metadata value is referred to as a "validator"
157   when it is used within a precondition.
158</t>
159
160<section title="Weak versus Strong" anchor="weak.and.strong.validators">
161   <iref primary="true" item="validator" subitem="weak"/>
162   <iref primary="true" item="validator" subitem="strong"/>
163<t>
164   Validators come in two flavors: strong or weak.  Weak validators are easy
165   to generate but are far less useful for comparisons.  Strong validators
166   are ideal for comparisons but can be very difficult (and occasionally
167   impossible) to generate efficiently.  Rather than impose that all forms
168   of resource adhere to the same strength of validator, HTTP exposes the
169   type of validator in use and imposes restrictions on when weak validators
170   can be used as preconditions.
171</t>
172<t>
173   A "strong validator" is representation metadata that changes value whenever
174   a change occurs to the representation data that would be observable in the
175   payload body of a 200 (OK) response to GET.
176</t>
177<t>  
178   A strong validator might change for other reasons, such as when a
179   semantically significant part of the representation metadata is changed
180   (e.g., Content-Type), but it is in the best interests of the
181   origin server to only change the value when it is necessary to invalidate
182   the stored responses held by remote caches and authoring tools. A strong
183   validator is unique across all representations of a given resource, such
184   that no two representations of that resource can share the same validator
185   unless their representation data is identical.
186</t>
187<t>
188   Cache entries might persist for arbitrarily long periods, regardless
189   of expiration times.  Thus, a cache might attempt to validate an
190   entry using a validator that it obtained in the distant past.
191   A strong validator is unique across all versions of all
192   representations associated with a particular resource over time.
193   However, there is no implication of uniqueness across representations
194   of different resources (i.e., the same strong validator might be
195   in use for representations of multiple resources at the same time
196   and does not imply that those representations are equivalent).
197</t>
198<t>
199   There are a variety of strong validators used in practice.  The best are
200   based on strict revision control, wherein each change to a representation
201   always results in a unique node name and revision identifier being assigned
202   before the representation is made accessible to GET.  A collision-resistant hash
203   function applied to the representation data is also sufficient if the data
204   is available prior to the response header fields being sent and the digest
205   does not need to be recalculated every time a validation request is
206   received.  However, if a resource has distinct representations that differ
207   only in their metadata, such as might occur with content negotiation over
208   media types that happen to share the same data format, then the origin
209   server needs to incorporate additional information in the validator to
210   distinguish those representations.
211</t>
212<t>
213   In contrast, a "weak validator" is representation metadata that
214   might not change for every change to the representation data.  This
215   weakness might be due to limitations in how the value is calculated, such
216   as clock resolution or an inability to ensure uniqueness for all possible
217   representations of the resource, or due to a desire by the resource owner
218   to group representations by some self-determined set of equivalency
219   rather than unique sequences of data.  An origin server SHOULD change a
220   weak entity-tag whenever it considers prior representations to be
221   unacceptable as a substitute for the current representation. In other words,
222   a weak entity-tag ought to change whenever the origin server wants caches to
223   invalidate old responses.
224</t>
225<t>
226   For example, the representation of a weather report that changes in
227   content every second, based on dynamic measurements, might be grouped
228   into sets of equivalent representations (from the origin server's
229   perspective) with the same weak validator in order to allow cached
230   representations to be valid for a reasonable period of time (perhaps
231   adjusted dynamically based on server load or weather quality).
232   Likewise, a representation's modification time, if defined with only
233   one-second resolution, might be a weak validator if it is possible
234   for the representation to be modified twice during a single second and
235   retrieved between those modifications.
236</t>
237<t>
238   Likewise, a validator is weak if it is shared by two or more
239   representations of a given resource at the same time, unless those
240   representations have identical representation data. For example, if the
241   origin server sends the same validator for a representation with a gzip
242   content coding applied as it does for a representation with no content
243   coding, then that validator is weak. However, two simultaneous
244   representations might share the same strong validator if they differ only
245   in the representation metadata, such as when two different media types are
246   available for the same representation data.
247</t>
248<t>
249   Strong validators are usable for all conditional requests, including cache
250   validation, partial content ranges, and "lost update" avoidance.
251   Weak validators are only usable when the client does not require exact
252   equality with previously obtained representation data, such as when
253   validating a cache entry or limiting a web traversal to recent changes.
254</t>
255</section>
256
257<section title="Last-Modified" anchor="header.last-modified">
258  <iref primary="true" item="Last-Modified header field"/>
259 
260<t>
261   The "Last-Modified" header field in a response provides a timestamp
262   indicating the date and time at which the origin server believes the
263   selected representation was last modified, as determined at the conclusion
264   of handling the request.
265</t>
266<figure><iref primary="true" item="Grammar" subitem="Last-Modified"/><artwork type="abnf2616"><![CDATA[
267  Last-Modified = HTTP-date
268]]></artwork></figure>
269<t>
270   An example of its use is
271</t>
272<figure><artwork type="example"><![CDATA[
273  Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
274]]></artwork></figure>
275
276<section title="Generation" anchor="lastmod.generation">
277<t>
278   An origin server SHOULD send Last-Modified for any selected
279   representation for which a last modification date can be reasonably
280   and consistently determined, since its use in conditional requests
281   and evaluating cache freshness (<xref target="Part6"/>) results in a substantial
282   reduction of HTTP traffic on the Internet and can be a significant
283   factor in improving service scalability and reliability.
284</t>
285<t>
286   A representation is typically the sum of many parts behind the
287   resource interface.  The last-modified time would usually be
288   the most recent time that any of those parts were changed.
289   How that value is determined for any given resource is an
290   implementation detail beyond the scope of this specification.
291   What matters to HTTP is how recipients of the Last-Modified
292   header field can use its value to make conditional requests
293   and test the validity of locally cached responses.
294</t>
295<t>
296   An origin server SHOULD obtain the Last-Modified value of the
297   representation as close as possible to the time that it generates the
298   Date field value for its response. This allows a recipient to
299   make an accurate assessment of the representation's modification time,
300   especially if the representation changes near the time that the
301   response is generated.
302</t>
303<t>
304   An origin server with a clock MUST NOT send a Last-Modified date
305   that is later than the server's time of message origination (Date).
306   If the last modification time is derived from implementation-specific
307   metadata that evaluates to some time in the future, according to the
308   origin server's clock, then the origin server MUST replace that
309   value with the message origination date. This prevents a future
310   modification date from having an adverse impact on cache validation.
311</t>
312<t>
313   An origin server without a clock MUST NOT assign Last-Modified
314   values to a response unless these values were associated
315   with the resource by some other system or user with a reliable clock.
316</t>
317</section>
318
319<section title="Comparison" anchor="lastmod.comparison">
320<t>
321   A Last-Modified time, when used as a validator in a request, is
322   implicitly weak unless it is possible to deduce that it is strong,
323   using the following rules:
324  <list style="symbols">
325     <t>The validator is being compared by an origin server to the
326        actual current validator for the representation and,</t>
327     <t>That origin server reliably knows that the associated representation did
328        not change twice during the second covered by the presented
329        validator.</t>
330  </list>
331</t>
332<t>
333   or
334  <list style="symbols">
335     <t>The validator is about to be used by a client in an <xref target="header.if-modified-since" format="none">If-Modified-Since</xref>,
336        <xref target="header.if-unmodified-since" format="none">If-Unmodified-Since</xref> header field, because the client has
337        a cache entry, or If-Range for the associated
338        representation, and</t>
339     <t>That cache entry includes a Date value, which gives the
340        time when the origin server sent the original response, and</t>
341     <t>The presented Last-Modified time is at least 60 seconds before
342        the Date value.</t>
343  </list>
344</t>
345<t>
346   or
347  <list style="symbols">
348     <t>The validator is being compared by an intermediate cache to the
349        validator stored in its cache entry for the representation, and</t>
350     <t>That cache entry includes a Date value, which gives the
351        time when the origin server sent the original response, and</t>
352     <t>The presented Last-Modified time is at least 60 seconds before
353        the Date value.</t>
354  </list>
355</t>
356<t>
357   This method relies on the fact that if two different responses were
358   sent by the origin server during the same second, but both had the
359   same Last-Modified time, then at least one of those responses would
360   have a Date value equal to its Last-Modified time. The
361   arbitrary 60-second limit guards against the possibility that the Date and
362   Last-Modified values are generated from different clocks, or at somewhat
363   different times during the preparation of the response. An
364   implementation MAY use a value larger than 60 seconds, if it is
365   believed that 60 seconds is too short.
366</t>
367</section>
368</section>
369
370<section title="ETag" anchor="header.etag">
371  <iref primary="true" item="ETag header field"/>
372 
373 
374 
375 
376 
377<t>
378   The "ETag" header field in a response provides the current entity-tag for
379   the selected representation, as determined at the conclusion of handling
380   the request.
381   An entity-tag is an opaque validator for differentiating between
382   multiple representations of the same resource, regardless of whether
383   those multiple representations are due to resource state changes over
384   time, content negotiation resulting in multiple representations being
385   valid at the same time, or both. An entity-tag consists of an opaque
386   quoted string, possibly prefixed by a weakness indicator.
387</t>
388<figure><iref primary="true" item="Grammar" subitem="ETag"/><iref primary="true" item="Grammar" subitem="entity-tag"/><iref primary="true" item="Grammar" subitem="weak"/><iref primary="true" item="Grammar" subitem="opaque-tag"/><iref primary="true" item="Grammar" subitem="etagc"/><artwork type="abnf2616"><![CDATA[
389  ETag       = entity-tag
390
391  entity-tag = [ weak ] opaque-tag
392  weak       = %x57.2F ; "W/", case-sensitive
393  opaque-tag = DQUOTE *etagc DQUOTE
394  etagc      = %x21 / %x23-7E / obs-text
395             ; VCHAR except double quotes, plus obs-text
396]]></artwork></figure>
397<t><list>
398  <t>
399    Note: Previously, opaque-tag was defined to be a quoted-string
400    (<xref target="RFC2616"/>, Section 3.11), thus some recipients
401    might perform backslash unescaping. Servers therefore ought to avoid
402    backslash characters in entity tags.
403  </t>
404</list></t>
405<t>
406   An entity-tag can be more reliable for validation than a modification
407   date in situations where it is inconvenient to store modification
408   dates, where the one-second resolution of HTTP date values is not
409   sufficient, or where modification dates are not consistently maintained.
410</t>
411<figure><preamble>
412  Examples:
413</preamble>
414<artwork type="example"><![CDATA[
415  ETag: "xyzzy"
416  ETag: W/"xyzzy"
417  ETag: ""
418]]></artwork></figure>
419<t>
420   An entity-tag can be either a weak or strong validator, with
421   strong being the default.  If an origin server provides an entity-tag
422   for a representation and the generation of that entity-tag does not satisfy
423   all of the characteristics of a strong validator
424   (<xref target="weak.and.strong.validators"/>), then the origin server
425   MUST mark the entity-tag as weak by prefixing its opaque value
426   with "W/" (case-sensitive).
427</t>
428
429<section title="Generation" anchor="entity.tag.generation">
430<t>
431   The principle behind entity-tags is that only the service author
432   knows the implementation of a resource well enough to select the
433   most accurate and efficient validation mechanism for that resource,
434   and that any such mechanism can be mapped to a simple sequence of
435   octets for easy comparison.  Since the value is opaque, there is no
436   need for the client to be aware of how each entity-tag is constructed.
437</t>
438<t>
439   For example, a resource that has implementation-specific versioning
440   applied to all changes might use an internal revision number, perhaps
441   combined with a variance identifier for content negotiation, to
442   accurately differentiate between representations.
443   Other implementations might use a collision-resistant hash of
444   representation content,
445   a combination of various filesystem attributes, or a modification
446   timestamp that has sub-second resolution.
447</t>
448<t>
449   An origin server SHOULD send ETag for any selected representation
450   for which detection of changes can be reasonably and consistently
451   determined, since the entity-tag's use in conditional requests and
452   evaluating cache freshness (<xref target="Part6"/>) can result in a substantial
453   reduction of HTTP network traffic and can be a significant factor in
454   improving service scalability and reliability.
455</t>
456</section>
457
458<section title="Comparison" anchor="entity.tag.comparison">
459 
460 
461 
462<t>
463   There are two entity-tag comparison functions, depending
464   on whether the comparison context allows the use of weak validators
465   or not:
466  <list style="symbols">
467     <t>Strong comparison: two entity-tags are equivalent if both
468        are not weak and their opaque-tags match character-by-character.</t>
469     <t>Weak comparison: two entity-tags are equivalent if their opaque-tags
470        match character-by-character, regardless of either or both
471        being tagged as "weak".</t>
472  </list>
473</t>
474<t>
475   The example below shows the results for a set of entity-tag pairs,
476   and both the weak and strong comparison function results:
477</t>
478<texttable align="left">
479  <ttcol>ETag 1</ttcol>
480  <ttcol>ETag 2</ttcol>
481  <ttcol>Strong Comparison</ttcol>
482  <ttcol>Weak Comparison</ttcol>
483
484  <c>W/"1"</c>
485  <c>W/"1"</c>
486  <c>no match</c>
487  <c>match</c>
488 
489  <c>W/"1"</c>
490  <c>W/"2"</c>
491  <c>no match</c>
492  <c>no match</c>
493
494  <c>W/"1"</c>
495  <c>"1"</c>
496  <c>no match</c>
497  <c>match</c>
498
499  <c>"1"</c>
500  <c>"1"</c>
501  <c>match</c>
502  <c>match</c>
503</texttable>
504</section>
505
506<section title="Example: Entity-tags Varying on Content-Negotiated Resources" anchor="example.entity.tag.vs.conneg">
507<t>
508   Consider a resource that is subject to content negotiation
509   (Section 3.4 of <xref target="Part2"/>), and where the representations sent in response to
510   a GET request vary based on the Accept-Encoding request
511   header field (Section 5.3.4 of <xref target="Part2"/>):
512</t>
513<figure><preamble>&gt;&gt; Request:</preamble><artwork type="message/http; msgtype=&#34;request&#34;"><![CDATA[
514  GET /index HTTP/1.1
515  Host: www.example.com
516  Accept-Encoding: gzip
517 
518  ]]></artwork></figure>
519<t>
520   In this case, the response might or might not use the gzip content coding.
521   If it does not, the response might look like:
522</t>
523<figure><preamble>&gt;&gt; Response:</preamble><artwork type="message/http; msgtype=&#34;response&#34;"><![CDATA[
524  HTTP/1.1 200 OK
525  Date: Fri, 26 Mar 2010 00:05:00 GMT
526  ETag: "123-a"
527  Content-Length: 70
528  Vary: Accept-Encoding
529  Content-Type: text/plain
530 
531  Hello World!
532  Hello World!
533  Hello World!
534  Hello World!
535  Hello World!
536  ]]></artwork></figure>
537<t>
538   An alternative representation that does use gzip content coding would be:
539</t>
540<figure><preamble>&gt;&gt; Response:</preamble><artwork type="message/http; msgtype=&#34;response&#34;"><![CDATA[
541  HTTP/1.1 200 OK
542  Date: Fri, 26 Mar 2010 00:05:00 GMT
543  ETag: "123-b"
544  Content-Length: 43
545  Vary: Accept-Encoding
546  Content-Type: text/plain
547  Content-Encoding: gzip
548 
549  ...binary data...]]></artwork></figure>
550<t><list>
551  <t>
552    Note: Content codings are a property of the representation,
553    so therefore an entity-tag of an encoded representation has to be distinct
554    from an unencoded representation to prevent conflicts during cache updates
555    and range requests.  In contrast, transfer codings (Section 4 of <xref target="Part1"/>)
556    apply only during message transfer and do not require distinct entity-tags.
557  </t>
558</list></t>
559</section>
560</section>
561
562<section title="When to Use Entity-tags and Last-Modified Dates" anchor="when.to.use.entity.tags.and.last-modified.dates">
563<t>
564   We adopt a set of rules and recommendations for origin servers,
565   clients, and caches regarding when various validator types ought to
566   be used, and for what purposes.
567</t>
568<t>
569   In 200 (OK) responses to GET or HEAD, an origin server:
570  <list style="symbols">
571     <t>SHOULD send an entity-tag validator unless it is not feasible to
572        generate one.</t>
573
574     <t>MAY send a weak entity-tag instead of a strong entity-tag, if
575        performance considerations support the use of weak entity-tags,
576        or if it is unfeasible to send a strong entity-tag.</t>
577
578     <t>SHOULD send a <xref target="header.last-modified" format="none">Last-Modified</xref> value if it is feasible to
579        send one.</t>
580  </list>
581</t>
582<t>
583   In other words, the preferred behavior for an origin server
584   is to send both a strong entity-tag and a <xref target="header.last-modified" format="none">Last-Modified</xref>
585   value in successful responses to a retrieval request.
586</t>
587<t>
588   A client:
589  <list style="symbols">
590     <t>MUST send that entity-tag in any cache validation request (using
591        <xref target="header.if-match" format="none">If-Match</xref> or <xref target="header.if-none-match" format="none">If-None-Match</xref>) if an
592        entity-tag has been provided by the origin server.</t>
593
594     <t>SHOULD send the <xref target="header.last-modified" format="none">Last-Modified</xref> value in non-subrange
595        cache validation requests (using <xref target="header.if-modified-since" format="none">If-Modified-Since</xref>)
596        if only a Last-Modified value has been provided by the origin server.</t>
597
598     <t>MAY send the <xref target="header.last-modified" format="none">Last-Modified</xref> value in subrange
599        cache validation requests (using <xref target="header.if-unmodified-since" format="none">If-Unmodified-Since</xref>)
600        if only a Last-Modified value has been provided by an HTTP/1.0 origin
601        server. The user agent SHOULD provide a way to disable this, in case
602        of difficulty.</t>
603
604     <t>SHOULD send both validators in cache validation requests if both an
605        entity-tag and a <xref target="header.last-modified" format="none">Last-Modified</xref> value have been provided
606        by the origin server. This allows both HTTP/1.0 and HTTP/1.1 caches to
607        respond appropriately.</t>
608  </list>
609</t>
610</section>
611</section>
612
613<section title="Precondition Header Fields" anchor="preconditions">
614<t>
615   This section defines the syntax and semantics of HTTP/1.1 header fields
616   for applying preconditions on requests.
617   <xref target="evaluation"/> defines when the preconditions are applied.
618   <xref target="precedence"/> defines the order of evaluation when more than
619   one precondition is present.
620</t>
621
622<section title="If-Match" anchor="header.if-match">
623  <iref primary="true" item="If-Match header field"/>
624 
625<t>
626   The "If-Match" header field makes the request method conditional on the
627   recipient origin server either having at least one current
628   representation of the target resource, when the field-value is "*", or
629   having a current representation of the target resource that has an
630   entity-tag matching a member of the list of entity-tags provided in the
631   field-value.
632</t>
633<t>
634   An origin server MUST use the strong comparison function when comparing
635   entity-tags for If-Match (<xref target="entity.tag.comparison"/>), since
636   the client intends this precondition to prevent the method from being
637   applied if there have been any changes to the representation data.
638</t>
639<figure><iref primary="true" item="Grammar" subitem="If-Match"/><artwork type="abnf2616"><![CDATA[
640  If-Match = "*" / 1#entity-tag
641]]></artwork></figure>
642<t>
643   Examples:
644</t>
645<figure><artwork type="example"><![CDATA[
646  If-Match: "xyzzy"
647  If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
648  If-Match: *
649]]></artwork></figure>
650<t>
651   If-Match is most often used with state-changing methods (e.g., POST, PUT,
652   DELETE) to prevent accidental overwrites when multiple user agents might be
653   acting in parallel on the same resource (i.e., to prevent the "lost update"
654   problem). It can also be used with safe methods to abort a request if the
655   selected representation does not match one already stored
656   (or partially stored) from a prior request.
657</t>
658<t>
659   An origin server that receives an If-Match header field MUST evaluate the
660   condition prior to performing the method (<xref target="evaluation"/>).
661   If the field-value is "*", the condition is false if the origin server
662   does not have a current representation for the target resource.
663   If the field-value is a list of entity-tags, the condition is false if
664   none of the listed tags match the entity-tag of the selected representation.
665</t>
666<t>
667   An origin server MUST NOT perform the requested method if a received
668   If-Match condition evaluates to false; instead the origin server MUST
669   respond with either:
670   a) the <xref target="status.412" format="none">412 (Precondition Failed)</xref> status code; or,
671   b) one of the 2xx (Successful) status codes if the origin
672   server has verified that a state change is being requested and the final
673   state is already reflected in the current state of the target resource
674   (i.e., the change requested by the user agent has already succeeded, but
675   the user agent might not be aware of it, perhaps because the prior response
676   was lost or a compatible change was made by some other user agent).
677   In the latter case, the origin server MUST NOT send a validator header
678   field in the response unless it can verify that the request is a duplicate
679   of an immediately prior change made by the same user agent.
680</t>
681<t>
682   The If-Match header field can be ignored by caches and intermediaries
683   because it is not applicable to a stored response.
684</t>
685</section>
686
687<section title="If-None-Match" anchor="header.if-none-match">
688  <iref primary="true" item="If-None-Match header field"/>
689 
690<t>
691   The "If-None-Match" header field makes the request method conditional on
692   a recipient cache or origin server either not having any current
693   representation of the target resource, when the field-value is "*", or
694   having a selected representation with an entity-tag that does not match any
695   of those listed in the field-value.
696</t>
697<t>
698   A recipient MUST use the weak comparison function when comparing
699   entity-tags for If-None-Match (<xref target="entity.tag.comparison"/>),
700   since weak entity-tags can be used for cache validation even if there have
701   been changes to the representation data.
702</t>
703<figure><iref primary="true" item="Grammar" subitem="If-None-Match"/><artwork type="abnf2616"><![CDATA[
704  If-None-Match = "*" / 1#entity-tag
705]]></artwork></figure>
706<t>
707   Examples:
708</t>
709<figure><artwork type="example"><![CDATA[
710  If-None-Match: "xyzzy"
711  If-None-Match: W/"xyzzy"
712  If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
713  If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
714  If-None-Match: *
715]]></artwork></figure>
716<t>
717   If-None-Match is primarily used in conditional GET requests to enable
718   efficient updates of cached information with a minimum amount of
719   transaction overhead. When a client desires to update one or more stored
720   responses that have entity-tags, the client SHOULD generate an
721   If-None-Match header field containing a list of those entity-tags when
722   making a GET request; this allows recipient servers to send a
723   <xref target="status.304" format="none">304 (Not Modified)</xref> response to indicate when one of those
724   stored responses matches the selected representation.
725</t>
726<t>
727   If-None-Match can also be used with a value of "*" to prevent an unsafe
728   request method (e.g., PUT) from inadvertently modifying an existing
729   representation of the target resource when the client believes that
730   the resource does not have a current representation (Section 4.2.1 of <xref target="Part2"/>).
731   This is a variation on the "lost update" problem that might arise if more
732   than one client attempts to create an initial representation for the target
733   resource.
734</t>
735<t>
736   An origin server that receives an If-None-Match header field MUST
737   evaluate the condition prior to performing the method
738   (<xref target="evaluation"/>).
739   If the field-value is "*", the condition is false if the origin server
740   has a current representation for the target resource.
741   If the field-value is a list of entity-tags, the condition is false if
742   one of the listed tags match the entity-tag of the selected representation.
743</t>
744<t>
745   An origin server MUST NOT perform the requested method if the condition
746   evaluates to false; instead, the origin server MUST respond with either
747   a) the <xref target="status.304" format="none">304 (Not Modified)</xref> status code if the request method
748   is GET or HEAD; or,
749   b) the <xref target="status.412" format="none">412 (Precondition Failed)</xref> status code for all other
750   request methods.
751</t>
752<t>
753   Requirements on cache handling of a received If-None-Match header field
754   are defined in Section 4.3.2 of <xref target="Part6"/>.
755</t>
756</section>
757
758<section title="If-Modified-Since" anchor="header.if-modified-since">
759  <iref primary="true" item="If-Modified-Since header field"/>
760 
761<t>
762   The "If-Modified-Since" header field makes a GET or HEAD request method
763   conditional on the selected representation's modification date being more
764   recent than the date provided in the field-value. Transfer of the selected
765   representation's data is avoided if that data has not changed.
766</t>
767<figure><iref primary="true" item="Grammar" subitem="If-Modified-Since"/><artwork type="abnf2616"><![CDATA[
768  If-Modified-Since = HTTP-date
769]]></artwork></figure>
770<t>
771   An example of the field is:
772</t>
773<figure><artwork type="example"><![CDATA[
774  If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
775]]></artwork></figure>
776<t>
777   A recipient MUST ignore If-Modified-Since if the request contains an
778   <xref target="header.if-none-match" format="none">If-None-Match</xref> header field; the condition in
779   <xref target="header.if-none-match" format="none">If-None-Match</xref> is considered to be a more accurate
780   replacement for the condition in If-Modified-Since and the two are only
781   combined for the sake of interoperating with older intermediaries that
782   might not implement <xref target="header.if-none-match" format="none">If-None-Match</xref>.
783</t>
784<t>
785   A recipient MUST ignore the If-Modified-Since header field if the
786   received field-value is not a valid HTTP-date, or if the request method
787   is neither GET nor HEAD.
788</t>
789<t>
790   A recipient MUST interpret an If-Modified-Since field-value's timestamp
791   in terms of the origin server's clock.
792</t>
793<t>
794   If-Modified-Since is typically used for two distinct purposes:
795   1) to allow efficient updates of a cached representation that does not
796   have an entity-tag; and,
797   2) to limit the scope of a web traversal to resources that have recently
798   changed.
799</t>
800<t>
801   When used for cache updates, a cache will typically use the value of the
802   cached message's <xref target="header.last-modified" format="none">Last-Modified</xref> field to generate the field
803   value of If-Modified-Since. This behavior is most interoperable for cases
804   where clocks are poorly synchronized or when the server has chosen to only
805   honor exact timestamp matches (due to a problem with Last-Modified dates
806   that appear to go "back in time" when the origin server's clock is
807   corrected or a representation is restored from an archived backup).
808   However, caches occasionally generate the field value based on other data,
809   such as the Date header field of the cached message or the
810   local clock time that the message was received, particularly when the
811   cached message does not contain a <xref target="header.last-modified" format="none">Last-Modified</xref> field.
812</t>
813<t>
814   When used for limiting the scope of retrieval to a recent time window, a
815   user agent will generate an If-Modified-Since field value based on either
816   its own local clock or a Date header field received from the
817   server in a prior response. Origin servers that choose an exact timestamp
818   match based on the selected representation's <xref target="header.last-modified" format="none">Last-Modified</xref>
819   field will not be able to help the user agent limit its data transfers to
820   only those changed during the specified window.
821</t>
822<t>
823   An origin server that receives an If-Modified-Since header field SHOULD
824   evaluate the condition prior to performing the method
825   (<xref target="evaluation"/>).
826   The origin server SHOULD NOT perform the requested method if the selected
827   representation's last modification date is earlier than or equal to the
828   date provided in the field-value; instead, the origin server SHOULD
829   generate a <xref target="status.304" format="none">304 (Not Modified)</xref> response, including only those
830   metadata that are useful for identifying or updating a previously cached
831   response.
832</t>
833<t>
834   Requirements on cache handling of a received If-Modified-Since header field
835   are defined in Section 4.3.2 of <xref target="Part6"/>.
836</t>
837</section>
838
839<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
840  <iref primary="true" item="If-Unmodified-Since header field"/>
841 
842<t>
843   The "If-Unmodified-Since" header field makes the request method conditional
844   on the selected representation's last modification date being earlier than or
845   equal to the date provided in the field-value. This field accomplishes the
846   same purpose as <xref target="header.if-match" format="none">If-Match</xref> for cases where the user agent does
847   not have an entity-tag for the representation.
848</t>
849<figure><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/><artwork type="abnf2616"><![CDATA[
850  If-Unmodified-Since = HTTP-date
851]]></artwork></figure>
852<t>
853   An example of the field is:
854</t>
855<figure><artwork type="example"><![CDATA[
856  If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
857]]></artwork></figure>
858<t>
859   A recipient MUST ignore If-Unmodified-Since if the request contains an
860   <xref target="header.if-match" format="none">If-Match</xref> header field; the condition in
861   <xref target="header.if-match" format="none">If-Match</xref> is considered to be a more accurate replacement for
862   the condition in If-Unmodified-Since and the two are only combined for the
863   sake of interoperating with older intermediaries that might not implement
864   <xref target="header.if-match" format="none">If-Match</xref>.
865</t>
866<t>
867   A recipient MUST ignore the If-Unmodified-Since header field if the
868   received field-value is not a valid HTTP-date.
869</t>
870<t>
871   A recipient MUST interpret an If-Unmodified-Since field-value's timestamp
872   in terms of the origin server's clock.
873</t>
874<t>
875   If-Unmodified-Since is most often used with state-changing methods
876   (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple
877   user agents might be acting in parallel on a resource that does
878   not supply entity-tags with its representations (i.e., to prevent the
879   "lost update" problem). It can also be used with safe methods to abort a
880   request if the selected representation does not match one
881   already stored (or partially stored) from a prior request.
882</t>
883<t>
884   An origin server that receives an If-Unmodified-Since header field MUST
885   evaluate the condition prior to performing the method
886   (<xref target="evaluation"/>).
887   The origin server MUST NOT perform the requested method if the selected
888   representation's last modification date is more recent than the date
889   provided in the field-value; instead the
890   origin server MUST respond with either:
891   a) the <xref target="status.412" format="none">412 (Precondition Failed)</xref> status code; or,
892   b) one of the 2xx (Successful) status codes if the origin
893   server has verified that a state change is being requested and the final
894   state is already reflected in the current state of the target resource
895   (i.e., the change requested by the user agent has already succeeded, but
896   the user agent might not be aware of that because the prior response message
897   was lost or a compatible change was made by some other user agent).
898   In the latter case, the origin server MUST NOT send a validator header
899   field in the response unless it can verify that the request is a duplicate
900   of an immediately prior change made by the same user agent.
901</t>
902<t>
903   The If-Unmodified-Since header field can be ignored by caches and
904   intermediaries because it is not applicable to a stored response.
905</t>
906</section>
907
908<section title="If-Range" anchor="header.if-range">
909<t>
910   The "If-Range" header field provides a special conditional request
911   mechanism that is similar to the <xref target="header.if-match" format="none">If-Match</xref> and
912   <xref target="header.if-unmodified-since" format="none">If-Unmodified-Since</xref> header fields but instructs the
913   recipient to ignore the Range header field if the validator
914   doesn't match, resulting in transfer of the new selected representation
915   instead of a 412 response. If-Range is defined in Section 3.2 of <xref target="Part5"/>.
916</t>
917</section>
918</section>
919
920<section title="Status Code Definitions" anchor="status.code.definitions">
921<section title="304 Not Modified" anchor="status.304">
922  <iref primary="true" item="304 Not Modified (status code)"/>
923 
924 
925<t>
926   The 304 (Not Modified) status code indicates that a
927   conditional GET or HEAD request has been
928   received and would have resulted in a 200 (OK) response
929   if it were not for the fact that the condition has evaluated to false.
930   In other words, there is no need for the server to transfer a
931   representation of the target resource because the request indicates that
932   the client, which made the request conditional, already has a valid
933   representation; the server is therefore redirecting the client to make
934   use of that stored representation as if it were the payload of a
935   200 (OK) response.
936</t>
937<t>
938   The server generating a 304 response MUST generate any of the following
939   header fields that would have been sent in a 200 (OK)
940   response to the same request:
941   Cache-Control,
942   Content-Location,
943   Date,
944   <xref target="header.etag" format="none">ETag</xref>,
945   Expires, and
946   Vary.
947</t>
948<t>
949   Since the goal of a 304 response is to minimize information transfer
950   when the recipient already has one or more cached representations,
951   a sender SHOULD NOT generate representation metadata other
952   than the above listed fields unless said metadata exists for the
953   purpose of guiding cache updates (e.g., <xref target="header.last-modified" format="none">Last-Modified</xref> might
954   be useful if the response does not have an <xref target="header.etag" format="none">ETag</xref> field).
955</t>
956<t>
957   Requirements on a cache that receives a 304 response are defined in
958   Section 4.3.4 of <xref target="Part6"/>. If the conditional request originated with an
959   outbound client, such as a user agent with its own cache sending a
960   conditional GET to a shared proxy, then the proxy SHOULD forward the
961   304 response to that client.
962</t>
963<t>
964   A 304 response cannot contain a message-body; it is always
965   terminated by the first empty line after the header fields.
966</t>
967</section>
968
969<section title="412 Precondition Failed" anchor="status.412">
970  <iref primary="true" item="412 Precondition Failed (status code)"/>
971 
972<t>
973   The 412 (Precondition Failed) status code indicates that one
974   or more conditions given in the request header fields evaluated to false
975   when tested on the server. This response code allows the client to place
976   preconditions on the current resource state (its current representations
977   and metadata) and thus prevent the request method from being applied if the
978   target resource is in an unexpected state.
979</t>
980</section>
981</section>
982
983<section title="Evaluation" anchor="evaluation">
984<t>
985   Except when excluded below, a recipient cache or origin server MUST
986   evaluate received request preconditions after it has successfully performed
987   its normal request checks and just before it would perform the action
988   associated with the request method.
989   A server MUST ignore all received preconditions if its response to the
990   same request without those conditions would have been a status code other
991   than a 2xx or <xref target="status.412" format="none">412 (Precondition Failed)</xref>.
992   In other words, redirects and failures take precedence over the evaluation
993   of preconditions in conditional requests.
994</t>
995<t>
996   A server that is not the origin server for the target resource and cannot
997   act as a cache for requests on the target resource MUST NOT evaluate the
998   conditional request header fields defined by this specification, and
999   MUST forward them if the request is forwarded, since the generating
1000   client intends that they be evaluated by a server that can provide a
1001   current representation.
1002   Likewise, a server MUST ignore the conditional request header fields
1003   defined by this specification when received with a request method that does
1004   not involve the selection or modification of a
1005   selected representation, such as CONNECT, OPTIONS, or TRACE.
1006</t>
1007<t>
1008   Conditional request header fields that are defined by extensions to HTTP
1009   might place conditions on all recipients, on the state of the target
1010   resource in general, or on a group of resources. For instance, the "If"
1011   header field in WebDAV can make a request conditional on various aspects
1012   of multiple resources, such as locks, if the recipient understands and
1013   implements that field (<xref target="RFC4918"/>, Section 10.4).
1014</t>
1015<t>
1016   Although conditional request header fields are defined as being usable with
1017   the HEAD method (to keep HEAD's semantics consistent with those of GET),
1018   there is no point in sending a conditional HEAD because a successful
1019   response is around the same size as a <xref target="status.304" format="none">304 (Not Modified)</xref>
1020   response and more useful than a <xref target="status.412" format="none">412 (Precondition Failed)</xref>
1021   response.
1022</t>
1023</section>
1024
1025<section title="Precedence" anchor="precedence">
1026<t>
1027   When more than one conditional request header field is present in a request,
1028   the order in which the fields are evaluated becomes important. In practice,
1029   the fields defined in this document are consistently implemented in a
1030   single, logical order, since "lost update" preconditions have more strict
1031   requirements than cache validation, a validated cache is more efficient
1032   than a partial response, and entity tags are presumed to be more accurate
1033   than date validators.
1034</t>
1035<t>
1036   A recipient cache or origin server MUST evaluate the request
1037   preconditions defined by this specification in the following order:
1038   <list style="numbers">
1039     <t anchor="precedence1">When recipient is the origin server and
1040       <xref target="header.if-match" format="none">If-Match</xref> is present,
1041       evaluate the <xref target="header.if-match" format="none">If-Match</xref> precondition:
1042       <list style="symbols">
1043         <t>if true, continue to step <xref target="precedence3" format="counter"/></t>
1044         <t>if false, respond <xref target="status.412" format="none">412 (Precondition Failed)</xref> unless
1045            it can be determined that the state-changing request has already
1046            succeeded (see <xref target="header.if-match"/>)</t>
1047       </list>
1048     </t>
1049     <t anchor="precedence2">When recipient is the origin server,
1050       <xref target="header.if-match" format="none">If-Match</xref> is not present, and
1051       <xref target="header.if-unmodified-since" format="none">If-Unmodified-Since</xref> is present,
1052       evaluate the <xref target="header.if-unmodified-since" format="none">If-Unmodified-Since</xref> precondition:
1053       <list style="symbols">
1054         <t>if true, continue to step <xref target="precedence3" format="counter"/></t>
1055         <t>if false, respond <xref target="status.412" format="none">412 (Precondition Failed)</xref> unless
1056            it can be determined that the state-changing request has already
1057            succeeded (see <xref target="header.if-unmodified-since"/>)</t>
1058       </list>
1059     </t>
1060     <t anchor="precedence3">When <xref target="header.if-none-match" format="none">If-None-Match</xref> is present,
1061       evaluate the <xref target="header.if-none-match" format="none">If-None-Match</xref> precondition:
1062       <list style="symbols">
1063         <t>if true, continue to step <xref target="precedence5" format="counter"/></t>
1064         <t>if false for GET/HEAD, respond <xref target="status.304" format="none">304 (Not Modified)</xref></t>
1065         <t>if false for other methods, respond <xref target="status.412" format="none">412 (Precondition Failed)</xref></t>
1066       </list>
1067     </t>
1068     <t anchor="precedence4">When the method is GET or HEAD,
1069       <xref target="header.if-none-match" format="none">If-None-Match</xref> is not present, and
1070       <xref target="header.if-modified-since" format="none">If-Modified-Since</xref> is present,
1071       evaluate the <xref target="header.if-modified-since" format="none">If-Modified-Since</xref> precondition:
1072       <list style="symbols">
1073         <t>if true, continue to step <xref target="precedence5" format="counter"/></t>
1074         <t>if false, respond <xref target="status.304" format="none">304 (Not Modified)</xref></t>
1075       </list>
1076     </t>
1077     <t anchor="precedence5">When the method is GET and both
1078       Range and If-Range are present,
1079       evaluate the If-Range precondition:
1080       <list style="symbols">
1081         <t>if the validator matches and the Range specification is
1082            applicable to the selected representation, respond
1083            206 (Partial Content) <xref target="Part5"/></t>
1084       </list>
1085     </t>
1086     <t anchor="precedencelast">Otherwise,
1087       <list style="symbols">
1088         <t>all conditions are met, so perform the requested action and
1089            respond according to its success or failure.</t>
1090       </list>
1091     </t>
1092   </list>
1093</t>
1094<t>
1095   Any extension to HTTP/1.1 that defines additional conditional request
1096   header fields ought to define its own expectations regarding the order
1097   for evaluating such fields in relation to those defined in this document
1098   and other conditionals that might be found in practice.
1099</t>
1100</section>
1101
1102<section title="IANA Considerations" anchor="IANA.considerations">
1103
1104<section title="Status Code Registration" anchor="status.code.registration">
1105<t>
1106   The HTTP Status Code Registry located at <eref target="http://www.iana.org/assignments/http-status-codes"/>
1107   shall be updated with the registrations below:
1108</t>
1109
1110<!--AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually-->
1111<texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table">
1112   <ttcol>Value</ttcol>
1113   <ttcol>Description</ttcol>
1114   <ttcol>Reference</ttcol>
1115   <c>304</c>
1116   <c>Not Modified</c>
1117   <c>
1118      <xref target="status.304"/>
1119   </c>
1120   <c>412</c>
1121   <c>Precondition Failed</c>
1122   <c>
1123      <xref target="status.412"/>
1124   </c>
1125</texttable>
1126<!--(END)-->
1127
1128</section>
1129
1130<section title="Header Field Registration" anchor="header.field.registration">
1131<t>
1132   HTTP header fields are registered within the Message Header Field Registry
1133   maintained at
1134   <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/>.
1135</t>
1136<t>
1137   This document defines the following HTTP header fields, so their
1138   associated registry entries shall be updated according to the permanent
1139   registrations below (see <xref target="BCP90"/>):
1140</t>
1141
1142<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
1143<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
1144   <ttcol>Header Field Name</ttcol>
1145   <ttcol>Protocol</ttcol>
1146   <ttcol>Status</ttcol>
1147   <ttcol>Reference</ttcol>
1148
1149   <c>ETag</c>
1150   <c>http</c>
1151   <c>standard</c>
1152   <c>
1153      <xref target="header.etag"/>
1154   </c>
1155   <c>If-Match</c>
1156   <c>http</c>
1157   <c>standard</c>
1158   <c>
1159      <xref target="header.if-match"/>
1160   </c>
1161   <c>If-Modified-Since</c>
1162   <c>http</c>
1163   <c>standard</c>
1164   <c>
1165      <xref target="header.if-modified-since"/>
1166   </c>
1167   <c>If-None-Match</c>
1168   <c>http</c>
1169   <c>standard</c>
1170   <c>
1171      <xref target="header.if-none-match"/>
1172   </c>
1173   <c>If-Unmodified-Since</c>
1174   <c>http</c>
1175   <c>standard</c>
1176   <c>
1177      <xref target="header.if-unmodified-since"/>
1178   </c>
1179   <c>Last-Modified</c>
1180   <c>http</c>
1181   <c>standard</c>
1182   <c>
1183      <xref target="header.last-modified"/>
1184   </c>
1185</texttable>
1186<!--(END)-->
1187
1188<t>
1189   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
1190</t>
1191</section>
1192</section>
1193
1194<section title="Security Considerations" anchor="security.considerations">
1195<t>
1196   This section is meant to inform developers, information providers, and
1197   users of known security concerns specific to the HTTP/1.1 conditional
1198   request mechanisms. More general security considerations are addressed
1199   in HTTP messaging <xref target="Part1"/> and semantics <xref target="Part2"/>.
1200</t>
1201<t>
1202   The validators defined by this specification are not intended to ensure
1203   the validity of a representation, guard against malicious changes, or
1204   detect man-in-the-middle attacks. At best, they enable more efficient cache
1205   updates and optimistic concurrent writes when all participants are behaving
1206   nicely. At worst, the conditions will fail and the client will receive a
1207   response that is no more harmful than an HTTP exchange without conditional
1208   requests.
1209</t>
1210<t>
1211   An entity-tag can be abused in ways that create privacy risks. For example,
1212   a site might deliberately construct a semantically invalid entity-tag that
1213   is unique to the user or user agent, send it in a cacheable response with a
1214   long freshness time, and then read that entity-tag in later conditional
1215   requests as a means of re-identifying that user or user agent. Such an
1216   identifying tag would become a persistent identifier for as long as the
1217   user agent retained the original cache entry. User agents that cache
1218   representations ought to ensure that the cache is cleared or replaced
1219   whenever the user performs privacy-maintaining actions, such as clearing
1220   stored cookies or changing to a private browsing mode.
1221</t>
1222</section>
1223
1224<section title="Acknowledgments" anchor="acks">
1225<t>
1226  See Section 10 of <xref target="Part1"/>.
1227</t>
1228</section>
1229</middle>
1230<back>
1231
1232<references title="Normative References">
1233
1234<reference anchor="Part1">
1235  <front>
1236    <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
1237    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1238      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1239      <address><email>fielding@gbiv.com</email></address>
1240    </author>
1241    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1242      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1243      <address><email>julian.reschke@greenbytes.de</email></address>
1244    </author>
1245    <date month="September" year="2013"/>
1246  </front>
1247  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-24"/>
1248 
1249</reference>
1250
1251<reference anchor="Part2">
1252  <front>
1253    <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
1254    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1255      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1256      <address><email>fielding@gbiv.com</email></address>
1257    </author>
1258    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1259      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1260      <address><email>julian.reschke@greenbytes.de</email></address>
1261    </author>
1262    <date month="September" year="2013"/>
1263  </front>
1264  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-24"/>
1265 
1266</reference>
1267
1268<reference anchor="Part5">
1269  <front>
1270    <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
1271    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1272      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1273      <address><email>fielding@gbiv.com</email></address>
1274    </author>
1275    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1276      <organization abbrev="W3C">World Wide Web Consortium</organization>
1277      <address><email>ylafon@w3.org</email></address>
1278    </author>
1279    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1280      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1281      <address><email>julian.reschke@greenbytes.de</email></address>
1282    </author>
1283    <date month="September" year="2013"/>
1284  </front>
1285  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-24"/>
1286 
1287</reference>
1288
1289<reference anchor="Part6">
1290  <front>
1291    <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
1292    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1293      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1294      <address><email>fielding@gbiv.com</email></address>
1295    </author>
1296    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
1297      <organization>Akamai</organization>
1298      <address><email>mnot@mnot.net</email></address>
1299    </author>
1300    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1301      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1302      <address><email>julian.reschke@greenbytes.de</email></address>
1303    </author>
1304    <date month="September" year="2013"/>
1305  </front>
1306  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-24"/>
1307 
1308</reference>
1309
1310<reference anchor="RFC2119">
1311  <front>
1312    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1313    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1314      <organization>Harvard University</organization>
1315      <address><email>sob@harvard.edu</email></address>
1316    </author>
1317    <date month="March" year="1997"/>
1318  </front>
1319  <seriesInfo name="BCP" value="14"/>
1320  <seriesInfo name="RFC" value="2119"/>
1321</reference>
1322
1323<reference anchor="RFC5234">
1324  <front>
1325    <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
1326    <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
1327      <organization>Brandenburg InternetWorking</organization>
1328      <address>
1329        <email>dcrocker@bbiw.net</email>
1330      </address> 
1331    </author>
1332    <author initials="P." surname="Overell" fullname="Paul Overell">
1333      <organization>THUS plc.</organization>
1334      <address>
1335        <email>paul.overell@thus.net</email>
1336      </address>
1337    </author>
1338    <date month="January" year="2008"/>
1339  </front>
1340  <seriesInfo name="STD" value="68"/>
1341  <seriesInfo name="RFC" value="5234"/>
1342</reference>
1343
1344</references>
1345
1346<references title="Informative References">
1347
1348<reference anchor="RFC2616">
1349  <front>
1350    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1351    <author initials="R." surname="Fielding" fullname="R. Fielding">
1352      <organization>University of California, Irvine</organization>
1353      <address><email>fielding@ics.uci.edu</email></address>
1354    </author>
1355    <author initials="J." surname="Gettys" fullname="J. Gettys">
1356      <organization>W3C</organization>
1357      <address><email>jg@w3.org</email></address>
1358    </author>
1359    <author initials="J." surname="Mogul" fullname="J. Mogul">
1360      <organization>Compaq Computer Corporation</organization>
1361      <address><email>mogul@wrl.dec.com</email></address>
1362    </author>
1363    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1364      <organization>MIT Laboratory for Computer Science</organization>
1365      <address><email>frystyk@w3.org</email></address>
1366    </author>
1367    <author initials="L." surname="Masinter" fullname="L. Masinter">
1368      <organization>Xerox Corporation</organization>
1369      <address><email>masinter@parc.xerox.com</email></address>
1370    </author>
1371    <author initials="P." surname="Leach" fullname="P. Leach">
1372      <organization>Microsoft Corporation</organization>
1373      <address><email>paulle@microsoft.com</email></address>
1374    </author>
1375    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1376      <organization>W3C</organization>
1377      <address><email>timbl@w3.org</email></address>
1378    </author>
1379    <date month="June" year="1999"/>
1380  </front>
1381  <seriesInfo name="RFC" value="2616"/>
1382</reference>
1383
1384<reference anchor="BCP90">
1385  <front>
1386    <title>Registration Procedures for Message Header Fields</title>
1387    <author initials="G." surname="Klyne" fullname="G. Klyne">
1388      <organization>Nine by Nine</organization>
1389      <address><email>GK-IETF@ninebynine.org</email></address>
1390    </author>
1391    <author initials="M." surname="Nottingham" fullname="M. Nottingham">
1392      <organization>BEA Systems</organization>
1393      <address><email>mnot@pobox.com</email></address>
1394    </author>
1395    <author initials="J." surname="Mogul" fullname="J. Mogul">
1396      <organization>HP Labs</organization>
1397      <address><email>JeffMogul@acm.org</email></address>
1398    </author>
1399    <date year="2004" month="September"/>
1400  </front>
1401  <seriesInfo name="BCP" value="90"/>
1402  <seriesInfo name="RFC" value="3864"/>
1403</reference>
1404
1405<reference anchor="RFC4918">
1406  <front>
1407    <title>HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</title>
1408    <author initials="L.M." surname="Dusseault" fullname="Lisa Dusseault" role="editor">
1409      <organization abbrev="CommerceNet">CommerceNet</organization>
1410      <address><email>ldusseault@commerce.net</email></address>
1411    </author>
1412    <date month="June" year="2007"/>
1413  </front>
1414  <seriesInfo name="RFC" value="4918"/>
1415</reference>
1416</references>
1417
1418<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1419<t>
1420  The definition of validator weakness has been expanded and clarified.
1421  (<xref target="weak.and.strong.validators"/>)
1422</t>
1423<t>
1424  Weak entity-tags are now allowed in all requests except range requests.
1425  (Sections <xref target="weak.and.strong.validators" format="counter"/> and
1426  <xref target="header.if-none-match" format="counter"/>)
1427</t>
1428<t>
1429  The <xref target="header.etag" format="none">ETag</xref> header field ABNF has been changed to not use
1430  quoted-string, thus avoiding escaping issues.
1431  (<xref target="header.etag"/>)
1432</t>
1433<t>
1434  ETag is defined to provide an entity tag for the selected representation,
1435  thereby clarifying what it applies to in various situations (such as a
1436  PUT response).
1437  (<xref target="header.etag"/>)
1438</t>
1439<t>
1440  The precedence for evaluation of conditional requests has been defined.
1441  (<xref target="precedence"/>)
1442</t>
1443</section>
1444
1445<section title="Imported ABNF" anchor="imported.abnf">
1446 
1447 
1448 
1449 
1450 
1451 
1452 
1453 
1454 
1455 
1456 
1457<t>
1458  The following core rules are included by
1459  reference, as defined in Appendix B.1 of <xref target="RFC5234"/>:
1460  ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls),
1461  DIGIT (decimal 0-9), DQUOTE (double quote),
1462  HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed),
1463  OCTET (any 8-bit sequence of data), SP (space), and
1464  VCHAR (any visible US-ASCII character).
1465</t>
1466<t>
1467  The rules below are defined in <xref target="Part1"/>:
1468</t>
1469<figure><artwork type="abnf2616"><![CDATA[
1470  OWS           = <OWS, defined in [Part1], Section 3.2.3>
1471  obs-text      = <obs-text, defined in [Part1], Section 3.2.6>
1472]]></artwork></figure>
1473<t>
1474  The rules below are defined in other parts:
1475</t>
1476<figure><artwork type="abnf2616"><![CDATA[
1477  HTTP-date     = <HTTP-date, defined in [Part2], Section 7.1.1.1>
1478]]></artwork></figure>
1479</section>
1480
1481
1482<section title="Collected ABNF" anchor="collected.abnf">
1483<t>
1484  In the collected ABNF below, list rules are expanded as per Section 1.2 of <xref target="Part1"/>.
1485</t><figure>
1486<artwork type="abnf" name="p4-conditional.parsed-abnf"><![CDATA[
1487ETag = entity-tag
1488
1489HTTP-date = <HTTP-date, defined in [Part2], Section 7.1.1.1>
1490
1491If-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
1492 entity-tag ] ) )
1493If-Modified-Since = HTTP-date
1494If-None-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
1495 entity-tag ] ) )
1496If-Unmodified-Since = HTTP-date
1497
1498Last-Modified = HTTP-date
1499
1500OWS = <OWS, defined in [Part1], Section 3.2.3>
1501
1502entity-tag = [ weak ] opaque-tag
1503etagc = "!" / %x23-7E ; '#'-'~'
1504 / obs-text
1505
1506obs-text = <obs-text, defined in [Part1], Section 3.2.6>
1507opaque-tag = DQUOTE *etagc DQUOTE
1508
1509weak = %x57.2F ; W/
1510]]></artwork>
1511</figure>
1512</section>
1513
1514
1515<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
1516<t>
1517  Changes up to the first Working Group Last Call draft are summarized
1518  in <eref target="http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-19#appendix-C"/>.
1519</t>
1520
1521<section title="Since draft-ietf-httpbis-p4-conditional-19" anchor="changes.since.19">
1522<t>
1523  Closed issues:
1524  <list style="symbols">
1525    <t>
1526      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/241"/>:
1527      "Need to clarify eval order/interaction of conditional headers"
1528    </t>
1529    <t>
1530      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/345"/>:
1531      "Required headers on 304 and 206"
1532    </t>
1533    <t>
1534      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/350"/>:
1535      "Optionality of Conditional Request Support"
1536    </t>
1537    <t>
1538      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/354"/>:
1539      "ETags and Conditional Requests"
1540    </t>
1541    <t>
1542      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/361"/>:
1543      "ABNF requirements for recipients"
1544    </t>
1545    <t>
1546      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/363"/>:
1547      "Rare cases"
1548    </t>
1549    <t>
1550      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/365"/>:
1551      "Conditional Request Security Considerations"
1552    </t>
1553    <t>
1554      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/371"/>:
1555      "If-Modified-Since lacks definition for method != GET"
1556    </t>
1557    <t>
1558      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/372"/>:
1559      "refactor conditional header field descriptions"
1560    </t>
1561  </list>
1562</t>
1563</section>
1564
1565<section title="Since draft-ietf-httpbis-p4-conditional-20" anchor="changes.since.20">
1566<t>
1567  <list style="symbols">
1568    <t>
1569      Conformance criteria and considerations regarding error handling are
1570      now defined in Part 1.
1571    </t>
1572  </list>
1573</t>
1574</section>
1575
1576<section title="Since draft-ietf-httpbis-p4-conditional-21" anchor="changes.since.21">
1577<t>
1578  Closed issues:
1579  <list style="symbols">
1580    <t>
1581      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/96"/>:
1582      "Conditional GET text"
1583    </t>
1584    <t>
1585      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/350"/>:
1586      "Optionality of Conditional Request Support"
1587    </t>
1588    <t>
1589      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/384"/>:
1590      "unclear prose in definition of 304"
1591    </t>
1592    <t>
1593      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/401"/>:
1594      "ETags and Conneg"
1595    </t>
1596    <t>
1597      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/402"/>:
1598      "Comparison function for If-Match and If-None-Match"
1599    </t>
1600    <t>
1601      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/406"/>:
1602      "304 without validator"
1603    </t>
1604    <t>
1605      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/427"/>:
1606      "If-Match and 428"
1607    </t>
1608  </list>
1609</t>
1610</section>
1611
1612<section title="Since draft-ietf-httpbis-p4-conditional-22" anchor="changes.since.22">
1613<t>
1614  Closed issues:
1615  <list style="symbols">
1616    <t>
1617      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/436"/>:
1618      "explain list expansion in ABNF appendices"
1619    </t>
1620    <t>
1621      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/437"/>:
1622      "incorrect example dates"
1623    </t>
1624  </list>
1625</t>
1626<t>
1627  Partly resolved issues:
1628  <list style="symbols">
1629    <t>
1630      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/461"/>:
1631      "Editorial suggestions"
1632    </t>
1633  </list>
1634</t>
1635</section>
1636
1637<section title="Since draft-ietf-httpbis-p4-conditional-23" anchor="changes.since.23">
1638<t>
1639  Closed issues:
1640  <list style="symbols">
1641    <t>
1642      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/455"/>:
1643      "PUT + If-Match over-constrained?"
1644    </t>
1645    <t>
1646      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/479"/>:
1647      "MUSTs and other feedback"
1648    </t>
1649    <t>
1650      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/495"/>:
1651      "p4 editorial nits"
1652    </t>
1653  </list>
1654</t>
1655</section>
1656</section>
1657
1658</back>
1659</rfc>
Note: See TracBrowser for help on using the repository browser.