source: draft-ietf-httpbis/00/p4-conditional.xml @ 54

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

set version to 00

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