source: draft-ietf-httpbis/02/p4-conditional.xml @ 219

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

Prepare for release of draft 02 on Monday, Feb 24.

  • Property svn:eol-style set to native
File size: 53.9 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>">
15  <!ENTITY ID-MONTH "February">
16  <!ENTITY ID-YEAR "2008">
17  <!ENTITY notation-abnf              "<xref target='Part1' x:rel='#notation.abnf' xmlns:x=''/>">
18  <!ENTITY basic-rules                "<xref target='Part1' x:rel='#basic.rules' xmlns:x=''/>">
19  <!ENTITY messaging                  "<xref target='Part1' xmlns:x=''/>">
20  <!ENTITY caching                    "<xref target='Part6' xmlns:x=''/>">
21  <!ENTITY header-if-range            "<xref target='Part5' x:rel='#header.if-range' xmlns:x=''/>">
22  <!ENTITY header-range               "<xref target='Part5' x:rel='#header.range' xmlns:x=''/>">
23  <!ENTITY header-vary                "<xref target='Part6' x:rel='#header.vary' xmlns:x=''/>">
24  <!ENTITY clockless                  "<xref target='Part1' x:rel='#clockless.origin.server.operation' xmlns:x=''/>">
25  <!ENTITY full-date                  "<xref target='Part1' x:rel='' xmlns:x=''/>">
27<?rfc toc="yes" ?>
28<?rfc symrefs="yes" ?>
29<?rfc sortrefs="yes" ?>
30<?rfc compact="yes"?>
31<?rfc subcompact="no" ?>
32<?rfc linkmailto="no" ?>
33<?rfc editing="no" ?>
34<?rfc comments="yes"?>
35<?rfc inline="yes"?>
36<?rfc-ext allow-markup-in-artwork="yes" ?>
37<?rfc-ext include-references-in-index="yes" ?>
38<rfc obsoletes="2616" category="std"
39     ipr="full3978" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"
40     xmlns:x=''>
43  <title abbrev="HTTP/1.1, Part 4">HTTP/1.1, part 4: Conditional Requests</title>
45  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
46    <organization abbrev="Day Software">Day Software</organization>
47    <address>
48      <postal>
49        <street>23 Corporate Plaza DR, Suite 280</street>
50        <city>Newport Beach</city>
51        <region>CA</region>
52        <code>92660</code>
53        <country>USA</country>
54      </postal>
55      <phone>+1-949-706-5300</phone>
56      <facsimile>+1-949-706-5305</facsimile>
57      <email></email>
58      <uri></uri>
59    </address>
60  </author>
62  <author initials="J." surname="Gettys" fullname="Jim Gettys">
63    <organization>One Laptop per Child</organization>
64    <address>
65      <postal>
66        <street>21 Oak Knoll Road</street>
67        <city>Carlisle</city>
68        <region>MA</region>
69        <code>01741</code>
70        <country>USA</country>
71      </postal>
72      <email></email>
73      <uri></uri>
74    </address>
75  </author>
77  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
78    <organization abbrev="HP">Hewlett-Packard Company</organization>
79    <address>
80      <postal>
81        <street>HP Labs, Large Scale Systems Group</street>
82        <street>1501 Page Mill Road, MS 1177</street>
83        <city>Palo Alto</city>
84        <region>CA</region>
85        <code>94304</code>
86        <country>USA</country>
87      </postal>
88      <email></email>
89    </address>
90  </author>
92  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
93    <organization abbrev="Microsoft">Microsoft Corporation</organization>
94    <address>
95      <postal>
96        <street>1 Microsoft Way</street>
97        <city>Redmond</city>
98        <region>WA</region>
99        <code>98052</code>
100        <country>USA</country>
101      </postal>
102      <email></email>
103    </address>
104  </author>
106  <author initials="L." surname="Masinter" fullname="Larry Masinter">
107    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
108    <address>
109      <postal>
110        <street>345 Park Ave</street>
111        <city>San Jose</city>
112        <region>CA</region>
113        <code>95110</code>
114        <country>USA</country>
115      </postal>
116      <email></email>
117      <uri></uri>
118    </address>
119  </author>
121  <author initials="P." surname="Leach" fullname="Paul J. Leach">
122    <organization abbrev="Microsoft">Microsoft Corporation</organization>
123    <address>
124      <postal>
125        <street>1 Microsoft Way</street>
126        <city>Redmond</city>
127        <region>WA</region>
128        <code>98052</code>
129      </postal>
130      <email></email>
131    </address>
132  </author>
134  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
135    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
136    <address>
137      <postal>
138        <street>MIT Computer Science and Artificial Intelligence Laboratory</street>
139        <street>The Stata Center, Building 32</street>
140        <street>32 Vassar Street</street>
141        <city>Cambridge</city>
142        <region>MA</region>
143        <code>02139</code>
144        <country>USA</country>
145      </postal>
146      <email></email>
147      <uri></uri>
148    </address>
149  </author>
151  <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
152    <organization abbrev="W3C">World Wide Web Consortium</organization>
153    <address>
154      <postal>
155        <street>W3C / ERCIM</street>
156        <street>2004, rte des Lucioles</street>
157        <city>Sophia-Antipolis</city>
158        <region>AM</region>
159        <code>06902</code>
160        <country>France</country>
161      </postal>
162      <email></email>
163      <uri></uri>
164    </address>
165  </author>
167  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
168    <organization abbrev="greenbytes">greenbytes GmbH</organization>
169    <address>
170      <postal>
171        <street>Hafenweg 16</street>
172        <city>Muenster</city><region>NW</region><code>48155</code>
173        <country>Germany</country>
174      </postal>
175      <phone>+49 251 2807760</phone>   
176      <facsimile>+49 251 2807761</facsimile>   
177      <email></email>       
178      <uri></uri>     
179    </address>
180  </author>
182  <date month="&ID-MONTH;" year="&ID-YEAR;" day="24"/>
186   The Hypertext Transfer Protocol (HTTP) is an application-level
187   protocol for distributed, collaborative, hypermedia information
188   systems. HTTP has been in use by the World Wide Web global information
189   initiative since 1990. This document is Part 4 of the seven-part specification
190   that defines the protocol referred to as "HTTP/1.1" and, taken together,
191   obsoletes RFC 2616.  Part 4 defines request header fields for
192   indicating conditional requests and the rules for constructing responses
193   to those requests.
197<note title="Editorial Note (To be removed by RFC Editor)">
198  <t>
199    Discussion of this draft should take place on the HTTPBIS working group
200    mailing list ( The current issues list is
201    at <eref target=""/>
202    and related documents (including fancy diffs) can be found at
203    <eref target=""/>.
204  </t>
205  <t>
206    This draft incorporates those issue resolutions that were either
207    collected in the original RFC2616 errata list (<eref target=""/>),
208    or which were agreed upon on the mailing list between October 2006 and
209    November 2007 (as published in "draft-lafon-rfc2616bis-03").
210  </t>
214<section title="Introduction" anchor="introduction">
216   This document defines HTTP/1.1 response metadata for indicating potential
217   changes to payload content, including modification time stamps and opaque
218   entity-tags, and the HTTP conditional request mechanisms that allow
219   preconditions to be placed on a request method.  Conditional GET requests
220   allow for efficient cache updates.  Other conditional request methods are
221   used to protect against overwriting or misunderstanding the state of a
222   resource that has been changed unbeknownst to the requesting client.
225   This document is currently disorganized in order to minimize the changes
226   between drafts and enable reviewers to see the smaller errata changes.
227   The next draft will reorganize the sections to better reflect the content.
228   In particular, the sections on resource metadata will be discussed first
229   and then followed by each conditional request-header, concluding with a
230   definition of precedence and the expectation of ordering strong validator
231   checks before weak validator checks.  It is likely that more content from
232   &caching; will migrate to this part, where appropriate.
233   The current mess reflects how widely dispersed these topics and associated
234   requirements had become in <xref target="RFC2616"/>.
237<section title="Requirements" anchor="intro.requirements">
239   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
240   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
241   document are to be interpreted as described in <xref target="RFC2119"/>.
244   An implementation is not compliant if it fails to satisfy one or more
245   of the &MUST; or &REQUIRED; level requirements for the protocols it
246   implements. An implementation that satisfies all the &MUST; or &REQUIRED;
247   level and all the &SHOULD; level requirements for its protocols is said
248   to be "unconditionally compliant"; one that satisfies all the &MUST;
249   level requirements but not all the &SHOULD; level requirements for its
250   protocols is said to be "conditionally compliant."
255<section title="Notational Conventions and Generic Grammar" anchor="notation">
257  This specification uses the ABNF syntax defined in &notation-abnf; and
258  the core rules defined in &basic-rules;:
259  <cref anchor="abnf.dep">ABNF syntax and basic rules will be adopted from RFC 5234, see
260  <eref target=""/>.</cref>
262<figure><artwork type="abnf2616">
263  quoted-string = &lt;quoted-string, defined in &basic-rules;&gt;
265<t anchor="abnf.dependencies">
266  The ABNF rules below are defined in other parts:
268<figure><!--Part1--><artwork type="abnf2616">
269  HTTP-date     = &lt;HTTP-date, defined in &full-date;&gt;
273<section title="Entity Tags" anchor="entity.tags">
275   Entity tags are used for comparing two or more entities from the same
276   requested resource. HTTP/1.1 uses entity tags in the ETag (<xref target="header.etag"/>),
277   If-Match (<xref target="header.if-match"/>), If-None-Match (<xref target="header.if-none-match"/>), and
278   If-Range (&header-if-range;) header fields. The definition of how they
279   are used and compared as cache validators is in <xref target="weak.and.strong.validators"/>. An
280   entity tag consists of an opaque quoted string, possibly prefixed by
281   a weakness indicator.
283<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="entity-tag"/><iref primary="true" item="Grammar" subitem="weak"/><iref primary="true" item="Grammar" subitem="opaque-tag"/>
284  entity-tag = [ weak ] opaque-tag
285  weak       = "W/"
286  opaque-tag = quoted-string
289   A "strong entity tag" &MAY; be shared by two entities of a resource
290   only if they are equivalent by octet equality.
293   A "weak entity tag," indicated by the "W/" prefix, &MAY; be shared by
294   two entities of a resource only if the entities are equivalent and
295   could be substituted for each other with no significant change in
296   semantics. A weak entity tag can only be used for weak comparison.
299   An entity tag &MUST; be unique across all versions of all entities
300   associated with a particular resource. A given entity tag value &MAY;
301   be used for entities obtained by requests on different URIs. The use
302   of the same entity tag value in conjunction with entities obtained by
303   requests on different URIs does not imply the equivalence of those
304   entities.
308<section title="Status Code Definitions">
309<section title="304 Not Modified" anchor="status.304">
310  <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/>
311  <iref primary="true" item="Status Codes" subitem="304 Not Modified" x:for-anchor=""/>
313   If the client has performed a conditional GET request and access is
314   allowed, but the document has not been modified, the server &SHOULD;
315   respond with this status code. The 304 response &MUST-NOT; contain a
316   message-body, and thus is always terminated by the first empty line
317   after the header fields.
320   The response &MUST; include the following header fields:
321  <list style="symbols">
322    <t>Date, unless its omission is required by &clockless;</t>
323  </list>
326   If a clockless origin server obeys these rules, and proxies and
327   clients add their own Date to any response received without one (as
328   already specified by <xref target="RFC2068" x:sec="14.19" x:fmt=","/>), caches will operate
329   correctly.
330  <list style="symbols">
331    <t>ETag and/or Content-Location, if the header would have been sent
332        in a 200 response to the same request</t>
333    <t>Expires, Cache-Control, and/or Vary, if the field-value might
334        differ from that sent in any previous response for the same
335        variant</t>
336  </list>
339   If the conditional GET used a strong cache validator (see <xref target="weak.and.strong.validators"/>),
340   the response &SHOULD-NOT;  include other entity-headers.
341   Otherwise (i.e., the conditional GET used a weak validator), the
342   response &MUST-NOT; include other entity-headers; this prevents
343   inconsistencies between cached entity-bodies and updated headers.
346   If a 304 response indicates an entity not currently cached, then the
347   cache &MUST; disregard the response and repeat the request without the
348   conditional.
351   If a cache uses a received 304 response to update a cache entry, the
352   cache &MUST; update the entry to reflect any new field values given in
353   the response.
357<section title="412 Precondition Failed" anchor="status.412">
358  <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/>
359  <iref primary="true" item="Status Codes" subitem="412 Precondition Failed" x:for-anchor=""/>
361   The precondition given in one or more of the request-header fields
362   evaluated to false when it was tested on the server. This response
363   code allows the client to place preconditions on the current resource
364   metainformation (header field data) and thus prevent the requested
365   method from being applied to a resource other than the one intended.
370<section title="Weak and Strong Validators" anchor="weak.and.strong.validators">
372   Since both origin servers and caches will compare two validators to
373   decide if they represent the same or different entities, one normally
374   would expect that if the entity (the entity-body or any entity-headers)
375   changes in any way, then the associated validator would
376   change as well. If this is true, then we call this validator a
377   "strong validator."
380   However, there might be cases when a server prefers to change the
381   validator only on semantically significant changes, and not when
382   insignificant aspects of the entity change. A validator that does not
383   always change when the resource changes is a "weak validator."
386   Entity tags are normally "strong validators," but the protocol
387   provides a mechanism to tag an entity tag as "weak." One can think of
388   a strong validator as one that changes whenever the bits of an entity
389   changes, while a weak value changes whenever the meaning of an entity
390   changes. Alternatively, one can think of a strong validator as part
391   of an identifier for a specific entity, while a weak validator is
392   part of an identifier for a set of semantically equivalent entities.
393  <list><t>
394      <x:h>Note:</x:h> One example of a strong validator is an integer that is
395      incremented in stable storage every time an entity is changed.
396    </t><t>
397      An entity's modification time, if represented with one-second
398      resolution, could be a weak validator, since it is possible that
399      the resource might be modified twice during a single second.
400    </t><t>
401      Support for weak validators is optional. However, weak validators
402      allow for more efficient caching of equivalent objects; for
403      example, a hit counter on a site is probably good enough if it is
404      updated every few days or weeks, and any value during that period
405      is likely "good enough" to be equivalent.
406    </t></list>
409   A "use" of a validator is either when a client generates a request
410   and includes the validator in a validating header field, or when a
411   server compares two validators.
414   Strong validators are usable in any context. Weak validators are only
415   usable in contexts that do not depend on exact equality of an entity.
416   For example, either kind is usable for a conditional GET of a full
417   entity. However, only a strong validator is usable for a sub-range
418   retrieval, since otherwise the client might end up with an internally
419   inconsistent entity.
422   Clients &MAY; issue simple (non-subrange) GET requests with either weak
423   validators or strong validators. Clients &MUST-NOT; use weak validators
424   in other forms of request.
427   The only function that HTTP/1.1 defines on validators is
428   comparison. There are two validator comparison functions, depending
429   on whether the comparison context allows the use of weak validators
430   or not:
431  <list style="symbols">
432     <t>The strong comparison function: in order to be considered equal,
433        both validators &MUST; be identical in every way, and both &MUST-NOT;
434        be weak.</t>
435     <t>The weak comparison function: in order to be considered equal,
436        both validators &MUST; be identical in every way, but either or
437        both of them &MAY; be tagged as "weak" without affecting the
438        result.</t>
439  </list>
442   An entity tag is strong unless it is explicitly tagged as weak.
443   <xref target="entity.tags"/> gives the syntax for entity tags.
446   A Last-Modified time, when used as a validator in a request, is
447   implicitly weak unless it is possible to deduce that it is strong,
448   using the following rules:
449  <list style="symbols">
450     <t>The validator is being compared by an origin server to the
451        actual current validator for the entity and,</t>
452     <t>That origin server reliably knows that the associated entity did
453        not change twice during the second covered by the presented
454        validator.</t>
455  </list>
458   or
459  <list style="symbols">
460     <t>The validator is about to be used by a client in an If-Modified-Since
461        or If-Unmodified-Since header, because the client
462        has a cache entry for the associated entity, and</t>
463     <t>That cache entry includes a Date value, which gives the time
464        when the origin server sent the original response, and</t>
465     <t>The presented Last-Modified time is at least 60 seconds before
466        the Date value.</t>
467  </list>
470   or
471  <list style="symbols">
472     <t>The validator is being compared by an intermediate cache to the
473        validator stored in its cache entry for the entity, and</t>
474     <t>That cache entry includes a Date value, which gives the time
475        when the origin server sent the original response, and</t>
476     <t>The presented Last-Modified time is at least 60 seconds before
477        the Date value.</t>
478  </list>
481   This method relies on the fact that if two different responses were
482   sent by the origin server during the same second, but both had the
483   same Last-Modified time, then at least one of those responses would
484   have a Date value equal to its Last-Modified time. The arbitrary 60-second
485   limit guards against the possibility that the Date and Last-Modified
486   values are generated from different clocks, or at somewhat
487   different times during the preparation of the response. An
488   implementation &MAY; use a value larger than 60 seconds, if it is
489   believed that 60 seconds is too short.
492   If a client wishes to perform a sub-range retrieval on a value for
493   which it has only a Last-Modified time and no opaque validator, it
494   &MAY; do this only if the Last-Modified time is strong in the sense
495   described here.
498   A cache or origin server receiving a conditional request, other than
499   a full-body GET request, &MUST; use the strong comparison function to
500   evaluate the condition.
503   These rules allow HTTP/1.1 caches and clients to safely perform sub-range
504   retrievals on values that have been obtained from HTTP/1.0
505   servers.
509<section title="Rules for When to Use Entity Tags and Last-Modified Dates" anchor="">
511   We adopt a set of rules and recommendations for origin servers,
512   clients, and caches regarding when various validator types ought to
513   be used, and for what purposes.
516   HTTP/1.1 origin servers:
517  <list style="symbols">
518     <t>&SHOULD; send an entity tag validator unless it is not feasible to
519        generate one.</t>
521     <t>&MAY; send a weak entity tag instead of a strong entity tag, if
522        performance considerations support the use of weak entity tags,
523        or if it is unfeasible to send a strong entity tag.</t>
525     <t>&SHOULD; send a Last-Modified value if it is feasible to send one,
526        unless the risk of a breakdown in semantic transparency that
527        could result from using this date in an If-Modified-Since header
528        would lead to serious problems.</t>
529  </list>
532   In other words, the preferred behavior for an HTTP/1.1 origin server
533   is to send both a strong entity tag and a Last-Modified value.
536   In order to be legal, a strong entity tag &MUST; change whenever the
537   associated entity value changes in any way. A weak entity tag &SHOULD;
538   change whenever the associated entity changes in a semantically
539   significant way.
540  <list><t>
541      <x:h>Note:</x:h> in order to provide semantically transparent caching, an
542      origin server must avoid reusing a specific strong entity tag
543      value for two different entities, or reusing a specific weak
544      entity tag value for two semantically different entities. Cache
545      entries might persist for arbitrarily long periods, regardless of
546      expiration times, so it might be inappropriate to expect that a
547      cache will never again attempt to validate an entry using a
548      validator that it obtained at some point in the past.
549  </t></list>
552   HTTP/1.1 clients:
553  <list style="symbols">
554     <t>If an entity tag has been provided by the origin server, &MUST;
555        use that entity tag in any cache-conditional request (using If-Match
556        or If-None-Match).</t>
558     <t>If only a Last-Modified value has been provided by the origin
559        server, &SHOULD; use that value in non-subrange cache-conditional
560        requests (using If-Modified-Since).</t>
562     <t>If only a Last-Modified value has been provided by an HTTP/1.0
563        origin server, &MAY; use that value in subrange cache-conditional
564        requests (using If-Unmodified-Since:). The user agent &SHOULD;
565        provide a way to disable this, in case of difficulty.</t>
567     <t>If both an entity tag and a Last-Modified value have been
568        provided by the origin server, &SHOULD; use both validators in
569        cache-conditional requests. This allows both HTTP/1.0 and
570        HTTP/1.1 caches to respond appropriately.</t>
571  </list>
574   An HTTP/1.1 origin server, upon receiving a conditional request that
575   includes both a Last-Modified date (e.g., in an If-Modified-Since or
576   If-Unmodified-Since header field) and one or more entity tags (e.g.,
577   in an If-Match, If-None-Match, or If-Range header field) as cache
578   validators, &MUST-NOT; return a response status of 304 (Not Modified)
579   unless doing so is consistent with all of the conditional header
580   fields in the request.
583   An HTTP/1.1 caching proxy, upon receiving a conditional request that
584   includes both a Last-Modified date and one or more entity tags as
585   cache validators, &MUST-NOT; return a locally cached response to the
586   client unless that cached response is consistent with all of the
587   conditional header fields in the request.
588  <list><t>
589      <x:h>Note:</x:h> The general principle behind these rules is that HTTP/1.1
590      servers and clients should transmit as much non-redundant
591      information as is available in their responses and requests.
592      HTTP/1.1 systems receiving this information will make the most
593      conservative assumptions about the validators they receive.
594  </t><t>
595      HTTP/1.0 clients and caches will ignore entity tags. Generally,
596      last-modified values received or used by these systems will
597      support transparent and efficient caching, and so HTTP/1.1 origin
598      servers should provide Last-Modified values. In those rare cases
599      where the use of a Last-Modified value as a validator by an
600      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
601      origin servers should not provide one.
602  </t></list>
606<section title="Header Field Definitions" anchor="header.fields">
608   This section defines the syntax and semantics of HTTP/1.1 header fields
609   related to conditional requests.
612   For entity-header fields, both sender and recipient refer to either the
613   client or the server, depending on who sends and who receives the entity.
616<section title="ETag" anchor="header.etag">
617  <iref primary="true" item="ETag header" x:for-anchor=""/>
618  <iref primary="true" item="Headers" subitem="ETag" x:for-anchor=""/>
620   The ETag response-header field provides the current value of the
621   entity tag for the requested variant. The headers used with entity
622   tags are described in Sections <xref target="header.if-match" format="counter"/>
623   and <xref target="header.if-none-match" format="counter"/> of this document,
624   and in &header-if-range;. The entity tag
625   &MAY; be used for comparison with other entities from the same resource
626   (see <xref target="weak.and.strong.validators"/>).
628<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/>
629  ETag = "ETag" ":" entity-tag
632   Examples:
634<artwork type="example">
635   ETag: "xyzzy"
636   ETag: W/"xyzzy"
637   ETag: ""
640   The ETag response-header field value, an entity tag, provides for an
641   "opaque" cache validator. This might allow more reliable validation
642   in situations where it is inconvenient to store modification dates,
643   where the one-second resolution of HTTP date values is not
644   sufficient, or where the origin server wishes to avoid certain
645   paradoxes that might arise from the use of modification dates.
648   The principle behind entity tags is that only the service author
649   knows the semantics of a resource well enough to select an
650   appropriate cache validation mechanism, and the specification of any
651   validator comparison function more complex than byte-equality would
652   open up a can of worms. Thus, comparisons of any other headers
653   (except Last-Modified, for compatibility with HTTP/1.0) are never
654   used for purposes of validating a cache entry.
658<section title="If-Match" anchor="header.if-match">
659  <iref primary="true" item="If-Match header" x:for-anchor=""/>
660  <iref primary="true" item="Headers" subitem="If-Match" x:for-anchor=""/>
662   The If-Match request-header field is used with a method to make it
663   conditional. A client that has one or more entities previously
664   obtained from the resource can verify that one of those entities is
665   current by including a list of their associated entity tags in the
666   If-Match header field. Entity tags are defined in <xref target="entity.tags"/>. The
667   purpose of this feature is to allow efficient updates of cached
668   information with a minimum amount of transaction overhead. It is also
669   used, on updating requests, to prevent inadvertent modification of
670   the wrong version of a resource. As a special case, the value "*"
671   matches any current entity of the resource.
673<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
674  If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
677   If any of the entity tags match the entity tag of the entity that
678   would have been returned in the response to a similar GET request
679   (without the If-Match header) on that resource, or if "*" is given
680   and any current entity exists for that resource, then the server &MAY;
681   perform the requested method as if the If-Match header field did not
682   exist.
685   A server &MUST; use the strong comparison function (see <xref target="weak.and.strong.validators"/>)
686   to compare the entity tags in If-Match.
689   If none of the entity tags match, or if "*" is given and no current
690   entity exists, the server &MUST-NOT; perform the requested method, and
691   &MUST; return a 412 (Precondition Failed) response. This behavior is
692   most useful when the client wants to prevent an updating method, such
693   as PUT, from modifying a resource that has changed since the client
694   last retrieved it.
697   If the request would, without the If-Match header field, result in
698   anything other than a 2xx or 412 status, then the If-Match header
699   &MUST; be ignored.
702   The meaning of "If-Match: *" is that the method &SHOULD; be performed
703   if the representation selected by the origin server (or by a cache,
704   possibly using the Vary mechanism, see &header-vary;) exists, and
705   &MUST-NOT; be performed if the representation does not exist.
708   A request intended to update a resource (e.g., a PUT) &MAY; include an
709   If-Match header field to signal that the request method &MUST-NOT; be
710   applied if the entity corresponding to the If-Match value (a single
711   entity tag) is no longer a representation of that resource. This
712   allows the user to indicate that they do not wish the request to be
713   successful if the resource has been changed without their knowledge.
714   Examples:
716<figure><artwork type="example">
717    If-Match: "xyzzy"
718    If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
719    If-Match: *
722   The result of a request having both an If-Match header field and
723   either an If-None-Match or an If-Modified-Since header fields is
724   undefined by this specification.
728<section title="If-Modified-Since" anchor="header.if-modified-since">
729  <iref primary="true" item="If-Modified-Since header" x:for-anchor=""/>
730  <iref primary="true" item="Headers" subitem="If-Modified-Since" x:for-anchor=""/>
732   The If-Modified-Since request-header field is used with a method to
733   make it conditional: if the requested variant has not been modified
734   since the time specified in this field, an entity will not be
735   returned from the server; instead, a 304 (Not Modified) response will
736   be returned without any message-body.
738<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
739  If-Modified-Since = "If-Modified-Since" ":" HTTP-date
742   An example of the field is:
744<figure><artwork type="example">
745    If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
748   A GET method with an If-Modified-Since header and no Range header
749   requests that the identified entity be transferred only if it has
750   been modified since the date given by the If-Modified-Since header.
751   The algorithm for determining this includes the following cases:
752  <list style="numbers">
753      <t>If the request would normally result in anything other than a
754         200 (OK) status, or if the passed If-Modified-Since date is
755         invalid, the response is exactly the same as for a normal GET.
756         A date which is later than the server's current time is
757         invalid.</t>
759      <t>If the variant has been modified since the If-Modified-Since
760         date, the response is exactly the same as for a normal GET.</t>
762      <t>If the variant has not been modified since a valid If-Modified-Since
763         date, the server &SHOULD; return a 304 (Not
764         Modified) response.</t>
765  </list>
768   The purpose of this feature is to allow efficient updates of cached
769   information with a minimum amount of transaction overhead.
770  <list><t>
771      <x:h>Note:</x:h> The Range request-header field modifies the meaning of If-Modified-Since;
772      see &header-range; for full details.
773    </t><t>
774      <x:h>Note:</x:h> If-Modified-Since times are interpreted by the server, whose
775      clock might not be synchronized with the client.
776    </t><t>
777      <x:h>Note:</x:h> When handling an If-Modified-Since header field, some
778      servers will use an exact date comparison function, rather than a
779      less-than function, for deciding whether to send a 304 (Not
780      Modified) response. To get best results when sending an If-Modified-Since
781      header field for cache validation, clients are
782      advised to use the exact date string received in a previous Last-Modified
783      header field whenever possible.
784    </t><t>
785      <x:h>Note:</x:h> If a client uses an arbitrary date in the If-Modified-Since
786      header instead of a date taken from the Last-Modified header for
787      the same request, the client should be aware of the fact that this
788      date is interpreted in the server's understanding of time. The
789      client should consider unsynchronized clocks and rounding problems
790      due to the different encodings of time between the client and
791      server. This includes the possibility of race conditions if the
792      document has changed between the time it was first requested and
793      the If-Modified-Since date of a subsequent request, and the
794      possibility of clock-skew-related problems if the If-Modified-Since
795      date is derived from the client's clock without correction
796      to the server's clock. Corrections for different time bases
797      between client and server are at best approximate due to network
798      latency.
799    </t>
800  </list>
803   The result of a request having both an If-Modified-Since header field
804   and either an If-Match or an If-Unmodified-Since header fields is
805   undefined by this specification.
809<section title="If-None-Match" anchor="header.if-none-match">
810  <iref primary="true" item="If-None-Match header" x:for-anchor=""/>
811  <iref primary="true" item="Headers" subitem="If-None-Match" x:for-anchor=""/>
813   The If-None-Match request-header field is used with a method to make
814   it conditional. A client that has one or more entities previously
815   obtained from the resource can verify that none of those entities is
816   current by including a list of their associated entity tags in the
817   If-None-Match header field. The purpose of this feature is to allow
818   efficient updates of cached information with a minimum amount of
819   transaction overhead. It is also used to prevent a method (e.g. PUT)
820   from inadvertently modifying an existing resource when the client
821   believes that the resource does not exist.
824   As a special case, the value "*" matches any current entity of the
825   resource.
827<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
828  If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
831   If any of the entity tags match the entity tag of the entity that
832   would have been returned in the response to a similar GET request
833   (without the If-None-Match header) on that resource, or if "*" is
834   given and any current entity exists for that resource, then the
835   server &MUST-NOT; perform the requested method, unless required to do
836   so because the resource's modification date fails to match that
837   supplied in an If-Modified-Since header field in the request.
838   Instead, if the request method was GET or HEAD, the server &SHOULD;
839   respond with a 304 (Not Modified) response, including the cache-related
840   header fields (particularly ETag) of one of the entities that
841   matched. For all other request methods, the server &MUST; respond with
842   a status of 412 (Precondition Failed).
845   See <xref target="weak.and.strong.validators"/> for rules on how to determine if two entities tags
846   match. The weak comparison function can only be used with GET or HEAD
847   requests.
850   If none of the entity tags match, then the server &MAY; perform the
851   requested method as if the If-None-Match header field did not exist,
852   but &MUST; also ignore any If-Modified-Since header field(s) in the
853   request. That is, if no entity tags match, then the server &MUST-NOT;
854   return a 304 (Not Modified) response.
857   If the request would, without the If-None-Match header field, result
858   in anything other than a 2xx or 304 status, then the If-None-Match
859   header &MUST; be ignored. (See <xref target=""/> for a discussion of
860   server behavior when both If-Modified-Since and If-None-Match appear
861   in the same request.)
864   The meaning of "If-None-Match: *" is that the method &MUST-NOT; be
865   performed if the representation selected by the origin server (or by
866   a cache, possibly using the Vary mechanism, see &header-vary;)
867   exists, and &SHOULD; be performed if the representation does not exist.
868   This feature is intended to be useful in preventing races between PUT
869   operations.
872   Examples:
874<figure><artwork type="example">
875    If-None-Match: "xyzzy"
876    If-None-Match: W/"xyzzy"
877    If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
878    If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
879    If-None-Match: *
882   The result of a request having both an If-None-Match header field and
883   either an If-Match or an If-Unmodified-Since header fields is
884   undefined by this specification.
888<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
889  <iref primary="true" item="If-Unmodified-Since header" x:for-anchor=""/>
890  <iref primary="true" item="Headers" subitem="If-Unmodified-Since" x:for-anchor=""/>
892   The If-Unmodified-Since request-header field is used with a method to
893   make it conditional. If the requested resource has not been modified
894   since the time specified in this field, the server &SHOULD; perform the
895   requested operation as if the If-Unmodified-Since header were not
896   present.
899   If the requested variant has been modified since the specified time,
900   the server &MUST-NOT; perform the requested operation, and &MUST; return
901   a 412 (Precondition Failed).
903<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
904  If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
907   An example of the field is:
909<figure><artwork type="example">
910    If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
913   If the request normally (i.e., without the If-Unmodified-Since
914   header) would result in anything other than a 2xx or 412 status, the
915   If-Unmodified-Since header &SHOULD; be ignored.
918   If the specified date is invalid, the header is ignored.
921   The result of a request having both an If-Unmodified-Since header
922   field and either an If-None-Match or an If-Modified-Since header
923   fields is undefined by this specification.
927<section title="Last-Modified" anchor="header.last-modified">
928  <iref primary="true" item="Last-Modified header" x:for-anchor=""/>
929  <iref primary="true" item="Headers" subitem="Last-Modified" x:for-anchor=""/>
931   The Last-Modified entity-header field indicates the date and time at
932   which the origin server believes the variant was last modified.
934<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
935  Last-Modified  = "Last-Modified" ":" HTTP-date
938   An example of its use is
940<figure><artwork type="example">
941    Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
944   The exact meaning of this header field depends on the implementation
945   of the origin server and the nature of the original resource. For
946   files, it may be just the file system last-modified time. For
947   entities with dynamically included parts, it may be the most recent
948   of the set of last-modify times for its component parts. For database
949   gateways, it may be the last-update time stamp of the record. For
950   virtual objects, it may be the last time the internal state changed.
953   An origin server &MUST-NOT; send a Last-Modified date which is later
954   than the server's time of message origination. In such cases, where
955   the resource's last modification would indicate some time in the
956   future, the server &MUST; replace that date with the message
957   origination date.
960   An origin server &SHOULD; obtain the Last-Modified value of the entity
961   as close as possible to the time that it generates the Date value of
962   its response. This allows a recipient to make an accurate assessment
963   of the entity's modification time, especially if the entity changes
964   near the time that the response is generated.
967   HTTP/1.1 servers &SHOULD; send Last-Modified whenever feasible.
970   The Last-Modified entity-header field value is often used as a cache
971   validator. In simple terms, a cache entry is considered to be valid
972   if the entity has not been modified since the Last-Modified value.
978<section title="IANA Considerations" anchor="IANA.considerations">
980   <cref>TBD.</cref>
984<section title="Security Considerations" anchor="security.considerations">
986   No additional security considerations have been identified beyond
987   those applicable to HTTP in general &messaging;.
991<section title="Acknowledgments" anchor="ack">
996<references title="Normative References">
998<reference anchor="Part1">
999  <front>
1000    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
1001    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1002      <organization abbrev="Day Software">Day Software</organization>
1003      <address><email></email></address>
1004    </author>
1005    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1006      <organization>One Laptop per Child</organization>
1007      <address><email></email></address>
1008    </author>
1009    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1010      <organization abbrev="HP">Hewlett-Packard Company</organization>
1011      <address><email></email></address>
1012    </author>
1013    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1014      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1015      <address><email></email></address>
1016    </author>
1017    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1018      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1019      <address><email></email></address>
1020    </author>
1021    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1022      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1023      <address><email></email></address>
1024    </author>
1025    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1026      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1027      <address><email></email></address>
1028    </author>
1029    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1030      <organization abbrev="W3C">World Wide Web Consortium</organization>
1031      <address><email></email></address>
1032    </author>
1033    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1034      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1035      <address><email></email></address>
1036    </author>
1037    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1038  </front>
1039  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/>
1040  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
1043<reference anchor="Part5">
1044  <front>
1045    <title abbrev="HTTP/1.1">HTTP/1.1, part 5: Range Requests and Partial Responses</title>
1046    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1047      <organization abbrev="Day Software">Day Software</organization>
1048      <address><email></email></address>
1049    </author>
1050    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1051      <organization>One Laptop per Child</organization>
1052      <address><email></email></address>
1053    </author>
1054    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1055      <organization abbrev="HP">Hewlett-Packard Company</organization>
1056      <address><email></email></address>
1057    </author>
1058    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1059      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1060      <address><email></email></address>
1061    </author>
1062    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1063      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1064      <address><email></email></address>
1065    </author>
1066    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1067      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1068      <address><email></email></address>
1069    </author>
1070    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1071      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1072      <address><email></email></address>
1073    </author>
1074    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1075      <organization abbrev="W3C">World Wide Web Consortium</organization>
1076      <address><email></email></address>
1077    </author>
1078    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1079      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1080      <address><email></email></address>
1081    </author>
1082    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1083  </front>
1084  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/>
1085  <x:source href="p5-range.xml" basename="p5-range"/>
1088<reference anchor="Part6">
1089  <front>
1090    <title abbrev="HTTP/1.1">HTTP/1.1, part 6: Caching</title>
1091    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1092      <organization abbrev="Day Software">Day Software</organization>
1093      <address><email></email></address>
1094    </author>
1095    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1096      <organization>One Laptop per Child</organization>
1097      <address><email></email></address>
1098    </author>
1099    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1100      <organization abbrev="HP">Hewlett-Packard Company</organization>
1101      <address><email></email></address>
1102    </author>
1103    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1104      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1105      <address><email></email></address>
1106    </author>
1107    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1108      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1109      <address><email></email></address>
1110    </author>
1111    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1112      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1113      <address><email></email></address>
1114    </author>
1115    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1116      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1117      <address><email></email></address>
1118    </author>
1119    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1120      <organization abbrev="W3C">World Wide Web Consortium</organization>
1121      <address><email></email></address>
1122    </author>
1123    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1124      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1125      <address><email></email></address>
1126    </author>
1127    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1128  </front>
1129  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
1130  <x:source href="p6-cache.xml" basename="p6-cache"/>
1133<reference anchor="RFC2119">
1134  <front>
1135    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1136    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1137      <organization>Harvard University</organization>
1138      <address><email></email></address>
1139    </author>
1140    <date month="March" year="1997"/>
1141  </front>
1142  <seriesInfo name="BCP" value="14"/>
1143  <seriesInfo name="RFC" value="2119"/>
1148<references title="Informative References">
1150<reference anchor="RFC2068">
1151  <front>
1152    <title abbrev="HTTP/1.1">Hypertext Transfer Protocol -- HTTP/1.1</title>
1153    <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
1154      <organization>University of California, Irvine, Department of Information and Computer Science</organization>
1155      <address><email></email></address>
1156    </author>
1157    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1158      <organization>MIT Laboratory for Computer Science</organization>
1159      <address><email></email></address>
1160    </author>
1161    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1162      <organization>Digital Equipment Corporation, Western Research Laboratory</organization>
1163      <address><email></email></address>
1164    </author>
1165    <author initials="H." surname="Nielsen" fullname="Henrik Frystyk Nielsen">
1166      <organization>MIT Laboratory for Computer Science</organization>
1167      <address><email></email></address>
1168    </author>
1169    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1170      <organization>MIT Laboratory for Computer Science</organization>
1171      <address><email></email></address>
1172    </author>
1173    <date month="January" year="1997"/>
1174  </front>
1175  <seriesInfo name="RFC" value="2068"/>
1178<reference anchor="RFC2616">
1179  <front>
1180    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1181    <author initials="R." surname="Fielding" fullname="R. Fielding">
1182      <organization>University of California, Irvine</organization>
1183      <address><email></email></address>
1184    </author>
1185    <author initials="J." surname="Gettys" fullname="J. Gettys">
1186      <organization>W3C</organization>
1187      <address><email></email></address>
1188    </author>
1189    <author initials="J." surname="Mogul" fullname="J. Mogul">
1190      <organization>Compaq Computer Corporation</organization>
1191      <address><email></email></address>
1192    </author>
1193    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1194      <organization>MIT Laboratory for Computer Science</organization>
1195      <address><email></email></address>
1196    </author>
1197    <author initials="L." surname="Masinter" fullname="L. Masinter">
1198      <organization>Xerox Corporation</organization>
1199      <address><email></email></address>
1200    </author>
1201    <author initials="P." surname="Leach" fullname="P. Leach">
1202      <organization>Microsoft Corporation</organization>
1203      <address><email></email></address>
1204    </author>
1205    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1206      <organization>W3C</organization>
1207      <address><email></email></address>
1208    </author>
1209    <date month="June" year="1999"/>
1210  </front>
1211  <seriesInfo name="RFC" value="2616"/>
1216<section title="Compatibility with Previous Versions" anchor="compatibility">
1218<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1223<section title="Change Log (to be removed by RFC Editor before publication)">
1225<section title="Since RFC2616">
1227  Extracted relevant partitions from <xref target="RFC2616"/>.
1231<section title="Since draft-ietf-httpbis-p4-conditional-00">
1233  Closed issues:
1234  <list style="symbols">
1235    <t>
1236      <eref target=""/>:
1237      "Normative and Informative references"
1238    </t>
1239  </list>
1242  Other changes:
1243  <list style="symbols">
1244    <t>
1245      Move definitions of 304 and 412 condition codes from Part2.
1246    </t>
1247  </list>
1251<section title="Since draft-ietf-httpbis-p4-conditional-01">
1253  Ongoing work on ABNF conversion (<eref target=""/>):
1254  <list style="symbols">
1255    <t>
1256      Add explicit references to BNF syntax and rules imported from other parts of the specification.
1257    </t>
1258  </list>
Note: See TracBrowser for help on using the repository browser.