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

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

Remove ABNF diagnostics for known to be non-referenced productions (header field names)

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