source: draft-ietf-httpbis/latest/p6-cache.xml @ 34

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

update address for TimBL

  • Property svn:eol-style set to native
File size: 120.7 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE rfc [
3  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
4  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
5  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
6  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
7  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
8  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
9  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
10  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
11  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
12  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
13  <!ENTITY ID-VERSION "latest">
14  <!ENTITY ID-MONTH "December">
15  <!ENTITY ID-YEAR "2007">
16  <!ENTITY messaging                   "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
17  <!ENTITY combining-byte-ranges       "<xref target='Part5' x:rel='#combining.byte.ranges' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
18  <!ENTITY entity-length               "<xref target='Part3' x:rel='#entity.length' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
19  <!ENTITY entity-tags                 "<xref target='Part4' x:rel='#entity.tags' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
20  <!ENTITY full-date                   "<xref target='Part1' x:rel='#full.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
21  <!ENTITY header-authorization        "<xref target='Part7' x:rel='#header.authorization' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
22  <!ENTITY header-connection           "<xref target='Part1' x:rel='#header.connection' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
23  <!ENTITY header-date                 "<xref target='Part1' x:rel='#header.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
24  <!ENTITY weak-and-strong-validators  "<xref target='Part4' x:rel='#weak.and.strong.validators' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
25  <!ENTITY message-headers             "<xref target='Part1' x:rel='#message.headers' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
26  <!ENTITY message-length              "<xref target='Part1' x:rel='#message.length' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
27  <!ENTITY safe-methods                "<xref target='Part2' x:rel='#safe.methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
28  <!ENTITY server-driven-negotiation   "<xref target='Part3' x:rel='#server-driven.negotiation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
29]>
30<?rfc toc="yes" ?>
31<?rfc symrefs="yes" ?>
32<?rfc sortrefs="yes" ?>
33<?rfc compact="yes"?>
34<?rfc subcompact="no" ?>
35<?rfc linkmailto="no" ?>
36<?rfc editing="no" ?>
37<?rfc-ext allow-markup-in-artwork="yes" ?>
38<?rfc-ext include-references-in-index="yes" ?>
39<rfc obsoletes="2068, 2616, 2617" category="std"
40     ipr="full3978" docName="draft-ietf-httpbis-p6-cache-&ID-VERSION;"
41     xmlns:x='http://purl.org/net/xml2rfc/ext' xmlns:ed="http://greenbytes.de/2002/rfcedit">
42<front>
43
44  <title abbrev="HTTP/1.1, part 6">HTTP/1.1, part 6: Caching</title>
45
46  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
47    <organization abbrev="Day Software">Day Software</organization>
48    <address>
49      <postal>
50        <street>23 Corporate Plaza DR, Suite 280</street>
51        <city>Newport Beach</city>
52        <region>CA</region>
53        <code>92660</code>
54        <country>USA</country>
55      </postal>
56      <phone>+1-949-706-5300</phone>
57      <facsimile>+1-949-706-5305</facsimile>
58      <email>fielding@gbiv.com</email>
59      <uri>http://roy.gbiv.com/</uri>
60    </address>
61  </author>
62
63  <author initials="J." surname="Gettys" fullname="Jim Gettys">
64    <organization>One Laptop per Child</organization>
65    <address>
66      <postal>
67        <street>21 Oak Knoll Road</street>
68        <city>Carlisle</city>
69        <region>MA</region>
70        <code>01741</code>
71        <country>USA</country>
72      </postal>
73      <email>jg@laptop.org</email>
74      <uri>http://www.laptop.org/</uri>
75    </address>
76  </author>
77 
78  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
79    <organization abbrev="HP">Hewlett-Packard Company</organization>
80    <address>
81      <postal>
82        <street>HP Labs, Large Scale Systems Group</street>
83        <street>1501 Page Mill Road, MS 1177</street>
84        <city>Palo Alto</city>
85        <region>CA</region>
86        <code>94304</code>
87        <country>USA</country>
88      </postal>
89      <email>JeffMogul@acm.org</email>
90    </address>
91  </author>
92
93  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
94    <organization abbrev="Microsoft">Microsoft Corporation</organization>
95    <address>
96      <postal>
97        <street>1 Microsoft Way</street>
98        <city>Redmond</city>
99        <region>WA</region>
100        <code>98052</code>
101        <country>USA</country>
102      </postal>
103      <email>henrikn@microsoft.com</email>
104    </address>
105  </author>
106
107  <author initials="L." surname="Masinter" fullname="Larry Masinter">
108    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
109    <address>
110      <postal>
111        <street>345 Park Ave</street>
112        <city>San Jose</city>
113        <region>CA</region>
114        <code>95110</code>
115        <country>USA</country>
116      </postal>
117      <email>LMM@acm.org</email>
118      <uri>http://larry.masinter.net/</uri>
119    </address>
120  </author>
121 
122  <author initials="P." surname="Leach" fullname="Paul J. Leach">
123    <organization abbrev="Microsoft">Microsoft Corporation</organization>
124    <address>
125      <postal>
126        <street>1 Microsoft Way</street>
127        <city>Redmond</city>
128        <region>WA</region>
129        <code>98052</code>
130      </postal>
131      <email>paulle@microsoft.com</email>
132    </address>
133  </author>
134   
135  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
136    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
137    <address>
138      <postal>
139        <street>MIT Computer Science and Artificial Intelligence Laboratory</street>
140        <street>The Stata Center, Building 32</street>
141        <street>32 Vassar Street</street>
142        <city>Cambridge</city>
143        <region>MA</region>
144        <code>02139</code>
145        <country>USA</country>
146      </postal>
147      <email>timbl@w3.org</email>
148      <uri>http://www.w3.org/People/Berners-Lee/</uri>
149    </address>
150  </author>
151
152  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
153
154<abstract>
155<t>
156   The Hypertext Transfer Protocol (HTTP) is an application-level
157   protocol for distributed, collaborative, hypermedia information
158   systems. HTTP has been in use by the World Wide Web global information
159   initiative since 1990. This document is Part 6 of the eight-part specification
160   that defines the protocol referred to as "HTTP/1.1" and, taken together,
161   updates RFC 2616 and RFC 2617.  Part 6 defines requirements on HTTP caches
162   and the associated header fields that control cache behavior or indicate
163   cacheable response messages.
164</t>
165</abstract>
166</front>
167<middle>
168<section title="Introduction" anchor="introduction">
169<t>
170   This document will define aspects of HTTP related to caching response
171   messages.  Right now it only includes the extracted relevant sections
172   of <xref target="RFC2616">RFC 2616</xref> without edit.
173</t>
174
175<section title="Terminology" anchor="intro.terminology">
176<t>
177   This specification uses a number of terms to refer to the roles
178   played by participants in, and objects of, the HTTP communication.
179</t>
180<t>
181  <iref item="cache"/>
182  <x:dfn>cache</x:dfn>
183  <list>
184    <t>
185      A program's local store of response messages and the subsystem
186      that controls its message storage, retrieval, and deletion. A
187      cache stores cacheable responses in order to reduce the response
188      time and network bandwidth consumption on future, equivalent
189      requests. Any client or server may include a cache, though a cache
190      cannot be used by a server that is acting as a tunnel.
191    </t>
192  </list>
193</t>
194<t>
195  <iref item="cacheable"/>
196  <x:dfn>cacheable</x:dfn>
197  <list>
198    <t>
199      A response is cacheable if a cache is allowed to store a copy of
200      the response message for use in answering subsequent requests. The
201      rules for determining the cacheability of HTTP responses are
202      defined in <xref target="caching"/>. Even if a resource is cacheable, there may
203      be additional constraints on whether a cache can use the cached
204      copy for a particular request.
205    </t>
206  </list>
207</t>
208<t>
209  <iref item="first-hand"/>
210  <x:dfn>first-hand</x:dfn>
211  <list>
212    <t>
213      A response is first-hand if it comes directly and without
214      unnecessary delay from the origin server, perhaps via one or more
215      proxies. A response is also first-hand if its validity has just
216      been checked directly with the origin server.
217    </t>
218  </list>
219</t>
220<t>
221  <iref item="explicit expiration time"/>
222  <x:dfn>explicit expiration time</x:dfn>
223  <list>
224    <t>
225      The time at which the origin server intends that an entity should
226      no longer be returned by a cache without further validation.
227    </t>
228  </list>
229</t>
230<t>
231  <iref item="heuristic expiration time"/>
232  <x:dfn>heuristic expiration time</x:dfn>
233  <list>
234    <t>
235      An expiration time assigned by a cache when no explicit expiration
236      time is available.
237    </t>
238  </list>
239</t>
240<t>
241  <iref item="age"/>
242  <x:dfn>age</x:dfn>
243  <list>
244    <t>
245      The age of a response is the time since it was sent by, or
246      successfully validated with, the origin server.
247    </t>
248  </list>
249</t>
250<t>
251  <iref item="freshness lifetime"/>
252  <x:dfn>freshness lifetime</x:dfn>
253  <list>
254    <t>
255      The length of time between the generation of a response and its
256      expiration time.
257    </t>
258  </list>
259</t>
260<t>
261  <iref item="fresh"/>
262  <x:dfn>fresh</x:dfn>
263  <list>
264    <t>
265      A response is fresh if its age has not yet exceeded its freshness
266      lifetime.
267    </t>
268  </list>
269</t>
270<t>
271  <iref item="stale"/>
272  <x:dfn>stale</x:dfn>
273  <list>
274    <t>
275      A response is stale if its age has passed its freshness lifetime.
276    </t>
277  </list>
278</t>
279<t>
280  <iref item="semantically transparent"/>
281  <x:dfn>semantically transparent</x:dfn>
282  <list>
283    <t>
284      A cache behaves in a "semantically transparent" manner, with
285      respect to a particular response, when its use affects neither the
286      requesting client nor the origin server, except to improve
287      performance. When a cache is semantically transparent, the client
288      receives exactly the same response (except for hop-by-hop headers)
289      that it would have received had its request been handled directly
290      by the origin server.
291    </t>
292  </list>
293</t>
294<t>
295  <iref item="validator"/>
296  <x:dfn>validator</x:dfn>
297  <list>
298    <t>
299      A protocol element (e.g., an entity tag or a Last-Modified time)
300      that is used to find out whether a cache entry is an equivalent
301      copy of an entity.
302    </t>
303  </list>
304</t>
305</section>
306
307<section title="Delta Seconds" anchor="delta.seconds">
308<t>
309   Some HTTP header fields allow a time value to be specified as an
310   integer number of seconds, represented in decimal, after the time
311   that the message was received.
312</t>
313<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="delta-seconds"/>
314    delta-seconds  = 1*DIGIT
315</artwork></figure>
316</section>
317</section>
318
319<section title="Caching in HTTP" anchor="caching">
320<section title="Overview" anchor="caching.overview">
321<t>
322   HTTP is typically used for distributed information systems, where
323   performance can be improved by the use of response caches. The
324   HTTP/1.1 protocol includes a number of elements intended to make
325   caching work as well as possible. Because these elements are
326   inextricable from other aspects of the protocol, and because they
327   interact with each other, it is useful to describe the basic caching
328   design of HTTP separately from the detailed descriptions of methods,
329   headers, response codes, etc.
330</t>
331<t>
332   Caching would be useless if it did not significantly improve
333   performance. The goal of caching in HTTP/1.1 is to eliminate the need
334   to send requests in many cases, and to eliminate the need to send
335   full responses in many other cases. The former reduces the number of
336   network round-trips required for many operations; we use an
337   "expiration" mechanism for this purpose (see <xref target="expiration.model"/>). The
338   latter reduces network bandwidth requirements; we use a "validation"
339   mechanism for this purpose (see <xref target="validation.model"/>).
340</t>
341<t>
342   Requirements for performance, availability, and disconnected
343   operation require us to be able to relax the goal of semantic
344   transparency. The HTTP/1.1 protocol allows origin servers, caches,
345   and clients to explicitly reduce transparency when necessary.
346   However, because non-transparent operation may confuse non-expert
347   users, and might be incompatible with certain server applications
348   (such as those for ordering merchandise), the protocol requires that
349   transparency be relaxed
350  <list style="symbols">
351     <t>only by an explicit protocol-level request when relaxed by
352        client or origin server</t>
353
354     <t>only with an explicit warning to the end user when relaxed by
355        cache or client</t>
356  </list>
357</t>
358<t>
359   Therefore, the HTTP/1.1 protocol provides these important elements:
360  <list style="numbers">
361      <t>Protocol features that provide full semantic transparency when
362         this is required by all parties.</t>
363
364      <t>Protocol features that allow an origin server or user agent to
365         explicitly request and control non-transparent operation.</t>
366
367      <t>Protocol features that allow a cache to attach warnings to
368         responses that do not preserve the requested approximation of
369         semantic transparency.</t>
370  </list>
371</t>
372<t>
373   A basic principle is that it must be possible for the clients to
374   detect any potential relaxation of semantic transparency.
375  <list><t>
376      <x:h>Note:</x:h> The server, cache, or client implementor might be faced with
377      design decisions not explicitly discussed in this specification.
378      If a decision might affect semantic transparency, the implementor
379      ought to err on the side of maintaining transparency unless a
380      careful and complete analysis shows significant benefits in
381      breaking transparency.
382    </t></list>
383</t>
384
385<section title="Cache Correctness" anchor="cache.correctness">
386<t>
387   A correct cache &MUST; respond to a request with the most up-to-date
388   response held by the cache that is appropriate to the request (see
389   sections <xref target="disambiguating.expiration.values" format="counter"/>,
390   <xref target="disambiguating.multiple.responses" format="counter"/>,
391   and <xref target="cache.replacement" format="counter"/>) which meets one of the following
392   conditions:
393  <list style="numbers">
394      <t>It has been checked for equivalence with what the origin server
395         would have returned by revalidating the response with the
396         origin server (<xref target="validation.model"/>);</t>
397
398      <t>It is "fresh enough" (see <xref target="expiration.model"/>). In the default case,
399         this means it meets the least restrictive freshness requirement
400         of the client, origin server, and cache (see <xref target="header.cache-control"/>); if
401         the origin server so specifies, it is the freshness requirement
402         of the origin server alone.
403
404         If a stored response is not "fresh enough" by the most
405         restrictive freshness requirement of both the client and the
406         origin server, in carefully considered circumstances the cache
407         &MAY; still return the response with the appropriate Warning
408         header (see section <xref target="exceptions.to.the.rules.and.warnings" format="counter"/>
409         and <xref target="header.warning" format="counter"/>), unless such a response
410         is prohibited (e.g., by a "no-store" cache-directive, or by a
411         "no-cache" cache-request-directive; see <xref target="header.cache-control"/>).</t>
412
413      <t>It is an appropriate 304 (Not Modified), 305 (Proxy Redirect),
414         or error (4xx or 5xx) response message.</t>
415  </list>
416</t>
417<t>
418   If the cache can not communicate with the origin server, then a
419   correct cache &SHOULD; respond as above if the response can be
420   correctly served from the cache; if not it &MUST; return an error or
421   warning indicating that there was a communication failure.
422</t>
423<t>
424   If a cache receives a response (either an entire response, or a 304
425   (Not Modified) response) that it would normally forward to the
426   requesting client, and the received response is no longer fresh, the
427   cache &SHOULD; forward it to the requesting client without adding a new
428   Warning (but without removing any existing Warning headers). A cache
429   &SHOULD-NOT;  attempt to revalidate a response simply because that
430   response became stale in transit; this might lead to an infinite
431   loop. A user agent that receives a stale response without a Warning
432   &MAY; display a warning indication to the user.
433</t>
434</section>
435
436<section title="Warnings" anchor="warnings">
437<t>
438   Whenever a cache returns a response that is neither first-hand nor
439   "fresh enough" (in the sense of condition 2 in <xref target="cache.correctness"/>), it
440   &MUST; attach a warning to that effect, using a Warning general-header.
441   The Warning header and the currently defined warnings are described
442   in <xref target="header.warning"/>. The warning allows clients to take appropriate
443   action.
444</t>
445<t>
446   Warnings &MAY; be used for other purposes, both cache-related and
447   otherwise. The use of a warning, rather than an error status code,
448   distinguish these responses from true failures.
449</t>
450<t>
451   Warnings are assigned three digit warn-codes. The first digit
452   indicates whether the Warning &MUST; or &MUST-NOT; be deleted from a
453   stored cache entry after a successful revalidation:
454</t>
455<t>
456  <list style="hanging">
457    <t hangText="1xx">Warnings that describe the freshness or revalidation status of
458     the response, and so &MUST; be deleted after a successful
459     revalidation. 1XX warn-codes &MAY; be generated by a cache only when
460     validating a cached entry. It &MUST-NOT; be generated by clients.</t>
461
462    <t hangText="2xx">Warnings that describe some aspect of the entity body or entity
463     headers that is not rectified by a revalidation (for example, a
464     lossy compression of the entity bodies) and which &MUST-NOT; be
465     deleted after a successful revalidation.</t>
466    </list>
467</t>
468<t>
469   See <xref target="header.warning"/> for the definitions of the codes themselves.
470</t>
471<t>
472   HTTP/1.0 caches will cache all Warnings in responses, without
473   deleting the ones in the first category. Warnings in responses that
474   are passed to HTTP/1.0 caches carry an extra warning-date field,
475   which prevents a future HTTP/1.1 recipient from believing an
476   erroneously cached Warning.
477</t>
478<t>
479   Warnings also carry a warning text. The text &MAY; be in any
480   appropriate natural language (perhaps based on the client's Accept
481   headers), and include an &OPTIONAL; indication of what character set is
482   used.
483</t>
484<t>
485   Multiple warnings &MAY; be attached to a response (either by the origin
486   server or by a cache), including multiple warnings with the same code
487   number. For example, a server might provide the same warning with
488   texts in both English and Basque.
489</t>
490<t>
491   When multiple warnings are attached to a response, it might not be
492   practical or reasonable to display all of them to the user. This
493   version of HTTP does not specify strict priority rules for deciding
494   which warnings to display and in what order, but does suggest some
495   heuristics.
496</t>
497</section>
498
499<section title="Cache-control Mechanisms" anchor="cache-control.mechanisms">
500<t>
501   The basic cache mechanisms in HTTP/1.1 (server-specified expiration
502   times and validators) are implicit directives to caches. In some
503   cases, a server or client might need to provide explicit directives
504   to the HTTP caches. We use the Cache-Control header for this purpose.
505</t>
506<t>
507   The Cache-Control header allows a client or server to transmit a
508   variety of directives in either requests or responses. These
509   directives typically override the default caching algorithms. As a
510   general rule, if there is any apparent conflict between header
511   values, the most restrictive interpretation is applied (that is, the
512   one that is most likely to preserve semantic transparency). However,
513   in some cases, cache-control directives are explicitly specified as
514   weakening the approximation of semantic transparency (for example,
515   "max-stale" or "public").
516</t>
517<t>
518   The cache-control directives are described in detail in <xref target="header.cache-control"/>.
519</t>
520</section>
521
522<section title="Explicit User Agent Warnings" anchor="explicit.ua.warnings">
523<t>
524   Many user agents make it possible for users to override the basic
525   caching mechanisms. For example, the user agent might allow the user
526   to specify that cached entities (even explicitly stale ones) are
527   never validated. Or the user agent might habitually add "Cache-Control:
528   max-stale=3600" to every request. The user agent &SHOULD-NOT;
529   default to either non-transparent behavior, or behavior that results
530   in abnormally ineffective caching, but &MAY; be explicitly configured
531   to do so by an explicit action of the user.
532</t>
533<t>
534   If the user has overridden the basic caching mechanisms, the user
535   agent &SHOULD; explicitly indicate to the user whenever this results in
536   the display of information that might not meet the server's
537   transparency requirements (in particular, if the displayed entity is
538   known to be stale). Since the protocol normally allows the user agent
539   to determine if responses are stale or not, this indication need only
540   be displayed when this actually happens. The indication need not be a
541   dialog box; it could be an icon (for example, a picture of a rotting
542   fish) or some other indicator.
543</t>
544<t>
545   If the user has overridden the caching mechanisms in a way that would
546   abnormally reduce the effectiveness of caches, the user agent &SHOULD;
547   continually indicate this state to the user (for example, by a
548   display of a picture of currency in flames) so that the user does not
549   inadvertently consume excess resources or suffer from excessive
550   latency.
551</t>
552</section>
553
554<section title="Exceptions to the Rules and Warnings" anchor="exceptions.to.the.rules.and.warnings">
555<t>
556   In some cases, the operator of a cache &MAY; choose to configure it to
557   return stale responses even when not requested by clients. This
558   decision ought not be made lightly, but may be necessary for reasons
559   of availability or performance, especially when the cache is poorly
560   connected to the origin server. Whenever a cache returns a stale
561   response, it &MUST; mark it as such (using a Warning header) enabling
562   the client software to alert the user that there might be a potential
563   problem.
564</t>
565<t>
566   It also allows the user agent to take steps to obtain a first-hand or
567   fresh response. For this reason, a cache &SHOULD-NOT;  return a stale
568   response if the client explicitly requests a first-hand or fresh one,
569   unless it is impossible to comply for technical or policy reasons.
570</t>
571</section>
572
573<section title="Client-controlled Behavior" anchor="client-controlled.behavior">
574<t>
575   While the origin server (and to a lesser extent, intermediate caches,
576   by their contribution to the age of a response) are the primary
577   source of expiration information, in some cases the client might need
578   to control a cache's decision about whether to return a cached
579   response without validating it. Clients do this using several
580   directives of the Cache-Control header.
581</t>
582<t>
583   A client's request &MAY; specify the maximum age it is willing to
584   accept of an unvalidated response; specifying a value of zero forces
585   the cache(s) to revalidate all responses. A client &MAY; also specify
586   the minimum time remaining before a response expires. Both of these
587   options increase constraints on the behavior of caches, and so cannot
588   further relax the cache's approximation of semantic transparency.
589</t>
590<t>
591   A client &MAY; also specify that it will accept stale responses, up to
592   some maximum amount of staleness. This loosens the constraints on the
593   caches, and so might violate the origin server's specified
594   constraints on semantic transparency, but might be necessary to
595   support disconnected operation, or high availability in the face of
596   poor connectivity.
597</t>
598</section>
599</section>
600
601<section title="Expiration Model" anchor="expiration.model">
602
603<section title="Server-Specified Expiration" anchor="server-specified.expiration">
604<t>
605   HTTP caching works best when caches can entirely avoid making
606   requests to the origin server. The primary mechanism for avoiding
607   requests is for an origin server to provide an explicit expiration
608   time in the future, indicating that a response &MAY; be used to satisfy
609   subsequent requests. In other words, a cache can return a fresh
610   response without first contacting the server.
611</t>
612<t>
613   Our expectation is that servers will assign future explicit
614   expiration times to responses in the belief that the entity is not
615   likely to change, in a semantically significant way, before the
616   expiration time is reached. This normally preserves semantic
617   transparency, as long as the server's expiration times are carefully
618   chosen.
619</t>
620<t>
621   The expiration mechanism applies only to responses taken from a cache
622   and not to first-hand responses forwarded immediately to the
623   requesting client.
624</t>
625<t>
626   If an origin server wishes to force a semantically transparent cache
627   to validate every request, it &MAY; assign an explicit expiration time
628   in the past. This means that the response is always stale, and so the
629   cache &SHOULD; validate it before using it for subsequent requests. See
630   <xref target="cache.revalidation.and.reload.controls"/> for a more restrictive way to force revalidation.
631</t>
632<t>
633   If an origin server wishes to force any HTTP/1.1 cache, no matter how
634   it is configured, to validate every request, it &SHOULD; use the "must-revalidate"
635   cache-control directive (see <xref target="header.cache-control"/>).
636</t>
637<t>
638   Servers specify explicit expiration times using either the Expires
639   header, or the max-age directive of the Cache-Control header.
640</t>
641<t>
642   An expiration time cannot be used to force a user agent to refresh
643   its display or reload a resource; its semantics apply only to caching
644   mechanisms, and such mechanisms need only check a resource's
645   expiration status when a new request for that resource is initiated.
646   See <xref target="history.lists"/> for an explanation of the difference between caches
647   and history mechanisms.
648</t>
649</section>
650
651<section title="Heuristic Expiration" anchor="heuristic.expiration">
652<t>
653   Since origin servers do not always provide explicit expiration times,
654   HTTP caches typically assign heuristic expiration times, employing
655   algorithms that use other header values (such as the Last-Modified
656   time) to estimate a plausible expiration time. The HTTP/1.1
657   specification does not provide specific algorithms, but does impose
658   worst-case constraints on their results. Since heuristic expiration
659   times might compromise semantic transparency, they ought to used
660   cautiously, and we encourage origin servers to provide explicit
661   expiration times as much as possible.
662</t>
663</section>
664
665<section title="Age Calculations" anchor="age.calculations">
666<t>
667   In order to know if a cached entry is fresh, a cache needs to know if
668   its age exceeds its freshness lifetime. We discuss how to calculate
669   the latter in <xref target="expiration.calculations"/>; this section describes how to calculate
670   the age of a response or cache entry.
671</t>
672<t>
673   In this discussion, we use the term "now" to mean "the current value
674   of the clock at the host performing the calculation." Hosts that use
675   HTTP, but especially hosts running origin servers and caches, &SHOULD;
676   use NTP <xref target="RFC1305"/> or some similar protocol to synchronize their clocks to
677   a globally accurate time standard.
678</t>
679<t>
680   HTTP/1.1 requires origin servers to send a Date header, if possible,
681   with every response, giving the time at which the response was
682   generated (see &header-date;). We use the term "date_value" to denote
683   the value of the Date header, in a form appropriate for arithmetic
684   operations.
685</t>
686<t>
687   HTTP/1.1 uses the Age response-header to convey the estimated age of
688   the response message when obtained from a cache. The Age field value
689   is the cache's estimate of the amount of time since the response was
690   generated or revalidated by the origin server.
691</t>
692<t>
693   In essence, the Age value is the sum of the time that the response
694   has been resident in each of the caches along the path from the
695   origin server, plus the amount of time it has been in transit along
696   network paths.
697</t>
698<t>
699   We use the term "age_value" to denote the value of the Age header, in
700   a form appropriate for arithmetic operations.
701</t>
702<t>
703   A response's age can be calculated in two entirely independent ways:
704  <list style="numbers">
705      <t>now minus date_value, if the local clock is reasonably well
706         synchronized to the origin server's clock. If the result is
707         negative, the result is replaced by zero.</t>
708
709      <t>age_value, if all of the caches along the response path
710         implement HTTP/1.1.</t>
711  </list>
712</t>
713<t>
714   Given that we have two independent ways to compute the age of a
715   response when it is received, we can combine these as
716</t>
717<figure><artwork type="code">
718    corrected_received_age = max(now - date_value, age_value)
719</artwork></figure>
720<t>
721   and as long as we have either nearly synchronized clocks or all-HTTP/1.1
722   paths, one gets a reliable (conservative) result.
723</t>
724<t>
725   Because of network-imposed delays, some significant interval might
726   pass between the time that a server generates a response and the time
727   it is received at the next outbound cache or client. If uncorrected,
728   this delay could result in improperly low ages.
729</t>
730<t>
731   Because the request that resulted in the returned Age value must have
732   been initiated prior to that Age value's generation, we can correct
733   for delays imposed by the network by recording the time at which the
734   request was initiated. Then, when an Age value is received, it &MUST;
735   be interpreted relative to the time the request was initiated, not
736   the time that the response was received. This algorithm results in
737   conservative behavior no matter how much delay is experienced. So, we
738   compute:
739</t>
740<figure><artwork type="code">
741   corrected_initial_age = corrected_received_age
742                         + (now - request_time)
743</artwork></figure>
744<t>
745   where "request_time" is the time (according to the local clock) when
746   the request that elicited this response was sent.
747</t>
748<t>
749   Summary of age calculation algorithm, when a cache receives a
750   response:
751</t>
752<figure><artwork type="code">
753   /*
754    * age_value
755    *      is the value of Age: header received by the cache with
756    *              this response.
757    * date_value
758    *      is the value of the origin server's Date: header
759    * request_time
760    *      is the (local) time when the cache made the request
761    *              that resulted in this cached response
762    * response_time
763    *      is the (local) time when the cache received the
764    *              response
765    * now
766    *      is the current (local) time
767    */
768
769   apparent_age = max(0, response_time - date_value);
770   corrected_received_age = max(apparent_age, age_value);
771   response_delay = response_time - request_time;
772   corrected_initial_age = corrected_received_age + response_delay;
773   resident_time = now - response_time;
774   current_age   = corrected_initial_age + resident_time;
775</artwork></figure>
776<t>
777   The current_age of a cache entry is calculated by adding the amount
778   of time (in seconds) since the cache entry was last validated by the
779   origin server to the corrected_initial_age. When a response is
780   generated from a cache entry, the cache &MUST; include a single Age
781   header field in the response with a value equal to the cache entry's
782   current_age.
783</t>
784<t>
785   The presence of an Age header field in a response implies that a
786   response is not first-hand. However, the converse is not true, since
787   the lack of an Age header field in a response does not imply that the
788   response is first-hand unless all caches along the request path are
789   compliant with HTTP/1.1 (i.e., older HTTP caches did not implement
790   the Age header field).
791</t>
792</section>
793
794<section title="Expiration Calculations" anchor="expiration.calculations">
795<t>
796   In order to decide whether a response is fresh or stale, we need to
797   compare its freshness lifetime to its age. The age is calculated as
798   described in <xref target="age.calculations"/>; this section describes how to calculate
799   the freshness lifetime, and to determine if a response has expired.
800   In the discussion below, the values can be represented in any form
801   appropriate for arithmetic operations.
802</t>
803<t>
804   We use the term "expires_value" to denote the value of the Expires
805   header. We use the term "max_age_value" to denote an appropriate
806   value of the number of seconds carried by the "max-age" directive of
807   the Cache-Control header in a response (see <xref target="modifications.of.the.basic.expiration.mechanism"/>).
808</t>
809<t>
810   The max-age directive takes priority over Expires, so if max-age is
811   present in a response, the calculation is simply:
812</t>
813<figure><artwork type="code">
814   freshness_lifetime = max_age_value
815</artwork></figure>
816<t>
817   Otherwise, if Expires is present in the response, the calculation is:
818</t>
819<figure><artwork type="code">
820   freshness_lifetime = expires_value - date_value
821</artwork></figure>
822<t>
823   Note that neither of these calculations is vulnerable to clock skew,
824   since all of the information comes from the origin server.
825</t>
826<t>
827   If none of Expires, Cache-Control: max-age, or Cache-Control: s-maxage
828   (see <xref target="modifications.of.the.basic.expiration.mechanism"/>) appears in the response, and the response
829   does not include other restrictions on caching, the cache &MAY; compute
830   a freshness lifetime using a heuristic. The cache &MUST; attach Warning
831   113 to any response whose age is more than 24 hours if such warning
832   has not already been added.
833</t>
834<t>
835   Also, if the response does have a Last-Modified time, the heuristic
836   expiration value &SHOULD; be no more than some fraction of the interval
837   since that time. A typical setting of this fraction might be 10%.
838</t>
839<t>
840   The calculation to determine if a response has expired is quite
841   simple:
842</t>
843<figure><artwork type="code">
844   response_is_fresh = (freshness_lifetime &gt; current_age)
845</artwork></figure>
846</section>
847
848<section title="Disambiguating Expiration Values" anchor="disambiguating.expiration.values">
849<t>
850   Because expiration values are assigned optimistically, it is possible
851   for two caches to contain fresh values for the same resource that are
852   different.
853</t>
854<t>
855   If a client performing a retrieval receives a non-first-hand response
856   for a request that was already fresh in its own cache, and the Date
857   header in its existing cache entry is newer than the Date on the new
858   response, then the client &MAY; ignore the response. If so, it &MAY;
859   retry the request with a "Cache-Control: max-age=0" directive (see
860   <xref target="header.cache-control"/>), to force a check with the origin server.
861</t>
862<t>
863   If a cache has two fresh responses for the same representation with
864   different validators, it &MUST; use the one with the more recent Date
865   header. This situation might arise because the cache is pooling
866   responses from other caches, or because a client has asked for a
867   reload or a revalidation of an apparently fresh cache entry.
868</t>
869</section>
870
871<section title="Disambiguating Multiple Responses" anchor="disambiguating.multiple.responses">
872<t>
873   Because a client might be receiving responses via multiple paths, so
874   that some responses flow through one set of caches and other
875   responses flow through a different set of caches, a client might
876   receive responses in an order different from that in which the origin
877   server sent them. We would like the client to use the most recently
878   generated response, even if older responses are still apparently
879   fresh.
880</t>
881<t>
882   Neither the entity tag nor the expiration value can impose an
883   ordering on responses, since it is possible that a later response
884   intentionally carries an earlier expiration time. The Date values are
885   ordered to a granularity of one second.
886</t>
887<t>
888   When a client tries to revalidate a cache entry, and the response it
889   receives contains a Date header that appears to be older than the one
890   for the existing entry, then the client &SHOULD; repeat the request
891   unconditionally, and include
892</t>
893<figure><artwork type="example">
894    Cache-Control: max-age=0
895</artwork></figure>
896<t>
897   to force any intermediate caches to validate their copies directly
898   with the origin server, or
899</t>
900<figure><artwork type="example">
901    Cache-Control: no-cache
902</artwork></figure>
903<t>
904   to force any intermediate caches to obtain a new copy from the origin
905   server.
906</t>
907<t>
908   If the Date values are equal, then the client &MAY; use either response
909   (or &MAY;, if it is being extremely prudent, request a new response).
910   Servers &MUST-NOT; depend on clients being able to choose
911   deterministically between responses generated during the same second,
912   if their expiration times overlap.
913</t>
914</section>
915</section>
916
917<section title="Validation Model" anchor="validation.model">
918<t>
919   When a cache has a stale entry that it would like to use as a
920   response to a client's request, it first has to check with the origin
921   server (or possibly an intermediate cache with a fresh response) to
922   see if its cached entry is still usable. We call this "validating"
923   the cache entry. Since we do not want to have to pay the overhead of
924   retransmitting the full response if the cached entry is good, and we
925   do not want to pay the overhead of an extra round trip if the cached
926   entry is invalid, the HTTP/1.1 protocol supports the use of
927   conditional methods.
928</t>
929<t>
930   The key protocol features for supporting conditional methods are
931   those concerned with "cache validators." When an origin server
932   generates a full response, it attaches some sort of validator to it,
933   which is kept with the cache entry. When a client (user agent or
934   proxy cache) makes a conditional request for a resource for which it
935   has a cache entry, it includes the associated validator in the
936   request.
937</t>
938<t>
939   The server then checks that validator against the current validator
940   for the entity, and, if they match (see &weak-and-strong-validators;), it responds
941   with a special status code (usually, 304 (Not Modified)) and no
942   entity-body. Otherwise, it returns a full response (including
943   entity-body). Thus, we avoid transmitting the full response if the
944   validator matches, and we avoid an extra round trip if it does not
945   match.
946</t>
947<t>
948   In HTTP/1.1, a conditional request looks exactly the same as a normal
949   request for the same resource, except that it carries a special
950   header (which includes the validator) that implicitly turns the
951   method (usually, GET) into a conditional.
952</t>
953<t>
954   The protocol includes both positive and negative senses of cache-validating
955   conditions. That is, it is possible to request either that
956   a method be performed if and only if a validator matches or if and
957   only if no validators match.
958  <list><t>
959      <x:h>Note:</x:h> a response that lacks a validator may still be cached, and
960      served from cache until it expires, unless this is explicitly
961      prohibited by a cache-control directive. However, a cache cannot
962      do a conditional retrieval if it does not have a validator for the
963      entity, which means it will not be refreshable after it expires.
964  </t></list>
965</t>
966
967<section title="Last-Modified Dates" anchor="last-modified.dates">
968<t>
969   The Last-Modified entity-header field value is often used as a cache
970   validator. In simple terms, a cache entry is considered to be valid
971   if the entity has not been modified since the Last-Modified value.
972</t>
973</section>
974
975<section title="Entity Tag Cache Validators" anchor="entity.tag.cache.validators">
976<t>
977   The ETag response-header field value, an entity tag, provides for an
978   "opaque" cache validator. This might allow more reliable validation
979   in situations where it is inconvenient to store modification dates,
980   where the one-second resolution of HTTP date values is not
981   sufficient, or where the origin server wishes to avoid certain
982   paradoxes that might arise from the use of modification dates.
983</t>
984<t>
985   Entity Tags are described in &entity-tags;.
986</t>
987</section>
988
989<section title="Non-validating Conditionals" anchor="non-validating.conditionals">
990<t>
991   The principle behind entity tags is that only the service author
992   knows the semantics of a resource well enough to select an
993   appropriate cache validation mechanism, and the specification of any
994   validator comparison function more complex than byte-equality would
995   open up a can of worms. Thus, comparisons of any other headers
996   (except Last-Modified, for compatibility with HTTP/1.0) are never
997   used for purposes of validating a cache entry.
998</t>
999</section>
1000</section>
1001
1002<section title="Response Cacheability" anchor="response.cacheability">
1003<t>
1004   Unless specifically constrained by a cache-control (<xref target="header.cache-control"/>)
1005   directive, a caching system &MAY; always store a successful response
1006   (see <xref target="errors.or.incomplete.response.cache.behavior"/>) as a cache entry, &MAY; return it without validation
1007   if it is fresh, and &MAY; return it after successful validation. If
1008   there is neither a cache validator nor an explicit expiration time
1009   associated with a response, we do not expect it to be cached, but
1010   certain caches &MAY; violate this expectation (for example, when little
1011   or no network connectivity is available). A client can usually detect
1012   that such a response was taken from a cache by comparing the Date
1013   header to the current time.
1014  <list><t>
1015      <x:h>Note:</x:h> some HTTP/1.0 caches are known to violate this expectation
1016      without providing any Warning.
1017  </t></list>
1018</t>
1019<t>
1020   However, in some cases it might be inappropriate for a cache to
1021   retain an entity, or to return it in response to a subsequent
1022   request. This might be because absolute semantic transparency is
1023   deemed necessary by the service author, or because of security or
1024   privacy considerations. Certain cache-control directives are
1025   therefore provided so that the server can indicate that certain
1026   resource entities, or portions thereof, are not to be cached
1027   regardless of other considerations.
1028</t>
1029<t>
1030   Note that &header-authorization; normally prevents a shared cache from saving
1031   and returning a response to a previous request if that request
1032   included an Authorization header.
1033</t>
1034<t>
1035   A response received with a status code of 200, 203, 206, 300, 301 or
1036   410 &MAY; be stored by a cache and used in reply to a subsequent
1037   request, subject to the expiration mechanism, unless a cache-control
1038   directive prohibits caching. However, a cache that does not support
1039   the Range and Content-Range headers &MUST-NOT; cache 206 (Partial
1040   Content) responses.
1041</t>
1042<t>
1043   A response received with any other status code (e.g. status codes 302
1044   and 307) &MUST-NOT; be returned in a reply to a subsequent request
1045   unless there are cache-control directives or another header(s) that
1046   explicitly allow it. For example, these include the following: an
1047   Expires header (<xref target="header.expires"/>); a "max-age", "s-maxage",  "must-revalidate",
1048   "proxy-revalidate", "public" or "private" cache-control
1049   directive (<xref target="header.cache-control"/>).
1050</t>
1051</section>
1052
1053<section title="Constructing Responses From Caches" anchor="constructing.responses.from.caches">
1054<t>
1055   The purpose of an HTTP cache is to store information received in
1056   response to requests for use in responding to future requests. In
1057   many cases, a cache simply returns the appropriate parts of a
1058   response to the requester. However, if the cache holds a cache entry
1059   based on a previous response, it might have to combine parts of a new
1060   response with what is held in the cache entry.
1061</t>
1062
1063<section title="End-to-end and Hop-by-hop Headers" anchor="end-to-end.and.hop-by-hop.headers">
1064<t>
1065   For the purpose of defining the behavior of caches and non-caching
1066   proxies, we divide HTTP headers into two categories:
1067  <list style="symbols">
1068      <t>End-to-end headers, which are  transmitted to the ultimate
1069        recipient of a request or response. End-to-end headers in
1070        responses &MUST; be stored as part of a cache entry and &MUST; be
1071        transmitted in any response formed from a cache entry.</t>
1072
1073      <t>Hop-by-hop headers, which are meaningful only for a single
1074        transport-level connection, and are not stored by caches or
1075        forwarded by proxies.</t>
1076  </list>
1077</t>
1078<t>
1079   The following HTTP/1.1 headers are hop-by-hop headers:
1080  <list style="symbols">
1081      <t>Connection</t>
1082      <t>Keep-Alive</t>
1083      <t>Proxy-Authenticate</t>
1084      <t>Proxy-Authorization</t>
1085      <t>TE</t>
1086      <t>Trailers</t>
1087      <t>Transfer-Encoding</t>
1088      <t>Upgrade</t>
1089  </list>
1090</t>
1091<t>
1092   All other headers defined by HTTP/1.1 are end-to-end headers.
1093</t>
1094<t>
1095   Other hop-by-hop headers &MUST; be listed in a Connection header,
1096   (&header-connection;) to be introduced into HTTP/1.1 (or later).
1097</t>
1098</section>
1099
1100<section title="Non-modifiable Headers" anchor="non-modifiable.headers">
1101<t>
1102   Some features of the HTTP/1.1 protocol, such as Digest
1103   Authentication, depend on the value of certain end-to-end headers. A
1104   transparent proxy &SHOULD-NOT;  modify an end-to-end header unless the
1105   definition of that header requires or specifically allows that.
1106</t>
1107<t>
1108   A transparent proxy &MUST-NOT; modify any of the following fields in a
1109   request or response, and it &MUST-NOT; add any of these fields if not
1110   already present:
1111  <list style="symbols">
1112      <t>Content-Location</t>
1113      <t>Content-MD5</t>
1114      <t>ETag</t>
1115      <t>Last-Modified</t>
1116  </list>
1117</t>
1118<t>
1119   A transparent proxy &MUST-NOT; modify any of the following fields in a
1120   response:
1121  <list style="symbols">
1122    <t>Expires</t>
1123  </list>
1124</t>
1125<t>
1126   but it &MAY; add any of these fields if not already present. If an
1127   Expires header is added, it &MUST; be given a field-value identical to
1128   that of the Date header in that response.
1129</t>
1130<t>
1131   A  proxy &MUST-NOT; modify or add any of the following fields in a
1132   message that contains the no-transform cache-control directive, or in
1133   any request:
1134  <list style="symbols">
1135    <t>Content-Encoding</t>
1136    <t>Content-Range</t>
1137    <t>Content-Type</t>
1138  </list>
1139</t>
1140<t>
1141   A non-transparent proxy &MAY; modify or add these fields to a message
1142   that does not include no-transform, but if it does so, it &MUST; add a
1143   Warning 214 (Transformation applied) if one does not already appear
1144   in the message (see <xref target="header.warning"/>).
1145  <list><t>
1146      Warning: unnecessary modification of end-to-end headers might
1147      cause authentication failures if stronger authentication
1148      mechanisms are introduced in later versions of HTTP. Such
1149      authentication mechanisms &MAY; rely on the values of header fields
1150      not listed here.
1151    </t></list>
1152</t>
1153<t>
1154   The Content-Length field of a request or response is added or deleted
1155   according to the rules in &message-length;. A transparent proxy &MUST;
1156   preserve the entity-length (&entity-length;) of the entity-body,
1157   although it &MAY; change the transfer-length (&message-length;).
1158</t>
1159</section>
1160
1161<section title="Combining Headers" anchor="combining.headers">
1162<t>
1163   When a cache makes a validating request to a server, and the server
1164   provides a 304 (Not Modified) response or a 206 (Partial Content)
1165   response, the cache then constructs a response to send to the
1166   requesting client.
1167</t>
1168<t>
1169   If the status code is 304 (Not Modified), the cache uses the entity-body
1170   stored in the cache entry as the entity-body of this outgoing
1171   response. If the status code is 206 (Partial Content) and the ETag or
1172   Last-Modified headers match exactly, the cache &MAY; combine the
1173   contents stored in the cache entry with the new contents received in
1174   the response and use the result as the entity-body of this outgoing
1175   response, (see &combining-byte-ranges;).
1176</t>
1177<t>
1178   The end-to-end headers stored in the cache entry are used for the
1179   constructed response, except that
1180  <list style="symbols">
1181    <t>any stored Warning headers with warn-code 1xx (see <xref target="header.warning"/>)
1182      &MUST; be deleted from the cache entry and the forwarded response.</t>
1183    <t>any stored Warning headers with warn-code 2xx &MUST; be retained
1184        in the cache entry and the forwarded response.</t>
1185    <t>any end-to-end headers provided in the 304 or 206 response &MUST;
1186        replace the corresponding headers from the cache entry.</t>
1187  </list>
1188</t>
1189<t>
1190   Unless the cache decides to remove the cache entry, it &MUST; also
1191   replace the end-to-end headers stored with the cache entry with
1192   corresponding headers received in the incoming response, except for
1193   Warning headers as described immediately above. If a header field-name
1194   in the incoming response matches more than one header in the
1195   cache entry, all such old headers &MUST; be replaced.
1196</t>
1197<t>
1198   In other words, the set of end-to-end headers received in the
1199   incoming response overrides all corresponding end-to-end headers
1200   stored with the cache entry (except for stored Warning headers with
1201   warn-code 1xx, which are deleted even if not overridden).
1202  <list><t>
1203      <x:h>Note:</x:h> this rule allows an origin server to use a 304 (Not
1204      Modified) or a 206 (Partial Content) response to update any header
1205      associated with a previous response for the same entity or sub-ranges
1206      thereof, although it might not always be meaningful or
1207      correct to do so. This rule does not allow an origin server to use
1208      a 304 (Not Modified) or a 206 (Partial Content) response to
1209      entirely delete a header that it had provided with a previous
1210      response.
1211  </t></list>
1212</t>
1213</section>
1214
1215</section>
1216
1217<section title="Caching Negotiated Responses" anchor="caching.negotiated.responses">
1218<t>
1219   Use of server-driven content negotiation (&server-driven-negotiation;), as indicated
1220   by the presence of a Vary header field in a response, alters the
1221   conditions and procedure by which a cache can use the response for
1222   subsequent requests. See <xref target="header.vary"/> for use of the Vary header
1223   field by servers.
1224</t>
1225<t>
1226   A server &SHOULD; use the Vary header field to inform a cache of what
1227   request-header fields were used to select among multiple
1228   representations of a cacheable response subject to server-driven
1229   negotiation. The set of header fields named by the Vary field value
1230   is known as the "selecting" request-headers.
1231</t>
1232<t>
1233   When the cache receives a subsequent request whose Request-URI
1234   specifies one or more cache entries including a Vary header field,
1235   the cache &MUST-NOT; use such a cache entry to construct a response to
1236   the new request unless all of the selecting request-headers present
1237   in the new request match the corresponding stored request-headers in
1238   the original request.
1239</t>
1240<t>
1241   The selecting request-headers from two requests are defined to match
1242   if and only if the selecting request-headers in the first request can
1243   be transformed to the selecting request-headers in the second request
1244   by adding or removing linear white space (LWS) at places where this
1245   is allowed by the corresponding BNF, and/or combining multiple
1246   message-header fields with the same field name following the rules
1247   about message headers in &message-headers;.
1248</t>
1249<t>
1250   A Vary header field-value of "*" always fails to match and subsequent
1251   requests on that resource can only be properly interpreted by the
1252   origin server.
1253</t>
1254<t>
1255   If the selecting request header fields for the cached entry do not
1256   match the selecting request header fields of the new request, then
1257   the cache &MUST-NOT; use a cached entry to satisfy the request unless
1258   it first relays the new request to the origin server in a conditional
1259   request and the server responds with 304 (Not Modified), including an
1260   entity tag or Content-Location that indicates the entity to be used.
1261</t>
1262<t>
1263   If an entity tag was assigned to a cached representation, the
1264   forwarded request &SHOULD; be conditional and include the entity tags
1265   in an If-None-Match header field from all its cache entries for the
1266   resource. This conveys to the server the set of entities currently
1267   held by the cache, so that if any one of these entities matches the
1268   requested entity, the server can use the ETag header field in its 304
1269   (Not Modified) response to tell the cache which entry is appropriate.
1270   If the entity-tag of the new response matches that of an existing
1271   entry, the new response &SHOULD; be used to update the header fields of
1272   the existing entry, and the result &MUST; be returned to the client.
1273</t>
1274<t>
1275   If any of the existing cache entries contains only partial content
1276   for the associated entity, its entity-tag &SHOULD-NOT;  be included in
1277   the If-None-Match header field unless the request is for a range that
1278   would be fully satisfied by that entry.
1279</t>
1280<t>
1281   If a cache receives a successful response whose Content-Location
1282   field matches that of an existing cache entry for the same Request-URI,
1283   whose entity-tag differs from that of the existing entry, and
1284   whose Date is more recent than that of the existing entry, the
1285   existing entry &SHOULD-NOT;  be returned in response to future requests
1286   and &SHOULD; be deleted from the cache.
1287</t>
1288</section>
1289
1290<section title="Shared and Non-Shared Caches" anchor="shared.and.non-shared.caches">
1291<t>
1292   For reasons of security and privacy, it is necessary to make a
1293   distinction between "shared" and "non-shared" caches. A non-shared
1294   cache is one that is accessible only to a single user. Accessibility
1295   in this case &SHOULD; be enforced by appropriate security mechanisms.
1296   All other caches are considered to be "shared." Other sections of
1297   this specification place certain constraints on the operation of
1298   shared caches in order to prevent loss of privacy or failure of
1299   access controls.
1300</t>
1301</section>
1302
1303<section title="Errors or Incomplete Response Cache Behavior" anchor="errors.or.incomplete.response.cache.behavior">
1304<t>
1305   A cache that receives an incomplete response (for example, with fewer
1306   bytes of data than specified in a Content-Length header) &MAY; store
1307   the response. However, the cache &MUST; treat this as a partial
1308   response. Partial responses &MAY; be combined as described in &combining-byte-ranges;;
1309   the result might be a full response or might still be
1310   partial. A cache &MUST-NOT; return a partial response to a client
1311   without explicitly marking it as such, using the 206 (Partial
1312   Content) status code. A cache &MUST-NOT; return a partial response
1313   using a status code of 200 (OK).
1314</t>
1315<t>
1316   If a cache receives a 5xx response while attempting to revalidate an
1317   entry, it &MAY; either forward this response to the requesting client,
1318   or act as if the server failed to respond. In the latter case, it &MAY;
1319   return a previously received response unless the cached entry
1320   includes the "must-revalidate" cache-control directive (see <xref target="header.cache-control"/>).
1321</t>
1322</section>
1323
1324<section title="Side Effects of GET and HEAD" anchor="side.effects.of.get.and.head">
1325<t>
1326   Unless the origin server explicitly prohibits the caching of their
1327   responses, the application of GET and HEAD methods to any resources
1328   &SHOULD-NOT;  have side effects that would lead to erroneous behavior if
1329   these responses are taken from a cache. They &MAY; still have side
1330   effects, but a cache is not required to consider such side effects in
1331   its caching decisions. Caches are always expected to observe an
1332   origin server's explicit restrictions on caching.
1333</t>
1334<t>
1335   We note one exception to this rule: since some applications have
1336   traditionally used GETs and HEADs with query URLs (those containing a
1337   "?" in the rel_path part) to perform operations with significant side
1338   effects, caches &MUST-NOT; treat responses to such URIs as fresh unless
1339   the server provides an explicit expiration time. This specifically
1340   means that responses from HTTP/1.0 servers for such URIs &SHOULD-NOT;
1341   be taken from a cache. See &safe-methods; for related information.
1342</t>
1343</section>
1344
1345<section title="Invalidation After Updates or Deletions" anchor="invalidation.after.updates.or.deletions">
1346<t>
1347   The effect of certain methods performed on a resource at the origin
1348   server might cause one or more existing cache entries to become non-transparently
1349   invalid. That is, although they might continue to be
1350   "fresh," they do not accurately reflect what the origin server would
1351   return for a new request on that resource.
1352</t>
1353<t>
1354   There is no way for the HTTP protocol to guarantee that all such
1355   cache entries are marked invalid. For example, the request that
1356   caused the change at the origin server might not have gone through
1357   the proxy where a cache entry is stored. However, several rules help
1358   reduce the likelihood of erroneous behavior.
1359</t>
1360<t>
1361   In this section, the phrase "invalidate an entity" means that the
1362   cache will either remove all instances of that entity from its
1363   storage, or will mark these as "invalid" and in need of a mandatory
1364   revalidation before they can be returned in response to a subsequent
1365   request.
1366</t>
1367<t>
1368   Some HTTP methods &MUST; cause a cache to invalidate an entity. This is
1369   either the entity referred to by the Request-URI, or by the Location
1370   or Content-Location headers (if present). These methods are:
1371  <list style="symbols">
1372      <t>PUT</t>
1373      <t>DELETE</t>
1374      <t>POST</t>
1375  </list>
1376</t> 
1377<t>
1378   In order to prevent denial of service attacks, an invalidation based
1379   on the URI in a Location or Content-Location header &MUST; only be
1380   performed if the host part is the same as in the Request-URI.
1381</t>
1382<t>
1383   A cache that passes through requests for methods it does not
1384   understand &SHOULD; invalidate any entities referred to by the
1385   Request-URI.
1386</t>
1387</section>
1388
1389<section title="Write-Through Mandatory" anchor="write-through.mandatory">
1390<t>
1391   All methods that might be expected to cause modifications to the
1392   origin server's resources &MUST; be written through to the origin
1393   server. This currently includes all methods except for GET and HEAD.
1394   A cache &MUST-NOT; reply to such a request from a client before having
1395   transmitted the request to the inbound server, and having received a
1396   corresponding response from the inbound server. This does not prevent
1397   a proxy cache from sending a 100 (Continue) response before the
1398   inbound server has sent its final reply.
1399</t>
1400<t>
1401   The alternative (known as "write-back" or "copy-back" caching) is not
1402   allowed in HTTP/1.1, due to the difficulty of providing consistent
1403   updates and the problems arising from server, cache, or network
1404   failure prior to write-back.
1405</t>
1406</section>
1407
1408<section title="Cache Replacement" anchor="cache.replacement">
1409<t>
1410   If a new cacheable (see sections <xref target="what.may.be.stored.by.caches" format="counter"/>,
1411   <xref target="disambiguating.expiration.values" format="counter"/>,
1412   <xref target="disambiguating.multiple.responses" format="counter"/>
1413   and <xref target="errors.or.incomplete.response.cache.behavior" format="counter"/>)
1414   response is received from a resource while any existing responses for
1415   the same resource are cached, the cache &SHOULD; use the new response
1416   to reply to the current request. It &MAY; insert it into cache storage
1417   and &MAY;, if it meets all other requirements, use it to respond to any
1418   future requests that would previously have caused the old response to
1419   be returned. If it inserts the new response into cache storage  the
1420   rules in <xref target="combining.headers"/> apply.
1421  <list><t>
1422      <x:h>Note:</x:h> a new response that has an older Date header value than
1423      existing cached responses is not cacheable.
1424  </t></list>
1425</t>
1426</section>
1427
1428<section title="History Lists" anchor="history.lists">
1429<t>
1430   User agents often have history mechanisms, such as "Back" buttons and
1431   history lists, which can be used to redisplay an entity retrieved
1432   earlier in a session.
1433</t>
1434<t>
1435   History mechanisms and caches are different. In particular history
1436   mechanisms &SHOULD-NOT;  try to show a semantically transparent view of
1437   the current state of a resource. Rather, a history mechanism is meant
1438   to show exactly what the user saw at the time when the resource was
1439   retrieved.
1440</t>
1441<t>
1442   By default, an expiration time does not apply to history mechanisms.
1443   If the entity is still in storage, a history mechanism &SHOULD; display
1444   it even if the entity has expired, unless the user has specifically
1445   configured the agent to refresh expired history documents.
1446</t>
1447<t>
1448   This is not to be construed to prohibit the history mechanism from
1449   telling the user that a view might be stale.
1450  <list><t>
1451      <x:h>Note:</x:h> if history list mechanisms unnecessarily prevent users from
1452      viewing stale resources, this will tend to force service authors
1453      to avoid using HTTP expiration controls and cache controls when
1454      they would otherwise like to. Service authors may consider it
1455      important that users not be presented with error messages or
1456      warning messages when they use navigation controls (such as BACK)
1457      to view previously fetched resources. Even though sometimes such
1458      resources ought not to cached, or ought to expire quickly, user
1459      interface considerations may force service authors to resort to
1460      other means of preventing caching (e.g. "once-only" URLs) in order
1461      not to suffer the effects of improperly functioning history
1462      mechanisms.
1463  </t></list>
1464</t>
1465</section>
1466</section>
1467
1468<section title="Header Field Definitions" anchor="header.fields">
1469<t>
1470   This section defines the syntax and semantics of all standard
1471   HTTP/1.1 header fields. For entity-header fields, both sender and
1472   recipient refer to either the client or the server, depending on who
1473   sends and who receives the entity.
1474</t>
1475
1476<section title="Age" anchor="header.age">
1477  <iref primary="true" item="Age header" x:for-anchor=""/>
1478  <iref primary="true" item="Headers" subitem="Age" x:for-anchor=""/>
1479<t>
1480      The Age response-header field conveys the sender's estimate of the
1481      amount of time since the response (or its revalidation) was
1482      generated at the origin server. A cached response is "fresh" if
1483      its age does not exceed its freshness lifetime. Age values are
1484      calculated as specified in <xref target="age.calculations"/>.
1485</t>
1486<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Age"/><iref primary="true" item="Grammar" subitem="age-value"/>
1487        Age = "Age" ":" age-value
1488        age-value = delta-seconds
1489</artwork></figure>
1490<t>
1491      Age values are non-negative decimal integers, representing time in
1492      seconds.
1493</t>
1494<t>
1495      If a cache receives a value larger than the largest positive
1496      integer it can represent, or if any of its age calculations
1497      overflows, it &MUST; transmit an Age header with a value of
1498      2147483648 (2^31). An HTTP/1.1 server that includes a cache &MUST;
1499      include an Age header field in every response generated from its
1500      own cache. Caches &SHOULD; use an arithmetic type of at least 31
1501      bits of range.
1502</t>
1503</section>
1504
1505<section title="Cache-Control" anchor="header.cache-control">
1506  <iref primary="true" item="Cache-Control header" x:for-anchor=""/>
1507  <iref primary="true" item="Headers" subitem="Cache-Control" x:for-anchor=""/>
1508<t>
1509   The Cache-Control general-header field is used to specify directives
1510   that &MUST; be obeyed by all caching mechanisms along the
1511   request/response chain. The directives specify behavior intended to
1512   prevent caches from adversely interfering with the request or
1513   response. These directives typically override the default caching
1514   algorithms. Cache directives are unidirectional in that the presence
1515   of a directive in a request does not imply that the same directive is
1516   to be given in the response.
1517  <list><t>
1518      Note that HTTP/1.0 caches might not implement Cache-Control and
1519      might only implement Pragma: no-cache (see <xref target="header.pragma"/>).
1520  </t></list>
1521</t>
1522<t>
1523   Cache directives &MUST; be passed through by a proxy or gateway
1524   application, regardless of their significance to that application,
1525   since the directives might be applicable to all recipients along the
1526   request/response chain. It is not possible to specify a cache-directive
1527   for a specific cache.
1528</t>
1529<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Cache-Control"/><iref primary="true" item="Grammar" subitem="cache-directive"/><iref primary="true" item="Grammar" subitem="cache-request-directive"/><iref primary="true" item="Grammar" subitem="cache-response-directive"/><iref primary="true" item="Grammar" subitem="cache-extension"/>
1530   Cache-Control   = "Cache-Control" ":" 1#cache-directive
1531
1532   cache-directive = cache-request-directive
1533        | cache-response-directive
1534
1535   cache-request-directive =
1536          "no-cache"                          ; <xref target="what.is.cacheable"/>
1537        | "no-store"                          ; <xref target="what.may.be.stored.by.caches"/>
1538        | "max-age" "=" delta-seconds         ; <xref target="modifications.of.the.basic.expiration.mechanism"/>, <xref format="counter" target="cache.revalidation.and.reload.controls"/>
1539        | "max-stale" [ "=" delta-seconds ]   ; <xref target="modifications.of.the.basic.expiration.mechanism"/>
1540        | "min-fresh" "=" delta-seconds       ; <xref target="modifications.of.the.basic.expiration.mechanism"/>
1541        | "no-transform"                      ; <xref target="no-transform.directive"/>
1542        | "only-if-cached"                    ; <xref target="cache.revalidation.and.reload.controls"/>
1543        | cache-extension                     ; <xref target="cache.control.extensions"/>
1544
1545    cache-response-directive =
1546          "public"                               ; <xref target="what.is.cacheable"/>
1547        | "private" [ "=" &lt;"&gt; 1#field-name &lt;"&gt; ] ; <xref target="what.is.cacheable"/>
1548        | "no-cache" [ "=" &lt;"&gt; 1#field-name &lt;"&gt; ]; <xref target="what.is.cacheable"/>
1549        | "no-store"                             ; <xref target="what.may.be.stored.by.caches"/>
1550        | "no-transform"                         ; <xref target="no-transform.directive"/>
1551        | "must-revalidate"                      ; <xref target="cache.revalidation.and.reload.controls"/>
1552        | "proxy-revalidate"                     ; <xref target="cache.revalidation.and.reload.controls"/>
1553        | "max-age" "=" delta-seconds            ; <xref target="modifications.of.the.basic.expiration.mechanism"/>
1554        | "s-maxage" "=" delta-seconds           ; <xref target="modifications.of.the.basic.expiration.mechanism"/>
1555        | cache-extension                        ; <xref target="cache.control.extensions"/>
1556
1557   cache-extension = token [ "=" ( token | quoted-string ) ]
1558</artwork></figure>
1559<t>
1560   When a directive appears without any 1#field-name parameter, the
1561   directive applies to the entire request or response. When such a
1562   directive appears with a 1#field-name parameter, it applies only to
1563   the named field or fields, and not to the rest of the request or
1564   response. This mechanism supports extensibility; implementations of
1565   future versions of the HTTP protocol might apply these directives to
1566   header fields not defined in HTTP/1.1.
1567</t>
1568<t>
1569   The cache-control directives can be broken down into these general
1570   categories:
1571  <list style="symbols">
1572     <t>Restrictions on what are cacheable; these may only be imposed by
1573        the origin server.</t>
1574
1575     <t>Restrictions on what may be stored by a cache; these may be
1576        imposed by either the origin server or the user agent.</t>
1577
1578     <t>Modifications of the basic expiration mechanism; these may be
1579        imposed by either the origin server or the user agent.</t>
1580
1581     <t>Controls over cache revalidation and reload; these may only be
1582        imposed by a user agent.</t>
1583
1584     <t>Control over transformation of entities.</t>
1585
1586     <t>Extensions to the caching system.</t>
1587  </list>
1588</t>
1589
1590<section title="What is Cacheable" anchor="what.is.cacheable">
1591<t>
1592   By default, a response is cacheable if the requirements of the
1593   request method, request header fields, and the response status
1594   indicate that it is cacheable. <xref target="response.cacheability"/> summarizes these defaults
1595   for cacheability. The following Cache-Control response directives
1596   allow an origin server to override the default cacheability of a
1597   response:
1598</t>
1599<t>
1600  <iref item="Cache Directives" subitem="public" primary="true"/>
1601  <iref item="public" subitem="Cache Directive" primary="true"/>
1602   public
1603  <list><t>
1604      Indicates that the response &MAY; be cached by any cache, even if it
1605      would normally be non-cacheable or cacheable only within a non-shared
1606      cache. (See also Authorization, &header-authorization;, for
1607      additional details.)
1608  </t></list>
1609</t>
1610<t>
1611  <iref item="Cache Directives" subitem="private" primary="true"/>
1612  <iref item="private" subitem="Cache Directive" primary="true"/>
1613   private
1614  <list><t>
1615      Indicates that all or part of the response message is intended for
1616      a single user and &MUST-NOT; be cached by a shared cache. This
1617      allows an origin server to state that the specified parts of the
1618      response are intended for only one user and are not a valid
1619      response for requests by other users. A private (non-shared) cache
1620      &MAY; cache the response.
1621    </t><t>
1622       <x:h>Note:</x:h> This usage of the word private only controls where the
1623       response may be cached, and cannot ensure the privacy of the
1624       message content.
1625  </t></list>
1626</t>
1627<t>
1628  <iref item="Cache Directives" subitem="no-cache" primary="true"/>
1629  <iref item="no-cache" subitem="Cache Directive" primary="true"/>
1630   no-cache
1631  <list><t>
1632       If the no-cache directive does not specify a field-name, then a
1633      cache &MUST-NOT; use the response to satisfy a subsequent request
1634      without successful revalidation with the origin server. This
1635      allows an origin server to prevent caching even by caches that
1636      have been configured to return stale responses to client requests.
1637    </t><t>
1638      If the no-cache directive does specify one or more field-names,
1639      then a cache &MAY; use the response to satisfy a subsequent request,
1640      subject to any other restrictions on caching. However, the
1641      specified field-name(s) &MUST-NOT; be sent in the response to a
1642      subsequent request without successful revalidation with the origin
1643      server. This allows an origin server to prevent the re-use of
1644      certain header fields in a response, while still allowing caching
1645      of the rest of the response.
1646    <list><t>
1647       <x:h>Note:</x:h> Most HTTP/1.0 caches will not recognize or obey this
1648       directive.
1649    </t></list>
1650  </t></list>
1651</t>
1652</section>
1653
1654<section title="What May be Stored by Caches" anchor="what.may.be.stored.by.caches">
1655<t>
1656  <iref item="Cache Directives" subitem="no-store" primary="true"/>
1657  <iref item="no-store" subitem="Cache Directive" primary="true"/>
1658   no-store
1659  <list><t>   
1660      The purpose of the no-store directive is to prevent the
1661      inadvertent release or retention of sensitive information (for
1662      example, on backup tapes). The no-store directive applies to the
1663      entire message, and &MAY; be sent either in a response or in a
1664      request. If sent in a request, a cache &MUST-NOT; store any part of
1665      either this request or any response to it. If sent in a response,
1666      a cache &MUST-NOT; store any part of either this response or the
1667      request that elicited it. This directive applies to both non-shared
1668      and shared caches. "&MUST-NOT; store" in this context means
1669      that the cache &MUST-NOT; intentionally store the information in
1670      non-volatile storage, and &MUST; make a best-effort attempt to
1671      remove the information from volatile storage as promptly as
1672      possible after forwarding it.
1673  </t><t>
1674      Even when this directive is associated with a response, users
1675      might explicitly store such a response outside of the caching
1676      system (e.g., with a "Save As" dialog). History buffers &MAY; store
1677      such responses as part of their normal operation.
1678  </t><t>
1679      The purpose of this directive is to meet the stated requirements
1680      of certain users and service authors who are concerned about
1681      accidental releases of information via unanticipated accesses to
1682      cache data structures. While the use of this directive might
1683      improve privacy in some cases, we caution that it is NOT in any
1684      way a reliable or sufficient mechanism for ensuring privacy. In
1685      particular, malicious or compromised caches might not recognize or
1686      obey this directive, and communications networks might be
1687      vulnerable to eavesdropping.
1688  </t></list>
1689</t>
1690</section>
1691
1692<section title="Modifications of the Basic Expiration Mechanism" anchor="modifications.of.the.basic.expiration.mechanism">
1693<t>
1694   The expiration time of an entity &MAY; be specified by the origin
1695   server using the Expires header (see <xref target="header.expires"/>). Alternatively,
1696   it &MAY; be specified using the max-age directive in a response. When
1697   the max-age cache-control directive is present in a cached response,
1698   the response is stale if its current age is greater than the age
1699   value given (in seconds) at the time of a new request for that
1700   resource. The max-age directive on a response implies that the
1701   response is cacheable (i.e., "public") unless some other, more
1702   restrictive cache directive is also present.
1703</t>
1704<t>
1705   If a response includes both an Expires header and a max-age
1706   directive, the max-age directive overrides the Expires header, even
1707   if the Expires header is more restrictive. This rule allows an origin
1708   server to provide, for a given response, a longer expiration time to
1709   an HTTP/1.1 (or later) cache than to an HTTP/1.0 cache. This might be
1710   useful if certain HTTP/1.0 caches improperly calculate ages or
1711   expiration times, perhaps due to desynchronized clocks.
1712</t>
1713<t>
1714   Many HTTP/1.0 cache implementations will treat an Expires value that
1715   is less than or equal to the response Date value as being equivalent
1716   to the Cache-Control response directive "no-cache". If an HTTP/1.1
1717   cache receives such a response, and the response does not include a
1718   Cache-Control header field, it &SHOULD; consider the response to be
1719   non-cacheable in order to retain compatibility with HTTP/1.0 servers.
1720  <list><t>
1721       <x:h>Note:</x:h> An origin server might wish to use a relatively new HTTP
1722       cache control feature, such as the "private" directive, on a
1723       network including older caches that do not understand that
1724       feature. The origin server will need to combine the new feature
1725       with an Expires field whose value is less than or equal to the
1726       Date value. This will prevent older caches from improperly
1727       caching the response.
1728  </t></list>
1729</t>
1730<t>
1731  <iref item="Cache Directives" subitem="s-maxage" primary="true"/>
1732  <iref item="s-maxage" subitem="Cache Directive" primary="true"/>
1733   s-maxage
1734  <list><t>
1735       If a response includes an s-maxage directive, then for a shared
1736       cache (but not for a private cache), the maximum age specified by
1737       this directive overrides the maximum age specified by either the
1738       max-age directive or the Expires header. The s-maxage directive
1739       also implies the semantics of the proxy-revalidate directive (see
1740       <xref target="cache.revalidation.and.reload.controls"/>), i.e., that the shared cache must not use the
1741       entry after it becomes stale to respond to a subsequent request
1742       without first revalidating it with the origin server. The s-maxage
1743       directive is always ignored by a private cache.
1744  </t></list>
1745</t>
1746<t>
1747   Note that most older caches, not compliant with this specification,
1748   do not implement any cache-control directives. An origin server
1749   wishing to use a cache-control directive that restricts, but does not
1750   prevent, caching by an HTTP/1.1-compliant cache &MAY; exploit the
1751   requirement that the max-age directive overrides the Expires header,
1752   and the fact that pre-HTTP/1.1-compliant caches do not observe the
1753   max-age directive.
1754</t>
1755<t>
1756   Other directives allow a user agent to modify the basic expiration
1757   mechanism. These directives &MAY; be specified on a request:
1758</t>
1759<t>
1760  <iref item="Cache Directives" subitem="max-age" primary="true"/>
1761  <iref item="max-age" subitem="Cache Directive" primary="true"/>
1762   max-age
1763  <list><t>
1764      Indicates that the client is willing to accept a response whose
1765      age is no greater than the specified time in seconds. Unless max-stale
1766      directive is also included, the client is not willing to
1767      accept a stale response.
1768  </t></list>
1769</t>
1770<t>
1771  <iref item="Cache Directives" subitem="min-fresh" primary="true"/>
1772  <iref item="min-fresh" subitem="Cache Directive" primary="true"/>
1773   min-fresh
1774  <list><t>
1775      Indicates that the client is willing to accept a response whose
1776      freshness lifetime is no less than its current age plus the
1777      specified time in seconds. That is, the client wants a response
1778      that will still be fresh for at least the specified number of
1779      seconds.
1780  </t></list>
1781</t>
1782<t>
1783  <iref item="Cache Directives" subitem="max-stale" primary="true"/>
1784  <iref item="max-stale" subitem="Cache Directive" primary="true"/>
1785   max-stale
1786  <list><t>
1787      Indicates that the client is willing to accept a response that has
1788      exceeded its expiration time. If max-stale is assigned a value,
1789      then the client is willing to accept a response that has exceeded
1790      its expiration time by no more than the specified number of
1791      seconds. If no value is assigned to max-stale, then the client is
1792      willing to accept a stale response of any age.
1793  </t></list>
1794</t>
1795<t>
1796   If a cache returns a stale response, either because of a max-stale
1797   directive on a request, or because the cache is configured to
1798   override the expiration time of a response, the cache &MUST; attach a
1799   Warning header to the stale response, using Warning 110 (Response is
1800   stale).
1801</t>
1802<t>
1803   A cache &MAY; be configured to return stale responses without
1804   validation, but only if this does not conflict with any "MUST"-level
1805   requirements concerning cache validation (e.g., a "must-revalidate"
1806   cache-control directive).
1807</t>
1808<t>
1809   If both the new request and the cached entry include "max-age"
1810   directives, then the lesser of the two values is used for determining
1811   the freshness of the cached entry for that request.
1812</t>
1813</section>
1814
1815<section title="Cache Revalidation and Reload Controls" anchor="cache.revalidation.and.reload.controls">
1816<t>
1817   Sometimes a user agent might want or need to insist that a cache
1818   revalidate its cache entry with the origin server (and not just with
1819   the next cache along the path to the origin server), or to reload its
1820   cache entry from the origin server. End-to-end revalidation might be
1821   necessary if either the cache or the origin server has overestimated
1822   the expiration time of the cached response. End-to-end reload may be
1823   necessary if the cache entry has become corrupted for some reason.
1824</t>
1825<t>
1826   End-to-end revalidation may be requested either when the client does
1827   not have its own local cached copy, in which case we call it
1828   "unspecified end-to-end revalidation", or when the client does have a
1829   local cached copy, in which case we call it "specific end-to-end
1830   revalidation."
1831</t>
1832<t>
1833   The client can specify these three kinds of action using Cache-Control
1834   request directives:
1835</t>
1836<t>
1837   End-to-end reload
1838  <list><t>
1839      The request includes a "no-cache" cache-control directive or, for
1840      compatibility with HTTP/1.0 clients, "Pragma: no-cache". Field
1841      names &MUST-NOT; be included with the no-cache directive in a
1842      request. The server &MUST-NOT; use a cached copy when responding to
1843      such a request.
1844  </t></list>
1845</t>
1846<t>
1847   Specific end-to-end revalidation
1848  <list><t>
1849      The request includes a "max-age=0" cache-control directive, which
1850      forces each cache along the path to the origin server to
1851      revalidate its own entry, if any, with the next cache or server.
1852      The initial request includes a cache-validating conditional with
1853      the client's current validator.
1854  </t></list>
1855</t>
1856<t>
1857   Unspecified end-to-end revalidation
1858  <list><t>
1859      The request includes "max-age=0" cache-control directive, which
1860      forces each cache along the path to the origin server to
1861      revalidate its own entry, if any, with the next cache or server.
1862      The initial request does not include a cache-validating
1863      conditional; the first cache along the path (if any) that holds a
1864      cache entry for this resource includes a cache-validating
1865      conditional with its current validator.
1866  </t></list>
1867</t>
1868<t>
1869  <iref item="Cache Directives" subitem="max-age" primary="true"/>
1870  <iref item="max-age" subitem="Cache Directive" primary="true"/>
1871   max-age
1872  <list><t>
1873      When an intermediate cache is forced, by means of a max-age=0
1874      directive, to revalidate its own cache entry, and the client has
1875      supplied its own validator in the request, the supplied validator
1876      might differ from the validator currently stored with the cache
1877      entry. In this case, the cache &MAY; use either validator in making
1878      its own request without affecting semantic transparency.
1879  </t><t>
1880      However, the choice of validator might affect performance. The
1881      best approach is for the intermediate cache to use its own
1882      validator when making its request. If the server replies with 304
1883      (Not Modified), then the cache can return its now validated copy
1884      to the client with a 200 (OK) response. If the server replies with
1885      a new entity and cache validator, however, the intermediate cache
1886      can compare the returned validator with the one provided in the
1887      client's request, using the strong comparison function. If the
1888      client's validator is equal to the origin server's, then the
1889      intermediate cache simply returns 304 (Not Modified). Otherwise,
1890      it returns the new entity with a 200 (OK) response.
1891  </t><t>
1892      If a request includes the no-cache directive, it &SHOULD-NOT;
1893      include min-fresh, max-stale, or max-age.
1894  </t></list>
1895</t>
1896<t>
1897  <iref item="Cache Directives" subitem="only-if-cached" primary="true"/>
1898  <iref item="only-if-cached" subitem="Cache Directive" primary="true"/>
1899   only-if-cached
1900  <list><t>
1901      In some cases, such as times of extremely poor network
1902      connectivity, a client may want a cache to return only those
1903      responses that it currently has stored, and not to reload or
1904      revalidate with the origin server. To do this, the client may
1905      include the only-if-cached directive in a request. If it receives
1906      this directive, a cache &SHOULD; either respond using a cached entry
1907      that is consistent with the other constraints of the request, or
1908      respond with a 504 (Gateway Timeout) status. However, if a group
1909      of caches is being operated as a unified system with good internal
1910      connectivity, such a request &MAY; be forwarded within that group of
1911      caches.
1912  </t></list>
1913</t>
1914<t>
1915  <iref item="Cache Directives" subitem="must-revalidate" primary="true"/>
1916  <iref item="must-revalidate" subitem="Cache Directive" primary="true"/>
1917   must-revalidate
1918  <list><t>
1919      Because a cache &MAY; be configured to ignore a server's specified
1920      expiration time, and because a client request &MAY; include a max-stale
1921      directive (which has a similar effect), the protocol also
1922      includes a mechanism for the origin server to require revalidation
1923      of a cache entry on any subsequent use. When the must-revalidate
1924      directive is present in a response received by a cache, that cache
1925      &MUST-NOT; use the entry after it becomes stale to respond to a
1926      subsequent request without first revalidating it with the origin
1927      server. (I.e., the cache &MUST; do an end-to-end revalidation every
1928      time, if, based solely on the origin server's Expires or max-age
1929      value, the cached response is stale.)
1930  </t><t>
1931      The must-revalidate directive is necessary to support reliable
1932      operation for certain protocol features. In all circumstances an
1933      HTTP/1.1 cache &MUST; obey the must-revalidate directive; in
1934      particular, if the cache cannot reach the origin server for any
1935      reason, it &MUST; generate a 504 (Gateway Timeout) response.
1936  </t><t>
1937      Servers &SHOULD; send the must-revalidate directive if and only if
1938      failure to revalidate a request on the entity could result in
1939      incorrect operation, such as a silently unexecuted financial
1940      transaction. Recipients &MUST-NOT; take any automated action that
1941      violates this directive, and &MUST-NOT; automatically provide an
1942      unvalidated copy of the entity if revalidation fails.
1943  </t><t>
1944      Although this is not recommended, user agents operating under
1945      severe connectivity constraints &MAY; violate this directive but, if
1946      so, &MUST; explicitly warn the user that an unvalidated response has
1947      been provided. The warning &MUST; be provided on each unvalidated
1948      access, and &SHOULD; require explicit user confirmation.
1949  </t></list>
1950</t>
1951<t>
1952  <iref item="Cache Directives" subitem="proxy-revalidate" primary="true"/>
1953  <iref item="proxy-revalidate" subitem="Cache Directive" primary="true"/>
1954   proxy-revalidate
1955  <list><t>
1956      The proxy-revalidate directive has the same meaning as the must-revalidate
1957      directive, except that it does not apply to non-shared
1958      user agent caches. It can be used on a response to an
1959      authenticated request to permit the user's cache to store and
1960      later return the response without needing to revalidate it (since
1961      it has already been authenticated once by that user), while still
1962      requiring proxies that service many users to revalidate each time
1963      (in order to make sure that each user has been authenticated).
1964      Note that such authenticated responses also need the public cache
1965      control directive in order to allow them to be cached at all.
1966  </t></list>
1967</t>
1968</section>
1969
1970<section title="No-Transform Directive" anchor="no-transform.directive">
1971<t>
1972  <iref item="Cache Directives" subitem="no-transform" primary="true"/>
1973  <iref item="no-transform" subitem="Cache Directive" primary="true"/>
1974   no-transform
1975  <list><t>
1976      Implementors of intermediate caches (proxies) have found it useful
1977      to convert the media type of certain entity bodies. A non-transparent
1978      proxy might, for example, convert between image
1979      formats in order to save cache space or to reduce the amount of
1980      traffic on a slow link.
1981  </t><t>
1982      Serious operational problems occur, however, when these
1983      transformations are applied to entity bodies intended for certain
1984      kinds of applications. For example, applications for medical
1985      imaging, scientific data analysis and those using end-to-end
1986      authentication, all depend on receiving an entity body that is bit
1987      for bit identical to the original entity-body.
1988  </t><t>
1989      Therefore, if a message includes the no-transform directive, an
1990      intermediate cache or proxy &MUST-NOT; change those headers that are
1991      listed in <xref target="non-modifiable.headers"/> as being subject to the no-transform
1992      directive. This implies that the cache or proxy &MUST-NOT; change
1993      any aspect of the entity-body that is specified by these headers,
1994      including the value of the entity-body itself.
1995  </t></list>
1996</t>
1997</section>
1998
1999<section title="Cache Control Extensions" anchor="cache.control.extensions">
2000<t>
2001   The Cache-Control header field can be extended through the use of one
2002   or more cache-extension tokens, each with an optional assigned value.
2003   Informational extensions (those which do not require a change in
2004   cache behavior) &MAY; be added without changing the semantics of other
2005   directives. Behavioral extensions are designed to work by acting as
2006   modifiers to the existing base of cache directives. Both the new
2007   directive and the standard directive are supplied, such that
2008   applications which do not understand the new directive will default
2009   to the behavior specified by the standard directive, and those that
2010   understand the new directive will recognize it as modifying the
2011   requirements associated with the standard directive. In this way,
2012   extensions to the cache-control directives can be made without
2013   requiring changes to the base protocol.
2014</t>
2015<t>
2016   This extension mechanism depends on an HTTP cache obeying all of the
2017   cache-control directives defined for its native HTTP-version, obeying
2018   certain extensions, and ignoring all directives that it does not
2019   understand.
2020</t>
2021<t>
2022   For example, consider a hypothetical new response directive called
2023   community which acts as a modifier to the private directive. We
2024   define this new directive to mean that, in addition to any non-shared
2025   cache, any cache which is shared only by members of the community
2026   named within its value may cache the response. An origin server
2027   wishing to allow the UCI community to use an otherwise private
2028   response in their shared cache(s) could do so by including
2029</t>
2030<figure><artwork type="example">
2031    Cache-Control: private, community="UCI"
2032</artwork></figure>
2033<t>
2034   A cache seeing this header field will act correctly even if the cache
2035   does not understand the community cache-extension, since it will also
2036   see and understand the private directive and thus default to the safe
2037   behavior.
2038</t>
2039<t>
2040   Unrecognized cache-directives &MUST; be ignored; it is assumed that any
2041   cache-directive likely to be unrecognized by an HTTP/1.1 cache will
2042   be combined with standard directives (or the response's default
2043   cacheability) such that the cache behavior will remain minimally
2044   correct even if the cache does not understand the extension(s).
2045</t>
2046</section>
2047</section>
2048
2049<section title="Expires" anchor="header.expires">
2050  <iref primary="true" item="Expires header" x:for-anchor=""/>
2051  <iref primary="true" item="Headers" subitem="Expires" x:for-anchor=""/>
2052<t>
2053   The Expires entity-header field gives the date/time after which the
2054   response is considered stale. A stale cache entry may not normally be
2055   returned by a cache (either a proxy cache or a user agent cache)
2056   unless it is first validated with the origin server (or with an
2057   intermediate cache that has a fresh copy of the entity). See <xref target="expiration.model"/>
2058   for further discussion of the expiration model.
2059</t>
2060<t>
2061   The presence of an Expires field does not imply that the original
2062   resource will change or cease to exist at, before, or after that
2063   time.
2064</t>
2065<t>
2066   The format is an absolute date and time as defined by HTTP-date in
2067   &full-date;; it &MUST; be in RFC 1123 date format:
2068</t>
2069<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Expires"/>
2070   Expires = "Expires" ":" HTTP-date
2071</artwork></figure>
2072<t>
2073   An example of its use is
2074</t>
2075<figure><artwork type="example">
2076   Expires: Thu, 01 Dec 1994 16:00:00 GMT
2077</artwork></figure>
2078<t>
2079  <list><t>
2080      <x:h>Note:</x:h> if a response includes a Cache-Control field with the max-age
2081      directive (see <xref target="modifications.of.the.basic.expiration.mechanism"/>), that directive overrides the
2082      Expires field.
2083  </t></list>
2084</t>
2085<t>
2086   HTTP/1.1 clients and caches &MUST; treat other invalid date formats,
2087   especially including the value "0", as in the past (i.e., "already
2088   expired").
2089</t>
2090<t>
2091   To mark a response as "already expired," an origin server sends an
2092   Expires date that is equal to the Date header value. (See the rules
2093   for expiration calculations in <xref target="expiration.calculations"/>.)
2094</t>
2095<t>
2096   To mark a response as "never expires," an origin server sends an
2097   Expires date approximately one year from the time the response is
2098   sent. HTTP/1.1 servers &SHOULD-NOT;  send Expires dates more than one
2099   year in the future.
2100</t>
2101<t>
2102   The presence of an Expires header field with a date value of some
2103   time in the future on a response that otherwise would by default be
2104   non-cacheable indicates that the response is cacheable, unless
2105   indicated otherwise by a Cache-Control header field (<xref target="header.cache-control"/>).
2106</t>
2107</section>
2108
2109<section title="Pragma" anchor="header.pragma">
2110  <iref primary="true" item="Pragma header" x:for-anchor=""/>
2111  <iref primary="true" item="Headers" subitem="Pragma" x:for-anchor=""/>
2112<t>
2113   The Pragma general-header field is used to include implementation-specific
2114   directives that might apply to any recipient along the
2115   request/response chain. All pragma directives specify optional
2116   behavior from the viewpoint of the protocol; however, some systems
2117   &MAY; require that behavior be consistent with the directives.
2118</t>
2119<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Pragma"/><iref primary="true" item="Grammar" subitem="pragma-directive"/><iref primary="true" item="Grammar" subitem="extension-pragma"/>
2120    Pragma            = "Pragma" ":" 1#pragma-directive
2121    pragma-directive  = "no-cache" | extension-pragma
2122    extension-pragma  = token [ "=" ( token | quoted-string ) ]
2123</artwork></figure>
2124<t>
2125   When the no-cache directive is present in a request message, an
2126   application &SHOULD; forward the request toward the origin server even
2127   if it has a cached copy of what is being requested. This pragma
2128   directive has the same semantics as the no-cache cache-directive (see
2129   <xref target="header.cache-control"/>) and is defined here for backward compatibility with
2130   HTTP/1.0. Clients &SHOULD; include both header fields when a no-cache
2131   request is sent to a server not known to be HTTP/1.1 compliant.
2132</t>
2133<t>
2134   Pragma directives &MUST; be passed through by a proxy or gateway
2135   application, regardless of their significance to that application,
2136   since the directives might be applicable to all recipients along the
2137   request/response chain. It is not possible to specify a pragma for a
2138   specific recipient; however, any pragma directive not relevant to a
2139   recipient &SHOULD; be ignored by that recipient.
2140</t>
2141<t>
2142   HTTP/1.1 caches &SHOULD; treat "Pragma: no-cache" as if the client had
2143   sent "Cache-Control: no-cache". No new Pragma directives will be
2144   defined in HTTP.
2145  <list><t>
2146      <x:h>Note:</x:h> because the meaning of "Pragma: no-cache as a response
2147      header field is not actually specified, it does not provide a
2148      reliable replacement for "Cache-Control: no-cache" in a response
2149  </t></list>
2150</t>
2151</section>
2152
2153<section title="Vary" anchor="header.vary">
2154  <iref primary="true" item="Vary header" x:for-anchor=""/>
2155  <iref primary="true" item="Headers" subitem="Vary" x:for-anchor=""/>
2156<t>
2157   The Vary field value indicates the set of request-header fields that
2158   fully determines, while the response is fresh, whether a cache is
2159   permitted to use the response to reply to a subsequent request
2160   without revalidation. For uncacheable or stale responses, the Vary
2161   field value advises the user agent about the criteria that were used
2162   to select the representation. A Vary field value of "*" implies that
2163   a cache cannot determine from the request headers of a subsequent
2164   request whether this response is the appropriate representation. See
2165   <xref target="caching.negotiated.responses"/> for use of the Vary header field by caches.
2166</t>
2167<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Vary"/>
2168    Vary  = "Vary" ":" ( "*" | 1#field-name )
2169</artwork></figure>
2170<t>
2171   An HTTP/1.1 server &SHOULD; include a Vary header field with any
2172   cacheable response that is subject to server-driven negotiation.
2173   Doing so allows a cache to properly interpret future requests on that
2174   resource and informs the user agent about the presence of negotiation
2175   on that resource. A server &MAY; include a Vary header field with a
2176   non-cacheable response that is subject to server-driven negotiation,
2177   since this might provide the user agent with useful information about
2178   the dimensions over which the response varies at the time of the
2179   response.
2180</t>
2181<t>
2182   A Vary field value consisting of a list of field-names signals that
2183   the representation selected for the response is based on a selection
2184   algorithm which considers ONLY the listed request-header field values
2185   in selecting the most appropriate representation. A cache &MAY; assume
2186   that the same selection will be made for future requests with the
2187   same values for the listed field names, for the duration of time for
2188   which the response is fresh.
2189</t>
2190<t>
2191   The field-names given are not limited to the set of standard
2192   request-header fields defined by this specification. Field names are
2193   case-insensitive.
2194</t>
2195<t>
2196   A Vary field value of "*" signals that unspecified parameters not
2197   limited to the request-headers (e.g., the network address of the
2198   client), play a role in the selection of the response representation.
2199   The "*" value &MUST-NOT; be generated by a proxy server; it may only be
2200   generated by an origin server.
2201</t>
2202</section>
2203
2204<section title="Warning" anchor="header.warning">
2205  <iref primary="true" item="Warning header" x:for-anchor=""/>
2206  <iref primary="true" item="Headers" subitem="Warning" x:for-anchor=""/>
2207<t>
2208   The Warning general-header field is used to carry additional
2209   information about the status or transformation of a message which
2210   might not be reflected in the message. This information is typically
2211   used to warn about a possible lack of semantic transparency from
2212   caching operations or transformations applied to the entity body of
2213   the message.
2214</t>
2215<t>
2216   Warning headers are sent with responses using:
2217</t>
2218<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Warning"/><iref primary="true" item="Grammar" subitem="warning-value"/><iref primary="true" item="Grammar" subitem="warn-code"/><iref primary="true" item="Grammar" subitem="warn-agent"/><iref primary="true" item="Grammar" subitem="warn-text"/><iref primary="true" item="Grammar" subitem="warn-date"/>
2219    Warning    = "Warning" ":" 1#warning-value
2220
2221    warning-value = warn-code SP warn-agent SP warn-text
2222                                          [SP warn-date]
2223
2224    warn-code  = 3DIGIT
2225    warn-agent = ( host [ ":" port ] ) | pseudonym
2226                    ; the name or pseudonym of the server adding
2227                    ; the Warning header, for use in debugging
2228    warn-text  = quoted-string
2229    warn-date  = &lt;"&gt; HTTP-date &lt;"&gt;
2230</artwork></figure>
2231<t>
2232   A response &MAY; carry more than one Warning header.
2233</t>
2234<t>
2235   The warn-text &SHOULD; be in a natural language and character set that
2236   is most likely to be intelligible to the human user receiving the
2237   response. This decision &MAY; be based on any available knowledge, such
2238   as the location of the cache or user, the Accept-Language field in a
2239   request, the Content-Language field in a response, etc. The default
2240   language is English and the default character set is ISO-8859-1.
2241</t>
2242<t>
2243   If a character set other than ISO-8859-1 is used, it &MUST; be encoded
2244   in the warn-text using the method described in RFC 2047 <xref target="RFC2047"/>.
2245</t>
2246<t>
2247   Warning headers can in general be applied to any message, however
2248   some specific warn-codes are specific to caches and can only be
2249   applied to response messages. New Warning headers &SHOULD; be added
2250   after any existing Warning headers. A cache &MUST-NOT; delete any
2251   Warning header that it received with a message. However, if a cache
2252   successfully validates a cache entry, it &SHOULD; remove any Warning
2253   headers previously attached to that entry except as specified for
2254   specific Warning codes. It &MUST; then add any Warning headers received
2255   in the validating response. In other words, Warning headers are those
2256   that would be attached to the most recent relevant response.
2257</t>
2258<t>
2259   When multiple Warning headers are attached to a response, the user
2260   agent ought to inform the user of as many of them as possible, in the
2261   order that they appear in the response. If it is not possible to
2262   inform the user of all of the warnings, the user agent &SHOULD; follow
2263   these heuristics:
2264  <list style="symbols">
2265    <t>Warnings that appear early in the response take priority over
2266        those appearing later in the response.</t>
2267
2268    <t>Warnings in the user's preferred character set take priority
2269        over warnings in other character sets but with identical warn-codes
2270        and warn-agents.</t>
2271  </list>
2272</t>
2273<t>
2274   Systems that generate multiple Warning headers &SHOULD; order them with
2275   this user agent behavior in mind.
2276</t>
2277<t>
2278   Requirements for the behavior of caches with respect to Warnings are
2279   stated in <xref target="warnings"/>.
2280</t>
2281<t>
2282   This is a list of the currently-defined warn-codes, each with a
2283   recommended warn-text in English, and a description of its meaning.
2284</t>
2285<t>
2286   110 Response is stale
2287  <list><t>
2288     &MUST; be included whenever the returned response is stale.
2289  </t></list>
2290</t>
2291<t>
2292   111 Revalidation failed
2293  <list><t>
2294     &MUST; be included if a cache returns a stale response because an
2295     attempt to revalidate the response failed, due to an inability to
2296     reach the server.
2297  </t></list>
2298</t>
2299<t>
2300   112 Disconnected operation
2301  <list><t>
2302     &SHOULD; be included if the cache is intentionally disconnected from
2303     the rest of the network for a period of time.
2304  </t></list>
2305</t>
2306<t>
2307   113 Heuristic expiration
2308  <list><t>
2309     &MUST; be included if the cache heuristically chose a freshness
2310     lifetime greater than 24 hours and the response's age is greater
2311     than 24 hours.
2312  </t></list>
2313</t>
2314<t>
2315   199 Miscellaneous warning
2316  <list><t>
2317     The warning text &MAY; include arbitrary information to be presented
2318     to a human user, or logged. A system receiving this warning &MUST-NOT;
2319     take any automated action, besides presenting the warning to
2320     the user.
2321  </t></list>
2322</t>
2323<t>
2324   214 Transformation applied
2325  <list><t>
2326     &MUST; be added by an intermediate cache or proxy if it applies any
2327     transformation changing the content-coding (as specified in the
2328     Content-Encoding header) or media-type (as specified in the
2329     Content-Type header) of the response, or the entity-body of the
2330     response, unless this Warning code already appears in the response.
2331  </t></list>
2332</t>
2333<t>
2334   299 Miscellaneous persistent warning
2335  <list><t>
2336     The warning text &MAY; include arbitrary information to be presented
2337     to a human user, or logged. A system receiving this warning &MUST-NOT;
2338     take any automated action.
2339  </t></list>
2340</t>
2341<t>
2342   If an implementation sends a message with one or more Warning headers
2343   whose version is HTTP/1.0 or lower, then the sender &MUST; include in
2344   each warning-value a warn-date that matches the date in the response.
2345</t>
2346<t>
2347   If an implementation receives a message with a warning-value that
2348   includes a warn-date, and that warn-date is different from the Date
2349   value in the response, then that warning-value &MUST; be deleted from
2350   the message before storing, forwarding, or using it. (This prevents
2351   bad consequences of naive caching of Warning header fields.) If all
2352   of the warning-values are deleted for this reason, the Warning header
2353   &MUST; be deleted as well.
2354</t>
2355</section>
2356
2357</section>
2358
2359<section title="IANA Considerations" anchor="IANA.considerations">
2360<t>
2361   TBD.
2362</t>
2363</section>
2364
2365<section title="Security Considerations" anchor="security.considerations">
2366<t>
2367   Caching proxies provide additional potential vulnerabilities, since
2368   the contents of the cache represent an attractive target for
2369   malicious exploitation. Because cache contents persist after an HTTP
2370   request is complete, an attack on the cache can reveal information
2371   long after a user believes that the information has been removed from
2372   the network. Therefore, cache contents should be protected as
2373   sensitive information.
2374</t>
2375</section>
2376
2377<section title="Acknowledgments" anchor="ack">
2378<t>
2379   Much of the content and presentation of the caching design is due to
2380   suggestions and comments from individuals including: Shel Kaphan,
2381   Paul Leach, Koen Holtman, David Morris, and Larry Masinter.
2382</t>
2383<t>
2384   Based on an XML translation of RFC 2616 by Julian Reschke.
2385</t>
2386</section>
2387</middle>
2388<back>
2389<references>
2390
2391<reference anchor="Part1">
2392  <front>
2393    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
2394 
2395    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
2396      <organization abbrev="Day Software">Day Software</organization>
2397      <address>
2398        <email>fielding@gbiv.com</email>
2399      </address>
2400    </author>
2401 
2402    <author initials="J." surname="Gettys" fullname="Jim Gettys">
2403      <organization>One Laptop per Child</organization>
2404      <address>
2405        <email>jg@laptop.org</email>
2406      </address>
2407    </author>
2408   
2409    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
2410      <organization abbrev="HP">Hewlett-Packard Company</organization>
2411      <address>
2412        <email>JeffMogul@acm.org</email>
2413      </address>
2414    </author>
2415 
2416    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
2417      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2418      <address>
2419        <email>henrikn@microsoft.com</email>
2420      </address>
2421    </author>
2422 
2423    <author initials="L." surname="Masinter" fullname="Larry Masinter">
2424      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
2425      <address>
2426        <email>LMM@acm.org</email>
2427      </address>
2428    </author>
2429   
2430    <author initials="P." surname="Leach" fullname="Paul J. Leach">
2431      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2432      <address>
2433        <email>paulle@microsoft.com</email>
2434      </address>
2435    </author>
2436     
2437    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
2438      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
2439      <address>
2440        <email>timbl@w3.org</email>
2441      </address>
2442    </author>
2443 
2444    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
2445  </front>
2446  <seriesInfo name="Internet-Draft" value="draft-fielding-p1-messaging-&ID-VERSION;"/>
2447  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
2448</reference>
2449
2450<reference anchor="Part2">
2451  <front>
2452    <title abbrev="HTTP/1.1">HTTP/1.1, part 2: Message Semantics</title>
2453 
2454    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
2455      <organization abbrev="Day Software">Day Software</organization>
2456      <address>
2457        <email>fielding@gbiv.com</email>
2458      </address>
2459    </author>
2460 
2461    <author initials="J." surname="Gettys" fullname="Jim Gettys">
2462      <organization>One Laptop per Child</organization>
2463      <address>
2464        <email>jg@laptop.org</email>
2465      </address>
2466    </author>
2467   
2468    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
2469      <organization abbrev="HP">Hewlett-Packard Company</organization>
2470      <address>
2471        <email>JeffMogul@acm.org</email>
2472      </address>
2473    </author>
2474 
2475    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
2476      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2477      <address>
2478        <email>henrikn@microsoft.com</email>
2479      </address>
2480    </author>
2481 
2482    <author initials="L." surname="Masinter" fullname="Larry Masinter">
2483      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
2484      <address>
2485        <email>LMM@acm.org</email>
2486      </address>
2487    </author>
2488   
2489    <author initials="P." surname="Leach" fullname="Paul J. Leach">
2490      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2491      <address>
2492        <email>paulle@microsoft.com</email>
2493      </address>
2494    </author>
2495     
2496    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
2497      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
2498      <address>
2499        <email>timbl@w3.org</email>
2500      </address>
2501    </author>
2502 
2503    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
2504  </front>
2505  <seriesInfo name="Internet-Draft" value="draft-fielding-p2-semantics-&ID-VERSION;"/>
2506  <x:source href="p2-semantics.xml" basename="p2-semantics"/>
2507</reference>
2508
2509<reference anchor="Part3">
2510  <front>
2511    <title abbrev="HTTP/1.1">HTTP/1.1, part 3: Message Payload and Content Negotiation</title>
2512 
2513    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
2514      <organization abbrev="Day Software">Day Software</organization>
2515      <address>
2516        <email>fielding@gbiv.com</email>
2517      </address>
2518    </author>
2519 
2520    <author initials="J." surname="Gettys" fullname="Jim Gettys">
2521      <organization>One Laptop per Child</organization>
2522      <address>
2523        <email>jg@laptop.org</email>
2524      </address>
2525    </author>
2526   
2527    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
2528      <organization abbrev="HP">Hewlett-Packard Company</organization>
2529      <address>
2530        <email>JeffMogul@acm.org</email>
2531      </address>
2532    </author>
2533 
2534    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
2535      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2536      <address>
2537        <email>henrikn@microsoft.com</email>
2538      </address>
2539    </author>
2540 
2541    <author initials="L." surname="Masinter" fullname="Larry Masinter">
2542      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
2543      <address>
2544        <email>LMM@acm.org</email>
2545      </address>
2546    </author>
2547   
2548    <author initials="P." surname="Leach" fullname="Paul J. Leach">
2549      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2550      <address>
2551        <email>paulle@microsoft.com</email>
2552      </address>
2553    </author>
2554     
2555    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
2556      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
2557      <address>
2558        <email>timbl@w3.org</email>
2559      </address>
2560    </author>
2561 
2562    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
2563  </front>
2564  <seriesInfo name="Internet-Draft" value="draft-fielding-p3-payload-&ID-VERSION;"/>
2565  <x:source href="p3-payload.xml" basename="p3-payload"/>
2566</reference>
2567
2568<reference anchor="Part4">
2569  <front>
2570    <title abbrev="HTTP/1.1">HTTP/1.1, part 4: Conditional Requests</title>
2571 
2572    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
2573      <organization abbrev="Day Software">Day Software</organization>
2574      <address>
2575        <email>fielding@gbiv.com</email>
2576      </address>
2577    </author>
2578 
2579    <author initials="J." surname="Gettys" fullname="Jim Gettys">
2580      <organization>One Laptop per Child</organization>
2581      <address>
2582        <email>jg@laptop.org</email>
2583      </address>
2584    </author>
2585   
2586    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
2587      <organization abbrev="HP">Hewlett-Packard Company</organization>
2588      <address>
2589        <email>JeffMogul@acm.org</email>
2590      </address>
2591    </author>
2592 
2593    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
2594      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2595      <address>
2596        <email>henrikn@microsoft.com</email>
2597      </address>
2598    </author>
2599 
2600    <author initials="L." surname="Masinter" fullname="Larry Masinter">
2601      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
2602      <address>
2603        <email>LMM@acm.org</email>
2604      </address>
2605    </author>
2606   
2607    <author initials="P." surname="Leach" fullname="Paul J. Leach">
2608      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2609      <address>
2610        <email>paulle@microsoft.com</email>
2611      </address>
2612    </author>
2613     
2614    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
2615      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
2616      <address>
2617        <email>timbl@w3.org</email>
2618      </address>
2619    </author>
2620 
2621    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
2622  </front>
2623  <seriesInfo name="Internet-Draft" value="draft-fielding-p4-conditional-&ID-VERSION;"/>
2624  <x:source href="p4-conditional.xml" basename="p4-conditional"/>
2625</reference>
2626
2627<reference anchor="Part5">
2628  <front>
2629    <title abbrev="HTTP/1.1">HTTP/1.1, part 5: Range Requests and Partial Responses</title>
2630 
2631    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
2632      <organization abbrev="Day Software">Day Software</organization>
2633      <address>
2634        <email>fielding@gbiv.com</email>
2635      </address>
2636    </author>
2637 
2638    <author initials="J." surname="Gettys" fullname="Jim Gettys">
2639      <organization>One Laptop per Child</organization>
2640      <address>
2641        <email>jg@laptop.org</email>
2642      </address>
2643    </author>
2644   
2645    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
2646      <organization abbrev="HP">Hewlett-Packard Company</organization>
2647      <address>
2648        <email>JeffMogul@acm.org</email>
2649      </address>
2650    </author>
2651 
2652    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
2653      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2654      <address>
2655        <email>henrikn@microsoft.com</email>
2656      </address>
2657    </author>
2658 
2659    <author initials="L." surname="Masinter" fullname="Larry Masinter">
2660      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
2661      <address>
2662        <email>LMM@acm.org</email>
2663      </address>
2664    </author>
2665   
2666    <author initials="P." surname="Leach" fullname="Paul J. Leach">
2667      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2668      <address>
2669        <email>paulle@microsoft.com</email>
2670      </address>
2671    </author>
2672     
2673    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
2674      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
2675      <address>
2676        <email>timbl@w3.org</email>
2677      </address>
2678    </author>
2679 
2680    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
2681  </front>
2682  <seriesInfo name="Internet-Draft" value="draft-fielding-p5-range-&ID-VERSION;"/>
2683  <x:source href="p5-range.xml" basename="p5-range"/>
2684</reference>
2685
2686<reference anchor="Part7">
2687  <front>
2688    <title abbrev="HTTP/1.1">HTTP/1.1, part 7: Authentication</title>
2689 
2690    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
2691      <organization abbrev="Day Software">Day Software</organization>
2692      <address>
2693        <email>fielding@gbiv.com</email>
2694      </address>
2695    </author>
2696 
2697    <author initials="J." surname="Gettys" fullname="Jim Gettys">
2698      <organization>One Laptop per Child</organization>
2699      <address>
2700        <email>jg@laptop.org</email>
2701      </address>
2702    </author>
2703   
2704    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
2705      <organization abbrev="HP">Hewlett-Packard Company</organization>
2706      <address>
2707        <email>JeffMogul@acm.org</email>
2708      </address>
2709    </author>
2710 
2711    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
2712      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2713      <address>
2714        <email>henrikn@microsoft.com</email>
2715      </address>
2716    </author>
2717 
2718    <author initials="L." surname="Masinter" fullname="Larry Masinter">
2719      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
2720      <address>
2721        <email>LMM@acm.org</email>
2722      </address>
2723    </author>
2724   
2725    <author initials="P." surname="Leach" fullname="Paul J. Leach">
2726      <organization abbrev="Microsoft">Microsoft Corporation</organization>
2727      <address>
2728        <email>paulle@microsoft.com</email>
2729      </address>
2730    </author>
2731     
2732    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
2733      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
2734      <address>
2735        <email>timbl@w3.org</email>
2736      </address>
2737    </author>
2738 
2739    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
2740  </front>
2741  <seriesInfo name="Internet-Draft" value="draft-fielding-p7-auth-&ID-VERSION;"/>
2742  <x:source href="p7-auth.xml" basename="p7-auth"/>
2743</reference>
2744
2745<reference anchor="RFC2047">
2746<front>
2747<title abbrev="Message Header Extensions">MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text</title>
2748<author initials="K." surname="Moore" fullname="Keith Moore">
2749<organization>University of Tennessee</organization>
2750<address>
2751<postal>
2752<street>107 Ayres Hall</street>
2753<street>Knoxville TN 37996-1301</street></postal>
2754<email>moore@cs.utk.edu</email></address></author>
2755<date month="November" year="1996"/>
2756<area>Applications</area>
2757<keyword>Amercian Standard Code for Information Interchange</keyword>
2758<keyword>mail</keyword>
2759<keyword>multipurpose internet mail extensions</keyword>
2760</front>
2761<seriesInfo name="RFC" value="2047"/>
2762</reference>
2763
2764<reference anchor="RFC1305">
2765<front>
2766<title>Network Time Protocol (Version 3) Specification, Implementation</title>
2767<author initials="D." surname="Mills" fullname="David L. Mills">
2768<organization>University of Delaware, Electrical Engineering Department</organization>
2769<address>
2770<postal>
2771<street/>
2772<city>Newark</city>
2773<region>DE</region>
2774<code>19716</code>
2775<country>US</country></postal>
2776<phone>+1 302 451 8247</phone>
2777<email>mills@udel.edu</email></address></author>
2778<date month="March" year="1992"/>
2779<abstract>
2780<t>This document describes the Network Time Protocol (NTP), specifies its normal structure and summarizes information useful for its implementation. NTP provides the mechanisms to synchronize time and coordinate time distribution in a large, diverse internet operating at rates from mundane to lightwave. It uses a returnable-time design in which a distributed subnet of time servers operating in a self-organizing, hierarchical-master-slave configuration synchronizes local clocks within the subnet and to national time standards via wire or radio. The servers can also redistribute reference time via local routing algorithms and time daemons.</t></abstract></front>
2781<seriesInfo name="RFC" value="1305"/>
2782</reference>
2783
2784<reference anchor="RFC2616">
2785  <front>
2786    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
2787    <author initials="R." surname="Fielding" fullname="R. Fielding">
2788      <organization>University of California, Irvine</organization>
2789      <address><email>fielding@ics.uci.edu</email></address>
2790    </author>
2791    <author initials="J." surname="Gettys" fullname="J. Gettys">
2792      <organization>W3C</organization>
2793      <address><email>jg@w3.org</email></address>
2794    </author>
2795    <author initials="J." surname="Mogul" fullname="J. Mogul">
2796      <organization>Compaq Computer Corporation</organization>
2797      <address><email>mogul@wrl.dec.com</email></address>
2798    </author>
2799    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
2800      <organization>MIT Laboratory for Computer Science</organization>
2801      <address><email>frystyk@w3.org</email></address>
2802    </author>
2803    <author initials="L." surname="Masinter" fullname="L. Masinter">
2804      <organization>Xerox Corporation</organization>
2805      <address><email>masinter@parc.xerox.com</email></address>
2806    </author>
2807    <author initials="P." surname="Leach" fullname="P. Leach">
2808      <organization>Microsoft Corporation</organization>
2809      <address><email>paulle@microsoft.com</email></address>
2810    </author>
2811    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
2812      <organization>W3C</organization>
2813      <address><email>timbl@w3.org</email></address>
2814    </author>
2815    <date month="June" year="1999"/>
2816  </front>
2817  <seriesInfo name="RFC" value="2616"/>
2818</reference>
2819</references>
2820
2821<section title="Changes from RFC 2068" anchor="changes.from.rfc.2068">
2822<t>
2823   A case was missed in the Cache-Control model of HTTP/1.1; s-maxage
2824   was introduced to add this missing case. (Sections <xref target="response.cacheability" format="counter"/>,
2825   <xref target="header.cache-control" format="counter"/>,
2826   <xref target="modifications.of.the.basic.expiration.mechanism" format="counter"/>)
2827</t>
2828<t>
2829   The Cache-Control: max-age directive was not properly defined for
2830   responses. (<xref target="modifications.of.the.basic.expiration.mechanism"/>)
2831</t>
2832<t>
2833   Warnings could be cached incorrectly, or not updated appropriately.
2834   (Section <xref target="warnings" format="counter"/>, <xref target="expiration.calculations" format="counter"/>, <xref target="non-modifiable.headers" format="counter"/>,
2835   <xref target="combining.headers" format="counter"/>, <xref target="modifications.of.the.basic.expiration.mechanism" format="counter"/>,
2836   and <xref target="header.warning" format="counter"/>) Warning
2837   also needed to be a general header, as PUT or other methods may have
2838   need for it in requests.
2839</t>
2840</section>
2841</back>
2842</rfc>
Note: See TracBrowser for help on using the repository browser.