source: draft-ietf-httpbis/latest/p4-conditional.xml @ 1875

Last change on this file since 1875 was 1875, checked in by fielding@…, 7 years ago

Be more consistent regarding targeting conformance requirements.
Only define conformance criteria once, but repeat required nits.

Remove antiquated requirement about media type parameters not being
recognized by 1993-era browsers.

Add reference to TLS in p1.

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