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

Last change on this file since 204 was 203, checked in by julian.reschke@…, 14 years ago

Add processing instructions for inline comments throughout, and use them for the IANA TBDs.

  • Property svn:eol-style set to native
File size: 52.6 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 "February">
16  <!ENTITY ID-YEAR "2008">
17  <!ENTITY messaging                  "<xref target='Part1' xmlns:x=''/>">
18  <!ENTITY caching                    "<xref target='Part6' xmlns:x=''/>">
19  <!ENTITY header-if-range            "<xref target='Part5' x:rel='#header.if-range' xmlns:x=''/>">
20  <!ENTITY header-range               "<xref target='Part5' x:rel='#header.range' xmlns:x=''/>">
21  <!ENTITY header-vary                "<xref target='Part6' x:rel='#header.vary' xmlns:x=''/>">
22  <!ENTITY clockless                  "<xref target='Part1' x:rel='#clockless.origin.server.operation' xmlns:x=''/>">
24<?rfc toc="yes" ?>
25<?rfc symrefs="yes" ?>
26<?rfc sortrefs="yes" ?>
27<?rfc compact="yes"?>
28<?rfc subcompact="no" ?>
29<?rfc linkmailto="no" ?>
30<?rfc editing="no" ?>
31<?rfc comments="yes"?>
32<?rfc inline="yes"?>
33<?rfc-ext allow-markup-in-artwork="yes" ?>
34<?rfc-ext include-references-in-index="yes" ?>
35<rfc obsoletes="2616" category="std"
36     ipr="full3978" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"
37     xmlns:x=''>
40  <title abbrev="HTTP/1.1, Part 4">HTTP/1.1, part 4: Conditional Requests</title>
42  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
43    <organization abbrev="Day Software">Day Software</organization>
44    <address>
45      <postal>
46        <street>23 Corporate Plaza DR, Suite 280</street>
47        <city>Newport Beach</city>
48        <region>CA</region>
49        <code>92660</code>
50        <country>USA</country>
51      </postal>
52      <phone>+1-949-706-5300</phone>
53      <facsimile>+1-949-706-5305</facsimile>
54      <email></email>
55      <uri></uri>
56    </address>
57  </author>
59  <author initials="J." surname="Gettys" fullname="Jim Gettys">
60    <organization>One Laptop per Child</organization>
61    <address>
62      <postal>
63        <street>21 Oak Knoll Road</street>
64        <city>Carlisle</city>
65        <region>MA</region>
66        <code>01741</code>
67        <country>USA</country>
68      </postal>
69      <email></email>
70      <uri></uri>
71    </address>
72  </author>
74  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
75    <organization abbrev="HP">Hewlett-Packard Company</organization>
76    <address>
77      <postal>
78        <street>HP Labs, Large Scale Systems Group</street>
79        <street>1501 Page Mill Road, MS 1177</street>
80        <city>Palo Alto</city>
81        <region>CA</region>
82        <code>94304</code>
83        <country>USA</country>
84      </postal>
85      <email></email>
86    </address>
87  </author>
89  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
90    <organization abbrev="Microsoft">Microsoft Corporation</organization>
91    <address>
92      <postal>
93        <street>1 Microsoft Way</street>
94        <city>Redmond</city>
95        <region>WA</region>
96        <code>98052</code>
97        <country>USA</country>
98      </postal>
99      <email></email>
100    </address>
101  </author>
103  <author initials="L." surname="Masinter" fullname="Larry Masinter">
104    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
105    <address>
106      <postal>
107        <street>345 Park Ave</street>
108        <city>San Jose</city>
109        <region>CA</region>
110        <code>95110</code>
111        <country>USA</country>
112      </postal>
113      <email></email>
114      <uri></uri>
115    </address>
116  </author>
118  <author initials="P." surname="Leach" fullname="Paul J. Leach">
119    <organization abbrev="Microsoft">Microsoft Corporation</organization>
120    <address>
121      <postal>
122        <street>1 Microsoft Way</street>
123        <city>Redmond</city>
124        <region>WA</region>
125        <code>98052</code>
126      </postal>
127      <email></email>
128    </address>
129  </author>
131  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
132    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
133    <address>
134      <postal>
135        <street>MIT Computer Science and Artificial Intelligence Laboratory</street>
136        <street>The Stata Center, Building 32</street>
137        <street>32 Vassar Street</street>
138        <city>Cambridge</city>
139        <region>MA</region>
140        <code>02139</code>
141        <country>USA</country>
142      </postal>
143      <email></email>
144      <uri></uri>
145    </address>
146  </author>
148  <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
149    <organization abbrev="W3C">World Wide Web Consortium</organization>
150    <address>
151      <postal>
152        <street>W3C / ERCIM</street>
153        <street>2004, rte des Lucioles</street>
154        <city>Sophia-Antipolis</city>
155        <region>AM</region>
156        <code>06902</code>
157        <country>France</country>
158      </postal>
159      <email></email>
160      <uri></uri>
161    </address>
162  </author>
164  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
165    <organization abbrev="greenbytes">greenbytes GmbH</organization>
166    <address>
167      <postal>
168        <street>Hafenweg 16</street>
169        <city>Muenster</city><region>NW</region><code>48155</code>
170        <country>Germany</country>
171      </postal>
172      <phone>+49 251 2807760</phone>   
173      <facsimile>+49 251 2807761</facsimile>   
174      <email></email>       
175      <uri></uri>     
176    </address>
177  </author>
179  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
183   The Hypertext Transfer Protocol (HTTP) is an application-level
184   protocol for distributed, collaborative, hypermedia information
185   systems. HTTP has been in use by the World Wide Web global information
186   initiative since 1990. This document is Part 4 of the seven-part specification
187   that defines the protocol referred to as "HTTP/1.1" and, taken together,
188   obsoletes RFC 2616.  Part 4 defines request header fields for
189   indicating conditional requests and the rules for constructing responses
190   to those requests.
194<note title="Editorial Note (To be removed by RFC Editor)">
195  <t>
196    Discussion of this draft should take place on the HTTPBIS working group
197    mailing list ( The current issues list is
198    at <eref target=""/>
199    and related documents (including fancy diffs) can be found at
200    <eref target=""/>.
201  </t>
202  <t>
203    This draft incorporates those issue resolutions that were either
204    collected in the original RFC2616 errata list (<eref target=""/>),
205    or which were agreed upon on the mailing list between October 2006 and
206    November 2007 (as published in "draft-lafon-rfc2616bis-03").
207  </t>
211<section title="Introduction" anchor="introduction">
213   This document defines HTTP/1.1 response metadata for indicating potential
214   changes to payload content, including modification time stamps and opaque
215   entity-tags, and the HTTP conditional request mechanisms that allow
216   preconditions to be placed on a request method.  Conditional GET requests
217   allow for efficient cache updates.  Other conditional request methods are
218   used to protect against overwriting or misunderstanding the state of a
219   resource that has been changed unbeknownst to the requesting client.
222   This document is currently disorganized in order to minimize the changes
223   between drafts and enable reviewers to see the smaller errata changes.
224   The next draft will reorganize the sections to better reflect the content.
225   In particular, the sections on resource metadata will be discussed first
226   and then followed by each conditional request-header, concluding with a
227   definition of precedence and the expectation of ordering strong validator
228   checks before weak validator checks.  It is likely that more content from
229   &caching; will migrate to this part, where appropriate.
230   The current mess reflects how widely dispersed these topics and associated
231   requirements had become in <xref target="RFC2616"/>.
234<section title="Requirements" anchor="intro.requirements">
236   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
237   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
238   document are to be interpreted as described in <xref target="RFC2119"/>.
241   An implementation is not compliant if it fails to satisfy one or more
242   of the &MUST; or &REQUIRED; level requirements for the protocols it
243   implements. An implementation that satisfies all the &MUST; or &REQUIRED;
244   level and all the &SHOULD; level requirements for its protocols is said
245   to be "unconditionally compliant"; one that satisfies all the &MUST;
246   level requirements but not all the &SHOULD; level requirements for its
247   protocols is said to be "conditionally compliant."
252<section title="Entity Tags" anchor="entity.tags">
254   Entity tags are used for comparing two or more entities from the same
255   requested resource. HTTP/1.1 uses entity tags in the ETag (<xref target="header.etag"/>),
256   If-Match (<xref target="header.if-match"/>), If-None-Match (<xref target="header.if-none-match"/>), and
257   If-Range (&header-if-range;) header fields. The definition of how they
258   are used and compared as cache validators is in <xref target="weak.and.strong.validators"/>. An
259   entity tag consists of an opaque quoted string, possibly prefixed by
260   a weakness indicator.
262<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"/>
263  entity-tag = [ weak ] opaque-tag
264  weak       = "W/"
265  opaque-tag = quoted-string
268   A "strong entity tag" &MAY; be shared by two entities of a resource
269   only if they are equivalent by octet equality.
272   A "weak entity tag," indicated by the "W/" prefix, &MAY; be shared by
273   two entities of a resource only if the entities are equivalent and
274   could be substituted for each other with no significant change in
275   semantics. A weak entity tag can only be used for weak comparison.
278   An entity tag &MUST; be unique across all versions of all entities
279   associated with a particular resource. A given entity tag value &MAY;
280   be used for entities obtained by requests on different URIs. The use
281   of the same entity tag value in conjunction with entities obtained by
282   requests on different URIs does not imply the equivalence of those
283   entities.
287<section title="Status Code Definitions">
288<section title="304 Not Modified" anchor="status.304">
289  <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/>
290  <iref primary="true" item="Status Codes" subitem="304 Not Modified" x:for-anchor=""/>
292   If the client has performed a conditional GET request and access is
293   allowed, but the document has not been modified, the server &SHOULD;
294   respond with this status code. The 304 response &MUST-NOT; contain a
295   message-body, and thus is always terminated by the first empty line
296   after the header fields.
299   The response &MUST; include the following header fields:
300  <list style="symbols">
301    <t>Date, unless its omission is required by &clockless;</t>
302  </list>
305   If a clockless origin server obeys these rules, and proxies and
306   clients add their own Date to any response received without one (as
307   already specified by <xref target="RFC2068" x:sec="14.19" x:fmt=","/>), caches will operate
308   correctly.
309  <list style="symbols">
310    <t>ETag and/or Content-Location, if the header would have been sent
311        in a 200 response to the same request</t>
312    <t>Expires, Cache-Control, and/or Vary, if the field-value might
313        differ from that sent in any previous response for the same
314        variant</t>
315  </list>
318   If the conditional GET used a strong cache validator (see <xref target="weak.and.strong.validators"/>),
319   the response &SHOULD-NOT;  include other entity-headers.
320   Otherwise (i.e., the conditional GET used a weak validator), the
321   response &MUST-NOT; include other entity-headers; this prevents
322   inconsistencies between cached entity-bodies and updated headers.
325   If a 304 response indicates an entity not currently cached, then the
326   cache &MUST; disregard the response and repeat the request without the
327   conditional.
330   If a cache uses a received 304 response to update a cache entry, the
331   cache &MUST; update the entry to reflect any new field values given in
332   the response.
336<section title="412 Precondition Failed" anchor="status.412">
337  <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/>
338  <iref primary="true" item="Status Codes" subitem="412 Precondition Failed" x:for-anchor=""/>
340   The precondition given in one or more of the request-header fields
341   evaluated to false when it was tested on the server. This response
342   code allows the client to place preconditions on the current resource
343   metainformation (header field data) and thus prevent the requested
344   method from being applied to a resource other than the one intended.
349<section title="Weak and Strong Validators" anchor="weak.and.strong.validators">
351   Since both origin servers and caches will compare two validators to
352   decide if they represent the same or different entities, one normally
353   would expect that if the entity (the entity-body or any entity-headers)
354   changes in any way, then the associated validator would
355   change as well. If this is true, then we call this validator a
356   "strong validator."
359   However, there might be cases when a server prefers to change the
360   validator only on semantically significant changes, and not when
361   insignificant aspects of the entity change. A validator that does not
362   always change when the resource changes is a "weak validator."
365   Entity tags are normally "strong validators," but the protocol
366   provides a mechanism to tag an entity tag as "weak." One can think of
367   a strong validator as one that changes whenever the bits of an entity
368   changes, while a weak value changes whenever the meaning of an entity
369   changes. Alternatively, one can think of a strong validator as part
370   of an identifier for a specific entity, while a weak validator is
371   part of an identifier for a set of semantically equivalent entities.
372  <list><t>
373      <x:h>Note:</x:h> One example of a strong validator is an integer that is
374      incremented in stable storage every time an entity is changed.
375    </t><t>
376      An entity's modification time, if represented with one-second
377      resolution, could be a weak validator, since it is possible that
378      the resource might be modified twice during a single second.
379    </t><t>
380      Support for weak validators is optional. However, weak validators
381      allow for more efficient caching of equivalent objects; for
382      example, a hit counter on a site is probably good enough if it is
383      updated every few days or weeks, and any value during that period
384      is likely "good enough" to be equivalent.
385    </t></list>
388   A "use" of a validator is either when a client generates a request
389   and includes the validator in a validating header field, or when a
390   server compares two validators.
393   Strong validators are usable in any context. Weak validators are only
394   usable in contexts that do not depend on exact equality of an entity.
395   For example, either kind is usable for a conditional GET of a full
396   entity. However, only a strong validator is usable for a sub-range
397   retrieval, since otherwise the client might end up with an internally
398   inconsistent entity.
401   Clients &MAY; issue simple (non-subrange) GET requests with either weak
402   validators or strong validators. Clients &MUST-NOT; use weak validators
403   in other forms of request.
406   The only function that HTTP/1.1 defines on validators is
407   comparison. There are two validator comparison functions, depending
408   on whether the comparison context allows the use of weak validators
409   or not:
410  <list style="symbols">
411     <t>The strong comparison function: in order to be considered equal,
412        both validators &MUST; be identical in every way, and both &MUST-NOT;
413        be weak.</t>
414     <t>The weak comparison function: in order to be considered equal,
415        both validators &MUST; be identical in every way, but either or
416        both of them &MAY; be tagged as "weak" without affecting the
417        result.</t>
418  </list>
421   An entity tag is strong unless it is explicitly tagged as weak.
422   <xref target="entity.tags"/> gives the syntax for entity tags.
425   A Last-Modified time, when used as a validator in a request, is
426   implicitly weak unless it is possible to deduce that it is strong,
427   using the following rules:
428  <list style="symbols">
429     <t>The validator is being compared by an origin server to the
430        actual current validator for the entity and,</t>
431     <t>That origin server reliably knows that the associated entity did
432        not change twice during the second covered by the presented
433        validator.</t>
434  </list>
437   or
438  <list style="symbols">
439     <t>The validator is about to be used by a client in an If-Modified-Since
440        or If-Unmodified-Since header, because the client
441        has a cache entry for the associated entity, and</t>
442     <t>That cache entry includes a Date value, which gives the time
443        when the origin server sent the original response, and</t>
444     <t>The presented Last-Modified time is at least 60 seconds before
445        the Date value.</t>
446  </list>
449   or
450  <list style="symbols">
451     <t>The validator is being compared by an intermediate cache to the
452        validator stored in its cache entry for the entity, and</t>
453     <t>That cache entry includes a Date value, which gives the time
454        when the origin server sent the original response, and</t>
455     <t>The presented Last-Modified time is at least 60 seconds before
456        the Date value.</t>
457  </list>
460   This method relies on the fact that if two different responses were
461   sent by the origin server during the same second, but both had the
462   same Last-Modified time, then at least one of those responses would
463   have a Date value equal to its Last-Modified time. The arbitrary 60-second
464   limit guards against the possibility that the Date and Last-Modified
465   values are generated from different clocks, or at somewhat
466   different times during the preparation of the response. An
467   implementation &MAY; use a value larger than 60 seconds, if it is
468   believed that 60 seconds is too short.
471   If a client wishes to perform a sub-range retrieval on a value for
472   which it has only a Last-Modified time and no opaque validator, it
473   &MAY; do this only if the Last-Modified time is strong in the sense
474   described here.
477   A cache or origin server receiving a conditional request, other than
478   a full-body GET request, &MUST; use the strong comparison function to
479   evaluate the condition.
482   These rules allow HTTP/1.1 caches and clients to safely perform sub-range
483   retrievals on values that have been obtained from HTTP/1.0
484   servers.
488<section title="Rules for When to Use Entity Tags and Last-Modified Dates" anchor="">
490   We adopt a set of rules and recommendations for origin servers,
491   clients, and caches regarding when various validator types ought to
492   be used, and for what purposes.
495   HTTP/1.1 origin servers:
496  <list style="symbols">
497     <t>&SHOULD; send an entity tag validator unless it is not feasible to
498        generate one.</t>
500     <t>&MAY; send a weak entity tag instead of a strong entity tag, if
501        performance considerations support the use of weak entity tags,
502        or if it is unfeasible to send a strong entity tag.</t>
504     <t>&SHOULD; send a Last-Modified value if it is feasible to send one,
505        unless the risk of a breakdown in semantic transparency that
506        could result from using this date in an If-Modified-Since header
507        would lead to serious problems.</t>
508  </list>
511   In other words, the preferred behavior for an HTTP/1.1 origin server
512   is to send both a strong entity tag and a Last-Modified value.
515   In order to be legal, a strong entity tag &MUST; change whenever the
516   associated entity value changes in any way. A weak entity tag &SHOULD;
517   change whenever the associated entity changes in a semantically
518   significant way.
519  <list><t>
520      <x:h>Note:</x:h> in order to provide semantically transparent caching, an
521      origin server must avoid reusing a specific strong entity tag
522      value for two different entities, or reusing a specific weak
523      entity tag value for two semantically different entities. Cache
524      entries might persist for arbitrarily long periods, regardless of
525      expiration times, so it might be inappropriate to expect that a
526      cache will never again attempt to validate an entry using a
527      validator that it obtained at some point in the past.
528  </t></list>
531   HTTP/1.1 clients:
532  <list style="symbols">
533     <t>If an entity tag has been provided by the origin server, &MUST;
534        use that entity tag in any cache-conditional request (using If-Match
535        or If-None-Match).</t>
537     <t>If only a Last-Modified value has been provided by the origin
538        server, &SHOULD; use that value in non-subrange cache-conditional
539        requests (using If-Modified-Since).</t>
541     <t>If only a Last-Modified value has been provided by an HTTP/1.0
542        origin server, &MAY; use that value in subrange cache-conditional
543        requests (using If-Unmodified-Since:). The user agent &SHOULD;
544        provide a way to disable this, in case of difficulty.</t>
546     <t>If both an entity tag and a Last-Modified value have been
547        provided by the origin server, &SHOULD; use both validators in
548        cache-conditional requests. This allows both HTTP/1.0 and
549        HTTP/1.1 caches to respond appropriately.</t>
550  </list>
553   An HTTP/1.1 origin server, upon receiving a conditional request that
554   includes both a Last-Modified date (e.g., in an If-Modified-Since or
555   If-Unmodified-Since header field) and one or more entity tags (e.g.,
556   in an If-Match, If-None-Match, or If-Range header field) as cache
557   validators, &MUST-NOT; return a response status of 304 (Not Modified)
558   unless doing so is consistent with all of the conditional header
559   fields in the request.
562   An HTTP/1.1 caching proxy, upon receiving a conditional request that
563   includes both a Last-Modified date and one or more entity tags as
564   cache validators, &MUST-NOT; return a locally cached response to the
565   client unless that cached response is consistent with all of the
566   conditional header fields in the request.
567  <list><t>
568      <x:h>Note:</x:h> The general principle behind these rules is that HTTP/1.1
569      servers and clients should transmit as much non-redundant
570      information as is available in their responses and requests.
571      HTTP/1.1 systems receiving this information will make the most
572      conservative assumptions about the validators they receive.
573  </t><t>
574      HTTP/1.0 clients and caches will ignore entity tags. Generally,
575      last-modified values received or used by these systems will
576      support transparent and efficient caching, and so HTTP/1.1 origin
577      servers should provide Last-Modified values. In those rare cases
578      where the use of a Last-Modified value as a validator by an
579      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
580      origin servers should not provide one.
581  </t></list>
585<section title="Header Field Definitions" anchor="header.fields">
587   This section defines the syntax and semantics of HTTP/1.1 header fields
588   related to conditional requests.
591   For entity-header fields, both sender and recipient refer to either the
592   client or the server, depending on who sends and who receives the entity.
595<section title="ETag" anchor="header.etag">
596  <iref primary="true" item="ETag header" x:for-anchor=""/>
597  <iref primary="true" item="Headers" subitem="ETag" x:for-anchor=""/>
599   The ETag response-header field provides the current value of the
600   entity tag for the requested variant. The headers used with entity
601   tags are described in Sections <xref target="header.if-match" format="counter"/>
602   and <xref target="header.if-none-match" format="counter"/> of this document,
603   and in &header-if-range;. The entity tag
604   &MAY; be used for comparison with other entities from the same resource
605   (see <xref target="weak.and.strong.validators"/>).
607<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/>
608  ETag = "ETag" ":" entity-tag
611   Examples:
613<artwork type="example">
614   ETag: "xyzzy"
615   ETag: W/"xyzzy"
616   ETag: ""
619   The ETag response-header field value, an entity tag, provides for an
620   "opaque" cache validator. This might allow more reliable validation
621   in situations where it is inconvenient to store modification dates,
622   where the one-second resolution of HTTP date values is not
623   sufficient, or where the origin server wishes to avoid certain
624   paradoxes that might arise from the use of modification dates.
627   The principle behind entity tags is that only the service author
628   knows the semantics of a resource well enough to select an
629   appropriate cache validation mechanism, and the specification of any
630   validator comparison function more complex than byte-equality would
631   open up a can of worms. Thus, comparisons of any other headers
632   (except Last-Modified, for compatibility with HTTP/1.0) are never
633   used for purposes of validating a cache entry.
637<section title="If-Match" anchor="header.if-match">
638  <iref primary="true" item="If-Match header" x:for-anchor=""/>
639  <iref primary="true" item="Headers" subitem="If-Match" x:for-anchor=""/>
641   The If-Match request-header field is used with a method to make it
642   conditional. A client that has one or more entities previously
643   obtained from the resource can verify that one of those entities is
644   current by including a list of their associated entity tags in the
645   If-Match header field. Entity tags are defined in <xref target="entity.tags"/>. The
646   purpose of this feature is to allow efficient updates of cached
647   information with a minimum amount of transaction overhead. It is also
648   used, on updating requests, to prevent inadvertent modification of
649   the wrong version of a resource. As a special case, the value "*"
650   matches any current entity of the resource.
652<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
653  If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
656   If any of the entity tags match the entity tag of the entity that
657   would have been returned in the response to a similar GET request
658   (without the If-Match header) on that resource, or if "*" is given
659   and any current entity exists for that resource, then the server &MAY;
660   perform the requested method as if the If-Match header field did not
661   exist.
664   A server &MUST; use the strong comparison function (see <xref target="weak.and.strong.validators"/>)
665   to compare the entity tags in If-Match.
668   If none of the entity tags match, or if "*" is given and no current
669   entity exists, the server &MUST-NOT; perform the requested method, and
670   &MUST; return a 412 (Precondition Failed) response. This behavior is
671   most useful when the client wants to prevent an updating method, such
672   as PUT, from modifying a resource that has changed since the client
673   last retrieved it.
676   If the request would, without the If-Match header field, result in
677   anything other than a 2xx or 412 status, then the If-Match header
678   &MUST; be ignored.
681   The meaning of "If-Match: *" is that the method &SHOULD; be performed
682   if the representation selected by the origin server (or by a cache,
683   possibly using the Vary mechanism, see &header-vary;) exists, and
684   &MUST-NOT; be performed if the representation does not exist.
687   A request intended to update a resource (e.g., a PUT) &MAY; include an
688   If-Match header field to signal that the request method &MUST-NOT; be
689   applied if the entity corresponding to the If-Match value (a single
690   entity tag) is no longer a representation of that resource. This
691   allows the user to indicate that they do not wish the request to be
692   successful if the resource has been changed without their knowledge.
693   Examples:
695<figure><artwork type="example">
696    If-Match: "xyzzy"
697    If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
698    If-Match: *
701   The result of a request having both an If-Match header field and
702   either an If-None-Match or an If-Modified-Since header fields is
703   undefined by this specification.
707<section title="If-Modified-Since" anchor="header.if-modified-since">
708  <iref primary="true" item="If-Modified-Since header" x:for-anchor=""/>
709  <iref primary="true" item="Headers" subitem="If-Modified-Since" x:for-anchor=""/>
711   The If-Modified-Since request-header field is used with a method to
712   make it conditional: if the requested variant has not been modified
713   since the time specified in this field, an entity will not be
714   returned from the server; instead, a 304 (Not Modified) response will
715   be returned without any message-body.
717<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
718  If-Modified-Since = "If-Modified-Since" ":" HTTP-date
721   An example of the field is:
723<figure><artwork type="example">
724    If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
727   A GET method with an If-Modified-Since header and no Range header
728   requests that the identified entity be transferred only if it has
729   been modified since the date given by the If-Modified-Since header.
730   The algorithm for determining this includes the following cases:
731  <list style="numbers">
732      <t>If the request would normally result in anything other than a
733         200 (OK) status, or if the passed If-Modified-Since date is
734         invalid, the response is exactly the same as for a normal GET.
735         A date which is later than the server's current time is
736         invalid.</t>
738      <t>If the variant has been modified since the If-Modified-Since
739         date, the response is exactly the same as for a normal GET.</t>
741      <t>If the variant has not been modified since a valid If-Modified-Since
742         date, the server &SHOULD; return a 304 (Not
743         Modified) response.</t>
744  </list>
747   The purpose of this feature is to allow efficient updates of cached
748   information with a minimum amount of transaction overhead.
749  <list><t>
750      <x:h>Note:</x:h> The Range request-header field modifies the meaning of If-Modified-Since;
751      see &header-range; for full details.
752    </t><t>
753      <x:h>Note:</x:h> If-Modified-Since times are interpreted by the server, whose
754      clock might not be synchronized with the client.
755    </t><t>
756      <x:h>Note:</x:h> When handling an If-Modified-Since header field, some
757      servers will use an exact date comparison function, rather than a
758      less-than function, for deciding whether to send a 304 (Not
759      Modified) response. To get best results when sending an If-Modified-Since
760      header field for cache validation, clients are
761      advised to use the exact date string received in a previous Last-Modified
762      header field whenever possible.
763    </t><t>
764      <x:h>Note:</x:h> If a client uses an arbitrary date in the If-Modified-Since
765      header instead of a date taken from the Last-Modified header for
766      the same request, the client should be aware of the fact that this
767      date is interpreted in the server's understanding of time. The
768      client should consider unsynchronized clocks and rounding problems
769      due to the different encodings of time between the client and
770      server. This includes the possibility of race conditions if the
771      document has changed between the time it was first requested and
772      the If-Modified-Since date of a subsequent request, and the
773      possibility of clock-skew-related problems if the If-Modified-Since
774      date is derived from the client's clock without correction
775      to the server's clock. Corrections for different time bases
776      between client and server are at best approximate due to network
777      latency.
778    </t>
779  </list>
782   The result of a request having both an If-Modified-Since header field
783   and either an If-Match or an If-Unmodified-Since header fields is
784   undefined by this specification.
788<section title="If-None-Match" anchor="header.if-none-match">
789  <iref primary="true" item="If-None-Match header" x:for-anchor=""/>
790  <iref primary="true" item="Headers" subitem="If-None-Match" x:for-anchor=""/>
792   The If-None-Match request-header field is used with a method to make
793   it conditional. A client that has one or more entities previously
794   obtained from the resource can verify that none of those entities is
795   current by including a list of their associated entity tags in the
796   If-None-Match header field. The purpose of this feature is to allow
797   efficient updates of cached information with a minimum amount of
798   transaction overhead. It is also used to prevent a method (e.g. PUT)
799   from inadvertently modifying an existing resource when the client
800   believes that the resource does not exist.
803   As a special case, the value "*" matches any current entity of the
804   resource.
806<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
807  If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
810   If any of the entity tags match the entity tag of the entity that
811   would have been returned in the response to a similar GET request
812   (without the If-None-Match header) on that resource, or if "*" is
813   given and any current entity exists for that resource, then the
814   server &MUST-NOT; perform the requested method, unless required to do
815   so because the resource's modification date fails to match that
816   supplied in an If-Modified-Since header field in the request.
817   Instead, if the request method was GET or HEAD, the server &SHOULD;
818   respond with a 304 (Not Modified) response, including the cache-related
819   header fields (particularly ETag) of one of the entities that
820   matched. For all other request methods, the server &MUST; respond with
821   a status of 412 (Precondition Failed).
824   See <xref target="weak.and.strong.validators"/> for rules on how to determine if two entities tags
825   match. The weak comparison function can only be used with GET or HEAD
826   requests.
829   If none of the entity tags match, then the server &MAY; perform the
830   requested method as if the If-None-Match header field did not exist,
831   but &MUST; also ignore any If-Modified-Since header field(s) in the
832   request. That is, if no entity tags match, then the server &MUST-NOT;
833   return a 304 (Not Modified) response.
836   If the request would, without the If-None-Match header field, result
837   in anything other than a 2xx or 304 status, then the If-None-Match
838   header &MUST; be ignored. (See <xref target=""/> for a discussion of
839   server behavior when both If-Modified-Since and If-None-Match appear
840   in the same request.)
843   The meaning of "If-None-Match: *" is that the method &MUST-NOT; be
844   performed if the representation selected by the origin server (or by
845   a cache, possibly using the Vary mechanism, see &header-vary;)
846   exists, and &SHOULD; be performed if the representation does not exist.
847   This feature is intended to be useful in preventing races between PUT
848   operations.
851   Examples:
853<figure><artwork type="example">
854    If-None-Match: "xyzzy"
855    If-None-Match: W/"xyzzy"
856    If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
857    If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
858    If-None-Match: *
861   The result of a request having both an If-None-Match header field and
862   either an If-Match or an If-Unmodified-Since header fields is
863   undefined by this specification.
867<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
868  <iref primary="true" item="If-Unmodified-Since header" x:for-anchor=""/>
869  <iref primary="true" item="Headers" subitem="If-Unmodified-Since" x:for-anchor=""/>
871   The If-Unmodified-Since request-header field is used with a method to
872   make it conditional. If the requested resource has not been modified
873   since the time specified in this field, the server &SHOULD; perform the
874   requested operation as if the If-Unmodified-Since header were not
875   present.
878   If the requested variant has been modified since the specified time,
879   the server &MUST-NOT; perform the requested operation, and &MUST; return
880   a 412 (Precondition Failed).
882<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
883  If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
886   An example of the field is:
888<figure><artwork type="example">
889    If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
892   If the request normally (i.e., without the If-Unmodified-Since
893   header) would result in anything other than a 2xx or 412 status, the
894   If-Unmodified-Since header &SHOULD; be ignored.
897   If the specified date is invalid, the header is ignored.
900   The result of a request having both an If-Unmodified-Since header
901   field and either an If-None-Match or an If-Modified-Since header
902   fields is undefined by this specification.
906<section title="Last-Modified" anchor="header.last-modified">
907  <iref primary="true" item="Last-Modified header" x:for-anchor=""/>
908  <iref primary="true" item="Headers" subitem="Last-Modified" x:for-anchor=""/>
910   The Last-Modified entity-header field indicates the date and time at
911   which the origin server believes the variant was last modified.
913<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
914  Last-Modified  = "Last-Modified" ":" HTTP-date
917   An example of its use is
919<figure><artwork type="example">
920    Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
923   The exact meaning of this header field depends on the implementation
924   of the origin server and the nature of the original resource. For
925   files, it may be just the file system last-modified time. For
926   entities with dynamically included parts, it may be the most recent
927   of the set of last-modify times for its component parts. For database
928   gateways, it may be the last-update time stamp of the record. For
929   virtual objects, it may be the last time the internal state changed.
932   An origin server &MUST-NOT; send a Last-Modified date which is later
933   than the server's time of message origination. In such cases, where
934   the resource's last modification would indicate some time in the
935   future, the server &MUST; replace that date with the message
936   origination date.
939   An origin server &SHOULD; obtain the Last-Modified value of the entity
940   as close as possible to the time that it generates the Date value of
941   its response. This allows a recipient to make an accurate assessment
942   of the entity's modification time, especially if the entity changes
943   near the time that the response is generated.
946   HTTP/1.1 servers &SHOULD; send Last-Modified whenever feasible.
949   The Last-Modified entity-header field value is often used as a cache
950   validator. In simple terms, a cache entry is considered to be valid
951   if the entity has not been modified since the Last-Modified value.
957<section title="IANA Considerations" anchor="IANA.considerations">
959   <cref>TBD.</cref>
963<section title="Security Considerations" anchor="security.considerations">
965   No additional security considerations have been identified beyond
966   those applicable to HTTP in general &messaging;.
970<section title="Acknowledgments" anchor="ack">
975<references title="Normative References">
977<reference anchor="Part1">
978  <front>
979    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
980    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
981      <organization abbrev="Day Software">Day Software</organization>
982      <address><email></email></address>
983    </author>
984    <author initials="J." surname="Gettys" fullname="Jim Gettys">
985      <organization>One Laptop per Child</organization>
986      <address><email></email></address>
987    </author>
988    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
989      <organization abbrev="HP">Hewlett-Packard Company</organization>
990      <address><email></email></address>
991    </author>
992    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
993      <organization abbrev="Microsoft">Microsoft Corporation</organization>
994      <address><email></email></address>
995    </author>
996    <author initials="L." surname="Masinter" fullname="Larry Masinter">
997      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
998      <address><email></email></address>
999    </author>
1000    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1001      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1002      <address><email></email></address>
1003    </author>
1004    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1005      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1006      <address><email></email></address>
1007    </author>
1008    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1009      <organization abbrev="W3C">World Wide Web Consortium</organization>
1010      <address><email></email></address>
1011    </author>
1012    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1013      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1014      <address><email></email></address>
1015    </author>
1016    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1017  </front>
1018  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/>
1019  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
1022<reference anchor="Part5">
1023  <front>
1024    <title abbrev="HTTP/1.1">HTTP/1.1, part 5: Range Requests and Partial Responses</title>
1025    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1026      <organization abbrev="Day Software">Day Software</organization>
1027      <address><email></email></address>
1028    </author>
1029    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1030      <organization>One Laptop per Child</organization>
1031      <address><email></email></address>
1032    </author>
1033    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1034      <organization abbrev="HP">Hewlett-Packard Company</organization>
1035      <address><email></email></address>
1036    </author>
1037    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1038      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1039      <address><email></email></address>
1040    </author>
1041    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1042      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1043      <address><email></email></address>
1044    </author>
1045    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1046      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1047      <address><email></email></address>
1048    </author>
1049    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1050      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1051      <address><email></email></address>
1052    </author>
1053    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1054      <organization abbrev="W3C">World Wide Web Consortium</organization>
1055      <address><email></email></address>
1056    </author>
1057    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1058      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1059      <address><email></email></address>
1060    </author>
1061    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1062  </front>
1063  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/>
1064  <x:source href="p5-range.xml" basename="p5-range"/>
1067<reference anchor="Part6">
1068  <front>
1069    <title abbrev="HTTP/1.1">HTTP/1.1, part 6: Caching</title>
1070    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1071      <organization abbrev="Day Software">Day Software</organization>
1072      <address><email></email></address>
1073    </author>
1074    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1075      <organization>One Laptop per Child</organization>
1076      <address><email></email></address>
1077    </author>
1078    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1079      <organization abbrev="HP">Hewlett-Packard Company</organization>
1080      <address><email></email></address>
1081    </author>
1082    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1083      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1084      <address><email></email></address>
1085    </author>
1086    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1087      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1088      <address><email></email></address>
1089    </author>
1090    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1091      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1092      <address><email></email></address>
1093    </author>
1094    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1095      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1096      <address><email></email></address>
1097    </author>
1098    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1099      <organization abbrev="W3C">World Wide Web Consortium</organization>
1100      <address><email></email></address>
1101    </author>
1102    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1103      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1104      <address><email></email></address>
1105    </author>
1106    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1107  </front>
1108  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
1109  <x:source href="p6-cache.xml" basename="p6-cache"/>
1112<reference anchor="RFC2119">
1113  <front>
1114    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1115    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1116      <organization>Harvard University</organization>
1117      <address><email></email></address>
1118    </author>
1119    <date month="March" year="1997"/>
1120  </front>
1121  <seriesInfo name="BCP" value="14"/>
1122  <seriesInfo name="RFC" value="2119"/>
1127<references title="Informative References">
1129<reference anchor="RFC2068">
1130  <front>
1131    <title abbrev="HTTP/1.1">Hypertext Transfer Protocol -- HTTP/1.1</title>
1132    <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
1133      <organization>University of California, Irvine, Department of Information and Computer Science</organization>
1134      <address><email></email></address>
1135    </author>
1136    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1137      <organization>MIT Laboratory for Computer Science</organization>
1138      <address><email></email></address>
1139    </author>
1140    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1141      <organization>Digital Equipment Corporation, Western Research Laboratory</organization>
1142      <address><email></email></address>
1143    </author>
1144    <author initials="H." surname="Nielsen" fullname="Henrik Frystyk Nielsen">
1145      <organization>MIT Laboratory for Computer Science</organization>
1146      <address><email></email></address>
1147    </author>
1148    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1149      <organization>MIT Laboratory for Computer Science</organization>
1150      <address><email></email></address>
1151    </author>
1152    <date month="January" year="1997"/>
1153  </front>
1154  <seriesInfo name="RFC" value="2068"/>
1157<reference anchor="RFC2616">
1158  <front>
1159    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1160    <author initials="R." surname="Fielding" fullname="R. Fielding">
1161      <organization>University of California, Irvine</organization>
1162      <address><email></email></address>
1163    </author>
1164    <author initials="J." surname="Gettys" fullname="J. Gettys">
1165      <organization>W3C</organization>
1166      <address><email></email></address>
1167    </author>
1168    <author initials="J." surname="Mogul" fullname="J. Mogul">
1169      <organization>Compaq Computer Corporation</organization>
1170      <address><email></email></address>
1171    </author>
1172    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1173      <organization>MIT Laboratory for Computer Science</organization>
1174      <address><email></email></address>
1175    </author>
1176    <author initials="L." surname="Masinter" fullname="L. Masinter">
1177      <organization>Xerox Corporation</organization>
1178      <address><email></email></address>
1179    </author>
1180    <author initials="P." surname="Leach" fullname="P. Leach">
1181      <organization>Microsoft Corporation</organization>
1182      <address><email></email></address>
1183    </author>
1184    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1185      <organization>W3C</organization>
1186      <address><email></email></address>
1187    </author>
1188    <date month="June" year="1999"/>
1189  </front>
1190  <seriesInfo name="RFC" value="2616"/>
1195<section title="Compatibility with Previous Versions" anchor="compatibility">
1197<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1202<section title="Change Log (to be removed by RFC Editor before publication)">
1204<section title="Since RFC2616">
1206  Extracted relevant partitions from <xref target="RFC2616"/>.
1210<section title="Since draft-ietf-httpbis-p4-conditional-00">
1212  Closed issues:
1213  <list style="symbols">
1214    <t>
1215      <eref target=""/>:
1216      "Normative and Informative references"
1217    </t>
1218  </list>
1221  Other changes:
1222  <list style="symbols">
1223    <t>
1224      Move definitions of 304 and 412 condition codes from Part2.
1225    </t>
1226  </list>
1230<section title="Since draft-ietf-httpbis-p4-conditional-01">
Note: See TracBrowser for help on using the repository browser.