source: draft-ietf-httpbis/25/draft-ietf-httpbis-p4-conditional-25.xml @ 2656

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

prepare publication of -25 drafts on 2013-11-17

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