source: draft-ietf-httpbis/01/draft-ietf-httpbis-p4-conditional-01.xml @ 875

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

generated draft 01

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