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

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

Insert cross-document references.

  • Property svn:eol-style set to native
File size: 41.4 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE rfc [
3  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
4  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
5  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
6  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
7  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
8  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
9  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
10  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
11  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
12  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
13  <!ENTITY ID-VERSION "latest">
14  <!ENTITY ID-MONTH "December">
15  <!ENTITY ID-YEAR "2007">
16  <!ENTITY messaging                  "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
17  <!ENTITY header-if-range            "<xref target='Part5' x:rel='#header.if-range' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
18  <!ENTITY header-range               "<xref target='Part5' x:rel='#header.range' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
19  <!ENTITY header-vary                "<xref target='Part6' x:rel='#header.vary' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
20]>
21<?rfc toc="yes" ?>
22<?rfc symrefs="yes" ?>
23<?rfc sortrefs="yes" ?>
24<?rfc compact="yes"?>
25<?rfc subcompact="no" ?>
26<?rfc linkmailto="no" ?>
27<?rfc editing="no" ?>
28<?rfc-ext allow-markup-in-artwork="yes" ?>
29<?rfc-ext include-references-in-index="yes" ?>
30<rfc obsoletes="2068, 2616, 2617" category="std"
31     ipr="full3978" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"
32     xmlns:x='http://purl.org/net/xml2rfc/ext' xmlns:ed="http://greenbytes.de/2002/rfcedit">
33<front>
34
35  <title abbrev="HTTP/1.1, part 4">HTTP/1.1, part 4: Conditional Requests</title>
36
37  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
38    <organization abbrev="Day Software">Day Software</organization>
39    <address>
40      <postal>
41        <street>23 Corporate Plaza DR, Suite 280</street>
42        <city>Newport Beach</city>
43        <region>CA</region>
44        <code>92660</code>
45        <country>USA</country>
46      </postal>
47      <phone>+1-949-706-5300</phone>
48      <facsimile>+1-949-706-5305</facsimile>
49      <email>fielding@gbiv.com</email>
50      <uri>http://roy.gbiv.com/</uri>
51    </address>
52  </author>
53
54  <author initials="J." surname="Gettys" fullname="Jim Gettys">
55    <organization>One Laptop per Child</organization>
56    <address>
57      <postal>
58        <street>21 Oak Knoll Road</street>
59        <city>Carlisle</city>
60        <region>MA</region>
61        <code>01741</code>
62        <country>USA</country>
63      </postal>
64      <email>jg@laptop.org</email>
65      <uri>http://www.laptop.org/</uri>
66    </address>
67  </author>
68 
69  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
70    <organization abbrev="HP">Hewlett-Packard Company</organization>
71    <address>
72      <postal>
73        <street>HP Labs, Large Scale Systems Group</street>
74        <street>1501 Page Mill Road, MS 1177</street>
75        <city>Palo Alto</city>
76        <region>CA</region>
77        <code>94304</code>
78        <country>USA</country>
79      </postal>
80      <email>JeffMogul@acm.org</email>
81    </address>
82  </author>
83
84  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
85    <organization abbrev="Microsoft">Microsoft Corporation</organization>
86    <address>
87      <postal>
88        <street>1 Microsoft Way</street>
89        <city>Redmond</city>
90        <region>WA</region>
91        <code>98052</code>
92        <country>USA</country>
93      </postal>
94      <email>henrikn@microsoft.com</email>
95    </address>
96  </author>
97
98  <author initials="L." surname="Masinter" fullname="Larry Masinter">
99    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
100    <address>
101      <postal>
102        <street>345 Park Ave</street>
103        <city>San Jose</city>
104        <region>CA</region>
105        <code>95110</code>
106        <country>USA</country>
107      </postal>
108      <email>LMM@acm.org</email>
109      <uri>http://larry.masinter.net/</uri>
110    </address>
111  </author>
112 
113  <author initials="P." surname="Leach" fullname="Paul J. Leach">
114    <organization abbrev="Microsoft">Microsoft Corporation</organization>
115    <address>
116      <postal>
117        <street>1 Microsoft Way</street>
118        <city>Redmond</city>
119        <region>WA</region>
120        <code>98052</code>
121      </postal>
122      <email>paulle@microsoft.com</email>
123    </address>
124  </author>
125   
126  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
127    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
128    <address>
129      <postal>
130        <street>MIT Laboratory for Computer Science</street>
131        <street>545 Technology Square</street>
132        <city>Cambridge</city>
133        <region>MA</region>
134        <code>02139</code>
135        <country>USA</country>
136      </postal>
137      <facsimile>+1 (617) 258 8682</facsimile>
138      <email>timbl@w3.org</email>
139    </address>
140  </author>
141
142  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
143
144<abstract>
145<t>
146   The Hypertext Transfer Protocol (HTTP) is an application-level
147   protocol for distributed, collaborative, hypermedia information
148   systems. HTTP has been in use by the World Wide Web global information
149   initiative since 1990. This document is Part 4 of the eight-part specification
150   that defines the protocol referred to as "HTTP/1.1" and, taken together,
151   updates RFC 2616 and RFC 2617.  Part 4 defines request header fields for
152   indicating conditional requests and the rules for constructing responses
153   to those requests.
154</t>
155</abstract>
156</front>
157<middle>
158<section title="Introduction" anchor="introduction">
159<t>
160   This document will define aspects of HTTP related to conditional
161   request messages based on time stamps and entity-tags.  Right now it
162   only includes the extracted relevant sections of <xref target="RFC2616">RFC 2616</xref>
163   without edit.
164</t>
165</section>
166
167<section title="Entity Tags" anchor="entity.tags">
168<t>
169   Entity tags are used for comparing two or more entities from the same
170   requested resource. HTTP/1.1 uses entity tags in the ETag (<xref target="header.etag"/>),
171   If-Match (<xref target="header.if-match"/>), If-None-Match (<xref target="header.if-none-match"/>), and
172   If-Range (&header-if-range;) header fields. The definition of how they
173   are used and compared as cache validators is in <xref target="weak.and.strong.validators"/>. An
174   entity tag consists of an opaque quoted string, possibly prefixed by
175   a weakness indicator.
176</t>
177<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"/>
178   entity-tag = [ weak ] opaque-tag
179   weak       = "W/"
180   opaque-tag = quoted-string
181</artwork></figure>
182<t>
183   A "strong entity tag" &MAY; be shared by two entities of a resource
184   only if they are equivalent by octet equality.
185</t>
186<t>
187   A "weak entity tag," indicated by the "W/" prefix, &MAY; be shared by
188   two entities of a resource only if the entities are equivalent and
189   could be substituted for each other with no significant change in
190   semantics. A weak entity tag can only be used for weak comparison.
191</t>
192<t>
193   An entity tag &MUST; be unique across all versions of all entities
194   associated with a particular resource. A given entity tag value &MAY;
195   be used for entities obtained by requests on different URIs. The use
196   of the same entity tag value in conjunction with entities obtained by
197   requests on different URIs does not imply the equivalence of those
198   entities.
199</t>
200</section>
201
202<section title="Weak and Strong Validators" anchor="weak.and.strong.validators">
203<t>
204   Since both origin servers and caches will compare two validators to
205   decide if they represent the same or different entities, one normally
206   would expect that if the entity (the entity-body or any entity-headers)
207   changes in any way, then the associated validator would
208   change as well. If this is true, then we call this validator a
209   "strong validator."
210</t>
211<t>
212   However, there might be cases when a server prefers to change the
213   validator only on semantically significant changes, and not when
214   insignificant aspects of the entity change. A validator that does not
215   always change when the resource changes is a "weak validator."
216</t>
217<t>
218   Entity tags are normally "strong validators," but the protocol
219   provides a mechanism to tag an entity tag as "weak." One can think of
220   a strong validator as one that changes whenever the bits of an entity
221   changes, while a weak value changes whenever the meaning of an entity
222   changes. Alternatively, one can think of a strong validator as part
223   of an identifier for a specific entity, while a weak validator is
224   part of an identifier for a set of semantically equivalent entities.
225  <list><t>
226      <x:h>Note:</x:h> One example of a strong validator is an integer that is
227      incremented in stable storage every time an entity is changed.
228    </t><t>
229      An entity's modification time, if represented with one-second
230      resolution, could be a weak validator, since it is possible that
231      the resource might be modified twice during a single second.
232    </t><t>
233      Support for weak validators is optional. However, weak validators
234      allow for more efficient caching of equivalent objects; for
235      example, a hit counter on a site is probably good enough if it is
236      updated every few days or weeks, and any value during that period
237      is likely "good enough" to be equivalent.
238    </t></list>
239</t>
240<t>
241   A "use" of a validator is either when a client generates a request
242   and includes the validator in a validating header field, or when a
243   server compares two validators.
244</t>
245<t>
246   Strong validators are usable in any context. Weak validators are only
247   usable in contexts that do not depend on exact equality of an entity.
248   For example, either kind is usable for a conditional GET of a full
249   entity. However, only a strong validator is usable for a sub-range
250   retrieval, since otherwise the client might end up with an internally
251   inconsistent entity.
252</t>
253<t>
254   Clients &MAY; issue simple (non-subrange) GET requests with either weak
255   validators or strong validators. Clients &MUST-NOT; use weak validators
256   in other forms of request.
257</t>
258<t>
259   The only function that the HTTP/1.1 protocol defines on validators is
260   comparison. There are two validator comparison functions, depending
261   on whether the comparison context allows the use of weak validators
262   or not:
263  <list style="symbols">
264     <t>The strong comparison function: in order to be considered equal,
265        both validators &MUST; be identical in every way, and both &MUST-NOT;
266        be weak.</t>
267     <t>The weak comparison function: in order to be considered equal,
268        both validators &MUST; be identical in every way, but either or
269        both of them &MAY; be tagged as "weak" without affecting the
270        result.</t>
271  </list>
272</t>
273<t>
274   An entity tag is strong unless it is explicitly tagged as weak.
275   <xref target="entity.tags"/> gives the syntax for entity tags.
276</t>
277<t>
278   A Last-Modified time, when used as a validator in a request, is
279   implicitly weak unless it is possible to deduce that it is strong,
280   using the following rules:
281  <list style="symbols">
282     <t>The validator is being compared by an origin server to the
283        actual current validator for the entity and,</t>
284     <t>That origin server reliably knows that the associated entity did
285        not change twice during the second covered by the presented
286        validator.</t>
287  </list>
288</t>
289<t>
290   or
291  <list style="symbols">
292     <t>The validator is about to be used by a client in an If-Modified-Since
293        or If-Unmodified-Since header, because the client
294        has a cache entry for the associated entity, and</t>
295     <t>That cache entry includes a Date value, which gives the time
296        when the origin server sent the original response, and</t>
297     <t>The presented Last-Modified time is at least 60 seconds before
298        the Date value.</t>
299  </list>
300</t>
301<t>
302   or
303  <list style="symbols">
304     <t>The validator is being compared by an intermediate cache to the
305        validator stored in its cache entry for the entity, and</t>
306     <t>That cache entry includes a Date value, which gives the time
307        when the origin server sent the original response, and</t>
308     <t>The presented Last-Modified time is at least 60 seconds before
309        the Date value.</t>
310  </list>
311</t>
312<t>
313   This method relies on the fact that if two different responses were
314   sent by the origin server during the same second, but both had the
315   same Last-Modified time, then at least one of those responses would
316   have a Date value equal to its Last-Modified time. The arbitrary 60-second
317   limit guards against the possibility that the Date and Last-Modified
318   values are generated from different clocks, or at somewhat
319   different times during the preparation of the response. An
320   implementation &MAY; use a value larger than 60 seconds, if it is
321   believed that 60 seconds is too short.
322</t>
323<t>
324   If a client wishes to perform a sub-range retrieval on a value for
325   which it has only a Last-Modified time and no opaque validator, it
326   &MAY; do this only if the Last-Modified time is strong in the sense
327   described here.
328</t>
329<t>
330   A cache or origin server receiving a conditional request, other than
331   a full-body GET request, &MUST; use the strong comparison function to
332   evaluate the condition.
333</t>
334<t>
335   These rules allow HTTP/1.1 caches and clients to safely perform sub-range
336   retrievals on values that have been obtained from HTTP/1.0
337   servers.
338</t>
339</section>
340
341<section title="Rules for When to Use Entity Tags and Last-Modified Dates" anchor="rules.for.when.to.use.entity.tags.and.last-modified.dates">
342<t>
343   We adopt a set of rules and recommendations for origin servers,
344   clients, and caches regarding when various validator types ought to
345   be used, and for what purposes.
346</t>
347<t>
348   HTTP/1.1 origin servers:
349  <list style="symbols">
350     <t>&SHOULD; send an entity tag validator unless it is not feasible to
351        generate one.</t>
352
353     <t>&MAY; send a weak entity tag instead of a strong entity tag, if
354        performance considerations support the use of weak entity tags,
355        or if it is unfeasible to send a strong entity tag.</t>
356
357     <t>&SHOULD; send a Last-Modified value if it is feasible to send one,
358        unless the risk of a breakdown in semantic transparency that
359        could result from using this date in an If-Modified-Since header
360        would lead to serious problems.</t>
361  </list>
362</t>
363<t>
364   In other words, the preferred behavior for an HTTP/1.1 origin server
365   is to send both a strong entity tag and a Last-Modified value.
366</t>
367<t>
368   In order to be legal, a strong entity tag &MUST; change whenever the
369   associated entity value changes in any way. A weak entity tag &SHOULD;
370   change whenever the associated entity changes in a semantically
371   significant way.
372  <list><t>
373      <x:h>Note:</x:h> in order to provide semantically transparent caching, an
374      origin server must avoid reusing a specific strong entity tag
375      value for two different entities, or reusing a specific weak
376      entity tag value for two semantically different entities. Cache
377      entries might persist for arbitrarily long periods, regardless of
378      expiration times, so it might be inappropriate to expect that a
379      cache will never again attempt to validate an entry using a
380      validator that it obtained at some point in the past.
381  </t></list>
382</t>
383<t>
384   HTTP/1.1 clients:
385  <list style="symbols">
386     <t>If an entity tag has been provided by the origin server, &MUST;
387        use that entity tag in any cache-conditional request (using If-Match
388        or If-None-Match).</t>
389
390     <t>If only a Last-Modified value has been provided by the origin
391        server, &SHOULD; use that value in non-subrange cache-conditional
392        requests (using If-Modified-Since).</t>
393
394     <t>If only a Last-Modified value has been provided by an HTTP/1.0
395        origin server, &MAY; use that value in subrange cache-conditional
396        requests (using If-Unmodified-Since:). The user agent &SHOULD;
397        provide a way to disable this, in case of difficulty.</t>
398
399     <t>If both an entity tag and a Last-Modified value have been
400        provided by the origin server, &SHOULD; use both validators in
401        cache-conditional requests. This allows both HTTP/1.0 and
402        HTTP/1.1 caches to respond appropriately.</t>
403  </list>
404</t>
405<t>
406   An HTTP/1.1 origin server, upon receiving a conditional request that
407   includes both a Last-Modified date (e.g., in an If-Modified-Since or
408   If-Unmodified-Since header field) and one or more entity tags (e.g.,
409   in an If-Match, If-None-Match, or If-Range header field) as cache
410   validators, &MUST-NOT; return a response status of 304 (Not Modified)
411   unless doing so is consistent with all of the conditional header
412   fields in the request.
413</t>
414<t>
415   An HTTP/1.1 caching proxy, upon receiving a conditional request that
416   includes both a Last-Modified date and one or more entity tags as
417   cache validators, &MUST-NOT; return a locally cached response to the
418   client unless that cached response is consistent with all of the
419   conditional header fields in the request.
420  <list><t>
421      <x:h>Note:</x:h> The general principle behind these rules is that HTTP/1.1
422      servers and clients should transmit as much non-redundant
423      information as is available in their responses and requests.
424      HTTP/1.1 systems receiving this information will make the most
425      conservative assumptions about the validators they receive.
426  </t><t>
427      HTTP/1.0 clients and caches will ignore entity tags. Generally,
428      last-modified values received or used by these systems will
429      support transparent and efficient caching, and so HTTP/1.1 origin
430      servers should provide Last-Modified values. In those rare cases
431      where the use of a Last-Modified value as a validator by an
432      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
433      origin servers should not provide one.
434  </t></list>
435</t>
436</section>
437
438<section title="Header Field Definitions" anchor="header.fields">
439<t>
440   This section defines the syntax and semantics of all standard
441   HTTP/1.1 header fields. For entity-header fields, both sender and
442   recipient refer to either the client or the server, depending on who
443   sends and who receives the entity.
444</t>
445
446<section title="ETag" anchor="header.etag">
447  <iref primary="true" item="ETag header" x:for-anchor=""/>
448  <iref primary="true" item="Headers" subitem="ETag" x:for-anchor=""/>
449<t>
450   The ETag response-header field provides the current value of the
451   entity tag for the requested variant. The headers used with entity
452   tags are described in sections <xref target="header.if-match" format="counter"/>, <xref target="header.if-none-match" format="counter"/> and &header-if-range;. The entity tag
453   &MAY; be used for comparison with other entities from the same resource
454   (see <xref target="weak.and.strong.validators"/>).
455</t>
456<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/>
457    ETag = "ETag" ":" entity-tag
458</artwork></figure>
459<figure><preamble>
460   Examples:
461</preamble>
462<artwork type="example">
463   ETag: "xyzzy"
464   ETag: W/"xyzzy"
465   ETag: ""
466</artwork></figure>
467</section>
468
469<section title="If-Match" anchor="header.if-match">
470  <iref primary="true" item="If-Match header" x:for-anchor=""/>
471  <iref primary="true" item="Headers" subitem="If-Match" x:for-anchor=""/>
472<t>
473   The If-Match request-header field is used with a method to make it
474   conditional. A client that has one or more entities previously
475   obtained from the resource can verify that one of those entities is
476   current by including a list of their associated entity tags in the
477   If-Match header field. Entity tags are defined in <xref target="entity.tags"/>. The
478   purpose of this feature is to allow efficient updates of cached
479   information with a minimum amount of transaction overhead. It is also
480   used, on updating requests, to prevent inadvertent modification of
481   the wrong version of a resource. As a special case, the value "*"
482   matches any current entity of the resource.
483</t>
484<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
485    If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
486</artwork></figure>
487<t>
488   If any of the entity tags match the entity tag of the entity that
489   would have been returned in the response to a similar GET request
490   (without the If-Match header) on that resource, or if "*" is given
491   and any current entity exists for that resource, then the server &MAY;
492   perform the requested method as if the If-Match header field did not
493   exist.
494</t>
495<t>
496   A server &MUST; use the strong comparison function (see <xref target="weak.and.strong.validators"/>)
497   to compare the entity tags in If-Match.
498</t>
499<t>
500   If none of the entity tags match, or if "*" is given and no current
501   entity exists, the server &MUST-NOT; perform the requested method, and
502   &MUST; return a 412 (Precondition Failed) response. This behavior is
503   most useful when the client wants to prevent an updating method, such
504   as PUT, from modifying a resource that has changed since the client
505   last retrieved it.
506</t>
507<t>
508   If the request would, without the If-Match header field, result in
509   anything other than a 2xx or 412 status, then the If-Match header
510   &MUST; be ignored.
511</t>
512<t>
513   The meaning of "If-Match: *" is that the method &SHOULD; be performed
514   if the representation selected by the origin server (or by a cache,
515   possibly using the Vary mechanism, see &header-vary;) exists, and
516   &MUST-NOT; be performed if the representation does not exist.
517</t>
518<t>
519   A request intended to update a resource (e.g., a PUT) &MAY; include an
520   If-Match header field to signal that the request method &MUST-NOT; be
521   applied if the entity corresponding to the If-Match value (a single
522   entity tag) is no longer a representation of that resource. This
523   allows the user to indicate that they do not wish the request to be
524   successful if the resource has been changed without their knowledge.
525   Examples:
526</t>
527<figure><artwork type="example">
528    If-Match: "xyzzy"
529    If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
530    If-Match: *
531</artwork></figure>
532<t>
533   The result of a request having both an If-Match header field and
534   either an If-None-Match or an If-Modified-Since header fields is
535   undefined by this specification.
536</t>
537</section>
538
539<section title="If-Modified-Since" anchor="header.if-modified-since">
540  <iref primary="true" item="If-Modified-Since header" x:for-anchor=""/>
541  <iref primary="true" item="Headers" subitem="If-Modified-Since" x:for-anchor=""/>
542<t>
543   The If-Modified-Since request-header field is used with a method to
544   make it conditional: if the requested variant has not been modified
545   since the time specified in this field, an entity will not be
546   returned from the server; instead, a 304 (not modified) response will
547   be returned without any message-body.
548</t>
549<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
550    If-Modified-Since = "If-Modified-Since" ":" HTTP-date
551</artwork></figure>
552<t>
553   An example of the field is:
554</t>
555<figure><artwork type="example">
556    If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
557</artwork></figure>
558<t>
559   A GET method with an If-Modified-Since header and no Range header
560   requests that the identified entity be transferred only if it has
561   been modified since the date given by the If-Modified-Since header.
562   The algorithm for determining this includes the following cases:
563  <list style="numbers">
564      <t>If the request would normally result in anything other than a
565         200 (OK) status, or if the passed If-Modified-Since date is
566         invalid, the response is exactly the same as for a normal GET.
567         A date which is later than the server's current time is
568         invalid.</t>
569
570      <t>If the variant has been modified since the If-Modified-Since
571         date, the response is exactly the same as for a normal GET.</t>
572
573      <t>If the variant has not been modified since a valid If-Modified-Since
574         date, the server &SHOULD; return a 304 (Not
575         Modified) response.</t>
576  </list>
577</t>
578<t>
579   The purpose of this feature is to allow efficient updates of cached
580   information with a minimum amount of transaction overhead.
581  <list><t>
582      <x:h>Note:</x:h> The Range request-header field modifies the meaning of If-Modified-Since;
583      see &header-range; for full details.
584    </t><t>
585      <x:h>Note:</x:h> If-Modified-Since times are interpreted by the server, whose
586      clock might not be synchronized with the client.
587    </t><t>
588      <x:h>Note:</x:h> When handling an If-Modified-Since header field, some
589      servers will use an exact date comparison function, rather than a
590      less-than function, for deciding whether to send a 304 (Not
591      Modified) response. To get best results when sending an If-Modified-Since
592      header field for cache validation, clients are
593      advised to use the exact date string received in a previous Last-Modified
594      header field whenever possible.
595    </t><t>
596      <x:h>Note:</x:h> If a client uses an arbitrary date in the If-Modified-Since
597      header instead of a date taken from the Last-Modified header for
598      the same request, the client should be aware of the fact that this
599      date is interpreted in the server's understanding of time. The
600      client should consider unsynchronized clocks and rounding problems
601      due to the different encodings of time between the client and
602      server. This includes the possibility of race conditions if the
603      document has changed between the time it was first requested and
604      the If-Modified-Since date of a subsequent request, and the
605      possibility of clock-skew-related problems if the If-Modified-Since
606      date is derived from the client's clock without correction
607      to the server's clock. Corrections for different time bases
608      between client and server are at best approximate due to network
609      latency.
610    </t>
611  </list>
612</t>
613<t>
614   The result of a request having both an If-Modified-Since header field
615   and either an If-Match or an If-Unmodified-Since header fields is
616   undefined by this specification.
617</t>
618</section>
619
620<section title="If-None-Match" anchor="header.if-none-match">
621  <iref primary="true" item="If-None-Match header" x:for-anchor=""/>
622  <iref primary="true" item="Headers" subitem="If-None-Match" x:for-anchor=""/>
623<t>
624   The If-None-Match request-header field is used with a method to make
625   it conditional. A client that has one or more entities previously
626   obtained from the resource can verify that none of those entities is
627   current by including a list of their associated entity tags in the
628   If-None-Match header field. The purpose of this feature is to allow
629   efficient updates of cached information with a minimum amount of
630   transaction overhead. It is also used to prevent a method (e.g. PUT)
631   from inadvertently modifying an existing resource when the client
632   believes that the resource does not exist.
633</t>
634<t>
635   As a special case, the value "*" matches any current entity of the
636   resource.
637</t>
638<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
639    If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
640</artwork></figure>
641<t>
642   If any of the entity tags match the entity tag of the entity that
643   would have been returned in the response to a similar GET request
644   (without the If-None-Match header) on that resource, or if "*" is
645   given and any current entity exists for that resource, then the
646   server &MUST-NOT; perform the requested method, unless required to do
647   so because the resource's modification date fails to match that
648   supplied in an If-Modified-Since header field in the request.
649   Instead, if the request method was GET or HEAD, the server &SHOULD;
650   respond with a 304 (Not Modified) response, including the cache-related
651   header fields (particularly ETag) of one of the entities that
652   matched. For all other request methods, the server &MUST; respond with
653   a status of 412 (Precondition Failed).
654</t>
655<t>
656   See <xref target="weak.and.strong.validators"/> for rules on how to determine if two entities tags
657   match. The weak comparison function can only be used with GET or HEAD
658   requests.
659</t>
660<t>
661   If none of the entity tags match, then the server &MAY; perform the
662   requested method as if the If-None-Match header field did not exist,
663   but &MUST; also ignore any If-Modified-Since header field(s) in the
664   request. That is, if no entity tags match, then the server &MUST-NOT;
665   return a 304 (Not Modified) response.
666</t>
667<t>
668   If the request would, without the If-None-Match header field, result
669   in anything other than a 2xx or 304 status, then the If-None-Match
670   header &MUST; be ignored. (See <xref target="rules.for.when.to.use.entity.tags.and.last-modified.dates"/> for a discussion of
671   server behavior when both If-Modified-Since and If-None-Match appear
672   in the same request.)
673</t>
674<t>
675   The meaning of "If-None-Match: *" is that the method &MUST-NOT; be
676   performed if the representation selected by the origin server (or by
677   a cache, possibly using the Vary mechanism, see &header-vary;)
678   exists, and &SHOULD; be performed if the representation does not exist.
679   This feature is intended to be useful in preventing races between PUT
680   operations.
681</t>
682<t>
683   Examples:
684</t>
685<figure><artwork type="example">
686    If-None-Match: "xyzzy"
687    If-None-Match: W/"xyzzy"
688    If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
689    If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
690    If-None-Match: *
691</artwork></figure>
692<t>
693   The result of a request having both an If-None-Match header field and
694   either an If-Match or an If-Unmodified-Since header fields is
695   undefined by this specification.
696</t>
697</section>
698
699<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
700  <iref primary="true" item="If-Unmodified-Since header" x:for-anchor=""/>
701  <iref primary="true" item="Headers" subitem="If-Unmodified-Since" x:for-anchor=""/>
702<t>
703   The If-Unmodified-Since request-header field is used with a method to
704   make it conditional. If the requested resource has not been modified
705   since the time specified in this field, the server &SHOULD; perform the
706   requested operation as if the If-Unmodified-Since header were not
707   present.
708</t>
709<t>
710   If the requested variant has been modified since the specified time,
711   the server &MUST-NOT; perform the requested operation, and &MUST; return
712   a 412 (Precondition Failed).
713</t>
714<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
715   If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
716</artwork></figure>
717<t>
718   An example of the field is:
719</t>
720<figure><artwork type="example">
721    If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
722</artwork></figure>
723<t>
724   If the request normally (i.e., without the If-Unmodified-Since
725   header) would result in anything other than a 2xx or 412 status, the
726   If-Unmodified-Since header &SHOULD; be ignored.
727</t>
728<t>
729   If the specified date is invalid, the header is ignored.
730</t>
731<t>
732   The result of a request having both an If-Unmodified-Since header
733   field and either an If-None-Match or an If-Modified-Since header
734   fields is undefined by this specification.
735</t>
736</section>
737
738<section title="Last-Modified" anchor="header.last-modified">
739  <iref primary="true" item="Last-Modified header" x:for-anchor=""/>
740  <iref primary="true" item="Headers" subitem="Last-Modified" x:for-anchor=""/>
741<t>
742   The Last-Modified entity-header field indicates the date and time at
743   which the origin server believes the variant was last modified.
744</t>
745<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
746    Last-Modified  = "Last-Modified" ":" HTTP-date
747</artwork></figure>
748<t>
749   An example of its use is
750</t>
751<figure><artwork type="example">
752    Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
753</artwork></figure>
754<t>
755   The exact meaning of this header field depends on the implementation
756   of the origin server and the nature of the original resource. For
757   files, it may be just the file system last-modified time. For
758   entities with dynamically included parts, it may be the most recent
759   of the set of last-modify times for its component parts. For database
760   gateways, it may be the last-update time stamp of the record. For
761   virtual objects, it may be the last time the internal state changed.
762</t>
763<t>
764   An origin server &MUST-NOT; send a Last-Modified date which is later
765   than the server's time of message origination. In such cases, where
766   the resource's last modification would indicate some time in the
767   future, the server &MUST; replace that date with the message
768   origination date.
769</t>
770<t>
771   An origin server &SHOULD; obtain the Last-Modified value of the entity
772   as close as possible to the time that it generates the Date value of
773   its response. This allows a recipient to make an accurate assessment
774   of the entity's modification time, especially if the entity changes
775   near the time that the response is generated.
776</t>
777<t>
778   HTTP/1.1 servers &SHOULD; send Last-Modified whenever feasible.
779</t>
780</section>
781
782</section>
783
784<section title="IANA Considerations" anchor="IANA.considerations">
785<t>
786   TBD.
787</t>
788</section>
789
790<section title="Security Considerations" anchor="security.considerations">
791<t>
792   No additional security considerations have been identified beyond
793   those applicable to HTTP in general &messaging;.
794</t>
795</section>
796
797<section title="Acknowledgments" anchor="ack">
798<t>
799   Based on an XML translation of RFC 2616 by Julian Reschke.
800</t>
801</section>
802</middle>
803<back>
804<references>
805<reference anchor="Part1">
806  <front>
807    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
808 
809    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
810      <organization abbrev="Day Software">Day Software</organization>
811      <address>
812        <email>fielding@gbiv.com</email>
813      </address>
814    </author>
815 
816    <author initials="J." surname="Gettys" fullname="Jim Gettys">
817      <organization>One Laptop per Child</organization>
818      <address>
819        <email>jg@laptop.org</email>
820      </address>
821    </author>
822   
823    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
824      <organization abbrev="HP">Hewlett-Packard Company</organization>
825      <address>
826        <email>JeffMogul@acm.org</email>
827      </address>
828    </author>
829 
830    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
831      <organization abbrev="Microsoft">Microsoft Corporation</organization>
832      <address>
833        <email>henrikn@microsoft.com</email>
834      </address>
835    </author>
836 
837    <author initials="L." surname="Masinter" fullname="Larry Masinter">
838      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
839      <address>
840        <email>LMM@acm.org</email>
841      </address>
842    </author>
843   
844    <author initials="P." surname="Leach" fullname="Paul J. Leach">
845      <organization abbrev="Microsoft">Microsoft Corporation</organization>
846      <address>
847        <email>paulle@microsoft.com</email>
848      </address>
849    </author>
850     
851    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
852      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
853      <address>
854        <email>timbl@w3.org</email>
855      </address>
856    </author>
857 
858    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
859  </front>
860  <seriesInfo name="Internet-Draft" value="draft-fielding-p1-messaging-&ID-VERSION;"/>
861  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
862</reference>
863
864<reference anchor="Part5">
865  <front>
866    <title abbrev="HTTP/1.1">HTTP/1.1, part 5: Range Requests and Partial Responses</title>
867 
868    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
869      <organization abbrev="Day Software">Day Software</organization>
870      <address>
871        <email>fielding@gbiv.com</email>
872      </address>
873    </author>
874 
875    <author initials="J." surname="Gettys" fullname="Jim Gettys">
876      <organization>One Laptop per Child</organization>
877      <address>
878        <email>jg@laptop.org</email>
879      </address>
880    </author>
881   
882    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
883      <organization abbrev="HP">Hewlett-Packard Company</organization>
884      <address>
885        <email>JeffMogul@acm.org</email>
886      </address>
887    </author>
888 
889    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
890      <organization abbrev="Microsoft">Microsoft Corporation</organization>
891      <address>
892        <email>henrikn@microsoft.com</email>
893      </address>
894    </author>
895 
896    <author initials="L." surname="Masinter" fullname="Larry Masinter">
897      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
898      <address>
899        <email>LMM@acm.org</email>
900      </address>
901    </author>
902   
903    <author initials="P." surname="Leach" fullname="Paul J. Leach">
904      <organization abbrev="Microsoft">Microsoft Corporation</organization>
905      <address>
906        <email>paulle@microsoft.com</email>
907      </address>
908    </author>
909     
910    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
911      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
912      <address>
913        <email>timbl@w3.org</email>
914      </address>
915    </author>
916 
917    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
918  </front>
919  <seriesInfo name="Internet-Draft" value="draft-fielding-p5-range-&ID-VERSION;"/>
920  <x:source href="p5-range.xml" basename="p5-range"/>
921</reference>
922
923<reference anchor="Part6">
924  <front>
925    <title abbrev="HTTP/1.1">HTTP/1.1, part 6: Caching</title>
926 
927    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
928      <organization abbrev="Day Software">Day Software</organization>
929      <address>
930        <email>fielding@gbiv.com</email>
931      </address>
932    </author>
933 
934    <author initials="J." surname="Gettys" fullname="Jim Gettys">
935      <organization>One Laptop per Child</organization>
936      <address>
937        <email>jg@laptop.org</email>
938      </address>
939    </author>
940   
941    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
942      <organization abbrev="HP">Hewlett-Packard Company</organization>
943      <address>
944        <email>JeffMogul@acm.org</email>
945      </address>
946    </author>
947 
948    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
949      <organization abbrev="Microsoft">Microsoft Corporation</organization>
950      <address>
951        <email>henrikn@microsoft.com</email>
952      </address>
953    </author>
954 
955    <author initials="L." surname="Masinter" fullname="Larry Masinter">
956      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
957      <address>
958        <email>LMM@acm.org</email>
959      </address>
960    </author>
961   
962    <author initials="P." surname="Leach" fullname="Paul J. Leach">
963      <organization abbrev="Microsoft">Microsoft Corporation</organization>
964      <address>
965        <email>paulle@microsoft.com</email>
966      </address>
967    </author>
968     
969    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
970      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
971      <address>
972        <email>timbl@w3.org</email>
973      </address>
974    </author>
975 
976    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
977  </front>
978  <seriesInfo name="Internet-Draft" value="draft-fielding-p6-cache-&ID-VERSION;"/>
979  <x:source href="p6-cache.xml" basename="p6-cache"/>
980</reference>
981
982
983   <reference anchor="RFC2616">
984     <front>
985       <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
986       <author initials="R." surname="Fielding" fullname="R. Fielding">
987         <organization>University of California, Irvine</organization>
988         <address><email>fielding@ics.uci.edu</email></address>
989       </author>
990       <author initials="J." surname="Gettys" fullname="J. Gettys">
991         <organization>W3C</organization>
992         <address><email>jg@w3.org</email></address>
993       </author>
994       <author initials="J." surname="Mogul" fullname="J. Mogul">
995         <organization>Compaq Computer Corporation</organization>
996         <address><email>mogul@wrl.dec.com</email></address>
997       </author>
998       <author initials="H." surname="Frystyk" fullname="H. Frystyk">
999         <organization>MIT Laboratory for Computer Science</organization>
1000         <address><email>frystyk@w3.org</email></address>
1001       </author>
1002       <author initials="L." surname="Masinter" fullname="L. Masinter">
1003         <organization>Xerox Corporation</organization>
1004         <address><email>masinter@parc.xerox.com</email></address>
1005       </author>
1006       <author initials="P." surname="Leach" fullname="P. Leach">
1007         <organization>Microsoft Corporation</organization>
1008         <address><email>paulle@microsoft.com</email></address>
1009       </author>
1010       <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1011         <organization>W3C</organization>
1012         <address><email>timbl@w3.org</email></address>
1013       </author>
1014       <date month="June" year="1999"/>
1015     </front>
1016     <seriesInfo name="RFC" value="2616"/>
1017   </reference>
1018</references>
1019</back>
1020</rfc>
Note: See TracBrowser for help on using the repository browser.