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

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

added Yves Lafon in authors section

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