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

Last change on this file since 29 was 29, checked in by fielding@…, 12 years ago

Partition RFC 2616 into seven (mostly) independent documents.
No semantic changes. Some meaningless crossreferences to prior
editorial decisions have been removed from appendices.

Structural changes minimized to simplify diff versus rfc2616.
This was a lot harder than it looks.

Part 8 (Cookies) is for future specification based on RFC 2965.

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