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

Last change on this file since 2362 was 2362, checked in by julian.reschke@…, 9 years ago

Note change for [2361], see #479

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/xml
File size: 75.4 KB
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=''>MAY</bcp14>">
5  <!ENTITY MUST "<bcp14 xmlns=''>MUST</bcp14>">
6  <!ENTITY MUST-NOT "<bcp14 xmlns=''>MUST NOT</bcp14>">
7  <!ENTITY OPTIONAL "<bcp14 xmlns=''>OPTIONAL</bcp14>">
8  <!ENTITY RECOMMENDED "<bcp14 xmlns=''>RECOMMENDED</bcp14>">
9  <!ENTITY REQUIRED "<bcp14 xmlns=''>REQUIRED</bcp14>">
10  <!ENTITY SHALL "<bcp14 xmlns=''>SHALL</bcp14>">
11  <!ENTITY SHALL-NOT "<bcp14 xmlns=''>SHALL NOT</bcp14>">
12  <!ENTITY SHOULD "<bcp14 xmlns=''>SHOULD</bcp14>">
13  <!ENTITY SHOULD-NOT "<bcp14 xmlns=''>SHOULD NOT</bcp14>">
14  <!ENTITY ID-VERSION "latest">
15  <!ENTITY ID-MONTH "August">
16  <!ENTITY ID-YEAR "2013">
17  <!ENTITY Note "<x:h xmlns:x=''>Note:</x:h>">
18  <!ENTITY architecture               "<xref target='Part1' x:rel='#architecture' xmlns:x=''/>">
19  <!ENTITY conformance                "<xref target='Part1' x:rel='#conformance' xmlns:x=''/>">
20  <!ENTITY notation                   "<xref target='Part1' x:rel='#notation' xmlns:x=''/>">
21  <!ENTITY abnf-extension             "<xref target='Part1' x:rel='#abnf.extension' xmlns:x=''/>">
22  <!ENTITY acks                       "<xref target='Part1' x:rel='#acks' xmlns:x=''/>">
23  <!ENTITY whitespace                 "<xref target='Part1' x:rel='#whitespace' xmlns:x=''/>">
24  <!ENTITY field-components           "<xref target='Part1' x:rel='#field.components' xmlns:x=''/>">
25  <!ENTITY header-date                "<xref target='Part2' x:rel='' xmlns:x=''/>">
26  <!ENTITY safe-methods               "<xref target='Part2' x:rel='#safe.methods' xmlns:x=''/>">
27  <!ENTITY representation             "<xref target='Part2' x:rel='#representations' xmlns:x=''/>">
28  <!ENTITY messaging                  "<xref target='Part1' xmlns:x=''/>">
29  <!ENTITY semantics                  "<xref target='Part2' xmlns:x=''/>">
30  <!ENTITY caching                    "<xref target='Part6' xmlns:x=''/>">
31  <!ENTITY cache-key                  "<xref target='Part6' x:rel='#constructing.responses.from.caches' xmlns:x=''/>">
32  <!ENTITY freshening-responses       "<xref target='Part6' x:rel='#freshening.responses' xmlns:x=''/>">
33  <!ENTITY header-accept-encoding     "<xref target='Part2' x:rel='#header.accept-encoding' xmlns:x=''/>">
34  <!ENTITY header-if-range            "<xref target='Part5' x:rel='#header.if-range' xmlns:x=''/>">
35  <!ENTITY header-range               "<xref target='Part5' x:rel='#header.range' xmlns:x=''/>">
36  <!ENTITY header-vary                "<xref target='Part2' x:rel='#header.vary' xmlns:x=''/>">
37  <!ENTITY http-date                  "<xref target='Part2' x:rel='' xmlns:x=''/>">
38  <!ENTITY transfer-codings           "<xref target='Part1' x:rel='#transfer.codings' xmlns:x=''/>">
39  <!ENTITY content-negotiation        "<xref target='Part2' x:rel='#content.negotiation' xmlns:x=''/>">
41<?rfc toc="yes" ?>
42<?rfc symrefs="yes" ?>
43<?rfc sortrefs="yes" ?>
44<?rfc compact="yes"?>
45<?rfc subcompact="no" ?>
46<?rfc linkmailto="no" ?>
47<?rfc editing="no" ?>
48<?rfc comments="yes"?>
49<?rfc inline="yes"?>
50<?rfc rfcedstyle="yes"?>
51<?rfc-ext allow-markup-in-artwork="yes" ?>
52<?rfc-ext include-references-in-index="yes" ?>
53<rfc obsoletes="2616" category="std" x:maturity-level="proposed"
54     ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"
55     xmlns:x=''>
56<x:link rel="prev" basename="p2-semantics"/>
57<x:link rel="next" basename="p5-range"/>
58<x:feedback template="{docname},%20%22{section}%22&amp;body=&lt;{ref}&gt;:"/>
61  <title abbrev="HTTP/1.1 Conditional Requests">Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
63  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
64    <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
65    <address>
66      <postal>
67        <street>345 Park Ave</street>
68        <city>San Jose</city>
69        <region>CA</region>
70        <code>95110</code>
71        <country>USA</country>
72      </postal>
73      <email></email>
74      <uri></uri>
75    </address>
76  </author>
78  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
79    <organization abbrev="greenbytes">greenbytes GmbH</organization>
80    <address>
81      <postal>
82        <street>Hafenweg 16</street>
83        <city>Muenster</city><region>NW</region><code>48155</code>
84        <country>Germany</country>
85      </postal>
86      <email></email>
87      <uri></uri>
88    </address>
89  </author>
91  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
92  <workgroup>HTTPbis Working Group</workgroup>
96   The Hypertext Transfer Protocol (HTTP) is an application-level protocol for
97   distributed, collaborative, hypertext information systems. This document
98   defines HTTP/1.1 conditional requests, including metadata header fields
99   for indicating state changes, request header fields for making
100   preconditions on such state, and rules for constructing the responses to a
101   conditional request when one or more preconditions evaluate to false.
105<note title="Editorial Note (To be removed by RFC Editor)">
106  <t>
107    Discussion of this draft takes place on the HTTPBIS working group
108    mailing list (, which is archived at
109    <eref target=""/>.
110  </t>
111  <t>
112    The current issues list is at
113    <eref target=""/> and related
114    documents (including fancy diffs) can be found at
115    <eref target=""/>.
116  </t>
117  <t>
118    The changes in this draft are summarized in <xref target="changes.since.23"/>.
119  </t>
124<section title="Introduction" anchor="introduction">
126   Conditional requests are HTTP requests <xref target="Part2"/> that include
127   one or more header fields indicating a precondition to be tested before
128   applying the method semantics to the target resource.
129   This document defines the HTTP/1.1 conditional request mechanisms in terms
130   of the architecture, syntax notation, and conformance criteria defined in
131   <xref target="Part1"/>.
134   Conditional GET requests are the most efficient mechanism for HTTP
135   cache updates &caching;.  Conditionals can also be
136   applied to state-changing methods, such as PUT and DELETE, to prevent
137   the "lost update" problem: one client accidentally overwriting
138   the work of another client that has been acting in parallel.
140<t><iref primary="true" item="selected representation"/>
141   Conditional request preconditions are based on the state of the target
142   resource as a whole (its current value set) or the state as observed
143   in a previously obtained representation (one value in that set).
144   A resource might have multiple current representations, each with its
145   own observable state.  The conditional request mechanisms assume that
146   the mapping of requests to a "selected representation" (&representation;)
147   will be consistent over time if the server intends to take advantage of
148   conditionals. Regardless, if the mapping is inconsistent and the server is
149   unable to select the appropriate representation, then no harm will result
150   when the precondition evaluates to false.
153   The conditional request preconditions defined by this specification
154   (<xref target="preconditions"/>) are evaluated when applicable to the
155   recipient (<xref target="evaluation"/>) according to their order of
156   precedence (<xref target="precedence"/>).
159<section title="Conformance and Error Handling" anchor="conformance">
161   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
162   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
163   document are to be interpreted as described in <xref target="RFC2119"/>.
166   Conformance criteria and considerations regarding error handling
167   are defined in &conformance;.
171<section title="Syntax Notation" anchor="notation">
173   This specification uses the Augmented Backus-Naur Form (ABNF) notation
174   of <xref target="RFC5234"/> with the list rule extension defined in
175   &abnf-extension;. <xref target="imported.abnf"/> describes rules imported from
176   other documents. <xref target="collected.abnf"/> shows the collected ABNF
177   with the list rule expanded.
182<section title="Validators" anchor="validators">
183   <iref primary="true" item="metadata"/>
184   <iref primary="true" item="validator"/>
186   This specification defines two forms of metadata that are commonly used
187   to observe resource state and test for preconditions: modification dates
188   (<xref target="header.last-modified"/>) and opaque entity tags
189   (<xref target="header.etag"/>).  Additional metadata that reflects resource state
190   has been defined by various extensions of HTTP, such as WebDAV
191   <xref target="RFC4918"/>, that are beyond the scope of this specification.
192   A resource metadata value is referred to as a "<x:dfn>validator</x:dfn>"
193   when it is used within a precondition.
196<section title="Weak versus Strong" anchor="weak.and.strong.validators">
197   <iref primary="true" item="validator" subitem="weak"/>
198   <iref primary="true" item="validator" subitem="strong"/>
200   Validators come in two flavors: strong or weak.  Weak validators are easy
201   to generate but are far less useful for comparisons.  Strong validators
202   are ideal for comparisons but can be very difficult (and occasionally
203   impossible) to generate efficiently.  Rather than impose that all forms
204   of resource adhere to the same strength of validator, HTTP exposes the
205   type of validator in use and imposes restrictions on when weak validators
206   can be used as preconditions.
209   A "strong validator" is representation metadata that changes value whenever
210   a change occurs to the representation data that would be observable in the
211   payload body of a <x:ref>200 (OK)</x:ref> response to GET.
214   A strong validator might change for other reasons, such as when a
215   semantically significant part of the representation metadata is changed
216   (e.g., <x:ref>Content-Type</x:ref>), but it is in the best interests of the
217   origin server to only change the value when it is necessary to invalidate
218   the stored responses held by remote caches and authoring tools. A strong
219   validator is unique across all representations of a given resource, such
220   that no two representations of that resource can share the same validator
221   unless their representation data is identical.
224   Cache entries might persist for arbitrarily long periods, regardless
225   of expiration times.  Thus, a cache might attempt to validate an
226   entry using a validator that it obtained in the distant past.
227   A strong validator is unique across all versions of all
228   representations associated with a particular resource over time.
229   However, there is no implication of uniqueness across representations
230   of different resources (i.e., the same strong validator might be
231   in use for representations of multiple resources at the same time
232   and does not imply that those representations are equivalent).
235   There are a variety of strong validators used in practice.  The best are
236   based on strict revision control, wherein each change to a representation
237   always results in a unique node name and revision identifier being assigned
238   before the representation is made accessible to GET.  A collision-resistant hash
239   function applied to the representation data is also sufficient if the data
240   is available prior to the response header fields being sent and the digest
241   does not need to be recalculated every time a validation request is
242   received.  However, if a resource has distinct representations that differ
243   only in their metadata, such as might occur with content negotiation over
244   media types that happen to share the same data format, then the origin
245   server &SHOULD; incorporate additional information in the validator to
246   distinguish those representations.
249   In contrast, a "weak validator" is representation metadata that
250   might not change for every change to the representation data.  This
251   weakness might be due to limitations in how the value is calculated, such
252   as clock resolution or an inability to ensure uniqueness for all possible
253   representations of the resource, or due to a desire by the resource owner
254   to group representations by some self-determined set of equivalency
255   rather than unique sequences of data.  An origin server &SHOULD; change a
256   weak entity-tag whenever it considers prior representations to be
257   unacceptable as a substitute for the current representation. In other words,
258   a weak entity-tag ought to change whenever the origin server wants caches to
259   invalidate old responses.
262   For example, the representation of a weather report that changes in
263   content every second, based on dynamic measurements, might be grouped
264   into sets of equivalent representations (from the origin server's
265   perspective) with the same weak validator in order to allow cached
266   representations to be valid for a reasonable period of time (perhaps
267   adjusted dynamically based on server load or weather quality).
268   Likewise, a representation's modification time, if defined with only
269   one-second resolution, might be a weak validator if it is possible
270   for the representation to be modified twice during a single second and
271   retrieved between those modifications.
274   Likewise, a validator is weak if it is shared by two or more
275   representations of a given resource at the same time, unless those
276   representations have identical representation data. For example, if the
277   origin server sends the same validator for a representation with a gzip
278   content coding applied as it does for a representation with no content
279   coding, then that validator is weak. However, two simultaneous
280   representations might share the same strong validator if they differ only
281   in the representation metadata, such as when two different media types are
282   available for the same representation data.
285   A "use" of a validator occurs when either a client generates a request
286   and includes the validator in a precondition or when a server
287   compares two validators.
288   Weak validators are only usable in contexts that do not depend on exact
289   equality of the representation data.
290   Strong validators are usable and preferred for all conditional requests,
291   including cache validation, partial content ranges, and "lost update"
292   avoidance.
296<section title="Last-Modified" anchor="header.last-modified">
297  <iref primary="true" item="Last-Modified header field" x:for-anchor=""/>
298  <x:anchor-alias value="Last-Modified"/>
300   The "Last-Modified" header field in a response provides a timestamp
301   indicating the date and time at which the origin server believes the
302   selected representation was last modified, as determined at the conclusion
303   of handling the request.
305<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
306  <x:ref>Last-Modified</x:ref> = <x:ref>HTTP-date</x:ref>
309   An example of its use is
311<figure><artwork type="example">
312  Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
315<section title="Generation" anchor="lastmod.generation">
317   Origin servers &SHOULD; send Last-Modified for any selected
318   representation for which a last modification date can be reasonably
319   and consistently determined, since its use in conditional requests
320   and evaluating cache freshness (&caching;) results in a substantial
321   reduction of HTTP traffic on the Internet and can be a significant
322   factor in improving service scalability and reliability.
325   A representation is typically the sum of many parts behind the
326   resource interface.  The last-modified time would usually be
327   the most recent time that any of those parts were changed.
328   How that value is determined for any given resource is an
329   implementation detail beyond the scope of this specification.
330   What matters to HTTP is how recipients of the Last-Modified
331   header field can use its value to make conditional requests
332   and test the validity of locally cached responses.
335   An origin server &SHOULD; obtain the Last-Modified value of the
336   representation as close as possible to the time that it generates the
337   <x:ref>Date</x:ref> field value for its response. This allows a recipient to
338   make an accurate assessment of the representation's modification time,
339   especially if the representation changes near the time that the
340   response is generated.
343   An origin server with a clock &MUST-NOT; send a Last-Modified date
344   that is later than the server's time of message origination (<x:ref>Date</x:ref>).
345   If the last modification time is derived from implementation-specific
346   metadata that evaluates to some time in the future, according to the
347   origin server's clock, then the origin server &MUST; replace that
348   value with the message origination date. This prevents a future
349   modification date from having an adverse impact on cache validation.
352   An origin server without a clock &MUST-NOT; assign Last-Modified
353   values to a response unless these values were associated
354   with the resource by some other system or user with a reliable clock.
358<section title="Comparison" anchor="lastmod.comparison">
360   A Last-Modified time, when used as a validator in a request, is
361   implicitly weak unless it is possible to deduce that it is strong,
362   using the following rules:
363  <list style="symbols">
364     <t>The validator is being compared by an origin server to the
365        actual current validator for the representation and,</t>
366     <t>That origin server reliably knows that the associated representation did
367        not change twice during the second covered by the presented
368        validator.</t>
369  </list>
372   or
373  <list style="symbols">
374     <t>The validator is about to be used by a client in an <x:ref>If-Modified-Since</x:ref>,
375        <x:ref>If-Unmodified-Since</x:ref> header field, because the client has
376        a cache entry, or <x:ref>If-Range</x:ref> for the associated
377        representation, and</t>
378     <t>That cache entry includes a <x:ref>Date</x:ref> value, which gives the
379        time when the origin server sent the original response, and</t>
380     <t>The presented Last-Modified time is at least 60 seconds before
381        the Date value.</t>
382  </list>
385   or
386  <list style="symbols">
387     <t>The validator is being compared by an intermediate cache to the
388        validator stored in its cache entry for the representation, and</t>
389     <t>That cache entry includes a <x:ref>Date</x:ref> value, which gives the
390        time when the origin server sent the original response, and</t>
391     <t>The presented Last-Modified time is at least 60 seconds before
392        the Date value.</t>
393  </list>
396   This method relies on the fact that if two different responses were
397   sent by the origin server during the same second, but both had the
398   same Last-Modified time, then at least one of those responses would
399   have a <x:ref>Date</x:ref> value equal to its Last-Modified time. The
400   arbitrary 60-second limit guards against the possibility that the Date and
401   Last-Modified values are generated from different clocks, or at somewhat
402   different times during the preparation of the response. An
403   implementation &MAY; use a value larger than 60 seconds, if it is
404   believed that 60 seconds is too short.
409<section title="ETag" anchor="header.etag">
410  <iref primary="true" item="ETag header field" x:for-anchor=""/>
411  <x:anchor-alias value="ETag"/>
412  <x:anchor-alias value="entity-tag"/>
413  <x:anchor-alias value="opaque-tag"/>
414  <x:anchor-alias value="weak"/>
415  <x:anchor-alias value="etagc"/>
417   The "ETag" header field in a response provides the current entity-tag for
418   the selected representation, as determined at the conclusion of handling
419   the request.
420   An entity-tag is an opaque validator for differentiating between
421   multiple representations of the same resource, regardless of whether
422   those multiple representations are due to resource state changes over
423   time, content negotiation resulting in multiple representations being
424   valid at the same time, or both. An entity-tag consists of an opaque
425   quoted string, possibly prefixed by a weakness indicator.
427<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"/>
428  <x:ref>ETag</x:ref>       = <x:ref>entity-tag</x:ref>
430  <x:ref>entity-tag</x:ref> = [ <x:ref>weak</x:ref> ] <x:ref>opaque-tag</x:ref>
431  <x:ref>weak</x:ref>       = <x:abnf-char-sequence>"W/"</x:abnf-char-sequence> ; "W/", case-sensitive
432  <x:ref>opaque-tag</x:ref> = <x:ref>DQUOTE</x:ref> *<x:ref>etagc</x:ref> <x:ref>DQUOTE</x:ref>
433  <x:ref>etagc</x:ref>      = %x21 / %x23-7E / <x:ref>obs-text</x:ref>
434             ; <x:ref>VCHAR</x:ref> except double quotes, plus obs-text
437  <t>
438    &Note; Previously, opaque-tag was defined to be a quoted-string
439    (<xref target="RFC2616" x:fmt="," x:sec="3.11"/>), thus some recipients
440    might perform backslash unescaping. Servers therefore ought to avoid
441    backslash characters in entity tags.
442  </t>
445   An entity-tag can be more reliable for validation than a modification
446   date in situations where it is inconvenient to store modification
447   dates, where the one-second resolution of HTTP date values is not
448   sufficient, or where modification dates are not consistently maintained.
451  Examples:
453<artwork type="example">
454  ETag: "xyzzy"
455  ETag: W/"xyzzy"
456  ETag: ""
459   An entity-tag can be either a weak or strong validator, with
460   strong being the default.  If an origin server provides an entity-tag
461   for a representation and the generation of that entity-tag does not satisfy
462   all of the characteristics of a strong validator
463   (<xref target="weak.and.strong.validators"/>), then the origin server
464   &MUST; mark the entity-tag as weak by prefixing its opaque value
465   with "W/" (case-sensitive).
468<section title="Generation" anchor="entity.tag.generation">
470   The principle behind entity-tags is that only the service author
471   knows the implementation of a resource well enough to select the
472   most accurate and efficient validation mechanism for that resource,
473   and that any such mechanism can be mapped to a simple sequence of
474   octets for easy comparison.  Since the value is opaque, there is no
475   need for the client to be aware of how each entity-tag is constructed.
478   For example, a resource that has implementation-specific versioning
479   applied to all changes might use an internal revision number, perhaps
480   combined with a variance identifier for content negotiation, to
481   accurately differentiate between representations.
482   Other implementations might use a collision-resistant hash of
483   representation content,
484   a combination of various filesystem attributes, or a modification
485   timestamp that has sub-second resolution.
488   Origin servers &SHOULD; send ETag for any selected representation
489   for which detection of changes can be reasonably and consistently
490   determined, since the entity-tag's use in conditional requests and
491   evaluating cache freshness (&caching;) can result in a substantial
492   reduction of HTTP network traffic and can be a significant factor in
493   improving service scalability and reliability.
497<section title="Comparison" anchor="entity.tag.comparison">
498  <x:anchor-alias value="validator.comparison"/>
499  <x:anchor-alias value="strong comparison"/>
500  <x:anchor-alias value="weak comparison"/>
502   There are two entity-tag comparison functions, depending
503   on whether the comparison context allows the use of weak validators
504   or not:
505  <list style="symbols">
506     <t><x:dfn>Strong comparison</x:dfn>: two entity-tags are equivalent if both
507        are not weak and their opaque-tags match character-by-character.</t>
508     <t><x:dfn>Weak comparison</x:dfn>: two entity-tags are equivalent if their opaque-tags
509        match character-by-character, regardless of either or both
510        being tagged as "weak".</t>
511  </list>
514   The example below shows the results for a set of entity-tag pairs,
515   and both the weak and strong comparison function results:
517<texttable align="left">
518  <ttcol>ETag 1</ttcol>
519  <ttcol>ETag 2</ttcol>
520  <ttcol>Strong Comparison</ttcol>
521  <ttcol>Weak Comparison</ttcol>
523  <c>W/"1"</c>
524  <c>W/"1"</c>
525  <c>no match</c>
526  <c>match</c>
528  <c>W/"1"</c>
529  <c>W/"2"</c>
530  <c>no match</c>
531  <c>no match</c>
533  <c>W/"1"</c>
534  <c>"1"</c>
535  <c>no match</c>
536  <c>match</c>
538  <c>"1"</c>
539  <c>"1"</c>
540  <c>match</c>
541  <c>match</c>
545<section title="Example: Entity-tags Varying on Content-Negotiated Resources" anchor="example.entity.tag.vs.conneg">
547   Consider a resource that is subject to content negotiation
548   (&content-negotiation;), and where the representations sent in response to
549   a GET request vary based on the <x:ref>Accept-Encoding</x:ref> request
550   header field (&header-accept-encoding;):
552<figure><preamble>>> Request:</preamble><artwork type="message/http; msgtype=&#34;request&#34;"  x:indent-with="  ">
553GET /index HTTP/1.1
555Accept-Encoding: gzip
559   In this case, the response might or might not use the gzip content coding.
560   If it does not, the response might look like:
562<figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype=&#34;response&#34;"  x:indent-with="  ">
563HTTP/1.1 200 OK
564Date: Fri, 26 Mar 2010 00:05:00 GMT
565ETag: "123-a"
566Content-Length: <x:length-of target="exbody"/>
567Vary: Accept-Encoding
568Content-Type: text/plain
570<x:span anchor="exbody">Hello World!
571Hello World!
572Hello World!
573Hello World!
574Hello World!
577   An alternative representation that does use gzip content coding would be:
579<figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype=&#34;response&#34;"  x:indent-with="  ">
580HTTP/1.1 200 OK
581Date: Fri, 26 Mar 2010 00:05:00 GMT
582ETag: "123-b"
583Content-Length: 43
584Vary: Accept-Encoding
585Content-Type: text/plain
586Content-Encoding: gzip
588<spanx>...binary data...</spanx></artwork></figure>
590  <t>
591    &Note; Content codings are a property of the representation,
592    so therefore an entity-tag of an encoded representation has to be distinct
593    from an unencoded representation to prevent conflicts during cache updates
594    and range requests.  In contrast, transfer codings (&transfer-codings;)
595    apply only during message transfer and do not require distinct entity-tags.
596  </t>
601<section title="When to Use Entity-tags and Last-Modified Dates" anchor="">
603   We adopt a set of rules and recommendations for origin servers,
604   clients, and caches regarding when various validator types ought to
605   be used, and for what purposes.
608   In <x:ref>200 (OK)</x:ref> responses to GET or HEAD, an origin server:
609  <list style="symbols">
610     <t>&SHOULD; send an entity-tag validator unless it is not feasible to
611        generate one.</t>
613     <t>&MAY; send a weak entity-tag instead of a strong entity-tag, if
614        performance considerations support the use of weak entity-tags,
615        or if it is unfeasible to send a strong entity-tag.</t>
617     <t>&SHOULD; send a <x:ref>Last-Modified</x:ref> value if it is feasible to
618        send one.</t>
619  </list>
622   In other words, the preferred behavior for an origin server
623   is to send both a strong entity-tag and a <x:ref>Last-Modified</x:ref>
624   value in successful responses to a retrieval request.
627   A client:
628  <list style="symbols">
629     <t>&MUST; use that entity-tag in any cache-conditional request (using
630        <x:ref>If-Match</x:ref> or <x:ref>If-None-Match</x:ref>) if an
631        entity-tag has been provided by the origin server.</t>
633     <t>&SHOULD; use the <x:ref>Last-Modified</x:ref> value in non-subrange
634        cache-conditional requests (using <x:ref>If-Modified-Since</x:ref>)
635        if only a Last-Modified value has been provided by the origin server.</t>
637     <t>&MAY; use the <x:ref>Last-Modified</x:ref> value in subrange
638        cache-conditional requests (using <x:ref>If-Unmodified-Since</x:ref>)
639        if only a Last-Modified value has been provided by an HTTP/1.0 origin
640        server. The user agent &SHOULD; provide a way to disable this, in case
641        of difficulty.</t>
643     <t>&SHOULD; use both validators in cache-conditional requests if both an
644        entity-tag and a <x:ref>Last-Modified</x:ref> value have been provided
645        by the origin server. This allows both HTTP/1.0 and HTTP/1.1 caches to
646        respond appropriately.</t>
647  </list>
652<section title="Precondition Header Fields" anchor="preconditions">
654   This section defines the syntax and semantics of HTTP/1.1 header fields
655   for applying preconditions on requests.
656   <xref target="evaluation"/> defines when the preconditions are applied.
657   <xref target="precedence"/> defines the order of evaluation when more than
658   one precondition is present.
661<section title="If-Match" anchor="header.if-match">
662  <iref primary="true" item="If-Match header field" x:for-anchor=""/>
663  <x:anchor-alias value="If-Match"/>
665   The "If-Match" header field makes the request method conditional on the
666   recipient cache or origin server either having at least one current
667   representation of the target resource, when the field-value is "*", or
668   having a current representation of the target resource that has an
669   entity-tag matching a member of the list of entity-tags provided in the
670   field-value.
671   A recipient &MUST; use the strong comparison function when comparing
672   entity-tags for If-Match (<xref target="entity.tag.comparison"/>).
674<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
675  <x:ref>If-Match</x:ref> = "*" / 1#<x:ref>entity-tag</x:ref>
678   Examples:
680<figure><artwork type="example">
681  If-Match: "xyzzy"
682  If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
683  If-Match: *
686   If-Match is most often used with state-changing methods (e.g., POST, PUT,
687   DELETE) to prevent accidental overwrites when multiple user agents might be
688   acting in parallel on the same resource (i.e., to prevent the "lost update"
689   problem). It can also be used with safe methods to abort a request if the
690   <x:ref>selected representation</x:ref> does not match one already stored
691   (or partially stored) from a prior request.
694   An origin server that receives an If-Match header field &MUST; evaluate the
695   condition prior to performing the method (<xref target="evaluation"/>).
696   If the field-value is "*", the condition is false if the origin server
697   does not have a current representation for the target resource.
698   If the field-value is a list of entity-tags, the condition is false if
699   none of the listed tags match the entity-tag of the selected representation.
702   An origin server &MUST-NOT; perform the requested method if a received
703   If-Match condition evaluates to false; instead the origin server &MUST;
704   respond with either:
705   a) the <x:ref>412 (Precondition Failed)</x:ref> status code; or,
706   b) one of the <x:ref>2xx (Successful)</x:ref> status codes if the origin
707   server has verified that a state change is being requested and the final
708   state is already reflected in the current state of the target resource
709   (i.e., the change requested by the user agent has already succeeded, but
710   the user agent might not be aware of it, perhaps because the prior response
711   was lost or a compatible change was made by some other user agent).
712   In the latter case, the origin server &MUST-NOT; send a validator header
713   field in the response unless it can verify that the request is a duplicate
714   of an immediately prior change made by the same user agent.
717   If the request semantics can be satisfied with a cached response, a
718   recipient cache &MUST; evaluate the condition as part of its selection
719   process for determining a suitable response for that primary cache key
720   (see &cache-key;).
721   The cache &MUST; generate a <x:ref>412 (Precondition Failed)</x:ref>
722   response if the field-value is "*" and no suitable response is stored, or
723   if the field-value is a list of entity-tags and none of them match the
724   entity-tag of a suitable stored response.
725   Otherwise, the cache &MUST; generate a successful <x:ref>2xx</x:ref>
726   response that reuses the most recent of its matching stored responses to
727   satisfy the request.
731<section title="If-None-Match" anchor="header.if-none-match">
732  <iref primary="true" item="If-None-Match header field" x:for-anchor=""/>
733  <x:anchor-alias value="If-None-Match"/>
735   The "If-None-Match" header field makes the request method conditional on
736   the recipient cache or origin server either not having a current
737   representation for the target resource, when the field-value is "*", or
738   not having a current representation that has an entity-tag matching a
739   member of the list of entity-tags provided in the field-value.
740   A recipient &MUST; use the weak comparison function when comparing
741   entity-tags for If-None-Match (<xref target="entity.tag.comparison"/>).
743<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
744  <x:ref>If-None-Match</x:ref> = "*" / 1#<x:ref>entity-tag</x:ref>
747   Examples:
749<figure><artwork type="example">
750  If-None-Match: "xyzzy"
751  If-None-Match: W/"xyzzy"
752  If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
753  If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
754  If-None-Match: *
757   If-None-Match is primarily used in conditional GET requests to enable
758   efficient updates of cached information with a minimum amount of
759   transaction overhead. When a client desires to update one or more stored
760   responses that have entity-tags, the client &SHOULD; generate an
761   If-None-Match header field containing a list of those entity-tags when
762   making a GET request; this allows recipient servers to send a
763   <x:ref>304 (Not Modified)</x:ref> response to indicate when one of those
764   stored responses matches the selected representation.
767   If-None-Match can also be used with a value of "*" to prevent an unsafe
768   request method (e.g., PUT) from inadvertently modifying an existing
769   representation of the target resource when the client believes that
770   the resource does not have a current representation (&safe-methods;).
771   This is a variation on the "lost update" problem that might arise if more
772   than one client attempts to create an initial representation for the target
773   resource.
776   An origin server that receives an If-None-Match header field &MUST;
777   evaluate the condition prior to performing the method
778   (<xref target="evaluation"/>).
779   If the field-value is "*", the condition is false if the origin server
780   has a current representation for the target resource.
781   If the field-value is a list of entity-tags, the condition is false if
782   one of the listed tags match the entity-tag of the selected representation.
785   An origin server &MUST-NOT; perform the requested method if the condition
786   evaluates to false; instead, the origin server &MUST; respond with either
787   a) the <x:ref>304 (Not Modified)</x:ref> status code if the request method
788   is GET or HEAD; or,
789   b) the <x:ref>412 (Precondition Failed)</x:ref> status code for all other
790   request methods.
793   If the request semantics can be satisfied with a cached response, a
794   recipient cache &SHOULD; evaluate the condition as part of its selection
795   process for determining a suitable response for that primary cache key
796   (see &cache-key;). If the field-value is "*" and a suitable response is
797   stored, or the field-value is a list of entity-tags and at least one of
798   them match the entity-tag of a suitable stored response, the cache &SHOULD;
799   generate a <x:ref>304 (Not Modified)</x:ref> response using the most
800   suitable of those matching responses as the selected representation.
801   Otherwise, if the cache has one or more suitable stored responses that
802   do not match the condition, the cache &SHOULD; generate a successful
803   <x:ref>2xx</x:ref> response that reuses the most suitable of those stored
804   responses to satisfy the request. Finally, if the cache has no suitable
805   stored responses, the cache &SHOULD; forward the conditional request toward
806   the origin server; if the received condition contains a list of entity-tags
807   and the cache has its own set of stored responses for that primary cache
808   key, the cache &SHOULD; take the union of the received set with the set of
809   entity-tags for its own stored set of responses (fresh or stale) and
810   generate an <x:ref>If-None-Match</x:ref> header field containing that union
811   when it forwards the request toward the origin server.
815<section title="If-Modified-Since" anchor="header.if-modified-since">
816  <iref primary="true" item="If-Modified-Since header field" x:for-anchor=""/>
817  <x:anchor-alias value="If-Modified-Since"/>
819   The "If-Modified-Since" header field can be used with GET or HEAD to make
820   the method conditional by modification date: if the selected representation
821   has not been modified since the time specified in this field, then respond
822   with a <x:ref>304 (Not Modified)</x:ref> status code and only send
823   metadata that might be useful for identifying or updating a cached
824   representation. Hence, transfer of the selected representation's data is
825   avoided if that data has not changed.
827<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
828  <x:ref>If-Modified-Since</x:ref> = <x:ref>HTTP-date</x:ref>
831   An example of the field is:
833<figure><artwork type="example">
834  If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
837   A recipient &MUST; ignore If-Modified-Since if the request contains an
838   <x:ref>If-None-Match</x:ref> header field; the condition in
839   <x:ref>If-None-Match</x:ref> is considered to be a more accurate
840   replacement for the condition in If-Modified-Since and the two are only
841   combined for the sake of interoperating with older intermediaries that
842   might not implement <x:ref>If-None-Match</x:ref>.
845   A recipient &MUST; ignore the If-Modified-Since header field if the
846   received field-value is not a valid HTTP-date, or if the request method
847   is neither GET nor HEAD.
850   A recipient &MUST; interpret an If-Modified-Since field-value's timestamp
851   in terms of the origin server's clock.  A recipient cache that evaluates
852   this precondition &SHOULD; make its comparisons with
853   respect to a stored <x:ref>Last-Modified</x:ref> or <x:ref>Date</x:ref>
854   header field, when available in a prior response from that origin server,
855   rather than comparing it to a timestamp generated by its own clock.
858   If-Modified-Since is typically used for two distinct purposes:
859   1) to allow efficient updates of a cached representation that does not
860   have an entity-tag; and,
861   2) to limit the scope of a web traversal to resources that have recently
862   changed.
865   When used for cache updates, a cache will typically use the value of the
866   cached message's <x:ref>Last-Modified</x:ref> field to generate the field
867   value of If-Modified-Since. This behavior is most interoperable for cases
868   where clocks are poorly synchronized or when the server has chosen to only
869   honor exact timestamp matches (due to a problem with Last-Modified dates
870   that appear to go "back in time" when the origin server's clock is
871   corrected or a representation is restored from an archived backup).
872   However, caches occasionally generate the field value based on other data,
873   such as the <x:ref>Date</x:ref> header field of the cached message or the
874   local clock time that the message was received, particularly when the
875   cached message does not contain a <x:ref>Last-Modified</x:ref> field.
878   When used for limiting the scope of retrieval to a recent time window, a
879   user agent will generate an If-Modified-Since field value based on either
880   its own local clock or a <x:ref>Date</x:ref> header field received from the
881   server during a past run. Origin servers that choose an exact timestamp
882   match based on the selected representation's <x:ref>Last-Modified</x:ref>
883   field will not be able to help the user agent limit its data transfers to
884   only those changed during the specified window.
887   If the request semantics can be satisfied with a cached response, a
888   recipient cache &SHOULD; evaluate the condition as part of its selection
889   process for determining a suitable response for that primary cache key
890   (see &cache-key;).
891   The cache &SHOULD; forward the conditional request toward the origin server
892   if it does not have any suitable stored responses.
893   The cache &SHOULD; generate a successful
894   <x:ref>2xx</x:ref> response, reusing the most recent of its stored
895   responses to satisfy the request, if one of the following is true:
896   1) a stored response has a <x:ref>Last-Modified</x:ref> field-value that
897   is more recent than the conditional timestamp;
898   2) no <x:ref>Last-Modified</x:ref> field is present, but a stored
899   response has a <x:ref>Date</x:ref> field-value that is more recent than the
900   conditional timestamp; or,
901   3) neither <x:ref>Last-Modified</x:ref> nor <x:ref>Date</x:ref> is present,
902   but the cache recorded a stored response as having been received at a
903   time more recent than the conditional timestamp.
904   Otherwise, the cache &SHOULD; generate a <x:ref>304 (Not Modified)</x:ref>
905   response using the most recent of the stored responses as the selected
906   representation.
910<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
911  <iref primary="true" item="If-Unmodified-Since header field" x:for-anchor=""/>
912  <x:anchor-alias value="If-Unmodified-Since"/>
914   The "If-Unmodified-Since" header field makes the request method conditional
915   on the selected representation's last modification date being earlier or
916   equal to the date provided in the field-value. This field accomplishes the
917   same purpose as <x:ref>If-Match</x:ref> for cases where the user agent does
918   not have an entity-tag for the representation.
920<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
921  <x:ref>If-Unmodified-Since</x:ref> = <x:ref>HTTP-date</x:ref>
924   An example of the field is:
926<figure><artwork type="example">
927  If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
930   A recipient &MUST; ignore If-Unmodified-Since if the request contains an
931   <x:ref>If-Match</x:ref> header field; the condition in
932   <x:ref>If-Match</x:ref> is considered to be a more accurate replacement for
933   the condition in If-Unmodified-Since and the two are only combined for the
934   sake of interoperating with older intermediaries that might not implement
935   <x:ref>If-Match</x:ref>.
938   A recipient &MUST; ignore the If-Unmodified-Since header field if the
939   received field-value is not a valid HTTP-date.
942   A recipient &MUST; interpret an If-Unmodified-Since field-value's timestamp
943   in terms of the origin server's clock.
946   If-Unmodified-Since is most often used with state-changing methods
947   (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple
948   user agents might be acting in parallel on a resource that resource does
949   not supply entity-tags with its representations (i.e., to prevent the
950   "lost update" problem). It can also be used with safe methods to abort a
951   request if the <x:ref>selected representation</x:ref> does not match one
952   already stored (or partially stored) from a prior request.
955   An origin server that receives an If-Unmodified-Since header field &MUST;
956   evaluate the condition prior to performing the method
957   (<xref target="evaluation"/>). The condition is false if the selected
958   representation has been modified since the time specified in this field.
961   An origin server &MUST-NOT; perform the requested method if a received
962   If-Unmodified-Since condition evaluates to false; instead the
963   origin server &MUST; respond with either:
964   a) the <x:ref>412 (Precondition Failed)</x:ref> status code; or,
965   b) one of the <x:ref>2xx (Successful)</x:ref> status codes if the origin
966   server has verified that a state change is being requested and the final
967   state is already reflected in the current state of the target resource
968   (i.e., the change requested by the user agent has already succeeded, but
969   the user agent might not be aware of that because the prior response message
970   was lost or a compatible change was made by some other user agent).
971   In the latter case, the origin server &MUST-NOT; send a validator header
972   field in the response unless it can verify that the request is a duplicate
973   of an immediately prior change made by the same user agent.
976   If the request semantics can be satisfied with a cached response, a
977   recipient cache &MUST; evaluate the condition as part of its selection
978   process for determining a suitable response for that primary cache key
979   (see &cache-key;).
980   The cache &MUST; forward the conditional request toward the origin server
981   if it does not have any suitable stored responses.
982   The cache &MUST; generate a successful <x:ref>2xx</x:ref> response that
983   reuses the most recent of its suitable stored responses to satisfy the
984   request if that stored response has a <x:ref>Last-Modified</x:ref> date
985   that is equal to or earlier than the date given in If-Unmodified-Since.
986   Otherwise, the cache &MUST; respond with a
987   <x:ref>412 (Precondition Failed)</x:ref> status code.
991<section title="If-Range" anchor="header.if-range">
993   The "If-Range" header field provides a special conditional request
994   mechanism that is similar the <x:ref>If-Match</x:ref> and
995   <x:ref>If-Unmodified-Since</x:ref> fields but instructs the recipient to
996   ignore the <x:ref>Range</x:ref> header field if the validator doesn't
997   match, resulting in transfer of the new selected representation instead of
998   a 412 response. If-Range is defined in &header-if-range;.
1004<section title="Status Code Definitions" anchor="status.code.definitions">
1005<section title="304 Not Modified" anchor="status.304">
1006  <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/>
1007  <x:anchor-alias value="304"/>
1008  <x:anchor-alias value="304 (Not Modified)"/>
1010   The <x:dfn>304 (Not Modified)</x:dfn> status code indicates that a
1011   conditional GET or HEAD request has been
1012   received and would have resulted in a <x:ref>200 (OK)</x:ref> response
1013   if it were not for the fact that the condition has evaluated to false.
1014   In other words, there is no need for the server to transfer a
1015   representation of the target resource because the request indicates that
1016   the client, which made the request conditional, already has a valid
1017   representation; the server is therefore redirecting the client to make
1018   use of that stored representation as if it were the payload of a
1019   <x:ref>200 (OK)</x:ref> response.
1022   The server generating a 304 response &MUST; generate any of the following
1023   header fields that would have been sent in a <x:ref>200 (OK)</x:ref>
1024   response to the same request:
1025   <x:ref>Cache-Control</x:ref>,
1026   <x:ref>Content-Location</x:ref>,
1027   <x:ref>ETag</x:ref>,
1028   <x:ref>Expires</x:ref>, and
1029   <x:ref>Vary</x:ref>.
1032   Since the goal of a 304 response is to minimize information transfer
1033   when the recipient already has one or more cached representations,
1034   a sender &SHOULD-NOT; generate representation metadata other
1035   than the above listed fields unless said metadata exists for the
1036   purpose of guiding cache updates (e.g., <x:ref>Last-Modified</x:ref> might
1037   be useful if the response does not have an <x:ref>ETag</x:ref> field).
1040   Requirements on a cache that receives a 304 response are defined in
1041   &freshening-responses;. If the conditional request originated with an
1042   outbound client, such as a user agent with its own cache sending a
1043   conditional GET to a shared proxy, then the proxy &SHOULD; forward the
1044   304 response to that client.
1047   A 304 response cannot contain a message-body; it is always
1048   terminated by the first empty line after the header fields.
1052<section title="412 Precondition Failed" anchor="status.412">
1053  <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/>
1054  <x:anchor-alias value="412 (Precondition Failed)"/>
1056   The <x:dfn>412 (Precondition Failed)</x:dfn> status code indicates that one
1057   or more conditions given in the request header fields evaluated to false
1058   when tested on the server. This response code allows the client to place
1059   preconditions on the current resource state (its current representations
1060   and metadata) and thus prevent the request method from being applied if the
1061   target resource is in an unexpected state.
1066<section title="Evaluation" anchor="evaluation">
1068   Except when excluded below, a server &MUST; evaluate received request
1069   preconditions after it has successfully performed its normal request checks
1070   and just before it would perform the action associated with the request
1071   method.
1072   A server &MUST; ignore all received preconditions if its response to the
1073   same request without those conditions would have been a status code other
1074   than a <x:ref>2xx</x:ref> or <x:ref>412 (Precondition Failed)</x:ref>.
1075   In other words, redirects and failures take precedence over the evaluation
1076   of preconditions in conditional requests.
1079   A server that is not the origin server for the target resource and cannot
1080   act as a cache for requests on the target resource &MUST-NOT; evaluate the
1081   conditional request header fields defined by this specification, and
1082   &MUST; forward them if the request is forwarded, since the generating
1083   client intends that they be evaluated by a server that can provide a
1084   current representation.
1085   Likewise, a server &MUST; ignore the conditional request header fields
1086   defined by this specification when received with a request method that does
1087   not involve the selection or modification of a
1088   <x:ref>selected representation</x:ref>, such as CONNECT, OPTIONS, or TRACE.
1091   Conditional request header fields that are defined by extensions to HTTP
1092   might place conditions on all recipients, on the state of the target
1093   resource in general, or on a group of resources. For instance, the "If"
1094   header field in WebDAV can make a request conditional on various aspects
1095   of multiple resources, such as locks, if the recipient understands and
1096   implements that field (<xref target="RFC4918" x:fmt="," x:sec="10.4"/>).
1099   Although conditional request header fields are defined as being usable with
1100   the HEAD method (to keep HEAD's semantics consistent with those of GET),
1101   there is no point in sending a conditional HEAD because a successful
1102   response is around the same size as a <x:ref>304 (Not Modified)</x:ref>
1103   response and more useful than a <x:ref>412 (Precondition Failed)</x:ref>
1104   response.
1108<section title="Precedence" anchor="precedence">
1110   When more than one conditional request header field is present in a request,
1111   the order in which the fields are evaluated becomes important. In practice,
1112   the fields defined in this document are consistently implemented in a
1113   single, logical order, since "lost update" preconditions have more strict
1114   requirements than cache validation, a validated cache is more efficient
1115   than a partial response, and entity tags are presumed to be more accurate
1116   than date validators.
1119   A recipient cache or origin server &MUST; evaluate the request
1120   preconditions defined by this specification in the following order:
1121   <list style="numbers">
1122     <t anchor="precedence1">When <x:ref>If-Match</x:ref> is present, evaluate it:
1123       <list style="symbols">
1124         <t>if true, continue to step <xref target="precedence3" format="counter"/></t>
1125         <t>if false, respond <x:ref>412 (Precondition Failed)</x:ref> unless
1126            it can be determined that the state-changing request has already
1127            succeeded (see <xref target="header.if-match"/>)</t>
1128       </list>
1129     </t>
1130     <t anchor="precedence2">When <x:ref>If-Match</x:ref> is not present and
1131        <x:ref>If-Unmodified-Since</x:ref> is present, evaluate it:
1132       <list style="symbols">
1133         <t>if true, continue to step <xref target="precedence3" format="counter"/></t>
1134         <t>if false, respond <x:ref>412 (Precondition Failed)</x:ref> unless
1135            it can be determined that the state-changing request has already
1136            succeeded (see <xref target="header.if-unmodified-since"/>)</t>
1137       </list>
1138     </t>
1139     <t anchor="precedence3">When <x:ref>If-None-Match</x:ref> is present, evaluate it:
1140       <list style="symbols">
1141         <t>if true, continue to step <xref target="precedence5" format="counter"/></t>
1142         <t>if false for GET/HEAD, respond <x:ref>304 (Not Modified)</x:ref></t>
1143         <t>if false for other methods, respond <x:ref>412 (Precondition Failed)</x:ref></t>
1144       </list>
1145     </t>
1146     <t anchor="precedence4">When the method is GET or HEAD,
1147        <x:ref>If-None-Match</x:ref> is not present, and
1148        <x:ref>If-Modified-Since</x:ref> is present, evaluate it:
1149       <list style="symbols">
1150         <t>if true, continue to step <xref target="precedence5" format="counter"/></t>
1151         <t>if false, respond <x:ref>304 (Not Modified)</x:ref></t>
1152       </list>
1153     </t>
1154     <t anchor="precedence5">When the method is GET and both <x:ref>Range</x:ref> and
1155        <x:ref>If-Range</x:ref> are present, evaluate If-Range:
1156       <list style="symbols">
1157         <t>if the validator matches and the Range specification is
1158            applicable to the selected representation, respond
1159            <x:ref>206 (Partial Content)</x:ref> <xref target="Part5"/></t>
1160       </list>
1161     </t>
1162     <t anchor="precedencelast">Otherwise,
1163       <list style="symbols">
1164         <t>all conditions are met, so perform the requested action and
1165            respond according to its success or failure.</t>
1166       </list>
1167     </t>
1168   </list>
1171   Any extension to HTTP/1.1 that defines additional conditional request
1172   header fields ought to define its own expectations regarding the order
1173   for evaluating such fields in relation to those defined in this document
1174   and other conditionals that might be found in practice.
1178<section title="IANA Considerations" anchor="IANA.considerations">
1180<section title="Status Code Registration" anchor="status.code.registration">
1182   The HTTP Status Code Registry located at <eref target=""/>
1183   shall be updated with the registrations below:
1185<?BEGININC p4-conditional.iana-status-codes ?>
1186<!--AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually-->
1187<texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table">
1188   <ttcol>Value</ttcol>
1189   <ttcol>Description</ttcol>
1190   <ttcol>Reference</ttcol>
1191   <c>304</c>
1192   <c>Not Modified</c>
1193   <c>
1194      <xref target="status.304"/>
1195   </c>
1196   <c>412</c>
1197   <c>Precondition Failed</c>
1198   <c>
1199      <xref target="status.412"/>
1200   </c>
1203<?ENDINC p4-conditional.iana-status-codes ?>
1206<section title="Header Field Registration" anchor="header.field.registration">
1208   HTTP header fields are registered within the Message Header Field Registry
1209   maintained at
1210   <eref target=""/>.
1213   This document defines the following HTTP header fields, so their
1214   associated registry entries shall be updated according to the permanent
1215   registrations below (see <xref target="BCP90"/>):
1217<?BEGININC p4-conditional.iana-headers ?>
1218<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
1219<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
1220   <ttcol>Header Field Name</ttcol>
1221   <ttcol>Protocol</ttcol>
1222   <ttcol>Status</ttcol>
1223   <ttcol>Reference</ttcol>
1225   <c>ETag</c>
1226   <c>http</c>
1227   <c>standard</c>
1228   <c>
1229      <xref target="header.etag"/>
1230   </c>
1231   <c>If-Match</c>
1232   <c>http</c>
1233   <c>standard</c>
1234   <c>
1235      <xref target="header.if-match"/>
1236   </c>
1237   <c>If-Modified-Since</c>
1238   <c>http</c>
1239   <c>standard</c>
1240   <c>
1241      <xref target="header.if-modified-since"/>
1242   </c>
1243   <c>If-None-Match</c>
1244   <c>http</c>
1245   <c>standard</c>
1246   <c>
1247      <xref target="header.if-none-match"/>
1248   </c>
1249   <c>If-Unmodified-Since</c>
1250   <c>http</c>
1251   <c>standard</c>
1252   <c>
1253      <xref target="header.if-unmodified-since"/>
1254   </c>
1255   <c>Last-Modified</c>
1256   <c>http</c>
1257   <c>standard</c>
1258   <c>
1259      <xref target="header.last-modified"/>
1260   </c>
1263<?ENDINC p4-conditional.iana-headers ?>
1265   The change controller is: "IETF ( - Internet Engineering Task Force".
1270<section title="Security Considerations" anchor="security.considerations">
1272   This section is meant to inform developers, information providers, and
1273   users of known security concerns specific to the HTTP/1.1 conditional
1274   request mechanisms. More general security considerations are addressed
1275   in HTTP messaging &messaging; and semantics &semantics;.
1278   The validators defined by this specification are not intended to ensure
1279   the validity of a representation, guard against malicious changes, or
1280   detect man-in-the-middle attacks. At best, they enable more efficient cache
1281   updates and optimistic concurrent writes when all participants are behaving
1282   nicely. At worst, the conditions will fail and the client will receive a
1283   response that is no more harmful than an HTTP exchange without conditional
1284   requests.
1287   An entity-tag can be abused in ways that create privacy risks. For example,
1288   a site might deliberately construct a semantically invalid entity-tag that
1289   is unique to the user or user agent, send it in a cacheable response with a
1290   long freshness time, and then read that entity-tag in later conditional
1291   requests as a means of re-identifying that user or user agent. Such an
1292   identifying tag would become a persistent identifier for as long as the
1293   user agent retained the original cache entry. User agents that cache
1294   representations ought to ensure that the cache is cleared or replaced
1295   whenever the user performs privacy-maintaining actions, such as clearing
1296   stored cookies or changing to a private browsing mode.
1300<section title="Acknowledgments" anchor="acks">
1302  See &acks;.
1308<references title="Normative References">
1310<reference anchor="Part1">
1311  <front>
1312    <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
1313    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1314      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1315      <address><email></email></address>
1316    </author>
1317    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1318      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1319      <address><email></email></address>
1320    </author>
1321    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1322  </front>
1323  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/>
1324  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
1327<reference anchor="Part2">
1328  <front>
1329    <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
1330    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1331      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1332      <address><email></email></address>
1333    </author>
1334    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1335      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1336      <address><email></email></address>
1337    </author>
1338    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1339  </front>
1340  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;"/>
1341  <x:source href="p2-semantics.xml" basename="p2-semantics">
1342    <x:defines>2xx</x:defines>
1343    <x:defines>2xx (Successful)</x:defines>
1344    <x:defines>200 (OK)</x:defines>
1345    <x:defines>204 (No Content)</x:defines>
1346    <x:defines>Accept-Encoding</x:defines>
1347    <x:defines>Content-Location</x:defines>
1348    <x:defines>Content-Type</x:defines>
1349    <x:defines>Date</x:defines>
1350    <x:defines>Location</x:defines>
1351    <x:defines>Vary</x:defines>
1352    <x:defines>selected representation</x:defines>
1353  </x:source>
1356<reference anchor="Part5">
1357  <front>
1358    <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
1359    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1360      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1361      <address><email></email></address>
1362    </author>
1363    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1364      <organization abbrev="W3C">World Wide Web Consortium</organization>
1365      <address><email></email></address>
1366    </author>
1367    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1368      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1369      <address><email></email></address>
1370    </author>
1371    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1372  </front>
1373  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/>
1374  <x:source href="p5-range.xml" basename="p5-range">
1375    <x:defines>If-Range</x:defines>
1376    <x:defines>Range</x:defines>
1377    <x:defines>206 (Partial Content)</x:defines>
1378  </x:source>
1381<reference anchor="Part6">
1382  <front>
1383    <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
1384    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1385      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1386      <address><email></email></address>
1387    </author>
1388    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
1389      <organization>Akamai</organization>
1390      <address><email></email></address>
1391    </author>
1392    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1393      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1394      <address><email></email></address>
1395    </author>
1396    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1397  </front>
1398  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
1399  <x:source href="p6-cache.xml" basename="p6-cache">
1400    <x:defines>Cache-Control</x:defines>
1401    <x:defines>Expires</x:defines>
1402  </x:source>
1405<reference anchor="RFC2119">
1406  <front>
1407    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1408    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1409      <organization>Harvard University</organization>
1410      <address><email></email></address>
1411    </author>
1412    <date month="March" year="1997"/>
1413  </front>
1414  <seriesInfo name="BCP" value="14"/>
1415  <seriesInfo name="RFC" value="2119"/>
1418<reference anchor="RFC5234">
1419  <front>
1420    <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
1421    <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
1422      <organization>Brandenburg InternetWorking</organization>
1423      <address>
1424        <email></email>
1425      </address> 
1426    </author>
1427    <author initials="P." surname="Overell" fullname="Paul Overell">
1428      <organization>THUS plc.</organization>
1429      <address>
1430        <email></email>
1431      </address>
1432    </author>
1433    <date month="January" year="2008"/>
1434  </front>
1435  <seriesInfo name="STD" value="68"/>
1436  <seriesInfo name="RFC" value="5234"/>
1441<references title="Informative References">
1443<reference anchor="RFC2616">
1444  <front>
1445    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1446    <author initials="R." surname="Fielding" fullname="R. Fielding">
1447      <organization>University of California, Irvine</organization>
1448      <address><email></email></address>
1449    </author>
1450    <author initials="J." surname="Gettys" fullname="J. Gettys">
1451      <organization>W3C</organization>
1452      <address><email></email></address>
1453    </author>
1454    <author initials="J." surname="Mogul" fullname="J. Mogul">
1455      <organization>Compaq Computer Corporation</organization>
1456      <address><email></email></address>
1457    </author>
1458    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1459      <organization>MIT Laboratory for Computer Science</organization>
1460      <address><email></email></address>
1461    </author>
1462    <author initials="L." surname="Masinter" fullname="L. Masinter">
1463      <organization>Xerox Corporation</organization>
1464      <address><email></email></address>
1465    </author>
1466    <author initials="P." surname="Leach" fullname="P. Leach">
1467      <organization>Microsoft Corporation</organization>
1468      <address><email></email></address>
1469    </author>
1470    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1471      <organization>W3C</organization>
1472      <address><email></email></address>
1473    </author>
1474    <date month="June" year="1999"/>
1475  </front>
1476  <seriesInfo name="RFC" value="2616"/>
1479<reference anchor='BCP90'>
1480  <front>
1481    <title>Registration Procedures for Message Header Fields</title>
1482    <author initials='G.' surname='Klyne' fullname='G. Klyne'>
1483      <organization>Nine by Nine</organization>
1484      <address><email></email></address>
1485    </author>
1486    <author initials='M.' surname='Nottingham' fullname='M. Nottingham'>
1487      <organization>BEA Systems</organization>
1488      <address><email></email></address>
1489    </author>
1490    <author initials='J.' surname='Mogul' fullname='J. Mogul'>
1491      <organization>HP Labs</organization>
1492      <address><email></email></address>
1493    </author>
1494    <date year='2004' month='September' />
1495  </front>
1496  <seriesInfo name='BCP' value='90' />
1497  <seriesInfo name='RFC' value='3864' />
1500<reference anchor='RFC4918'>
1501  <front>
1502    <title>HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</title>
1503    <author initials="L.M." surname="Dusseault" fullname="Lisa Dusseault" role="editor" >
1504      <organization abbrev="CommerceNet">CommerceNet</organization>
1505      <address><email></email></address>
1506    </author>
1507    <date month="June" year="2007" />
1508  </front>
1509  <seriesInfo name='RFC' value='4918' />
1513<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1515  The definition of validator weakness has been expanded and clarified.
1516  (<xref target="weak.and.strong.validators" />)
1519  Weak entity-tags are now allowed in all requests except range requests
1520  (Sections <xref target="weak.and.strong.validators" format="counter"/> and
1521  <xref target="header.if-none-match" format="counter"/>).
1524  The <x:ref>ETag</x:ref> header field ABNF has been changed to not use
1525  quoted-string, thus avoiding escaping issues.
1526  (<xref target="header.etag" />)
1529  ETag is defined to provide an entity tag for the selected representation,
1530  thereby clarifying what it applies to in various situations (such as a
1531  PUT response).
1532  (<xref target="header.etag" />)
1535  The precedence for evaluation of conditional requests has been defined.
1536  (<xref target="precedence" />)
1540<section title="Imported ABNF" anchor="imported.abnf">
1541  <x:anchor-alias value="ALPHA"/>
1542  <x:anchor-alias value="CR"/>
1543  <x:anchor-alias value="DIGIT"/>
1544  <x:anchor-alias value="DQUOTE"/>
1545  <x:anchor-alias value="LF"/>
1546  <x:anchor-alias value="OCTET"/>
1547  <x:anchor-alias value="VCHAR"/>
1548  <x:anchor-alias value="core.rules"/>
1549  <x:anchor-alias value="obs-text"/>
1550  <x:anchor-alias value="OWS"/>
1551  <x:anchor-alias value="HTTP-date"/>
1553  The following core rules are included by
1554  reference, as defined in <xref target="RFC5234" x:fmt="of" x:sec="B.1"/>:
1555  ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls),
1556  DIGIT (decimal 0-9), DQUOTE (double quote),
1557  HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed),
1558  OCTET (any 8-bit sequence of data), SP (space), and
1559  VCHAR (any visible US-ASCII character).
1562  The rules below are defined in <xref target="Part1"/>:
1564<figure><artwork type="abnf2616">
1565  <x:ref>OWS</x:ref>           = &lt;OWS, defined in &whitespace;&gt;
1566  <x:ref>obs-text</x:ref>      = &lt;obs-text, defined in &field-components;&gt;
1569  The rules below are defined in other parts:
1571<figure><artwork type="abnf2616">
1572  <x:ref>HTTP-date</x:ref>     = &lt;HTTP-date, defined in &http-date;&gt;
1576<?BEGININC p4-conditional.abnf-appendix ?>
1577<section xmlns:x="" title="Collected ABNF" anchor="collected.abnf">
1579  In the collected ABNF below, list rules are expanded as per <xref target="Part1" x:rel="#notation"/>.
1581<artwork type="abnf" name="p4-conditional.parsed-abnf">
1582<x:ref>ETag</x:ref> = entity-tag
1584<x:ref>HTTP-date</x:ref> = &lt;HTTP-date, defined in [Part2], Section;
1586<x:ref>If-Match</x:ref> = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
1587 entity-tag ] ) )
1588<x:ref>If-Modified-Since</x:ref> = HTTP-date
1589<x:ref>If-None-Match</x:ref> = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
1590 entity-tag ] ) )
1591<x:ref>If-Unmodified-Since</x:ref> = HTTP-date
1593<x:ref>Last-Modified</x:ref> = HTTP-date
1595<x:ref>OWS</x:ref> = &lt;OWS, defined in [Part1], Section 3.2.3&gt;
1597<x:ref>entity-tag</x:ref> = [ weak ] opaque-tag
1598<x:ref>etagc</x:ref> = "!" / %x23-7E ; '#'-'~'
1599 / obs-text
1601<x:ref>obs-text</x:ref> = &lt;obs-text, defined in [Part1], Section 3.2.6&gt;
1602<x:ref>opaque-tag</x:ref> = DQUOTE *etagc DQUOTE
1604<x:ref>weak</x:ref> = %x57.2F ; W/
1608<?ENDINC p4-conditional.abnf-appendix ?>
1610<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
1612  Changes up to the first Working Group Last Call draft are summarized
1613  in <eref target=""/>.
1616<section title="Since draft-ietf-httpbis-p4-conditional-19" anchor="changes.since.19">
1618  Closed issues:
1619  <list style="symbols">
1620    <t>
1621      <eref target=""/>:
1622      "Need to clarify eval order/interaction of conditional headers"
1623    </t>
1624    <t>
1625      <eref target=""/>:
1626      "Required headers on 304 and 206"
1627    </t>
1628    <t>
1629      <eref target=""/>:
1630      "Optionality of Conditional Request Support"
1631    </t>
1632    <t>
1633      <eref target=""/>:
1634      "ETags and Conditional Requests"
1635    </t>
1636    <t>
1637      <eref target=""/>:
1638      "ABNF requirements for recipients"
1639    </t>
1640    <t>
1641      <eref target=""/>:
1642      "Rare cases"
1643    </t>
1644    <t>
1645      <eref target=""/>:
1646      "Conditional Request Security Considerations"
1647    </t>
1648    <t>
1649      <eref target=""/>:
1650      "If-Modified-Since lacks definition for method != GET"
1651    </t>
1652    <t>
1653      <eref target=""/>:
1654      "refactor conditional header field descriptions"
1655    </t>
1656  </list>
1660<section title="Since draft-ietf-httpbis-p4-conditional-20" anchor="changes.since.20">
1662  <list style="symbols">
1663    <t>
1664      Conformance criteria and considerations regarding error handling are
1665      now defined in Part 1.
1666    </t>
1667  </list>
1671<section title="Since draft-ietf-httpbis-p4-conditional-21" anchor="changes.since.21">
1673  Closed issues:
1674  <list style="symbols">
1675    <t>
1676      <eref target=""/>:
1677      "Conditional GET text"
1678    </t>
1679    <t>
1680      <eref target=""/>:
1681      "Optionality of Conditional Request Support"
1682    </t>
1683    <t>
1684      <eref target=""/>:
1685      "unclear prose in definition of 304"
1686    </t>
1687    <t>
1688      <eref target=""/>:
1689      "ETags and Conneg"
1690    </t>
1691    <t>
1692      <eref target=""/>:
1693      "Comparison function for If-Match and If-None-Match"
1694    </t>
1695    <t>
1696      <eref target=""/>:
1697      "304 without validator"
1698    </t>
1699    <t>
1700      <eref target=""/>:
1701      "If-Match and 428"
1702    </t>
1703  </list>
1707<section title="Since draft-ietf-httpbis-p4-conditional-22" anchor="changes.since.22">
1709  Closed issues:
1710  <list style="symbols">
1711    <t>
1712      <eref target=""/>:
1713      "explain list expansion in ABNF appendices"
1714    </t>
1715    <t>
1716      <eref target=""/>:
1717      "incorrect example dates"
1718    </t>
1719  </list>
1722  Partly resolved issues:
1723  <list style="symbols">
1724    <t>
1725      <eref target=""/>:
1726      "Editorial suggestions"
1727    </t>
1728  </list>
1732<section title="Since draft-ietf-httpbis-p4-conditional-23" anchor="changes.since.23">
1734  Closed issues:
1735  <list style="symbols">
1736    <t>
1737      <eref target=""/>:
1738      "PUT + If-Match over-constrained?"
1739    </t>
1740    <t>
1741      <eref target=""/>:
1742      MUSTs and other feedback"
1743    </t>
1744  </list>
Note: See TracBrowser for help on using the repository browser.