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

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

Just noticed that p5 requires If-Range be ignored if other preconditions win, so move it to end of precedence

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