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

Last change on this file since 187 was 183, checked in by fielding@…, 15 years ago

Reduce the description of cache validation to just those bits that
summarize what a cache SHOULD do, thus avoiding the need to respecify
what is defined in part 4. Move cache validator descriptions
to the associated header field definitions in part 4 (to be merged
at a later time).

  • Property svn:eol-style set to native
File size: 52.5 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-ext allow-markup-in-artwork="yes" ?>
32<?rfc-ext include-references-in-index="yes" ?>
33<rfc obsoletes="2616" category="std"
34     ipr="full3978" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"
35     xmlns:x=''>
38  <title abbrev="HTTP/1.1, Part 4">HTTP/1.1, part 4: Conditional Requests</title>
40  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
41    <organization abbrev="Day Software">Day Software</organization>
42    <address>
43      <postal>
44        <street>23 Corporate Plaza DR, Suite 280</street>
45        <city>Newport Beach</city>
46        <region>CA</region>
47        <code>92660</code>
48        <country>USA</country>
49      </postal>
50      <phone>+1-949-706-5300</phone>
51      <facsimile>+1-949-706-5305</facsimile>
52      <email></email>
53      <uri></uri>
54    </address>
55  </author>
57  <author initials="J." surname="Gettys" fullname="Jim Gettys">
58    <organization>One Laptop per Child</organization>
59    <address>
60      <postal>
61        <street>21 Oak Knoll Road</street>
62        <city>Carlisle</city>
63        <region>MA</region>
64        <code>01741</code>
65        <country>USA</country>
66      </postal>
67      <email></email>
68      <uri></uri>
69    </address>
70  </author>
72  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
73    <organization abbrev="HP">Hewlett-Packard Company</organization>
74    <address>
75      <postal>
76        <street>HP Labs, Large Scale Systems Group</street>
77        <street>1501 Page Mill Road, MS 1177</street>
78        <city>Palo Alto</city>
79        <region>CA</region>
80        <code>94304</code>
81        <country>USA</country>
82      </postal>
83      <email></email>
84    </address>
85  </author>
87  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
88    <organization abbrev="Microsoft">Microsoft Corporation</organization>
89    <address>
90      <postal>
91        <street>1 Microsoft Way</street>
92        <city>Redmond</city>
93        <region>WA</region>
94        <code>98052</code>
95        <country>USA</country>
96      </postal>
97      <email></email>
98    </address>
99  </author>
101  <author initials="L." surname="Masinter" fullname="Larry Masinter">
102    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
103    <address>
104      <postal>
105        <street>345 Park Ave</street>
106        <city>San Jose</city>
107        <region>CA</region>
108        <code>95110</code>
109        <country>USA</country>
110      </postal>
111      <email></email>
112      <uri></uri>
113    </address>
114  </author>
116  <author initials="P." surname="Leach" fullname="Paul J. Leach">
117    <organization abbrev="Microsoft">Microsoft Corporation</organization>
118    <address>
119      <postal>
120        <street>1 Microsoft Way</street>
121        <city>Redmond</city>
122        <region>WA</region>
123        <code>98052</code>
124      </postal>
125      <email></email>
126    </address>
127  </author>
129  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
130    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
131    <address>
132      <postal>
133        <street>MIT Computer Science and Artificial Intelligence Laboratory</street>
134        <street>The Stata Center, Building 32</street>
135        <street>32 Vassar Street</street>
136        <city>Cambridge</city>
137        <region>MA</region>
138        <code>02139</code>
139        <country>USA</country>
140      </postal>
141      <email></email>
142      <uri></uri>
143    </address>
144  </author>
146  <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
147    <organization abbrev="W3C">World Wide Web Consortium</organization>
148    <address>
149      <postal>
150        <street>W3C / ERCIM</street>
151        <street>2004, rte des Lucioles</street>
152        <city>Sophia-Antipolis</city>
153        <region>AM</region>
154        <code>06902</code>
155        <country>France</country>
156      </postal>
157      <email></email>
158      <uri></uri>
159    </address>
160  </author>
162  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
163    <organization abbrev="greenbytes">greenbytes GmbH</organization>
164    <address>
165      <postal>
166        <street>Hafenweg 16</street>
167        <city>Muenster</city><region>NW</region><code>48155</code>
168        <country>Germany</country>
169      </postal>
170      <phone>+49 251 2807760</phone>   
171      <facsimile>+49 251 2807761</facsimile>   
172      <email></email>       
173      <uri></uri>     
174    </address>
175  </author>
177  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
181   The Hypertext Transfer Protocol (HTTP) is an application-level
182   protocol for distributed, collaborative, hypermedia information
183   systems. HTTP has been in use by the World Wide Web global information
184   initiative since 1990. This document is Part 4 of the seven-part specification
185   that defines the protocol referred to as "HTTP/1.1" and, taken together,
186   obsoletes RFC 2616.  Part 4 defines request header fields for
187   indicating conditional requests and the rules for constructing responses
188   to those requests.
192<note title="Editorial Note (To be removed by RFC Editor)">
193  <t>
194    Discussion of this draft should take place on the HTTPBIS working group
195    mailing list ( The current issues list is
196    at <eref target=""/>
197    and related documents (including fancy diffs) can be found at
198    <eref target=""/>.
199  </t>
200  <t>
201    This draft incorporates those issue resolutions that were either
202    collected in the original RFC2616 errata list (<eref target=""/>),
203    or which were agreed upon on the mailing list between October 2006 and
204    November 2007 (as published in "draft-lafon-rfc2616bis-03").
205  </t>
209<section title="Introduction" anchor="introduction">
211   This document defines HTTP/1.1 response metadata for indicating potential
212   changes to payload content, including modification time stamps and opaque
213   entity-tags, and the HTTP conditional request mechanisms that allow
214   preconditions to be placed on a request method.  Conditional GET requests
215   allow for efficient cache updates.  Other conditional request methods are
216   used to protect against overwriting or misunderstanding the state of a
217   resource that has been changed unbeknownst to the requesting client.
220   This document is currently disorganized in order to minimize the changes
221   between drafts and enable reviewers to see the smaller errata changes.
222   The next draft will reorganize the sections to better reflect the content.
223   In particular, the sections on resource metadata will be discussed first
224   and then followed by each conditional request-header, concluding with a
225   definition of precedence and the expectation of ordering strong validator
226   checks before weak validator checks.  It is likely that more content from
227   &caching; will migrate to this part, where appropriate.
228   The current mess reflects how widely dispersed these topics and associated
229   requirements had become in <xref target="RFC2616"/>.
232<section title="Requirements" anchor="intro.requirements">
234   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
235   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
236   document are to be interpreted as described in <xref target="RFC2119"/>.
239   An implementation is not compliant if it fails to satisfy one or more
240   of the &MUST; or &REQUIRED; level requirements for the protocols it
241   implements. An implementation that satisfies all the &MUST; or &REQUIRED;
242   level and all the &SHOULD; level requirements for its protocols is said
243   to be "unconditionally compliant"; one that satisfies all the &MUST;
244   level requirements but not all the &SHOULD; level requirements for its
245   protocols is said to be "conditionally compliant."
250<section title="Entity Tags" anchor="entity.tags">
252   Entity tags are used for comparing two or more entities from the same
253   requested resource. HTTP/1.1 uses entity tags in the ETag (<xref target="header.etag"/>),
254   If-Match (<xref target="header.if-match"/>), If-None-Match (<xref target="header.if-none-match"/>), and
255   If-Range (&header-if-range;) header fields. The definition of how they
256   are used and compared as cache validators is in <xref target="weak.and.strong.validators"/>. An
257   entity tag consists of an opaque quoted string, possibly prefixed by
258   a weakness indicator.
260<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"/>
261  entity-tag = [ weak ] opaque-tag
262  weak       = "W/"
263  opaque-tag = quoted-string
266   A "strong entity tag" &MAY; be shared by two entities of a resource
267   only if they are equivalent by octet equality.
270   A "weak entity tag," indicated by the "W/" prefix, &MAY; be shared by
271   two entities of a resource only if the entities are equivalent and
272   could be substituted for each other with no significant change in
273   semantics. A weak entity tag can only be used for weak comparison.
276   An entity tag &MUST; be unique across all versions of all entities
277   associated with a particular resource. A given entity tag value &MAY;
278   be used for entities obtained by requests on different URIs. The use
279   of the same entity tag value in conjunction with entities obtained by
280   requests on different URIs does not imply the equivalence of those
281   entities.
285<section title="Status Code Definitions">
286<section title="304 Not Modified" anchor="status.304">
287  <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/>
288  <iref primary="true" item="Status Codes" subitem="304 Not Modified" x:for-anchor=""/>
290   If the client has performed a conditional GET request and access is
291   allowed, but the document has not been modified, the server &SHOULD;
292   respond with this status code. The 304 response &MUST-NOT; contain a
293   message-body, and thus is always terminated by the first empty line
294   after the header fields.
297   The response &MUST; include the following header fields:
298  <list style="symbols">
299    <t>Date, unless its omission is required by &clockless;</t>
300  </list>
303   If a clockless origin server obeys these rules, and proxies and
304   clients add their own Date to any response received without one (as
305   already specified by <xref target="RFC2068" x:sec="14.19" x:fmt=","/>), caches will operate
306   correctly.
307  <list style="symbols">
308    <t>ETag and/or Content-Location, if the header would have been sent
309        in a 200 response to the same request</t>
310    <t>Expires, Cache-Control, and/or Vary, if the field-value might
311        differ from that sent in any previous response for the same
312        variant</t>
313  </list>
316   If the conditional GET used a strong cache validator (see <xref target="weak.and.strong.validators"/>),
317   the response &SHOULD-NOT;  include other entity-headers.
318   Otherwise (i.e., the conditional GET used a weak validator), the
319   response &MUST-NOT; include other entity-headers; this prevents
320   inconsistencies between cached entity-bodies and updated headers.
323   If a 304 response indicates an entity not currently cached, then the
324   cache &MUST; disregard the response and repeat the request without the
325   conditional.
328   If a cache uses a received 304 response to update a cache entry, the
329   cache &MUST; update the entry to reflect any new field values given in
330   the response.
334<section title="412 Precondition Failed" anchor="status.412">
335  <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/>
336  <iref primary="true" item="Status Codes" subitem="412 Precondition Failed" x:for-anchor=""/>
338   The precondition given in one or more of the request-header fields
339   evaluated to false when it was tested on the server. This response
340   code allows the client to place preconditions on the current resource
341   metainformation (header field data) and thus prevent the requested
342   method from being applied to a resource other than the one intended.
347<section title="Weak and Strong Validators" anchor="weak.and.strong.validators">
349   Since both origin servers and caches will compare two validators to
350   decide if they represent the same or different entities, one normally
351   would expect that if the entity (the entity-body or any entity-headers)
352   changes in any way, then the associated validator would
353   change as well. If this is true, then we call this validator a
354   "strong validator."
357   However, there might be cases when a server prefers to change the
358   validator only on semantically significant changes, and not when
359   insignificant aspects of the entity change. A validator that does not
360   always change when the resource changes is a "weak validator."
363   Entity tags are normally "strong validators," but the protocol
364   provides a mechanism to tag an entity tag as "weak." One can think of
365   a strong validator as one that changes whenever the bits of an entity
366   changes, while a weak value changes whenever the meaning of an entity
367   changes. Alternatively, one can think of a strong validator as part
368   of an identifier for a specific entity, while a weak validator is
369   part of an identifier for a set of semantically equivalent entities.
370  <list><t>
371      <x:h>Note:</x:h> One example of a strong validator is an integer that is
372      incremented in stable storage every time an entity is changed.
373    </t><t>
374      An entity's modification time, if represented with one-second
375      resolution, could be a weak validator, since it is possible that
376      the resource might be modified twice during a single second.
377    </t><t>
378      Support for weak validators is optional. However, weak validators
379      allow for more efficient caching of equivalent objects; for
380      example, a hit counter on a site is probably good enough if it is
381      updated every few days or weeks, and any value during that period
382      is likely "good enough" to be equivalent.
383    </t></list>
386   A "use" of a validator is either when a client generates a request
387   and includes the validator in a validating header field, or when a
388   server compares two validators.
391   Strong validators are usable in any context. Weak validators are only
392   usable in contexts that do not depend on exact equality of an entity.
393   For example, either kind is usable for a conditional GET of a full
394   entity. However, only a strong validator is usable for a sub-range
395   retrieval, since otherwise the client might end up with an internally
396   inconsistent entity.
399   Clients &MAY; issue simple (non-subrange) GET requests with either weak
400   validators or strong validators. Clients &MUST-NOT; use weak validators
401   in other forms of request.
404   The only function that HTTP/1.1 defines on validators is
405   comparison. There are two validator comparison functions, depending
406   on whether the comparison context allows the use of weak validators
407   or not:
408  <list style="symbols">
409     <t>The strong comparison function: in order to be considered equal,
410        both validators &MUST; be identical in every way, and both &MUST-NOT;
411        be weak.</t>
412     <t>The weak comparison function: in order to be considered equal,
413        both validators &MUST; be identical in every way, but either or
414        both of them &MAY; be tagged as "weak" without affecting the
415        result.</t>
416  </list>
419   An entity tag is strong unless it is explicitly tagged as weak.
420   <xref target="entity.tags"/> gives the syntax for entity tags.
423   A Last-Modified time, when used as a validator in a request, is
424   implicitly weak unless it is possible to deduce that it is strong,
425   using the following rules:
426  <list style="symbols">
427     <t>The validator is being compared by an origin server to the
428        actual current validator for the entity and,</t>
429     <t>That origin server reliably knows that the associated entity did
430        not change twice during the second covered by the presented
431        validator.</t>
432  </list>
435   or
436  <list style="symbols">
437     <t>The validator is about to be used by a client in an If-Modified-Since
438        or If-Unmodified-Since header, because the client
439        has a cache entry for the associated entity, and</t>
440     <t>That cache entry includes a Date value, which gives the time
441        when the origin server sent the original response, and</t>
442     <t>The presented Last-Modified time is at least 60 seconds before
443        the Date value.</t>
444  </list>
447   or
448  <list style="symbols">
449     <t>The validator is being compared by an intermediate cache to the
450        validator stored in its cache entry for the entity, and</t>
451     <t>That cache entry includes a Date value, which gives the time
452        when the origin server sent the original response, and</t>
453     <t>The presented Last-Modified time is at least 60 seconds before
454        the Date value.</t>
455  </list>
458   This method relies on the fact that if two different responses were
459   sent by the origin server during the same second, but both had the
460   same Last-Modified time, then at least one of those responses would
461   have a Date value equal to its Last-Modified time. The arbitrary 60-second
462   limit guards against the possibility that the Date and Last-Modified
463   values are generated from different clocks, or at somewhat
464   different times during the preparation of the response. An
465   implementation &MAY; use a value larger than 60 seconds, if it is
466   believed that 60 seconds is too short.
469   If a client wishes to perform a sub-range retrieval on a value for
470   which it has only a Last-Modified time and no opaque validator, it
471   &MAY; do this only if the Last-Modified time is strong in the sense
472   described here.
475   A cache or origin server receiving a conditional request, other than
476   a full-body GET request, &MUST; use the strong comparison function to
477   evaluate the condition.
480   These rules allow HTTP/1.1 caches and clients to safely perform sub-range
481   retrievals on values that have been obtained from HTTP/1.0
482   servers.
486<section title="Rules for When to Use Entity Tags and Last-Modified Dates" anchor="">
488   We adopt a set of rules and recommendations for origin servers,
489   clients, and caches regarding when various validator types ought to
490   be used, and for what purposes.
493   HTTP/1.1 origin servers:
494  <list style="symbols">
495     <t>&SHOULD; send an entity tag validator unless it is not feasible to
496        generate one.</t>
498     <t>&MAY; send a weak entity tag instead of a strong entity tag, if
499        performance considerations support the use of weak entity tags,
500        or if it is unfeasible to send a strong entity tag.</t>
502     <t>&SHOULD; send a Last-Modified value if it is feasible to send one,
503        unless the risk of a breakdown in semantic transparency that
504        could result from using this date in an If-Modified-Since header
505        would lead to serious problems.</t>
506  </list>
509   In other words, the preferred behavior for an HTTP/1.1 origin server
510   is to send both a strong entity tag and a Last-Modified value.
513   In order to be legal, a strong entity tag &MUST; change whenever the
514   associated entity value changes in any way. A weak entity tag &SHOULD;
515   change whenever the associated entity changes in a semantically
516   significant way.
517  <list><t>
518      <x:h>Note:</x:h> in order to provide semantically transparent caching, an
519      origin server must avoid reusing a specific strong entity tag
520      value for two different entities, or reusing a specific weak
521      entity tag value for two semantically different entities. Cache
522      entries might persist for arbitrarily long periods, regardless of
523      expiration times, so it might be inappropriate to expect that a
524      cache will never again attempt to validate an entry using a
525      validator that it obtained at some point in the past.
526  </t></list>
529   HTTP/1.1 clients:
530  <list style="symbols">
531     <t>If an entity tag has been provided by the origin server, &MUST;
532        use that entity tag in any cache-conditional request (using If-Match
533        or If-None-Match).</t>
535     <t>If only a Last-Modified value has been provided by the origin
536        server, &SHOULD; use that value in non-subrange cache-conditional
537        requests (using If-Modified-Since).</t>
539     <t>If only a Last-Modified value has been provided by an HTTP/1.0
540        origin server, &MAY; use that value in subrange cache-conditional
541        requests (using If-Unmodified-Since:). The user agent &SHOULD;
542        provide a way to disable this, in case of difficulty.</t>
544     <t>If both an entity tag and a Last-Modified value have been
545        provided by the origin server, &SHOULD; use both validators in
546        cache-conditional requests. This allows both HTTP/1.0 and
547        HTTP/1.1 caches to respond appropriately.</t>
548  </list>
551   An HTTP/1.1 origin server, upon receiving a conditional request that
552   includes both a Last-Modified date (e.g., in an If-Modified-Since or
553   If-Unmodified-Since header field) and one or more entity tags (e.g.,
554   in an If-Match, If-None-Match, or If-Range header field) as cache
555   validators, &MUST-NOT; return a response status of 304 (Not Modified)
556   unless doing so is consistent with all of the conditional header
557   fields in the request.
560   An HTTP/1.1 caching proxy, upon receiving a conditional request that
561   includes both a Last-Modified date and one or more entity tags as
562   cache validators, &MUST-NOT; return a locally cached response to the
563   client unless that cached response is consistent with all of the
564   conditional header fields in the request.
565  <list><t>
566      <x:h>Note:</x:h> The general principle behind these rules is that HTTP/1.1
567      servers and clients should transmit as much non-redundant
568      information as is available in their responses and requests.
569      HTTP/1.1 systems receiving this information will make the most
570      conservative assumptions about the validators they receive.
571  </t><t>
572      HTTP/1.0 clients and caches will ignore entity tags. Generally,
573      last-modified values received or used by these systems will
574      support transparent and efficient caching, and so HTTP/1.1 origin
575      servers should provide Last-Modified values. In those rare cases
576      where the use of a Last-Modified value as a validator by an
577      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
578      origin servers should not provide one.
579  </t></list>
583<section title="Header Field Definitions" anchor="header.fields">
585   This section defines the syntax and semantics of HTTP/1.1 header fields
586   related to conditional requests.
589   For entity-header fields, both sender and recipient refer to either the
590   client or the server, depending on who sends and who receives the entity.
593<section title="ETag" anchor="header.etag">
594  <iref primary="true" item="ETag header" x:for-anchor=""/>
595  <iref primary="true" item="Headers" subitem="ETag" x:for-anchor=""/>
597   The ETag response-header field provides the current value of the
598   entity tag for the requested variant. The headers used with entity
599   tags are described in Sections <xref target="header.if-match" format="counter"/>
600   and <xref target="header.if-none-match" format="counter"/> of this document,
601   and in &header-if-range;. The entity tag
602   &MAY; be used for comparison with other entities from the same resource
603   (see <xref target="weak.and.strong.validators"/>).
605<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/>
606  ETag = "ETag" ":" entity-tag
609   Examples:
611<artwork type="example">
612   ETag: "xyzzy"
613   ETag: W/"xyzzy"
614   ETag: ""
617   The ETag response-header field value, an entity tag, provides for an
618   "opaque" cache validator. This might allow more reliable validation
619   in situations where it is inconvenient to store modification dates,
620   where the one-second resolution of HTTP date values is not
621   sufficient, or where the origin server wishes to avoid certain
622   paradoxes that might arise from the use of modification dates.
625   The principle behind entity tags is that only the service author
626   knows the semantics of a resource well enough to select an
627   appropriate cache validation mechanism, and the specification of any
628   validator comparison function more complex than byte-equality would
629   open up a can of worms. Thus, comparisons of any other headers
630   (except Last-Modified, for compatibility with HTTP/1.0) are never
631   used for purposes of validating a cache entry.
635<section title="If-Match" anchor="header.if-match">
636  <iref primary="true" item="If-Match header" x:for-anchor=""/>
637  <iref primary="true" item="Headers" subitem="If-Match" x:for-anchor=""/>
639   The If-Match request-header field is used with a method to make it
640   conditional. A client that has one or more entities previously
641   obtained from the resource can verify that one of those entities is
642   current by including a list of their associated entity tags in the
643   If-Match header field. Entity tags are defined in <xref target="entity.tags"/>. The
644   purpose of this feature is to allow efficient updates of cached
645   information with a minimum amount of transaction overhead. It is also
646   used, on updating requests, to prevent inadvertent modification of
647   the wrong version of a resource. As a special case, the value "*"
648   matches any current entity of the resource.
650<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
651  If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
654   If any of the entity tags match the entity tag of the entity that
655   would have been returned in the response to a similar GET request
656   (without the If-Match header) on that resource, or if "*" is given
657   and any current entity exists for that resource, then the server &MAY;
658   perform the requested method as if the If-Match header field did not
659   exist.
662   A server &MUST; use the strong comparison function (see <xref target="weak.and.strong.validators"/>)
663   to compare the entity tags in If-Match.
666   If none of the entity tags match, or if "*" is given and no current
667   entity exists, the server &MUST-NOT; perform the requested method, and
668   &MUST; return a 412 (Precondition Failed) response. This behavior is
669   most useful when the client wants to prevent an updating method, such
670   as PUT, from modifying a resource that has changed since the client
671   last retrieved it.
674   If the request would, without the If-Match header field, result in
675   anything other than a 2xx or 412 status, then the If-Match header
676   &MUST; be ignored.
679   The meaning of "If-Match: *" is that the method &SHOULD; be performed
680   if the representation selected by the origin server (or by a cache,
681   possibly using the Vary mechanism, see &header-vary;) exists, and
682   &MUST-NOT; be performed if the representation does not exist.
685   A request intended to update a resource (e.g., a PUT) &MAY; include an
686   If-Match header field to signal that the request method &MUST-NOT; be
687   applied if the entity corresponding to the If-Match value (a single
688   entity tag) is no longer a representation of that resource. This
689   allows the user to indicate that they do not wish the request to be
690   successful if the resource has been changed without their knowledge.
691   Examples:
693<figure><artwork type="example">
694    If-Match: "xyzzy"
695    If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
696    If-Match: *
699   The result of a request having both an If-Match header field and
700   either an If-None-Match or an If-Modified-Since header fields is
701   undefined by this specification.
705<section title="If-Modified-Since" anchor="header.if-modified-since">
706  <iref primary="true" item="If-Modified-Since header" x:for-anchor=""/>
707  <iref primary="true" item="Headers" subitem="If-Modified-Since" x:for-anchor=""/>
709   The If-Modified-Since request-header field is used with a method to
710   make it conditional: if the requested variant has not been modified
711   since the time specified in this field, an entity will not be
712   returned from the server; instead, a 304 (Not Modified) response will
713   be returned without any message-body.
715<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
716  If-Modified-Since = "If-Modified-Since" ":" HTTP-date
719   An example of the field is:
721<figure><artwork type="example">
722    If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
725   A GET method with an If-Modified-Since header and no Range header
726   requests that the identified entity be transferred only if it has
727   been modified since the date given by the If-Modified-Since header.
728   The algorithm for determining this includes the following cases:
729  <list style="numbers">
730      <t>If the request would normally result in anything other than a
731         200 (OK) status, or if the passed If-Modified-Since date is
732         invalid, the response is exactly the same as for a normal GET.
733         A date which is later than the server's current time is
734         invalid.</t>
736      <t>If the variant has been modified since the If-Modified-Since
737         date, the response is exactly the same as for a normal GET.</t>
739      <t>If the variant has not been modified since a valid If-Modified-Since
740         date, the server &SHOULD; return a 304 (Not
741         Modified) response.</t>
742  </list>
745   The purpose of this feature is to allow efficient updates of cached
746   information with a minimum amount of transaction overhead.
747  <list><t>
748      <x:h>Note:</x:h> The Range request-header field modifies the meaning of If-Modified-Since;
749      see &header-range; for full details.
750    </t><t>
751      <x:h>Note:</x:h> If-Modified-Since times are interpreted by the server, whose
752      clock might not be synchronized with the client.
753    </t><t>
754      <x:h>Note:</x:h> When handling an If-Modified-Since header field, some
755      servers will use an exact date comparison function, rather than a
756      less-than function, for deciding whether to send a 304 (Not
757      Modified) response. To get best results when sending an If-Modified-Since
758      header field for cache validation, clients are
759      advised to use the exact date string received in a previous Last-Modified
760      header field whenever possible.
761    </t><t>
762      <x:h>Note:</x:h> If a client uses an arbitrary date in the If-Modified-Since
763      header instead of a date taken from the Last-Modified header for
764      the same request, the client should be aware of the fact that this
765      date is interpreted in the server's understanding of time. The
766      client should consider unsynchronized clocks and rounding problems
767      due to the different encodings of time between the client and
768      server. This includes the possibility of race conditions if the
769      document has changed between the time it was first requested and
770      the If-Modified-Since date of a subsequent request, and the
771      possibility of clock-skew-related problems if the If-Modified-Since
772      date is derived from the client's clock without correction
773      to the server's clock. Corrections for different time bases
774      between client and server are at best approximate due to network
775      latency.
776    </t>
777  </list>
780   The result of a request having both an If-Modified-Since header field
781   and either an If-Match or an If-Unmodified-Since header fields is
782   undefined by this specification.
786<section title="If-None-Match" anchor="header.if-none-match">
787  <iref primary="true" item="If-None-Match header" x:for-anchor=""/>
788  <iref primary="true" item="Headers" subitem="If-None-Match" x:for-anchor=""/>
790   The If-None-Match request-header field is used with a method to make
791   it conditional. A client that has one or more entities previously
792   obtained from the resource can verify that none of those entities is
793   current by including a list of their associated entity tags in the
794   If-None-Match header field. The purpose of this feature is to allow
795   efficient updates of cached information with a minimum amount of
796   transaction overhead. It is also used to prevent a method (e.g. PUT)
797   from inadvertently modifying an existing resource when the client
798   believes that the resource does not exist.
801   As a special case, the value "*" matches any current entity of the
802   resource.
804<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
805  If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
808   If any of the entity tags match the entity tag of the entity that
809   would have been returned in the response to a similar GET request
810   (without the If-None-Match header) on that resource, or if "*" is
811   given and any current entity exists for that resource, then the
812   server &MUST-NOT; perform the requested method, unless required to do
813   so because the resource's modification date fails to match that
814   supplied in an If-Modified-Since header field in the request.
815   Instead, if the request method was GET or HEAD, the server &SHOULD;
816   respond with a 304 (Not Modified) response, including the cache-related
817   header fields (particularly ETag) of one of the entities that
818   matched. For all other request methods, the server &MUST; respond with
819   a status of 412 (Precondition Failed).
822   See <xref target="weak.and.strong.validators"/> for rules on how to determine if two entities tags
823   match. The weak comparison function can only be used with GET or HEAD
824   requests.
827   If none of the entity tags match, then the server &MAY; perform the
828   requested method as if the If-None-Match header field did not exist,
829   but &MUST; also ignore any If-Modified-Since header field(s) in the
830   request. That is, if no entity tags match, then the server &MUST-NOT;
831   return a 304 (Not Modified) response.
834   If the request would, without the If-None-Match header field, result
835   in anything other than a 2xx or 304 status, then the If-None-Match
836   header &MUST; be ignored. (See <xref target=""/> for a discussion of
837   server behavior when both If-Modified-Since and If-None-Match appear
838   in the same request.)
841   The meaning of "If-None-Match: *" is that the method &MUST-NOT; be
842   performed if the representation selected by the origin server (or by
843   a cache, possibly using the Vary mechanism, see &header-vary;)
844   exists, and &SHOULD; be performed if the representation does not exist.
845   This feature is intended to be useful in preventing races between PUT
846   operations.
849   Examples:
851<figure><artwork type="example">
852    If-None-Match: "xyzzy"
853    If-None-Match: W/"xyzzy"
854    If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
855    If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
856    If-None-Match: *
859   The result of a request having both an If-None-Match header field and
860   either an If-Match or an If-Unmodified-Since header fields is
861   undefined by this specification.
865<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
866  <iref primary="true" item="If-Unmodified-Since header" x:for-anchor=""/>
867  <iref primary="true" item="Headers" subitem="If-Unmodified-Since" x:for-anchor=""/>
869   The If-Unmodified-Since request-header field is used with a method to
870   make it conditional. If the requested resource has not been modified
871   since the time specified in this field, the server &SHOULD; perform the
872   requested operation as if the If-Unmodified-Since header were not
873   present.
876   If the requested variant has been modified since the specified time,
877   the server &MUST-NOT; perform the requested operation, and &MUST; return
878   a 412 (Precondition Failed).
880<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
881  If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
884   An example of the field is:
886<figure><artwork type="example">
887    If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
890   If the request normally (i.e., without the If-Unmodified-Since
891   header) would result in anything other than a 2xx or 412 status, the
892   If-Unmodified-Since header &SHOULD; be ignored.
895   If the specified date is invalid, the header is ignored.
898   The result of a request having both an If-Unmodified-Since header
899   field and either an If-None-Match or an If-Modified-Since header
900   fields is undefined by this specification.
904<section title="Last-Modified" anchor="header.last-modified">
905  <iref primary="true" item="Last-Modified header" x:for-anchor=""/>
906  <iref primary="true" item="Headers" subitem="Last-Modified" x:for-anchor=""/>
908   The Last-Modified entity-header field indicates the date and time at
909   which the origin server believes the variant was last modified.
911<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
912  Last-Modified  = "Last-Modified" ":" HTTP-date
915   An example of its use is
917<figure><artwork type="example">
918    Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
921   The exact meaning of this header field depends on the implementation
922   of the origin server and the nature of the original resource. For
923   files, it may be just the file system last-modified time. For
924   entities with dynamically included parts, it may be the most recent
925   of the set of last-modify times for its component parts. For database
926   gateways, it may be the last-update time stamp of the record. For
927   virtual objects, it may be the last time the internal state changed.
930   An origin server &MUST-NOT; send a Last-Modified date which is later
931   than the server's time of message origination. In such cases, where
932   the resource's last modification would indicate some time in the
933   future, the server &MUST; replace that date with the message
934   origination date.
937   An origin server &SHOULD; obtain the Last-Modified value of the entity
938   as close as possible to the time that it generates the Date value of
939   its response. This allows a recipient to make an accurate assessment
940   of the entity's modification time, especially if the entity changes
941   near the time that the response is generated.
944   HTTP/1.1 servers &SHOULD; send Last-Modified whenever feasible.
947   The Last-Modified entity-header field value is often used as a cache
948   validator. In simple terms, a cache entry is considered to be valid
949   if the entity has not been modified since the Last-Modified value.
955<section title="IANA Considerations" anchor="IANA.considerations">
957   TBD.
961<section title="Security Considerations" anchor="security.considerations">
963   No additional security considerations have been identified beyond
964   those applicable to HTTP in general &messaging;.
968<section title="Acknowledgments" anchor="ack">
973<references title="Normative References">
975<reference anchor="Part1">
976  <front>
977    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
978    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
979      <organization abbrev="Day Software">Day Software</organization>
980      <address><email></email></address>
981    </author>
982    <author initials="J." surname="Gettys" fullname="Jim Gettys">
983      <organization>One Laptop per Child</organization>
984      <address><email></email></address>
985    </author>
986    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
987      <organization abbrev="HP">Hewlett-Packard Company</organization>
988      <address><email></email></address>
989    </author>
990    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
991      <organization abbrev="Microsoft">Microsoft Corporation</organization>
992      <address><email></email></address>
993    </author>
994    <author initials="L." surname="Masinter" fullname="Larry Masinter">
995      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
996      <address><email></email></address>
997    </author>
998    <author initials="P." surname="Leach" fullname="Paul J. Leach">
999      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1000      <address><email></email></address>
1001    </author>
1002    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1003      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1004      <address><email></email></address>
1005    </author>
1006    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1007      <organization abbrev="W3C">World Wide Web Consortium</organization>
1008      <address><email></email></address>
1009    </author>
1010    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1011      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1012      <address><email></email></address>
1013    </author>
1014    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1015  </front>
1016  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/>
1017  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
1020<reference anchor="Part5">
1021  <front>
1022    <title abbrev="HTTP/1.1">HTTP/1.1, part 5: Range Requests and Partial Responses</title>
1023    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1024      <organization abbrev="Day Software">Day Software</organization>
1025      <address><email></email></address>
1026    </author>
1027    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1028      <organization>One Laptop per Child</organization>
1029      <address><email></email></address>
1030    </author>
1031    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1032      <organization abbrev="HP">Hewlett-Packard Company</organization>
1033      <address><email></email></address>
1034    </author>
1035    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1036      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1037      <address><email></email></address>
1038    </author>
1039    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1040      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1041      <address><email></email></address>
1042    </author>
1043    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1044      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1045      <address><email></email></address>
1046    </author>
1047    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1048      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1049      <address><email></email></address>
1050    </author>
1051    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1052      <organization abbrev="W3C">World Wide Web Consortium</organization>
1053      <address><email></email></address>
1054    </author>
1055    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1056      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1057      <address><email></email></address>
1058    </author>
1059    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1060  </front>
1061  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/>
1062  <x:source href="p5-range.xml" basename="p5-range"/>
1065<reference anchor="Part6">
1066  <front>
1067    <title abbrev="HTTP/1.1">HTTP/1.1, part 6: Caching</title>
1068    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1069      <organization abbrev="Day Software">Day Software</organization>
1070      <address><email></email></address>
1071    </author>
1072    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1073      <organization>One Laptop per Child</organization>
1074      <address><email></email></address>
1075    </author>
1076    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1077      <organization abbrev="HP">Hewlett-Packard Company</organization>
1078      <address><email></email></address>
1079    </author>
1080    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1081      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1082      <address><email></email></address>
1083    </author>
1084    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1085      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1086      <address><email></email></address>
1087    </author>
1088    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1089      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1090      <address><email></email></address>
1091    </author>
1092    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1093      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1094      <address><email></email></address>
1095    </author>
1096    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1097      <organization abbrev="W3C">World Wide Web Consortium</organization>
1098      <address><email></email></address>
1099    </author>
1100    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1101      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1102      <address><email></email></address>
1103    </author>
1104    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1105  </front>
1106  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
1107  <x:source href="p6-cache.xml" basename="p6-cache"/>
1110<reference anchor="RFC2119">
1111  <front>
1112    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1113    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1114      <organization>Harvard University</organization>
1115      <address><email></email></address>
1116    </author>
1117    <date month="March" year="1997"/>
1118  </front>
1119  <seriesInfo name="BCP" value="14"/>
1120  <seriesInfo name="RFC" value="2119"/>
1125<references title="Informative References">
1127<reference anchor="RFC2068">
1128  <front>
1129    <title abbrev="HTTP/1.1">Hypertext Transfer Protocol -- HTTP/1.1</title>
1130    <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
1131      <organization>University of California, Irvine, Department of Information and Computer Science</organization>
1132      <address><email></email></address>
1133    </author>
1134    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1135      <organization>MIT Laboratory for Computer Science</organization>
1136      <address><email></email></address>
1137    </author>
1138    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1139      <organization>Digital Equipment Corporation, Western Research Laboratory</organization>
1140      <address><email></email></address>
1141    </author>
1142    <author initials="H." surname="Nielsen" fullname="Henrik Frystyk Nielsen">
1143      <organization>MIT Laboratory for Computer Science</organization>
1144      <address><email></email></address>
1145    </author>
1146    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1147      <organization>MIT Laboratory for Computer Science</organization>
1148      <address><email></email></address>
1149    </author>
1150    <date month="January" year="1997"/>
1151  </front>
1152  <seriesInfo name="RFC" value="2068"/>
1155<reference anchor="RFC2616">
1156  <front>
1157    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1158    <author initials="R." surname="Fielding" fullname="R. Fielding">
1159      <organization>University of California, Irvine</organization>
1160      <address><email></email></address>
1161    </author>
1162    <author initials="J." surname="Gettys" fullname="J. Gettys">
1163      <organization>W3C</organization>
1164      <address><email></email></address>
1165    </author>
1166    <author initials="J." surname="Mogul" fullname="J. Mogul">
1167      <organization>Compaq Computer Corporation</organization>
1168      <address><email></email></address>
1169    </author>
1170    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1171      <organization>MIT Laboratory for Computer Science</organization>
1172      <address><email></email></address>
1173    </author>
1174    <author initials="L." surname="Masinter" fullname="L. Masinter">
1175      <organization>Xerox Corporation</organization>
1176      <address><email></email></address>
1177    </author>
1178    <author initials="P." surname="Leach" fullname="P. Leach">
1179      <organization>Microsoft Corporation</organization>
1180      <address><email></email></address>
1181    </author>
1182    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1183      <organization>W3C</organization>
1184      <address><email></email></address>
1185    </author>
1186    <date month="June" year="1999"/>
1187  </front>
1188  <seriesInfo name="RFC" value="2616"/>
1193<section title="Compatibility with Previous Versions" anchor="compatibility">
1195<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1200<section title="Change Log (to be removed by RFC Editor before publication)">
1202<section title="Since RFC2616">
1204  Extracted relevant partitions from <xref target="RFC2616"/>.
1208<section title="Since draft-ietf-httpbis-p4-conditional-00">
1210  Closed issues:
1211  <list style="symbols">
1212    <t>
1213      <eref target=""/>:
1214      "Normative and Informative references"
1215    </t>
1216  </list>
1219  Other changes:
1220  <list style="symbols">
1221    <t>
1222      Move definitions of 304 and 412 condition codes from Part2.
1223    </t>
1224  </list>
1228<section title="Since draft-ietf-httpbis-p4-conditional-01">
Note: See TracBrowser for help on using the repository browser.