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

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

note that simultaneous use of the same validator for different representation data would also make it weak; addresses #401

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