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

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

add example Warning and recommend - be used as pseudonym when name is unknown; addresses #496

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/xml
File size: 114.4 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?>
3<!DOCTYPE rfc [
4  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
5  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
6  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
7  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
8  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
9  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
10  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
11  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
12  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
13  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
14  <!ENTITY ID-VERSION "latest">
15  <!ENTITY ID-MONTH "September">
16  <!ENTITY ID-YEAR "2013">
17  <!ENTITY mdash "&#8212;">
18  <!ENTITY Note "<x:h xmlns:x='http://purl.org/net/xml2rfc/ext'>Note:</x:h>">
19  <!ENTITY architecture                "<xref target='Part1' x:rel='#architecture' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
20  <!ENTITY conformance                 "<xref target='Part1' x:rel='#conformance' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
21  <!ENTITY notation                    "<xref target='Part1' x:rel='#notation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
22  <!ENTITY abnf-extension              "<xref target='Part1' x:rel='#abnf.extension' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
23  <!ENTITY acks                        "<xref target='Part1' x:rel='#acks' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
24  <!ENTITY whitespace                  "<xref target='Part1' x:rel='#whitespace' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
25  <!ENTITY field-components            "<xref target='Part1' x:rel='#field.components' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
26  <!ENTITY uri                         "<xref target='Part1' x:rel='#uri' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
27  <!ENTITY effective-request-uri       "<xref target='Part1' x:rel='#effective.request.uri' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
28  <!ENTITY messaging                   "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
29  <!ENTITY semantics                   "<xref target='Part2' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
30  <!ENTITY conditional                 "<xref target='Part4' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
31  <!ENTITY conditional-precedence      "<xref target='Part4' x:rel='#precedence' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
32  <!ENTITY partial                     "<xref target='Part5' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
33  <!ENTITY combining-byte-ranges       "<xref target='Part5' x:rel='#combining.byte.ranges' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
34  <!ENTITY http-date                   "<xref target='Part2' x:rel='#http.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
35  <!ENTITY header-authorization        "<xref target='Part7' x:rel='#header.authorization' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
36  <!ENTITY header-connection           "<xref target='Part1' x:rel='#header.connection' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
37  <!ENTITY header-date                 "<xref target='Part2' x:rel='#header.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
38  <!ENTITY header-etag                 "<xref target='Part4' x:rel='#header.etag' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
39  <!ENTITY header-if-match             "<xref target='Part4' x:rel='#header.if-match' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
40  <!ENTITY header-if-none-match        "<xref target='Part4' x:rel='#header.if-none-match' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
41  <!ENTITY header-if-modified-since    "<xref target='Part4' x:rel='#header.if-modified-since' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
42  <!ENTITY header-if-unmodified-since  "<xref target='Part4' x:rel='#header.if-unmodified-since' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
43  <!ENTITY header-if-range             "<xref target='Part5' x:rel='#header.if-range' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
44  <!ENTITY header-last-modified        "<xref target='Part4' x:rel='#header.last-modified' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
45  <!ENTITY header-vary                 "<xref target='Part2' x:rel='#header.vary' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
46  <!ENTITY header-via                  "<xref target='Part1' x:rel='#header.via' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
47  <!ENTITY header-fields               "<xref target='Part1' x:rel='#header.fields' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
48  <!ENTITY GET                         "<xref target='Part2' x:rel='#GET' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
49  <!ENTITY safe-methods                "<xref target='Part2' x:rel='#safe.methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
50  <!ENTITY entity-tags                 "<xref target='Part4' x:rel='#header.etag' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
51  <!ENTITY weak-and-strong             "<xref target='Part4' x:rel='#weak.and.strong.validators' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
52  <!ENTITY lastmod-comparison          "<xref target='Part4' x:rel='#lastmod.comparison' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
53  <!ENTITY status-codes                "<xref target='Part2' x:rel='#status.codes' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
54  <!ENTITY status.2xx                  "<xref target='Part2' x:rel='#status.2xx' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
55  <!ENTITY transformations             "<xref target='Part1' x:rel='#message.transformations' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
56]>
57<?rfc toc="yes" ?>
58<?rfc symrefs="yes" ?>
59<?rfc sortrefs="yes" ?>
60<?rfc compact="yes"?>
61<?rfc subcompact="no" ?>
62<?rfc linkmailto="no" ?>
63<?rfc editing="no" ?>
64<?rfc comments="yes"?>
65<?rfc inline="yes"?>
66<?rfc rfcedstyle="yes"?>
67<?rfc-ext allow-markup-in-artwork="yes" ?>
68<?rfc-ext include-references-in-index="yes" ?>
69<rfc category="std" docName="draft-ietf-httpbis-p6-cache-&ID-VERSION;" ipr="pre5378Trust200902"
70  obsoletes="2616" x:maturity-level="proposed" xmlns:x="http://purl.org/net/xml2rfc/ext">
71<x:link rel="prev" basename="p5-range"/>
72<x:link rel="next" basename="p7-auth"/>
73<x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=&lt;{ref}&gt;:"/>
74<front>
75
76  <title abbrev="HTTP/1.1 Caching">Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
77
78  <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
79    <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
80    <address>
81      <postal>
82        <street>345 Park Ave</street>
83        <city>San Jose</city>
84        <region>CA</region>
85        <code>95110</code>
86        <country>USA</country>
87      </postal>
88      <email>fielding@gbiv.com</email>
89      <uri>http://roy.gbiv.com/</uri>
90    </address>
91  </author>
92
93  <author fullname="Mark Nottingham" initials="M." role="editor" surname="Nottingham">
94    <organization>Akamai</organization>
95    <address>
96      <email>mnot@mnot.net</email>
97      <uri>http://www.mnot.net/</uri>
98    </address>
99  </author>
100
101  <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
102    <organization abbrev="greenbytes">greenbytes GmbH</organization>
103    <address>
104      <postal>
105        <street>Hafenweg 16</street>
106        <city>Muenster</city><region>NW</region><code>48155</code>
107        <country>Germany</country>
108      </postal>
109      <email>julian.reschke@greenbytes.de</email>
110      <uri>http://greenbytes.de/tech/webdav/</uri>
111    </address>
112  </author>
113
114  <date month="&ID-MONTH;" year="&ID-YEAR;" />
115  <workgroup>HTTPbis Working Group</workgroup>
116
117<abstract>
118<t>
119   The Hypertext Transfer Protocol (HTTP) is an application-level protocol for
120   distributed, collaborative, hypertext information systems. This document
121   defines requirements on HTTP caches and the associated header fields
122   that control cache behavior or indicate cacheable response messages.
123</t>
124</abstract>
125
126<note title="Editorial Note (To be removed by RFC Editor)">
127  <t>
128    Discussion of this draft takes place on the HTTPBIS working group
129    mailing list (ietf-http-wg@w3.org), which is archived at
130    <eref target="http://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
131  </t>
132  <t>
133    The current issues list is at
134    <eref target="http://tools.ietf.org/wg/httpbis/trac/report/3"/> and related
135    documents (including fancy diffs) can be found at
136    <eref target="http://tools.ietf.org/wg/httpbis/"/>.
137  </t>
138  <t>
139    The changes in this draft are summarized in <xref target="changes.since.23"/>.
140  </t>
141</note>
142
143   </front>
144   <middle>
145
146<section anchor="caching" title="Introduction">
147<t>
148   HTTP is typically used for distributed information systems, where
149   performance can be improved by the use of response caches. This document
150   defines aspects of HTTP/1.1 related to caching and reusing response
151   messages.
152</t>
153
154<iref item="cache" />
155<t>
156   An HTTP <x:dfn>cache</x:dfn> is a local store of response messages and the
157   subsystem that controls storage, retrieval, and deletion of messages in it.
158   A cache stores cacheable responses in order to reduce the response time and
159   network bandwidth consumption on future, equivalent requests. Any client or
160   server &MAY; employ a cache, though a cache cannot be used by a server that
161   is acting as a tunnel.
162</t>
163<iref item="shared cache" />
164<iref item="private cache" />
165<t anchor="shared.and.private.caches">
166   A <x:dfn>shared cache</x:dfn> is a cache that stores responses to be reused
167   by more than one user; shared caches are usually (but not always) deployed
168   as a part of an intermediary. A <x:dfn>private cache</x:dfn>, in contrast,
169   is dedicated to a single user.
170</t>
171<t>
172   The goal of caching in HTTP/1.1 is to significantly improve performance
173   by reusing a prior response message to satisfy a current request.
174   A stored response is considered "fresh", as defined in
175   <xref target="expiration.model" />, if the response can be reused without
176   "validation" (checking with the origin server to see if the cached response
177   remains valid for this request).  A fresh response can therefore
178   reduce both latency and network overhead each time it is reused.
179   When a cached response is not fresh, it might still be reusable if it can
180   be freshened by validation (<xref target="validation.model" />) or if the
181   origin is unavailable (<xref target="serving.stale.responses" />).
182</t>
183
184<section title="Conformance and Error Handling" anchor="conformance">
185<t>
186   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
187   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
188   document are to be interpreted as described in <xref target="RFC2119"/>.
189</t>
190<t>
191   Conformance criteria and considerations regarding error handling
192   are defined in &conformance;.
193</t>
194</section>
195
196<section title="Syntax Notation" anchor="notation">
197<t>
198   This specification uses the Augmented Backus-Naur Form (ABNF) notation
199   of <xref target="RFC5234"/> with the list rule extension defined in
200   &abnf-extension;. <xref target="imported.abnf"/> describes rules imported from
201   other documents. <xref target="collected.abnf"/> shows the collected ABNF
202   with the list rule expanded.
203</t>
204
205<section title="Delta Seconds" anchor="delta-seconds">
206<t>
207   The delta-seconds rule specifies a non-negative integer, representing time
208   in seconds.
209</t>
210<figure><artwork type="abnf2616"><iref item="Grammar" primary="true" subitem="delta-seconds" />
211  <x:ref>delta-seconds</x:ref>  = 1*<x:ref>DIGIT</x:ref>
212</artwork></figure>
213<t>
214   If a cache receives a delta-seconds value larger than the largest
215   positive integer it can represent, or if any of its subsequent calculations
216   overflows, the cache &MUST; consider the value to be 2147483648
217   (2<x:sup>31</x:sup>). A recipient parsing a delta-seconds value &MUST; use
218   an arithmetic type of at least 31 bits of range, and a sender &MUST-NOT;
219   generate delta-seconds with a value greater than 2147483648.
220</t>
221</section>
222
223</section>
224</section>
225
226<section anchor="caching.overview" title="Overview of Cache Operation">
227<iref item="cache entry" />
228<iref item="cache key" />
229<t>
230   Proper cache operation preserves the semantics of HTTP transfers
231   (&semantics;) while eliminating the transfer of information already held
232   in the cache.  Although caching is an entirely &OPTIONAL; feature of HTTP,
233   we assume that reusing the cached response is desirable and that such
234   reuse is the default behavior when no requirement or local
235   configuration prevents it.  Therefore, HTTP cache requirements are focused
236   on preventing a cache from either storing a non-reusable response or
237   reusing a stored response inappropriately, rather than mandating that
238   caches always store and reuse particular responses.
239</t>
240<t>
241   Each <x:dfn>cache entry</x:dfn> consists of a cache key and one or more
242   HTTP responses corresponding to prior requests that used the same key. The
243   most common form of cache entry is a successful result of a retrieval
244   request: i.e., a <x:ref>200 (OK)</x:ref> response to a GET request, which
245   contains a representation of the resource identified by the request target
246   (&GET;). However, it is also possible to cache permanent redirects,
247   negative results (e.g., <x:ref>404 (Not Found)</x:ref>),
248   incomplete results (e.g., <x:ref>206 (Partial Content)</x:ref>), and
249   responses to methods other than GET if the method's definition allows such
250   caching and defines something suitable for use as a cache key.
251</t>
252<iref item="cache key" />
253<t>
254   The primary <x:dfn>cache key</x:dfn> consists of the request method and
255   target URI.  However, since HTTP caches in common use today are typically
256   limited to caching responses to GET, many caches simply decline
257   other methods and use only the URI as the primary cache key.
258</t>
259<t>
260   If a request target is subject to content negotiation, its cache entry
261   might consist of multiple stored responses, each differentiated by a
262   secondary key for the values of the original request's selecting header
263   fields (<xref target="caching.negotiated.responses"/>).
264</t>
265</section>
266
267<section anchor="response.cacheability" title="Storing Responses in Caches">
268<t>
269   A cache &MUST-NOT; store a response to any request, unless:
270   <list style="symbols">
271      <t>The request method is understood by the cache and defined as being
272      cacheable, and</t>
273      <t>the response status code is understood by the cache, and</t>
274      <t>the "no-store" cache directive (see <xref
275      target="header.cache-control" />) does not appear in request or response
276      header fields, and</t>
277      <t>the "private" cache response directive (see <xref
278      target="cache-response-directive.private" />) does not appear in the
279      response, if the cache is shared, and</t>
280      <t>the <x:ref>Authorization</x:ref> header field (see
281      &header-authorization;) does not appear in the request, if the cache is
282      shared, unless the response explicitly allows it (see <xref
283      target="caching.authenticated.responses" />), and</t>
284      <t>the response either:
285         <list style="symbols">
286            <t>contains an <x:ref>Expires</x:ref> header field (see
287            <xref target="header.expires"/>), or</t>
288            <t>contains a max-age response cache directive (see <xref
289            target="cache-response-directive.max-age" />), or</t>
290            <t>contains a s-maxage response cache directive (see <xref
291            target="cache-response-directive.s-maxage" />) and the cache is
292            shared, or</t>
293            <t>contains a Cache Control Extension (see <xref
294            target="cache.control.extensions" />) that allows it to be cached,
295            or</t>
296            <t>has a status code that is defined as cacheable
297            (see <xref target="heuristic.freshness" />), or</t>
298            <t>contains a public response cache directive (see <xref
299            target="cache-response-directive.public"/>).</t>
300         </list>
301      </t>
302   </list>
303</t>
304<t>
305   Note that any of the requirements listed above can be overridden by a
306   cache-control extension; see <xref target="cache.control.extensions" />.
307</t>
308<t>
309   In this context, a cache has "understood" a request method or a response
310   status code if it recognizes it and implements all specified
311   caching-related behavior.
312</t>
313<t>
314   Note that, in normal operation, some caches will not store a response that
315   has neither a cache validator nor an explicit expiration time, as such
316   responses are not usually useful to store. However, caches are not
317   prohibited from storing such responses.
318</t>
319
320<section anchor="incomplete.responses" title="Storing Incomplete Responses">
321<t>
322   A response message is considered complete when all of the octets indicated
323   by the message framing (&messaging;) are received prior to the connection
324   being closed. If the request method is GET, the response status code is
325   <x:ref>200 (OK)</x:ref>, and the entire response header section has been received, a
326   cache &MAY; store an incomplete response message body if the cache entry is
327   recorded as incomplete. Likewise, a <x:ref>206 (Partial Content)</x:ref>
328   response &MAY; be stored as if it were an incomplete <x:ref>200
329   (OK)</x:ref> cache entry. However, a cache &MUST-NOT; store incomplete or
330   partial content responses if it does not support the <x:ref>Range</x:ref>
331   and <x:ref>Content-Range</x:ref> header fields or if it does not understand
332   the range units used in those fields.
333</t>
334<t>
335   A cache &MAY; complete a stored incomplete response by making a subsequent
336   range request (&partial;) and combining the successful response with the
337   stored entry, as defined in <xref target="combining.responses"/>. A cache
338   &MUST-NOT; use an incomplete response to answer requests unless the
339   response has been made complete or the request is partial and specifies a
340   range that is wholly within the incomplete response. A cache &MUST-NOT;
341   send a partial response to a client without explicitly marking it as such
342   using the <x:ref>206 (Partial Content)</x:ref> status code.
343</t>
344</section>
345
346
347<section anchor="caching.authenticated.responses"
348   title="Storing Responses to Authenticated Requests">
349<t>
350   A shared cache &MUST-NOT; use a cached response to a request with an
351   <x:ref>Authorization</x:ref> header field (&header-authorization;) to
352   satisfy any subsequent request unless a cache directive that allows such
353   responses to be stored is present in the response.
354</t>
355<t>
356   In this specification, the following <x:ref>Cache-Control</x:ref> response
357   directives (<xref target="cache-response-directive"/>) have such an effect:
358   must-revalidate, public, s-maxage.
359</t>
360<t>
361   Note that cached responses that contain the "must-revalidate" and/or
362   "s-maxage" response directives are not allowed to be served stale (<xref
363   target="serving.stale.responses"/>) by shared caches. In particular, a
364   response with either "max-age=0, must-revalidate" or "s-maxage=0" cannot be
365   used to satisfy a subsequent request without revalidating it on the origin
366   server.
367</t>
368</section>
369
370<section anchor="combining.responses" title="Combining Partial Content">
371<t>
372   A response might transfer only a partial representation if the
373   connection closed prematurely or if the request used one or more Range
374   specifiers (&partial;).  After several such transfers, a cache might have
375   received several ranges of the same representation.  A cache &MAY; combine
376   these ranges into a single stored response, and reuse that response to
377   satisfy later requests, if they all share the same strong validator and
378   the cache complies with the client requirements in &combining-byte-ranges;.
379</t>
380<t>
381   When combining the new response with one or more stored responses, a
382   cache &MUST;:
383   <list style="symbols">
384      <t>delete any <x:ref>Warning</x:ref> header fields in the stored response
385         with warn-code 1xx (see <xref target="header.warning" />);</t>
386      <t>retain any <x:ref>Warning</x:ref> header fields in the stored response
387         with warn-code 2xx; and,</t>
388      <t>use other header fields provided in the new response, aside
389         from <x:ref>Content-Range</x:ref>, to replace all instances of the
390         corresponding header fields in the stored response.</t>
391   </list>
392</t>
393</section>
394
395</section>
396
397
398<section anchor="constructing.responses.from.caches"
399   title="Constructing Responses from Caches">
400<t>
401   When presented with a request, a cache &MUST-NOT; reuse a stored response,
402   unless:
403   <list style="symbols">
404      <t>The presented effective request URI (&effective-request-uri;) and
405      that of the stored response match, and</t>
406      <t>the request method associated with the stored response allows it to
407      be used for the presented request, and</t>
408      <t>selecting header fields nominated by the stored response (if any)
409      match those presented (see <xref target="caching.negotiated.responses"
410      />), and</t>
411      <t>the presented request does not contain the no-cache pragma (<xref
412      target="header.pragma"/>), nor the no-cache cache directive (<xref
413      target="cache-request-directive"/>), unless the stored response is
414      successfully validated (<xref target="validation.model"/>), and</t>
415      <t>the stored response does not contain the no-cache cache directive
416      (<xref target="cache-response-directive.no-cache"/>), unless it is
417      successfully validated (<xref target="validation.model"/>), and</t>
418      <t>the stored response is either:
419         <list style="symbols">
420            <t>fresh (see <xref target="expiration.model" />), or</t>
421            <t>allowed to be served stale (see <xref
422            target="serving.stale.responses" />), or</t>
423            <t>successfully validated (see <xref target="validation.model"
424            />).</t>
425         </list>
426      </t>
427  </list>
428</t>
429<t>
430   Note that any of the requirements listed above can be overridden by a
431   cache-control extension; see <xref target="cache.control.extensions" />.
432</t>
433<t>
434   When a stored response is used to satisfy a request without validation, a
435   cache &MUST; generate an <x:ref>Age</x:ref> header field (<xref
436   target="header.age"/>), replacing any present in the response with a value
437   equal to the stored response's current_age; see <xref
438   target="age.calculations" />.
439</t>
440<t>
441   A cache &MUST; write through requests with methods that are unsafe
442   (&safe-methods;) to the origin server; i.e., a cache is not allowed to
443   generate a reply to such a request before having forwarded the request and
444   having received a corresponding response.
445</t>
446<t>
447   Also, note that unsafe requests might invalidate already stored responses;
448   see <xref target="invalidation" />.
449</t>
450<t>
451   When more than one suitable response is stored, a cache &MUST; use the
452   most recent response (as determined by the <x:ref>Date</x:ref> header
453   field). It can also forward the request with "Cache-Control: max-age=0" or
454   "Cache-Control: no-cache" to disambiguate which response to use.
455</t>
456<t>
457   A cache that does not have a clock available &MUST-NOT; use stored
458   responses without revalidating them upon every use.
459</t>
460
461<section anchor="caching.negotiated.responses"
462   title="Calculating Secondary Keys with Vary">
463<t>
464   When a cache receives a request that can be satisfied by a stored response
465   that has a <x:ref>Vary</x:ref> header field (&header-vary;),
466   it &MUST-NOT; use that response unless all of the selecting header fields
467   nominated by the Vary header field match in both the original request
468   (i.e., that associated with the stored response), and the presented
469   request.
470</t>
471<t>
472   The selecting header fields from two requests are defined to match if and
473   only if those in the first request can be transformed to those in the
474   second request by applying any of the following:
475   <list style="symbols">
476      <t>
477         adding or removing whitespace, where allowed in the header field's
478         syntax
479      </t>
480      <t>
481         combining multiple header fields with the same field name
482         (see &header-fields;)
483      </t>
484      <t>
485         normalizing both header field values in a way that is known to have
486         identical semantics, according to the header field's specification
487         (e.g., re-ordering field values when order is not significant;
488         case-normalization, where values are defined to be case-insensitive)
489      </t>
490  </list>
491</t>
492<t>
493   If (after any normalization that might take place) a header field is absent
494   from a request, it can only match another request if it is also absent
495   there.
496</t>
497<t>
498   A <x:ref>Vary</x:ref> header field-value of "*" always fails to match.
499</t>
500<t>
501   The stored response with matching selecting header fields is known as the
502   selected response.
503</t>
504<t>
505   If multiple selected responses are available (potentially including
506   responses without a Vary header field), the cache will need to choose one to use.
507   When a selecting header field has a known mechanism for doing so (e.g., qvalues on
508   <x:ref>Accept</x:ref> and similar request header fields), that mechanism &MAY; be
509   used to select preferred responses; of the remainder, the most recent
510   response (as determined by the <x:ref>Date</x:ref> header field) is used, as
511   per <xref target="constructing.responses.from.caches"/>.
512</t>
513<t>
514   If no selected response is available, the cache cannot satisfy the
515   presented request. Typically, it is forwarded to the origin server
516   in a (possibly conditional; see <xref target="validation.model"/>) request.
517</t>
518</section>
519
520<section anchor="expiration.model" title="Freshness">
521<iref item="fresh" />
522<iref item="stale" />
523<t>
524   A <x:dfn>fresh</x:dfn> response is one whose age has not yet exceeded its
525   freshness lifetime. Conversely, a <x:dfn>stale</x:dfn>
526   response is one where it has.
527</t>
528<iref item="freshness lifetime" />
529<iref item="explicit expiration time" />
530<iref item="heuristic expiration time" />
531<t>
532   A response's <x:dfn>freshness lifetime</x:dfn> is the length of time
533   between its generation by the origin server and its expiration time. An
534   <x:dfn>explicit expiration time</x:dfn> is the time at which the origin
535   server intends that a stored response can no longer be used by a cache
536   without further validation, whereas a <x:dfn>heuristic expiration
537   time</x:dfn> is assigned by a cache when no explicit expiration time is
538   available.
539</t>
540<iref item="age" />
541<t>
542   A response's <x:dfn>age</x:dfn> is the time that has passed since it was
543   generated by, or successfully validated with, the origin server. 
544</t>
545<t>
546   When a response is "fresh" in the cache, it can be used to satisfy
547   subsequent requests without contacting the origin server, thereby improving
548   efficiency.
549</t>
550<t>
551   The primary mechanism for determining freshness is for an origin server to
552   provide an explicit expiration time in the future, using either the
553   <x:ref>Expires</x:ref> header field (<xref target="header.expires" />) or
554   the max-age response cache directive (<xref
555   target="cache-response-directive.max-age" />). Generally, origin servers
556   will assign future explicit expiration times to responses in the belief
557   that the representation is not likely to change in a semantically
558   significant way before the expiration time is reached.
559</t>
560<t>
561   If an origin server wishes to force a cache to validate every request, it
562   can assign an explicit expiration time in the past to indicate that the
563   response is already stale. Compliant caches will normally validate a stale
564   cached response before reusing it for subsequent requests (see <xref
565   target="serving.stale.responses" />).
566</t>
567<t>
568   Since origin servers do not always provide explicit expiration times,
569   caches are also allowed to use a heuristic to determine an expiration time
570   under certain circumstances (see <xref target="heuristic.freshness"/>).
571</t>
572<figure>
573<preamble>
574  The calculation to determine if a response is fresh is:
575</preamble>
576<artwork type="code">
577   response_is_fresh = (freshness_lifetime &gt; current_age)
578</artwork>
579</figure>
580<t>
581   freshness_lifetime is defined in <xref
582   target="calculating.freshness.lifetime" />; current_age is defined in
583   <xref target="age.calculations" />.
584</t>
585<t>
586   Clients can send the max-age or min-fresh cache directives in a request to
587   constrain or relax freshness calculations for the corresponding response
588   (<xref target="cache-request-directive" />).
589</t>
590<t>
591   When calculating freshness, to avoid common problems in date parsing:
592</t>
593<t>
594  <list style="symbols">
595     <t>Although all date formats are specified to be case-sensitive,
596        a cache recipient &SHOULD; match day, week, and timezone names
597        case-insensitively.</t>
598             
599     <t>If a cache recipient's internal implementation of time has less
600        resolution than the value of an HTTP-date, the recipient &MUST;
601        internally represent a parsed <x:ref>Expires</x:ref> date as the
602        nearest time equal to or earlier than the received value.</t>
603
604     <t>A cache recipient &MUST-NOT; allow local time zones to influence the
605        calculation or comparison of an age or expiration time.</t>
606
607     <t>A cache recipient &SHOULD; consider a date with a zone abbreviation
608        other than GMT or UTC to be invalid for calculating expiration.</t>
609  </list>
610</t>
611<t>
612   Note that freshness applies only to cache operation; it cannot be used to
613   force a user agent to refresh its display or reload a resource. See <xref
614   target="history.lists" /> for an explanation of the difference between
615   caches and history mechanisms.
616</t>
617
618<section anchor="calculating.freshness.lifetime"
619   title="Calculating Freshness Lifetime">
620<t>
621   A cache can calculate the freshness lifetime (denoted as
622   freshness_lifetime) of a response by using the first match of:
623   <list style="symbols">
624      <t>If the cache is shared and the s-maxage response cache directive
625      (<xref target="cache-response-directive.s-maxage" />) is present, use its value,
626      or</t>
627      <t>If the max-age response cache directive (<xref
628      target="cache-response-directive.max-age" />) is present, use its value, or</t>
629      <t>If the <x:ref>Expires</x:ref> response header field
630      (<xref target="header.expires" />) is present, use its value minus the
631      value of the <x:ref>Date</x:ref> response header field, or</t>
632      <t>Otherwise, no explicit expiration time is present in the response. A
633      heuristic freshness lifetime might be applicable; see <xref
634      target="heuristic.freshness" />.</t>
635   </list>
636</t>
637<t>
638   Note that this calculation is not vulnerable to clock skew, since all of
639   the information comes from the origin server.
640</t>
641<t>
642   When there is more than one value present for a given directive (e.g., two
643   <x:ref>Expires</x:ref> header fields, multiple Cache-Control: max-age
644   directives), the directive's value is considered invalid. Caches are
645   encouraged to consider responses that have invalid freshness information to
646   be stale.
647</t>
648</section>
649
650<section anchor="heuristic.freshness" title="Calculating Heuristic Freshness">
651<t>
652   Since origin servers do not always provide explicit expiration times, a
653   cache &MAY; assign a heuristic expiration time when an explicit time is not
654   specified, employing algorithms that use other header field values (such as
655   the <x:ref>Last-Modified</x:ref> time) to estimate a plausible expiration
656   time. This specification does not provide specific algorithms, but does
657   impose worst-case constraints on their results.
658</t>
659<t>
660   A cache &MUST-NOT; use heuristics to determine freshness when an explicit
661   expiration time is present in the stored response. Because of the
662   requirements in <xref target="response.cacheability"/>, this means that,
663   effectively, heuristics can only be used on responses without explicit
664   freshness whose status codes are defined as cacheable, and responses
665   without explicit freshness that have been marked as explicitly cacheable
666   (e.g., with a "public" response cache directive).
667</t>
668<t>
669   If the response has a <x:ref>Last-Modified</x:ref> header field
670   (&header-last-modified;), caches are encouraged to use a heuristic
671   expiration value that is no more than some fraction of the interval since
672   that time. A typical setting of this fraction might be 10%.
673</t>
674<t>
675   When a heuristic is used to calculate freshness lifetime, a cache &SHOULD;
676   generate a <x:ref>Warning</x:ref> header field with a 113 warn-code (see
677   <xref target="warn.113"/>) in the response if its current_age is more than
678   24 hours and such a warning is not already present.
679</t>
680<x:note>
681   <t>
682      &Note; <xref target="RFC2616" x:fmt="of" x:sec="13.9"/> prohibited caches
683      from calculating heuristic freshness for URIs with query components
684      (i.e., those containing '?'). In practice, this has not been widely
685      implemented. Therefore, origin servers are encouraged to send explicit
686      directives (e.g., Cache-Control: no-cache) if they wish to preclude
687      caching.
688   </t>
689</x:note>
690</section>
691
692<section anchor="age.calculations" title="Calculating Age">
693<t>
694   The <x:ref>Age</x:ref> header field is used to convey an estimated
695   age of the response message when obtained from a cache. The Age field value
696   is the cache's estimate of the number of seconds since the response was
697   generated or validated by the origin server. In essence, the Age value is
698   the sum of the time that the response has been resident in each of the
699   caches along the path from the origin server, plus the amount of time it
700   has been in transit along network paths.
701</t>
702<t>
703   The following data is used for the age calculation:
704</t>
705<t>
706   <x:dfn>age_value</x:dfn>
707   <list>
708      <t>
709         The term "age_value" denotes the value of the <x:ref>Age</x:ref>
710         header field (<xref target="header.age"/>), in a form appropriate for
711         arithmetic operation; or 0, if not available.
712      </t>
713   </list>
714</t>
715<t>
716   <x:dfn>date_value</x:dfn>
717   <list>
718      <t>
719         The term "date_value" denotes the value of
720         the Date header field, in a form appropriate for arithmetic
721         operations. See &header-date; for the definition of the Date header
722         field, and for requirements regarding responses without it.
723      </t>
724   </list>
725</t>
726<t>
727   <x:dfn>now</x:dfn>
728   <list>
729      <t>
730         The term "now" means "the current value of the clock at the host
731         performing the calculation". A host ought to use NTP (<xref
732         target="RFC1305"/>) or some similar protocol to synchronize its
733         clocks to Coordinated Universal Time.
734      </t>
735   </list>
736</t>
737<t>
738   <x:dfn>request_time</x:dfn>
739   <list>
740      <t>
741         The current value of the clock at the host at the time the request
742         resulting in the stored response was made.
743      </t>
744   </list>
745</t>
746<t>
747   <x:dfn>response_time</x:dfn>
748   <list>
749      <t>
750         The current value of the clock at the host at the time the response
751         was received.
752      </t>
753   </list>
754</t>
755<t>
756   A response's age can be calculated in two entirely independent ways:
757   <list style="numbers">
758      <t>the "apparent_age": response_time minus date_value, if the local
759      clock is reasonably well synchronized to the origin server's clock. If
760      the result is negative, the result is replaced by zero.</t>
761      <t>the "corrected_age_value", if all of the caches along the response
762      path implement HTTP/1.1. A cache &MUST; interpret this value relative
763      to the time the request was initiated, not the time that the response
764      was received.</t>
765   </list>
766</t>
767<figure>
768<artwork type="code">
769  apparent_age = max(0, response_time - date_value);
770
771  response_delay = response_time - request_time;
772  corrected_age_value = age_value + response_delay; 
773</artwork>
774</figure>
775<figure>
776<preamble>These are combined as</preamble>
777<artwork type="code">
778  corrected_initial_age = max(apparent_age, corrected_age_value);
779</artwork></figure>
780<t>
781   unless the cache is confident in the value of the <x:ref>Age</x:ref> header
782   field (e.g., because there are no HTTP/1.0 hops in the <x:ref>Via</x:ref>
783   header field), in which case the corrected_age_value &MAY; be used as the
784   corrected_initial_age.
785</t>
786<t>
787   The current_age of a stored response can then be calculated by adding the
788   amount of time (in seconds) since the stored response was last validated by
789   the origin server to the corrected_initial_age.
790</t>
791<figure><artwork type="code">
792  resident_time = now - response_time;
793  current_age = corrected_initial_age + resident_time;
794</artwork></figure>
795</section>
796
797<section anchor="serving.stale.responses" title="Serving Stale Responses">
798<t>
799   A "stale" response is one that either has explicit expiry information or is
800   allowed to have heuristic expiry calculated, but is not fresh according to
801   the calculations in <xref target="expiration.model" />.
802</t>
803<t>
804   A cache &MUST-NOT; generate a stale response if it is prohibited by an
805   explicit in-protocol directive (e.g., by a "no-store" or "no-cache" cache
806   directive, a "must-revalidate" cache-response-directive, or an applicable
807   "s-maxage" or "proxy-revalidate" cache-response-directive; see <xref
808   target="cache-response-directive"/>).
809</t>
810<t>
811   A cache &MUST-NOT; send stale responses unless it is disconnected
812   (i.e., it cannot contact the origin server or otherwise find a forward
813   path) or doing so is explicitly allowed (e.g., by the max-stale request
814   directive; see <xref target="cache-request-directive" />).
815</t>
816<t>
817   A cache &SHOULD; generate a <x:ref>Warning</x:ref> header field with the
818   110 warn-code (see <xref target="warn.110"/>) in stale responses.
819   Likewise, a cache &SHOULD; generate a 112 warn-code (see
820   <xref target="warn.112"/>) in stale responses if the cache is disconnected.
821</t>
822<t>
823   A cache &SHOULD-NOT; generate a new <x:ref>Warning</x:ref> header field
824   when forwarding a response that does not have an <x:ref>Age</x:ref> header
825   field, even if the response is already stale.  A cache need not validate
826   a response that merely became stale in transit.
827</t>
828</section>
829</section>
830
831<section anchor="validation.model" title="Validation">
832<t>
833   When a cache has one or more stored responses for a requested URI, but
834   cannot serve any of them (e.g., because they are not fresh, or one cannot
835   be selected; see <xref target="caching.negotiated.responses"/>), it can use
836   the conditional request mechanism &conditional; in the forwarded request to
837   give the next inbound server an opportunity to select a valid stored
838   response to use, updating the stored metadata in the process, or to replace
839   the stored response(s) with a new response. This process is known as
840   "validating" or "revalidating" the stored response.
841</t>
842
843<section anchor="validation.sent" title="Sending a Validation Request"><iref item="validator" />
844<t>
845   When sending a conditional request for cache validation, a cache sends one
846   or more precondition header fields containing <x:dfn>validator</x:dfn>
847   metadata from its stored response(s), which is then compared by recipients
848   to determine whether a stored response is equivalent to a current
849   representation of the resource.
850</t>
851<t>
852   One such validator is the timestamp given in a <x:ref>Last-Modified</x:ref>
853   header field (&header-last-modified;), which can be used in an
854   <x:ref>If-Modified-Since</x:ref> header field for response validation, or
855   in an <x:ref>If-Unmodified-Since</x:ref> or <x:ref>If-Range</x:ref> header
856   field for representation selection (i.e., the client is referring
857   specifically to a previously obtained representation with that timestamp).
858</t>
859<t>
860   Another validator is the entity-tag given in an <x:ref>ETag</x:ref> header
861   field (&header-etag;). One or more entity-tags, indicating one or more
862   stored responses, can be used in an <x:ref>If-None-Match</x:ref> header
863   field for response validation, or in an <x:ref>If-Match</x:ref> or
864   <x:ref>If-Range</x:ref> header field for representation selection (i.e.,
865   the client is referring specifically to one or more previously obtained
866   representations with the listed entity-tags).
867</t>
868</section>
869
870<section anchor="validation.received" title="Handling a Received Validation Request">
871<t>
872   Each client in the request chain may have its own cache, so it is common
873   for a cache at an intermediary to receive conditional requests from other
874   (outbound) caches. Likewise, some user agents make use of conditional
875   requests to limit data transfers to recently modified representations or to
876   complete the transfer of a partially retrieved representation.
877</t>
878<t>
879   If a cache receives a request that can be satisfied by reusing one of
880   its stored <x:ref>200 (OK)</x:ref> or <x:ref>206 (Partial Content)</x:ref>
881   responses, the cache &SHOULD; evaluate any applicable conditional header
882   field preconditions received in that request with respect to the
883   corresponding validators contained within the selected response.
884   A cache &MUST-NOT; evaluate conditional header fields that are only
885   applicable to an origin server, found in a request with semantics that
886   cannot be satisfied with a cached response, or applied to a target resource
887   for which it has no stored responses; such preconditions are likely
888   intended for some other (inbound) server.
889</t>
890<t>
891   The proper evaluation of conditional requests by a cache depends on the
892   received precondition header fields and their precedence, as defined in
893   &conditional-precedence;. The <x:ref>If-Match</x:ref> and
894   <x:ref>If-Unmodified-Since</x:ref> conditional header fields are not
895   applicable to a cache.
896</t>
897<t>
898   A request containing an <x:ref>If-None-Match</x:ref> header field
899   (&header-if-none-match;) indicates that the client wants to validate one
900   or more of its own stored responses in comparison to whichever stored
901   response is selected by the cache.
902   If the field-value is "*", or if the field-value is a list of entity-tags
903   and at least one of them match the entity-tag of the selected stored
904   response, a cache recipient &SHOULD; generate a
905   <x:ref>304 (Not Modified)</x:ref> response (using the metadata of the
906   selected stored response) instead of sending that stored response.
907</t>
908<t>
909   When a cache decides to revalidate its own stored responses for a
910   request that contains an <x:ref>If-None-Match</x:ref> list of entity-tags,
911   the cache &MAY; combine the received list with a list of entity-tags
912   from its own stored set of responses (fresh or stale) and send the union of
913   the two lists as a replacement <x:ref>If-None-Match</x:ref> header
914   field value in the forwarded request.
915   If a stored response contains only partial content, the
916   cache &MUST-NOT; include its entity-tag in the union unless the request is
917   for a range that would be fully satisfied by that partial stored response.
918   If the response to the forwarded request is
919   <x:ref>304 (Not Modified)</x:ref> and has an ETag header field value with
920   an entity-tag that is not in the client's list, the cache &MUST;
921   generate a <x:ref>200 (OK)</x:ref> response for the client by reusing its
922   corresponding stored response, as updated by the 304 response metadata
923   (<xref target="freshening.responses"/>).
924</t>
925<t>
926   If an <x:ref>If-None-Match</x:ref> header field is not present, a request
927   containing an <x:ref>If-Modified-Since</x:ref> header field
928   (&header-if-modified-since;) indicates that the client wants to validate
929   one or more of its own stored responses by modification date.
930   A cache recipient &SHOULD; generate a <x:ref>304 (Not Modified)</x:ref>
931   response (using the metadata of the selected stored response) if one of the
932   following cases is true:
933   1) the selected stored response has a <x:ref>Last-Modified</x:ref>
934   field-value that is earlier than or equal to the conditional timestamp;
935   2) no <x:ref>Last-Modified</x:ref> field is present in the selected stored
936   response, but it has a <x:ref>Date</x:ref> field-value that is earlier than
937   or equal to the conditional timestamp; or,
938   3) neither <x:ref>Last-Modified</x:ref> nor <x:ref>Date</x:ref> is present
939   in the selected stored response, but the cache recorded it as having been
940   received at a time earlier than or equal to the conditional timestamp.
941</t>
942<t>
943   A cache that implements partial responses to range requests, as defined in
944   &partial;, also needs to evaluate a received <x:ref>If-Range</x:ref> header
945   field (&header-if-range;) with respect to its selected stored response.
946</t>
947</section>
948
949<section anchor="validation.response" title="Handling a Validation Response">
950<t>
951   Cache handling of a response to a conditional request is dependent upon its
952   status code:
953</t>
954<t>
955   <list style="symbols">
956      <t>
957         A <x:ref>304 (Not Modified)</x:ref> response status code indicates
958         that the stored response can be updated and reused; see <xref
959         target="freshening.responses"/>.
960      </t>
961      <t>
962         A full response (i.e., one with a payload body) indicates that none
963         of the stored responses nominated in the conditional request is
964         suitable. Instead, the cache &MUST; use the full response to
965         satisfy the request and &MAY; replace the stored response(s).
966      </t>
967      <t>
968         However, if a cache receives a <x:ref>5xx (Server Error)</x:ref>
969         response while attempting to validate a response, it can either
970         forward this response to the requesting client, or act as if the
971         server failed to respond. In the latter case, the cache &MAY; send a
972         previously stored response (see <xref
973         target="serving.stale.responses" />).
974      </t>
975   </list>
976</t>
977</section>
978
979<section anchor="freshening.responses" title="Freshening Stored Responses upon Validation">
980<t>
981   When a cache receives a <x:ref>304 (Not Modified)</x:ref> response and
982   already has one or more stored <x:ref>200 (OK)</x:ref> responses for the
983   same cache key, the cache needs to identify which of the stored responses
984   are updated by this new response and then update the stored response(s)
985   with the new information provided in the <x:ref>304</x:ref> response.
986</t>
987<iref item="strong validator" />
988<t>
989   The stored response to update is identified by using the first match (if
990   any) of:
991   <list style="symbols">
992    <t>
993     If the new response contains a <x:dfn>strong validator</x:dfn> (see
994     &weak-and-strong;), then that strong validator identifies the selected
995     representation for update. All of the stored responses with the same
996     strong validator are selected. If none of the stored responses contain the
997     same strong validator, then the cache &MUST-NOT; use the new response to
998     update any stored responses.
999    </t>
1000    <t>
1001     If the new response contains a weak validator and that validator
1002     corresponds to one of the cache's stored responses, then the most
1003     recent of those matching stored responses is selected for update.
1004    </t>
1005    <t>
1006     If the new response does not include any form of validator (such as in
1007     the case where a client generates an If-Modified-Since request from a
1008     source other than the Last-Modified response header field), and there is
1009     only one stored response, and that stored response also lacks a
1010     validator, then that stored response is selected for update.
1011    </t>
1012   </list>
1013</t>
1014<t>
1015   If a stored response is selected for update, the cache &MUST;:
1016   <list style="symbols">
1017      <t>delete any <x:ref>Warning</x:ref> header fields in the stored response
1018         with warn-code 1xx (see <xref target="header.warning" />);</t>
1019      <t>retain any <x:ref>Warning</x:ref> header fields in the stored response
1020         with warn-code 2xx; and,</t>
1021      <t>use other header fields provided in the <x:ref>304 (Not Modified)</x:ref>
1022         response to replace all instances of the corresponding header
1023         fields in the stored response.</t>
1024   </list>
1025</t>
1026</section>
1027
1028<section anchor="head.effects" title="Freshening Responses via HEAD">
1029<t>
1030   A response to the HEAD method is identical to what an equivalent request
1031   made with a GET would have been, except it lacks a body. This property
1032   of HEAD responses can be used to invalidate or update a cached GET
1033   response if the more efficient conditional GET request mechanism is not
1034   available (due to no validators being present in the stored response) or
1035   if transmission of the representation body is not desired even if it has
1036   changed.
1037</t>
1038<t>
1039   When a cache makes an inbound HEAD request for a given request target and
1040   receives a <x:ref>200 (OK)</x:ref> response, the cache &SHOULD; update or
1041   invalidate each of its stored GET responses that could have been selected
1042   for that request (see <xref target="caching.negotiated.responses"/>).
1043</t>
1044<t>
1045   For each of the stored responses that could have been selected, if the
1046   stored response and HEAD response have matching values for any received
1047   validator fields (<x:ref>ETag</x:ref> and <x:ref>Last-Modified</x:ref>)
1048   and, if the HEAD response has a <x:ref>Content-Length</x:ref> header field,
1049   the value of <x:ref>Content-Length</x:ref> matches that of the stored
1050   response, the cache &SHOULD; update the stored response a described below;
1051   otherwise, the cache &SHOULD; consider the stored response to be stale.
1052</t>
1053<t>
1054   If a cache updates a stored response with the metadata provided in a HEAD
1055   response, the cache &MUST;:
1056   <list style="symbols">
1057      <t>delete any <x:ref>Warning</x:ref> header fields in the stored response
1058         with warn-code 1xx (see <xref target="header.warning" />);</t>
1059      <t>retain any <x:ref>Warning</x:ref> header fields in the stored response
1060         with warn-code 2xx; and,</t>
1061      <t>use other header fields provided in the HEAD response to replace all
1062         instances of the corresponding header fields in the stored response
1063         and append new header fields to the stored response's header section
1064         unless otherwise restricted by the <x:ref>Cache-Control</x:ref>
1065         header field.</t>
1066   </list>
1067</t>
1068</section>
1069</section>
1070
1071
1072<section anchor="invalidation" title="Invalidation">
1073<t>
1074   Because unsafe request methods (&safe-methods;) such as PUT, POST or DELETE
1075   have the potential for changing state on the origin server, intervening
1076   caches can use them to keep their contents up-to-date.
1077</t>
1078<t>
1079   A cache &MUST; invalidate the effective Request URI
1080   (&effective-request-uri;) as well as the URI(s) in the
1081   <x:ref>Location</x:ref> and <x:ref>Content-Location</x:ref> response header
1082   fields (if present) when a non-error status code is received in response to
1083   an unsafe request method.
1084</t>
1085<t>
1086   However, a cache &MUST-NOT; invalidate a URI from a <x:ref>Location</x:ref>
1087   or <x:ref>Content-Location</x:ref> response header field if the host part of
1088   that URI differs from the host part in the effective request URI
1089   (&effective-request-uri;). This helps prevent denial of service attacks.
1090</t>
1091<t>
1092   A cache &MUST; invalidate the effective request URI
1093   (&effective-request-uri;) when it receives a non-error response
1094   to a request with a method whose safety is unknown.
1095</t>
1096<t>
1097   Here, a "non-error response" is one with a <x:ref>2xx (Successful)</x:ref>
1098   or <x:ref>3xx (Redirection)</x:ref> status code. "Invalidate" means that
1099   the cache will either remove all stored responses related to the effective
1100   request URI, or will mark these as "invalid" and in need of a mandatory
1101   validation before they can be sent in response to a subsequent request.
1102</t>
1103<t>
1104   Note that this does not guarantee that all appropriate responses are
1105   invalidated. For example, a state-changing request might invalidate
1106   responses in the caches it travels through, but relevant responses still
1107   might be stored in other caches that it has not.</t>
1108</section>
1109</section>
1110
1111
1112
1113<section anchor="header.field.definitions" title="Header Field Definitions">
1114<t>
1115   This section defines the syntax and semantics of HTTP/1.1 header fields
1116   related to caching.
1117</t>
1118
1119<section anchor="header.age" title="Age">
1120   <iref item="Age header field" primary="true" x:for-anchor="" />
1121   <x:anchor-alias value="Age"/>
1122   <x:anchor-alias value="age-value"/>
1123<t>
1124   The "Age" header field conveys the sender's estimate of the amount
1125   of time since the response was generated or successfully validated at the
1126   origin server. Age values are calculated as specified in <xref
1127   target="age.calculations" />.
1128</t>
1129<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Age"/>
1130  <x:ref>Age</x:ref> = <x:ref>delta-seconds</x:ref>
1131</artwork></figure>
1132<t>
1133   The Age field-value is a non-negative integer, representing time in seconds
1134   (see <xref target="delta-seconds"/>).
1135</t>
1136<t>
1137   The presence of an Age header field implies that the response was not
1138   generated or validated by the origin server for this request. However,
1139   lack of an Age header field does not imply the origin was contacted, since
1140   the response might have been received from an HTTP/1.0 cache that does not
1141   implement Age.
1142</t>
1143</section>
1144
1145<section anchor="header.cache-control" title="Cache-Control">
1146   <iref item="Cache-Control header field" primary="true" x:for-anchor="" />
1147   <x:anchor-alias value="Cache-Control"/>
1148   <x:anchor-alias value="cache-directive"/>
1149<t>
1150   The "Cache-Control" header field is used to specify directives for
1151   caches along the request/response chain. Such cache directives are
1152   unidirectional in that the presence of a directive in a request does not
1153   imply that the same directive is to be given in the response.
1154</t>
1155<t>
1156   A cache &MUST; obey the requirements of the Cache-Control
1157   directives defined in this section. See <xref
1158   target="cache.control.extensions"/> for information about how Cache-Control
1159   directives defined elsewhere are handled.
1160</t>
1161<x:note>
1162   <t>
1163       &Note; Some HTTP/1.0 caches might not implement Cache-Control.
1164   </t>
1165</x:note>
1166<t>
1167   A proxy, whether or not it implements a cache, &MUST; pass cache directives
1168   through in forwarded messages, regardless of their
1169   significance to that application, since the directives might be applicable
1170   to all recipients along the request/response chain. It is not possible to
1171   target a directive to a specific cache.
1172</t>
1173<t>
1174   Cache directives are identified by a token, to be compared case-insensitively,
1175   and have an optional argument, that can use both token and quoted-string
1176   syntax. For the directives defined below that define arguments, recipients
1177   ought to accept both forms, even if one is documented to be preferred. For
1178   any directive not defined by this specification, a recipient &MUST; accept
1179   both forms.
1180</t>
1181<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Cache-Control"/><iref primary="true" item="Grammar" subitem="cache-directive"/>
1182  <x:ref>Cache-Control</x:ref>   = 1#<x:ref>cache-directive</x:ref>
1183
1184  <x:ref>cache-directive</x:ref> = <x:ref>token</x:ref> [ "=" ( <x:ref>token</x:ref> / <x:ref>quoted-string</x:ref> ) ]
1185</artwork></figure>
1186<t>
1187   For the cache directives defined below, no argument is defined (nor allowed)
1188   unless stated otherwise.
1189</t>
1190
1191<section title="Request Cache-Control Directives" anchor="cache-request-directive">
1192
1193<section title="max-age" anchor="cache-request-directive.max-age">
1194   <iref item="max-age (cache directive)" primary="true" />
1195<t>
1196   Argument syntax:
1197   <list>
1198      <t>
1199        <x:ref>delta-seconds</x:ref> (see <xref target="delta-seconds"/>)
1200      </t>
1201   </list>
1202</t>
1203<t>
1204   The "max-age" request directive indicates that the client is unwilling to
1205   accept a response whose age is greater than the specified number of
1206   seconds. Unless the max-stale request directive is also present, the
1207   client is not willing to accept a stale response.
1208</t>
1209<t>
1210   &Note; This directive uses the token form of the argument syntax;
1211   e.g., 'max-age=5', not 'max-age="5"'. A sender &SHOULD-NOT; generate the
1212   quoted-string form.
1213</t>
1214</section>
1215
1216<section title="max-stale" anchor="cache-request-directive.max-stale">
1217   <iref item="max-stale (cache directive)" primary="true" />
1218<t>
1219   Argument syntax:
1220   <list>
1221      <t>
1222        <x:ref>delta-seconds</x:ref> (see <xref target="delta-seconds"/>)
1223      </t>
1224   </list>
1225</t>
1226<t>
1227   The "max-stale" request directive indicates that the client is willing
1228   to accept a response that has exceeded its freshness lifetime. If max-stale
1229   is assigned a value, then the client is willing to accept a response
1230   that has exceeded its freshness lifetime by no more than the specified
1231   number of seconds. If no value is assigned to max-stale, then the client
1232   is willing to accept a stale response of any age.
1233</t>
1234<t>
1235   &Note; This directive uses the token form of the argument syntax;
1236   e.g., 'max-stale=10', not 'max-stale="10"'. A sender &SHOULD-NOT; generate
1237   the quoted-string form.
1238</t>
1239</section>
1240
1241<section title="min-fresh" anchor="cache-request-directive.min-fresh">
1242   <iref item="min-fresh (cache directive)" primary="true" />
1243<t>
1244   Argument syntax:
1245   <list>
1246      <t>
1247        <x:ref>delta-seconds</x:ref> (see <xref target="delta-seconds"/>)
1248      </t>
1249   </list>
1250</t>
1251<t>
1252   The "min-fresh" request directive indicates that the client is willing
1253   to accept a response whose freshness lifetime is no less than its
1254   current age plus the specified time in seconds. That is, the client
1255   wants a response that will still be fresh for at least the specified
1256   number of seconds.
1257</t>
1258<t>
1259   &Note; This directive uses the token form of the argument syntax;
1260   e.g., 'min-fresh=20', not 'min-fresh="20"'. A sender &SHOULD-NOT; generate
1261   the quoted-string form.
1262</t>
1263</section>
1264
1265<section title="no-cache" anchor="cache-request-directive.no-cache">
1266   <iref item="no-cache (cache directive)" primary="true" />
1267<t>
1268   The "no-cache" request directive indicates that a cache &MUST-NOT;
1269   use a stored response to satisfy the request without successful
1270   validation on the origin server.
1271</t>
1272</section>
1273 
1274<section title="no-store" anchor="cache-request-directive.no-store">
1275   <iref item="no-store (cache directive)" primary="true" />
1276<t>
1277   The "no-store" request directive indicates that a cache &MUST-NOT;
1278   store any part of either this request or any response to it. This
1279   directive applies to both private and shared caches. "&MUST-NOT;
1280   store" in this context means that the cache &MUST-NOT; intentionally
1281   store the information in non-volatile storage, and &MUST; make a
1282   best-effort attempt to remove the information from volatile storage as
1283   promptly as possible after forwarding it.
1284</t>
1285<t>
1286   This directive is NOT a reliable or sufficient mechanism for ensuring
1287   privacy. In particular, malicious or compromised caches might not
1288   recognize or obey this directive, and communications networks might be
1289   vulnerable to eavesdropping.
1290</t>
1291<t>
1292   Note that if a request containing this directive is satisfied from a
1293   cache, the no-store request directive does not apply to the already
1294   stored response.
1295</t>
1296</section>
1297
1298<section title="no-transform" anchor="cache-request-directive.no-transform">
1299   <iref item="no-transform (cache directive)" primary="true" />
1300<t>
1301   The "no-transform" request directive indicates that an intermediary
1302   (whether or not it implements a cache) &MUST-NOT; transform the payload,
1303   as defined in &transformations;.
1304</t>
1305</section>
1306
1307<section title="only-if-cached" anchor="cache-request-directive.only-if-cached">
1308   <iref item="only-if-cached (cache directive)" primary="true" />
1309<t>
1310   The "only-if-cached" request directive indicates that the client only wishes
1311   to obtain a stored response. If it receives this directive, a cache &SHOULD;
1312   either respond using a stored response that is consistent with the other
1313   constraints of the request, or respond with a <x:ref>504 (Gateway
1314   Timeout)</x:ref> status code. If a group of caches is being operated as a
1315   unified system with good internal connectivity, a member cache &MAY;
1316   forward such a request within that group of caches.
1317</t>
1318</section>
1319</section>
1320
1321<section anchor="cache-response-directive"
1322   title="Response Cache-Control Directives">
1323   <x:anchor-alias value="cache-response-directive" />
1324
1325<section title="must-revalidate" anchor="cache-response-directive.must-revalidate">
1326   <iref item="must-revalidate (cache directive)" primary="true" />
1327<t>
1328   The "must-revalidate" response directive indicates that once it has
1329   become stale, a cache &MUST-NOT; use the response to satisfy subsequent
1330   requests without successful validation on the origin server.
1331</t>
1332<t>
1333   The must-revalidate directive is necessary to support reliable
1334   operation for certain protocol features. In all circumstances a
1335   cache &MUST; obey the must-revalidate directive; in particular,
1336   if a cache cannot reach the origin server for any reason, it &MUST;
1337   generate a <x:ref>504 (Gateway Timeout)</x:ref> response.
1338</t>
1339<t>
1340   The must-revalidate directive ought to be used by servers if and only
1341   if failure to validate a request on the representation could result in
1342   incorrect operation, such as a silently unexecuted financial
1343   transaction.
1344</t>
1345</section>
1346
1347<section title="no-cache" anchor="cache-response-directive.no-cache">
1348   <iref item="no-cache (cache directive)" primary="true" />
1349<t>
1350   Argument syntax:
1351   <list>
1352      <t>
1353        #<x:ref>field-name</x:ref>
1354      </t>
1355   </list>
1356</t>
1357<t>
1358   The "no-cache" response directive indicates that the response &MUST-NOT;
1359   be used to satisfy a subsequent request without successful validation on
1360   the origin server. This allows an origin server to prevent a cache from
1361   using it to satisfy a request without contacting it, even by caches that
1362   have been configured to send stale responses.
1363</t>
1364<t>
1365   If the no-cache response directive specifies one or more field-names,
1366   then a cache &MAY; use the response to satisfy a subsequent request,
1367   subject to any other restrictions on caching. However, any header fields
1368   in the response that have the field-name(s) listed &MUST-NOT; be sent
1369   in the response to a subsequent request without successful revalidation
1370   with the origin server. This allows an origin server to prevent the
1371   re-use of certain header fields in a response, while still allowing
1372   caching of the rest of the response.
1373</t>
1374<t>
1375   The field-names given are not limited to the set of header
1376   fields defined by this specification. Field names are case-insensitive.
1377</t>
1378<t>
1379   &Note; Although it has been back-ported to many implementations, some
1380   HTTP/1.0 caches will not recognize or obey this directive. Also, no-cache
1381   response directives with field-names are often handled by caches
1382   as if an unqualified no-cache directive was received; i.e., the special
1383   handling for the qualified form is not widely implemented.
1384</t>
1385<t>
1386   &Note; This directive uses the quoted-string form of the argument syntax.
1387   A sender &SHOULD-NOT; generate the token form (even if quoting appears not
1388   to be needed for single-entry lists).
1389</t>
1390</section>
1391
1392<section title="no-store" anchor="cache-response-directive.no-store">
1393   <iref item="no-store (cache directive)" primary="true" />
1394<t>
1395   The "no-store" response directive indicates that a cache &MUST-NOT;
1396   store any part of either the immediate request or response. This
1397   directive applies to both private and shared caches. "&MUST-NOT;
1398   store" in this context means that the cache &MUST-NOT; intentionally
1399   store the information in non-volatile storage, and &MUST; make a
1400   best-effort attempt to remove the information from volatile storage as
1401   promptly as possible after forwarding it.
1402</t>
1403<t>
1404   This directive is NOT a reliable or sufficient mechanism for ensuring
1405   privacy. In particular, malicious or compromised caches might not
1406   recognize or obey this directive, and communications networks might be
1407   vulnerable to eavesdropping.
1408</t>
1409</section>
1410
1411<section title="no-transform" anchor="cache-response-directive.no-transform">
1412   <iref item="no-transform (cache directive)" primary="true" />
1413<t>
1414   The "no-transform" response directive indicates that an intermediary
1415   (regardless of whether it implements a cache) &MUST-NOT; transform the
1416   payload, as defined in &transformations;.
1417</t>
1418</section>
1419
1420<section title="public" anchor="cache-response-directive.public">
1421   <iref item="public (cache directive)" primary="true" />
1422<t>
1423   The "public" response directive indicates that any cache &MAY; store the
1424   response, even if the response would normally be non-cacheable or cacheable
1425   only within a private cache. (See <xref
1426   target="caching.authenticated.responses"/> for additional details related
1427   to the use of public in response to a request containing
1428   <x:ref>Authorization</x:ref>, and <xref target="response.cacheability"/>
1429   for details of how public affects responses that would normally not be
1430   stored, due to their status codes not being defined as cacheable.)
1431</t>
1432</section>
1433
1434<section title="private" anchor="cache-response-directive.private">
1435   <iref item="private (cache directive)" primary="true" />
1436<t>
1437   Argument syntax:
1438   <list>
1439      <t>
1440        #<x:ref>field-name</x:ref>
1441      </t>
1442   </list>
1443</t>
1444<t>
1445   The "private" response directive indicates that the response message is
1446   intended for a single user and &MUST-NOT; be stored by a shared cache. A
1447   private cache &MAY; store the response and reuse it for later requests,
1448   even if the response would normally be non-cacheable.
1449</t>
1450<t>
1451   If the private response directive specifies one or more field-names,
1452   this requirement is limited to the field-values associated with the
1453   listed response header fields. That is, a shared cache &MUST-NOT; store
1454   the specified field-names(s), whereas it &MAY; store the remainder of the
1455   response message.
1456</t>
1457<t>
1458   The field-names given are not limited to the set of header
1459   fields defined by this specification. Field names are case-insensitive.
1460</t>
1461<t>
1462   &Note; This usage of the word "private" only controls
1463   where the response can be stored; it cannot ensure the privacy of the
1464   message content. Also, private response directives with field-names are
1465   often handled by caches as if an unqualified private directive
1466   was received; i.e., the special handling for the qualified form is not
1467   widely implemented.
1468</t>
1469<t>
1470   &Note; This directive uses the quoted-string form of the argument syntax.
1471   A sender &SHOULD-NOT; generate the token form (even if quoting appears not
1472   to be needed for single-entry lists).
1473</t>
1474</section>
1475
1476<section title="proxy-revalidate" anchor="cache-response-directive.proxy-revalidate">
1477   <iref item="proxy-revalidate (cache directive)" primary="true" />
1478<t>
1479   The "proxy-revalidate" response directive has the same meaning as the
1480   must-revalidate response directive, except that it does not apply to
1481   private caches.
1482</t>
1483</section>
1484
1485<section title="max-age" anchor="cache-response-directive.max-age">
1486   <iref item="max-age (cache directive)" primary="true" />
1487<t>
1488   Argument syntax:
1489   <list>
1490      <t>
1491        <x:ref>delta-seconds</x:ref> (see <xref target="delta-seconds"/>)
1492      </t>
1493   </list>
1494</t>
1495<t>
1496   The "max-age" response directive indicates that the response is to be
1497   considered stale after its age is greater than the specified number of
1498   seconds.
1499</t>
1500<t>
1501   &Note; This directive uses the token form of the argument syntax;
1502   e.g., 'max-age=5', not 'max-age="5"'. A sender &SHOULD-NOT; generate the
1503   quoted-string form.
1504</t>
1505</section>     
1506
1507<section title="s-maxage" anchor="cache-response-directive.s-maxage">
1508   <iref item="s-maxage (cache directive)" primary="true" />
1509<t>
1510   Argument syntax:
1511   <list>
1512      <t>
1513        <x:ref>delta-seconds</x:ref> (see <xref target="delta-seconds"/>)
1514      </t>
1515   </list>
1516</t>
1517<t>
1518   The "s-maxage" response directive indicates that, in shared caches, the
1519   maximum age specified by this directive overrides the maximum age
1520   specified by either the max-age directive or the <x:ref>Expires</x:ref>
1521   header field. The s-maxage directive also implies the semantics of the
1522   proxy-revalidate response directive.
1523</t>
1524<t>
1525   &Note; This directive uses the token form of the argument syntax;
1526   e.g., 's-maxage=10', not 's-maxage="10"'. A sender &SHOULD-NOT; generate
1527   the quoted-string form.
1528</t>
1529</section>
1530
1531</section>
1532
1533<section anchor="cache.control.extensions" title="Cache Control Extensions">
1534<t>
1535   The Cache-Control header field can be extended through the use of one or
1536   more cache-extension tokens, each with an optional value.
1537</t>
1538<t>
1539   Informational extensions (those that do not require a change in cache
1540   behavior) can be added without changing the semantics of other directives.
1541   Behavioral extensions are designed to work by acting as modifiers to the
1542   existing base of cache directives.
1543</t>
1544<t>  
1545   Both the new directive and the standard directive are supplied, such that
1546   applications that do not understand the new directive will default to the
1547   behavior specified by the standard directive, and those that understand the
1548   new directive will recognize it as modifying the requirements associated
1549   with the standard directive. In this way, extensions to the cache-control
1550   directives can be made without requiring changes to the base protocol.
1551</t>
1552<t>
1553   This extension mechanism depends on an HTTP cache obeying all of the
1554   cache-control directives defined for its native HTTP-version, obeying
1555   certain extensions, and ignoring all directives that it does not
1556   understand.
1557</t>
1558<t>
1559   For example, consider a hypothetical new response directive called
1560   "community" that acts as a modifier to the private directive. We define
1561   this new directive to mean that, in addition to any private cache, any
1562   cache that is shared only by members of the community named within its
1563   value is allowed to cache the response. An origin server wishing to allow
1564   the UCI community to use an otherwise private response in their shared
1565   cache(s) could do so by including
1566</t>
1567<figure><artwork type="example">
1568  Cache-Control: private, community="UCI"
1569</artwork></figure>
1570<t>
1571   A cache seeing this header field will act correctly even if the cache does
1572   not understand the community cache-extension, since it will also see and
1573   understand the private directive and thus default to the safe behavior.
1574</t>
1575<t>
1576   A cache &MUST; ignore unrecognized cache directives; it is assumed that any
1577   cache directive likely to be unrecognized by an HTTP/1.1 cache will be
1578   combined with standard directives (or the response's default cacheability)
1579   such that the cache behavior will remain minimally correct even if the
1580   cache does not understand the extension(s).
1581</t>
1582</section>
1583
1584</section>
1585
1586<section anchor="header.expires" title="Expires">
1587   <iref item="Expires header field" primary="true" x:for-anchor="" />
1588   <x:anchor-alias value="Expires"/>
1589<t>
1590   The "Expires" header field gives the date/time after which the
1591   response is considered stale. See <xref target="expiration.model" /> for
1592   further discussion of the freshness model.
1593</t>
1594<t>
1595   The presence of an Expires field does not imply that the original resource
1596   will change or cease to exist at, before, or after that time.
1597</t>
1598<t>
1599   The Expires value is an HTTP-date timestamp, as defined in &http-date;.
1600</t>
1601<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Expires"/>
1602  <x:ref>Expires</x:ref> = <x:ref>HTTP-date</x:ref>
1603</artwork></figure>
1604<figure>
1605  <preamble>For example</preamble>
1606<artwork type="example">
1607  Expires: Thu, 01 Dec 1994 16:00:00 GMT
1608</artwork></figure>
1609<t>
1610   A cache recipient &MUST; interpret invalid date formats, especially the
1611   value "0", as representing a time in the past (i.e., "already expired").
1612</t>
1613<t>
1614   If a response includes a <x:ref>Cache-Control</x:ref> field with
1615   the max-age directive (<xref target="cache-response-directive.max-age"/>),
1616   a recipient &MUST; ignore the Expires field.
1617   Likewise, if a response includes the s-maxage directive
1618   (<xref target="cache-response-directive.s-maxage" />), a shared cache
1619   recipient &MUST; ignore the Expires field. In both these cases, the value
1620   in Expires is only intended for recipients that have not yet implemented
1621   the Cache-Control field.
1622</t>
1623<t>
1624   An origin server without a clock &MUST-NOT; generate an Expires field
1625   unless its value represents a fixed time in the past (always expired)
1626   or its value has been associated with the resource by a system or user
1627   with a reliable clock.
1628</t>
1629<t>
1630   Historically, HTTP required the Expires field-value to be no more than a
1631   year in the future. While longer freshness lifetimes are no longer
1632   prohibited, extremely large values have been demonstrated to cause
1633   problems (e.g., clock overflows due to use of 32-bit integers for
1634   time values), and many caches will evict a response far sooner than
1635   that.
1636</t>
1637</section>
1638
1639<section anchor="header.pragma" title="Pragma">
1640   <iref item="Pragma header field" primary="true" x:for-anchor="" />
1641   <x:anchor-alias value="extension-pragma"/>
1642   <x:anchor-alias value="Pragma"/>
1643   <x:anchor-alias value="pragma-directive"/>
1644<t>
1645   The "Pragma" header field allows backwards compatibility with HTTP/1.0
1646   caches, so that clients can specify a "no-cache" request that they will
1647   understand (as <x:ref>Cache-Control</x:ref> was not defined until HTTP/1.1).
1648   When the Cache-Control header field is also present and understood in a
1649   request, Pragma is ignored.
1650</t>
1651<t>
1652   In HTTP/1.0, Pragma was defined as an extensible field for
1653   implementation-specified directives for recipients. This specification
1654   deprecates such extensions to improve interoperability.
1655</t>
1656<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"/>
1657  <x:ref>Pragma</x:ref>           = 1#<x:ref>pragma-directive</x:ref>
1658  <x:ref>pragma-directive</x:ref> = "no-cache" / <x:ref>extension-pragma</x:ref>
1659  <x:ref>extension-pragma</x:ref> = <x:ref>token</x:ref> [ "=" ( <x:ref>token</x:ref> / <x:ref>quoted-string</x:ref> ) ]
1660</artwork></figure>
1661<t>
1662   When the <x:ref>Cache-Control</x:ref> header field is not present in a
1663   request, caches &MUST; consider the no-cache request pragma-directive as
1664   having the same effect as if "Cache-Control: no-cache" were present (see
1665   <xref target="cache-request-directive" />).
1666</t>
1667<t>
1668   When sending a no-cache request, a client ought to include both the pragma
1669   and cache-control directives, unless Cache-Control: no-cache is
1670   purposefully omitted to target other <x:ref>Cache-Control</x:ref> response
1671   directives at HTTP/1.1 caches. For example:
1672</t>
1673<figure>
1674<artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with="  ">
1675GET / HTTP/1.1
1676Host: www.example.com
1677Cache-Control: max-age=30
1678Pragma: no-cache
1679
1680</artwork>
1681</figure>
1682<t>
1683   will constrain HTTP/1.1 caches to serve a response no older than 30
1684   seconds, while precluding implementations that do not understand
1685   <x:ref>Cache-Control</x:ref> from serving a cached response.
1686</t>
1687<x:note>
1688   <t>
1689      &Note; Because the meaning of "Pragma: no-cache" in responses is not
1690      specified, it does not provide a reliable replacement for
1691      "Cache-Control: no-cache" in them.
1692   </t>
1693</x:note>
1694</section>
1695
1696<section anchor="header.warning" title="Warning">
1697   <iref item="Warning header field" primary="true" x:for-anchor="" />
1698   <x:anchor-alias value="Warning"/>
1699   <x:anchor-alias value="warning-value"/>
1700   <x:anchor-alias value="warn-agent"/>
1701   <x:anchor-alias value="warn-code"/>
1702   <x:anchor-alias value="warn-date"/>
1703   <x:anchor-alias value="warn-text"/>
1704<t>
1705   The "Warning" header field is used to carry additional information
1706   about the status or transformation of a message that might not be reflected
1707   in the status code. This information is typically used to warn about possible
1708   incorrectness introduced by caching operations or transformations applied
1709   to the payload of the message.
1710</t>
1711<t>
1712   Warnings can be used for other purposes, both cache-related and otherwise.
1713   The use of a warning, rather than an error status code, distinguishes these
1714   responses from true failures.
1715</t>
1716<t>
1717   Warning header fields can in general be applied to any message, however some
1718   warn-codes are specific to caches and can only be applied to response
1719   messages.
1720</t>
1721<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"/>
1722  <x:ref>Warning</x:ref>       = 1#<x:ref>warning-value</x:ref>
1723 
1724  <x:ref>warning-value</x:ref> = <x:ref>warn-code</x:ref> <x:ref>SP</x:ref> <x:ref>warn-agent</x:ref> <x:ref>SP</x:ref> <x:ref>warn-text</x:ref>
1725                                        [ <x:ref>SP</x:ref> <x:ref>warn-date</x:ref> ]
1726 
1727  <x:ref>warn-code</x:ref>  = 3<x:ref>DIGIT</x:ref>
1728  <x:ref>warn-agent</x:ref> = ( <x:ref>uri-host</x:ref> [ ":" <x:ref>port</x:ref> ] ) / <x:ref>pseudonym</x:ref>
1729                  ; the name or pseudonym of the server adding
1730                  ; the Warning header field, for use in debugging
1731                  ; a single "-" is recommended when agent unknown
1732  <x:ref>warn-text</x:ref>  = <x:ref>quoted-string</x:ref>
1733  <x:ref>warn-date</x:ref>  = <x:ref>DQUOTE</x:ref> <x:ref>HTTP-date</x:ref> <x:ref>DQUOTE</x:ref>
1734</artwork></figure>
1735<t>
1736   Multiple warnings can be generated in a response (either by the origin
1737   server or by a cache), including multiple warnings with the same warn-code
1738   number that only differ in warn-text.
1739</t>
1740<t>
1741   A user agent that receives one or more Warning header fields &SHOULD;
1742   inform the user of as many of them as possible, in the order that they
1743   appear in the response. Senders that generate multiple Warning header
1744   fields are encouraged to order them with this user agent behavior in mind.
1745   A sender that generates new Warning header fields &MUST; append them after
1746   any existing Warning header fields.
1747</t>
1748<t>
1749   Warnings are assigned three digit warn-codes. The first digit indicates
1750   whether the Warning is required to be deleted from a stored response after
1751   validation:
1752   <list style="symbols">
1753      <t>1xx warn-codes describe the freshness or validation status of the
1754      response, and so &MUST; be deleted by a cache after validation. They can
1755      only be generated by a cache when validating a cached entry, and
1756      &MUST-NOT; be generated in any other situation.</t>
1757      <t>2xx warn-codes describe some aspect of the representation that is not
1758      rectified by a validation (for example, a lossy compression of the
1759      representation) and &MUST-NOT; be deleted by a cache after validation,
1760      unless a full response is sent, in which case they &MUST; be.</t>
1761   </list>
1762</t>
1763<t>
1764   If a sender generates one or more 1xx warn-codes in a message to be
1765   sent to a recipient known to implement only HTTP/1.0, the sender &MUST;
1766   include in each corresponding warning-value a warn-date that matches the
1767   <x:ref>Date</x:ref> header field in the message. For example:
1768</t>
1769<figure><artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with="  ">
1770HTTP/1.1 200 OK
1771Date: Sat, 25 Aug 2012 23:34:45 GMT
1772Warning: 112 - "network down" "Sat, 25 Aug 2012 23:34:45 GMT"
1773
1774</artwork></figure>
1775<t>
1776   If a recipient that uses, evaluates, or displays Warning header fields
1777   receives a warn-date that is different from the <x:ref>Date</x:ref> value
1778   in the same message, the recipient &MUST; exclude the warning-value
1779   containing that warn-date before storing, forwarding, or using the message.
1780   This allows recipients to exclude warning-values that were improperly
1781   retained after a cache validation.
1782   If all of the warning-values are excluded, the recipient &MUST; exclude
1783   the Warning header field as well.
1784</t>
1785<t>
1786   The following warn-codes are defined by this specification, each with a
1787   recommended warn-text in English, and a description of its meaning.
1788   The procedure for defining additional warn codes is described in
1789   <xref target="warn.code.registry.procedure"/>.
1790</t>
1791
1792<section title='Warning: 110 - "Response is Stale"' anchor="warn.110">
1793  <iref primary="true" item="110 (warn-code)" x:for-anchor=""/>
1794  <iref primary="true" item="Response is Stale (warn-text)" x:for-anchor=""/>
1795<t>
1796   A cache &SHOULD; generate this whenever the sent response is stale.
1797</t>
1798</section>
1799
1800<section title='Warning: 111 - "Revalidation Failed"' anchor="warn.111">
1801  <iref primary="true" item="111 (warn-code)" x:for-anchor=""/>
1802  <iref primary="true" item="Revalidation Failed (warn-text)" x:for-anchor=""/>
1803<t>
1804   A cache &SHOULD; generate this when sending a stale response because an
1805   attempt to validate the response failed, due to an inability to reach
1806   the server.
1807</t>
1808</section>
1809
1810<section title='Warning: 112 - "Disconnected Operation"' anchor="warn.112">
1811  <iref primary="true" item="112 (warn-code)" x:for-anchor=""/>
1812  <iref primary="true" item="Disconnected Operation (warn-text)" x:for-anchor=""/>
1813<t>
1814   A cache &SHOULD; generate this if it is intentionally disconnected from
1815   the rest of the network for a period of time.
1816</t>
1817</section>
1818
1819<section title='Warning: 113 - "Heuristic Expiration"' anchor="warn.113">
1820  <iref primary="true" item="113 (warn-code)" x:for-anchor=""/>
1821  <iref primary="true" item="Heuristic Expiration (warn-text)" x:for-anchor=""/>
1822<t>
1823   A cache &SHOULD; generate this if it heuristically chose a freshness
1824   lifetime greater than 24 hours and the response's age is greater than 24
1825   hours.
1826</t>
1827</section>
1828
1829<section title='Warning: 199 - "Miscellaneous Warning"' anchor="warn.199">
1830  <iref primary="true" item="199 (warn-code)" x:for-anchor=""/>
1831  <iref primary="true" item="Miscellaneous Warning (warn-text)" x:for-anchor=""/>
1832<t>
1833   The warning text can include arbitrary information to be presented to
1834   a human user, or logged. A system receiving this warning &MUST-NOT; take
1835   any automated action, besides presenting the warning to the user.
1836</t>
1837</section>
1838
1839<section title='Warning: 214 - "Transformation Applied"' anchor="warn.214">
1840  <iref primary="true" item="214 (warn-code)" x:for-anchor=""/>
1841  <iref primary="true" item="Transformation Applied (warn-text)" x:for-anchor=""/>
1842<t>
1843   &MUST; be added by a proxy if it applies any transformation to the
1844   representation, such as changing the content-coding, media-type, or
1845   modifying the representation data, unless this Warning code already appears
1846   in the response.
1847</t>
1848</section>
1849
1850<section title='Warning: 299 - "Miscellaneous Persistent Warning"' anchor="warn.299">
1851  <iref primary="true" item="299 (warn-code)" x:for-anchor=""/>
1852  <iref primary="true" item="Miscellaneous Persistent Warning (warn-text)" x:for-anchor=""/>
1853<t>
1854   The warning text can include arbitrary information to be presented to
1855   a human user, or logged. A system receiving this warning &MUST-NOT; take
1856   any automated action.
1857</t>
1858</section>
1859</section>
1860</section>
1861
1862<section anchor="history.lists" title="History Lists">
1863<t>
1864   User agents often have history mechanisms, such as "Back" buttons and
1865   history lists, that can be used to redisplay a representation retrieved
1866   earlier in a session.
1867</t>
1868<t>
1869   The freshness model (<xref target="expiration.model"/>) does not
1870   necessarily apply to history mechanisms. I.e., a history mechanism can
1871   display a previous representation even if it has expired.
1872</t>
1873<t>
1874   This does not prohibit the history mechanism from telling the user that a
1875   view might be stale, or from honoring cache directives (e.g.,
1876   Cache-Control: no-store).
1877</t>
1878</section>
1879
1880
1881<section title="IANA Considerations" anchor="iana.considerations">
1882
1883<section title="Cache Directive Registry" anchor="cache.directive.registry">
1884<t>
1885   The HTTP Cache Directive Registry defines the name space for the
1886   cache directives. It will be created and maintained at
1887   <eref target="http://www.iana.org/assignments/http-cache-directives"/>.
1888</t>
1889
1890<section title="Procedure" anchor="cache.directive.registry.procedure">
1891<t>
1892   A registration &MUST; include the following fields:
1893   <list style="symbols">
1894      <t>Cache Directive Name</t>
1895      <t>Pointer to specification text</t>
1896   </list>
1897</t>
1898<t>
1899   Values to be added to this name space require IETF Review (see <xref
1900   target="RFC5226" x:fmt="," x:sec="4.1"/>).
1901</t>
1902</section>
1903
1904<section title="Considerations for New Cache Control Directives" anchor="cache.directive.considerations">
1905<t>
1906   New extension directives ought to consider defining:
1907</t>
1908<t>
1909   <list style="symbols">
1910      <t>What it means for a directive to be specified multiple times,</t>
1911      <t>When the directive does not take an argument, what it means when an
1912      argument is present,</t>
1913      <t>When the directive requires an argument, what it means when it is
1914      missing,</t>
1915      <t>Whether the directive is specific to requests, responses, or able
1916        to be used in either.</t>
1917   </list>
1918</t>
1919<t>
1920  See also <xref target="cache.control.extensions"/>.
1921</t>
1922</section>
1923
1924<section title="Registrations" anchor="cache.directive.registration">
1925<t>
1926  The HTTP Cache Directive Registry shall be populated with the registrations below:
1927</t>
1928<?BEGININC p6-cache.cache-directives ?>
1929<!--AUTOGENERATED FROM extract-cache-directives-defs.xslt, do not edit manually-->
1930<texttable xmlns:my="#my" align="left" suppress-title="true"
1931           anchor="iana.cache.directive.registration.table">
1932   <ttcol>Cache Directive</ttcol>
1933   <ttcol>Reference</ttcol>
1934
1935   <c>max-age</c>
1936   <c>
1937      <xref target="cache-request-directive.max-age"/>, <xref target="cache-response-directive.max-age"/>
1938   </c>
1939   <c>max-stale</c>
1940   <c>
1941      <xref target="cache-request-directive.max-stale"/>
1942   </c>
1943   <c>min-fresh</c>
1944   <c>
1945      <xref target="cache-request-directive.min-fresh"/>
1946   </c>
1947   <c>must-revalidate</c>
1948   <c>
1949      <xref target="cache-response-directive.must-revalidate"/>
1950   </c>
1951   <c>no-cache</c>
1952   <c>
1953      <xref target="cache-request-directive.no-cache"/>, <xref target="cache-response-directive.no-cache"/>
1954   </c>
1955   <c>no-store</c>
1956   <c>
1957      <xref target="cache-request-directive.no-store"/>, <xref target="cache-response-directive.no-store"/>
1958   </c>
1959   <c>no-transform</c>
1960   <c>
1961      <xref target="cache-request-directive.no-transform"/>, <xref target="cache-response-directive.no-transform"/>
1962   </c>
1963   <c>only-if-cached</c>
1964   <c>
1965      <xref target="cache-request-directive.only-if-cached"/>
1966   </c>
1967   <c>private</c>
1968   <c>
1969      <xref target="cache-response-directive.private"/>
1970   </c>
1971   <c>proxy-revalidate</c>
1972   <c>
1973      <xref target="cache-response-directive.proxy-revalidate"/>
1974   </c>
1975   <c>public</c>
1976   <c>
1977      <xref target="cache-response-directive.public"/>
1978   </c>
1979   <c>s-maxage</c>
1980   <c>
1981      <xref target="cache-response-directive.s-maxage"/>
1982   </c>
1983   <c>stale-if-error</c>
1984   <c>
1985      <xref xmlns:x="http://purl.org/net/xml2rfc/ext" target="RFC5861" x:fmt="," x:sec="4"/>
1986   </c>
1987   <c>stale-while-revalidate</c>
1988   <c>
1989      <xref xmlns:x="http://purl.org/net/xml2rfc/ext" target="RFC5861" x:fmt="," x:sec="3"/>
1990   </c>
1991</texttable>
1992<!--(END)-->
1993<?ENDINC p6-cache.cache-directives ?>
1994</section>
1995</section>
1996
1997<section title="Warn Code Registry" anchor="warn.code.registry">
1998<t>
1999   The HTTP Warn Code Registry defines the name space for warn codes.
2000   It will be created and maintained at
2001   <eref target="http://www.iana.org/assignments/http-warn-codes"/>.
2002</t>
2003
2004<section title="Procedure" anchor="warn.code.registry.procedure">
2005<t>
2006   A registration &MUST; include the following fields:
2007   <list style="symbols">
2008      <t>Warn Code (3 digits)</t>
2009      <t>Short Description</t>
2010      <t>Pointer to specification text</t>
2011   </list>
2012</t>
2013<t>
2014   Values to be added to this name space require IETF Review (see <xref
2015   target="RFC5226" x:fmt="," x:sec="4.1"/>).
2016</t>
2017</section>
2018
2019<section title="Registrations" anchor="warn.code.registration">
2020<t>
2021  The HTTP Warn Code Registry shall be populated with the registrations below:
2022</t>
2023<?BEGININC p6-cache.iana-warn-codes ?>
2024<!--AUTOGENERATED FROM extract-warn-code-defs.xslt, do not edit manually-->
2025<texttable align="left" suppress-title="true" anchor="iana.warn.code.registration.table">
2026   <ttcol>Warn Code</ttcol>
2027   <ttcol>Short Description</ttcol>
2028   <ttcol>Reference</ttcol>
2029   <c>110</c>
2030   <c>Response is Stale</c>
2031   <c>
2032      <xref target="warn.110"/>
2033   </c>
2034   <c>111</c>
2035   <c>Revalidation Failed</c>
2036   <c>
2037      <xref target="warn.111"/>
2038   </c>
2039   <c>112</c>
2040   <c>Disconnected Operation</c>
2041   <c>
2042      <xref target="warn.112"/>
2043   </c>
2044   <c>113</c>
2045   <c>Heuristic Expiration</c>
2046   <c>
2047      <xref target="warn.113"/>
2048   </c>
2049   <c>199</c>
2050   <c>Miscellaneous Warning</c>
2051   <c>
2052      <xref target="warn.199"/>
2053   </c>
2054   <c>214</c>
2055   <c>Transformation Applied</c>
2056   <c>
2057      <xref target="warn.214"/>
2058   </c>
2059   <c>299</c>
2060   <c>Miscellaneous Persistent Warning</c>
2061   <c>
2062      <xref target="warn.299"/>
2063   </c>
2064</texttable>
2065<!--(END)-->
2066<?ENDINC p6-cache.iana-warn-codes ?>
2067</section>
2068</section>
2069
2070<section title="Header Field Registration" anchor="header.field.registration">
2071<t>
2072   HTTP header fields are registered within the Message Header Field Registry
2073   maintained at
2074   <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/>.
2075</t>
2076<t>
2077   This document defines the following HTTP header fields, so their
2078   associated registry entries shall be updated according to the permanent
2079   registrations below (see <xref target="BCP90"/>):
2080</t>
2081<?BEGININC p6-cache.iana-headers ?>
2082<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
2083<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
2084   <ttcol>Header Field Name</ttcol>
2085   <ttcol>Protocol</ttcol>
2086   <ttcol>Status</ttcol>
2087   <ttcol>Reference</ttcol>
2088
2089   <c>Age</c>
2090   <c>http</c>
2091   <c>standard</c>
2092   <c>
2093      <xref target="header.age"/>
2094   </c>
2095   <c>Cache-Control</c>
2096   <c>http</c>
2097   <c>standard</c>
2098   <c>
2099      <xref target="header.cache-control"/>
2100   </c>
2101   <c>Expires</c>
2102   <c>http</c>
2103   <c>standard</c>
2104   <c>
2105      <xref target="header.expires"/>
2106   </c>
2107   <c>Pragma</c>
2108   <c>http</c>
2109   <c>standard</c>
2110   <c>
2111      <xref target="header.pragma"/>
2112   </c>
2113   <c>Warning</c>
2114   <c>http</c>
2115   <c>standard</c>
2116   <c>
2117      <xref target="header.warning"/>
2118   </c>
2119</texttable>
2120<!--(END)-->
2121<?ENDINC p6-cache.iana-headers ?>
2122<t>
2123   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task
2124   Force".
2125</t>
2126</section>
2127</section>
2128
2129<section anchor="security.considerations" title="Security Considerations">
2130<t>
2131   This section is meant to inform developers, information providers, and
2132   users of known security concerns specific to HTTP/1.1 caching.
2133   More general security considerations are addressed in HTTP messaging
2134   &messaging; and semantics &semantics;.
2135</t>
2136<t>
2137   Caches expose additional potential vulnerabilities, since the contents of
2138   the cache represent an attractive target for malicious exploitation.
2139   Because cache contents persist after an HTTP request is complete, an attack
2140   on the cache can reveal information long after a user believes that the
2141   information has been removed from the network. Therefore, cache contents
2142   need to be protected as sensitive information.
2143</t>
2144<t>
2145   Furthermore, the very use of a cache can bring about privacy concerns. For
2146   example, if two users share a cache, and the first one browses to a site,
2147   the second may be able to detect that the other has been to that site,
2148   because the resources from it load more quickly, thanks to the cache.
2149</t>
2150<t>
2151   Implementation flaws might allow attackers to insert content into a cache
2152   ("cache poisoning"), leading to compromise of clients that trust that
2153   content. Because of their nature, these attacks are difficult to mitigate.
2154</t>
2155<t>
2156   Likewise, implementation flaws (as well as misunderstanding of cache
2157   operation) might lead to caching of sensitive information (e.g.,
2158   authentication credentials) that is thought to be private, exposing it to
2159   unauthorized parties.
2160</t>
2161<t>
2162   Note that the Set-Cookie response header field <xref target="RFC6265"/> does not
2163   inhibit caching; a cacheable response with a Set-Cookie header field can be (and
2164   often is) used to satisfy subsequent requests to caches. Servers who wish
2165   to control caching of these responses are encouraged to emit appropriate
2166   Cache-Control response header fields.
2167</t>
2168
2169</section>
2170
2171<section title="Acknowledgments" anchor="acks">
2172<t>
2173  See &acks;.
2174</t>
2175</section>
2176
2177</middle>
2178
2179<back>
2180<references title="Normative References">
2181
2182  <reference anchor="Part1">
2183    <front>
2184      <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
2185      <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
2186        <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
2187        <address><email>fielding@gbiv.com</email></address>
2188      </author>
2189      <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
2190        <organization abbrev="greenbytes">greenbytes GmbH</organization>
2191        <address><email>julian.reschke@greenbytes.de</email></address>
2192      </author>
2193      <date month="&ID-MONTH;" year="&ID-YEAR;" />
2194    </front>
2195    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;" />
2196    <x:source basename="p1-messaging" href="p1-messaging.xml">
2197      <x:defines>Content-Length</x:defines>
2198      <x:defines>Via</x:defines>
2199    </x:source>
2200  </reference>
2201
2202  <reference anchor="Part2">
2203    <front>
2204      <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
2205      <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
2206        <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
2207        <address><email>fielding@gbiv.com</email></address>
2208      </author>
2209      <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
2210        <organization abbrev="greenbytes">greenbytes GmbH</organization>
2211        <address><email>julian.reschke@greenbytes.de</email></address>
2212      </author>
2213      <date month="&ID-MONTH;" year="&ID-YEAR;" />
2214    </front>
2215    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;" />
2216    <x:source basename="p2-semantics" href="p2-semantics.xml">
2217      <x:defines>2xx (Successful)</x:defines>
2218      <x:defines>200 (OK)</x:defines>
2219      <x:defines>203 (Non-Authoritative Information)</x:defines>
2220      <x:defines>3xx (Redirection)</x:defines>
2221      <x:defines>300 (Multiple Choices)</x:defines>
2222      <x:defines>301 (Moved Permanently)</x:defines>
2223      <x:defines>404 (Not Found)</x:defines>
2224      <x:defines>410 (Gone)</x:defines>
2225      <x:defines>5xx (Server Error)</x:defines>
2226      <x:defines>504 (Gateway Timeout)</x:defines>
2227      <x:defines>Accept</x:defines>
2228      <x:defines>Content-Encoding</x:defines>
2229      <x:defines>Content-Location</x:defines>
2230      <x:defines>Content-Type</x:defines>
2231      <x:defines>Date</x:defines>
2232      <x:defines>Location</x:defines>
2233      <x:defines>Vary</x:defines>
2234    </x:source>
2235  </reference>
2236
2237  <reference anchor="Part4">
2238    <front>
2239      <title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
2240      <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
2241        <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
2242        <address><email>fielding@gbiv.com</email></address>
2243      </author>
2244      <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
2245        <organization abbrev="greenbytes">greenbytes GmbH</organization>
2246        <address><email>julian.reschke@greenbytes.de</email></address>
2247      </author>
2248      <date month="&ID-MONTH;" year="&ID-YEAR;" />
2249    </front>
2250    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p4-conditional-&ID-VERSION;" />
2251    <x:source basename="p4-conditional" href="p4-conditional.xml">
2252      <x:defines>304</x:defines>
2253      <x:defines>304 (Not Modified)</x:defines>
2254      <x:defines>412 (Precondition Failed)</x:defines>
2255      <x:defines>ETag</x:defines>
2256      <x:defines>If-Modified-Since</x:defines>
2257      <x:defines>If-Unmodified-Since</x:defines>
2258      <x:defines>If-Match</x:defines>
2259      <x:defines>If-None-Match</x:defines>
2260      <x:defines>Last-Modified</x:defines>
2261    </x:source>
2262  </reference>
2263
2264  <reference anchor="Part5">
2265    <front>
2266      <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
2267      <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
2268        <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
2269        <address><email>fielding@gbiv.com</email></address>
2270      </author>
2271      <author fullname="Yves Lafon" initials="Y." role="editor" surname="Lafon">
2272        <organization abbrev="W3C">World Wide Web Consortium</organization>
2273        <address><email>ylafon@w3.org</email></address>
2274      </author>
2275      <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
2276        <organization abbrev="greenbytes">greenbytes GmbH</organization>
2277        <address><email>julian.reschke@greenbytes.de</email></address>
2278      </author>
2279      <date month="&ID-MONTH;" year="&ID-YEAR;" />
2280    </front>
2281    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;" />
2282    <x:source basename="p5-range" href="p5-range.xml">
2283      <x:defines>206 (Partial Content)</x:defines>
2284      <x:defines>Content-Range</x:defines>
2285      <x:defines>If-Range</x:defines>
2286      <x:defines>Range</x:defines>
2287    </x:source>
2288  </reference>
2289
2290  <reference anchor="Part7">
2291    <front>
2292      <title>Hypertext Transfer Protocol (HTTP/1.1): Authentication</title>
2293      <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
2294        <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
2295        <address><email>fielding@gbiv.com</email></address>
2296      </author>
2297      <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
2298        <organization abbrev="greenbytes">greenbytes GmbH</organization>
2299        <address><email>julian.reschke@greenbytes.de</email></address>
2300      </author>
2301      <date month="&ID-MONTH;" year="&ID-YEAR;" />
2302    </front>
2303    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p7-auth-&ID-VERSION;" />
2304    <x:source basename="p7-auth" href="p7-auth.xml">
2305      <x:defines>Authorization</x:defines>
2306    </x:source>
2307  </reference>
2308
2309  <reference anchor="RFC2119">
2310    <front>
2311      <title>Key words for use in RFCs to Indicate Requirement Levels</title>
2312      <author fullname="Scott Bradner" initials="S." surname="Bradner">
2313        <organization>Harvard University</organization>
2314        <address><email>sob@harvard.edu</email></address>
2315      </author>
2316      <date month="March" year="1997" />
2317    </front>
2318    <seriesInfo name="BCP" value="14" />
2319    <seriesInfo name="RFC" value="2119" />
2320  </reference>
2321
2322  <reference anchor="RFC5234">
2323    <front>
2324      <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
2325      <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
2326        <organization>Brandenburg InternetWorking</organization>
2327        <address>
2328          <email>dcrocker@bbiw.net</email>
2329        </address> 
2330      </author>
2331      <author initials="P." surname="Overell" fullname="Paul Overell">
2332        <organization>THUS plc.</organization>
2333        <address>
2334          <email>paul.overell@thus.net</email>
2335        </address>
2336      </author>
2337      <date month="January" year="2008"/>
2338    </front>
2339    <seriesInfo name="STD" value="68"/>
2340    <seriesInfo name="RFC" value="5234"/>
2341  </reference>
2342 
2343</references>
2344
2345<references title="Informative References">
2346
2347  <reference anchor="RFC1305">
2348    <front>
2349      <title>Network Time Protocol (Version 3) Specification, Implementation</title>
2350      <author fullname="David L. Mills" initials="D." surname="Mills">
2351        <organization>University of Delaware, Electrical Engineering Department</organization>
2352        <address><email>mills@udel.edu</email></address>
2353      </author>
2354      <date month="March" year="1992" />
2355    </front>
2356    <seriesInfo name="RFC" value="1305" />
2357  </reference>
2358
2359  <reference anchor="RFC2616">
2360    <front>
2361      <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
2362      <author fullname="R. Fielding" initials="R." surname="Fielding">
2363        <organization>University of California, Irvine</organization>
2364        <address><email>fielding@ics.uci.edu</email></address>
2365      </author>
2366      <author fullname="J. Gettys" initials="J." surname="Gettys">
2367        <organization>W3C</organization>
2368        <address><email>jg@w3.org</email></address>
2369      </author>
2370      <author fullname="J. Mogul" initials="J." surname="Mogul">
2371        <organization>Compaq Computer Corporation</organization>
2372        <address><email>mogul@wrl.dec.com</email></address>
2373      </author>
2374      <author fullname="H. Frystyk" initials="H." surname="Frystyk">
2375        <organization>MIT Laboratory for Computer Science</organization>
2376        <address><email>frystyk@w3.org</email></address>
2377      </author>
2378      <author fullname="L. Masinter" initials="L." surname="Masinter">
2379        <organization>Xerox Corporation</organization>
2380        <address><email>masinter@parc.xerox.com</email></address>
2381      </author>
2382      <author fullname="P. Leach" initials="P." surname="Leach">
2383        <organization>Microsoft Corporation</organization>
2384        <address><email>paulle@microsoft.com</email></address>
2385      </author>
2386      <author fullname="T. Berners-Lee" initials="T." surname="Berners-Lee">
2387        <organization>W3C</organization>
2388        <address><email>timbl@w3.org</email></address>
2389      </author>
2390      <date month="June" year="1999" />
2391    </front>
2392    <seriesInfo name="RFC" value="2616" />
2393  </reference>
2394
2395  <reference anchor="BCP90">
2396    <front>
2397      <title>Registration Procedures for Message Header Fields</title>
2398      <author fullname="G. Klyne" initials="G." surname="Klyne">
2399        <organization>Nine by Nine</organization>
2400        <address><email>GK-IETF@ninebynine.org</email></address>
2401      </author>
2402      <author fullname="M. Nottingham" initials="M." surname="Nottingham">
2403        <organization>BEA Systems</organization>
2404        <address><email>mnot@pobox.com</email></address>
2405      </author>
2406      <author fullname="J. Mogul" initials="J." surname="Mogul">
2407        <organization>HP Labs</organization>
2408        <address><email>JeffMogul@acm.org</email></address>
2409      </author>
2410      <date month="September" year="2004" />
2411    </front>
2412    <seriesInfo name="BCP" value="90" />
2413    <seriesInfo name="RFC" value="3864" />
2414  </reference>
2415
2416  <reference anchor='RFC5226'>
2417    <front>
2418      <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
2419      <author initials='T.' surname='Narten' fullname='T. Narten'>
2420        <organization>IBM</organization>
2421        <address><email>narten@us.ibm.com</email></address>
2422      </author>
2423      <author initials='H.' surname='Alvestrand' fullname='H. Alvestrand'>
2424        <organization>Google</organization>
2425        <address><email>Harald@Alvestrand.no</email></address>
2426      </author>
2427      <date year='2008' month='May' />
2428    </front>
2429    <seriesInfo name='BCP' value='26' />
2430    <seriesInfo name='RFC' value='5226' />
2431  </reference>
2432
2433  <reference anchor='RFC5861'>
2434    <front>
2435      <title abbrev="HTTP stale controls">HTTP Cache-Control Extensions for Stale Content</title>
2436      <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
2437        <organization>Yahoo! Inc.</organization>
2438        <address><email>mnot@yahoo-inc.com</email></address>
2439      </author>
2440      <date month="April" year="2010"/>
2441    </front>
2442    <seriesInfo name='RFC' value='5861' />
2443  </reference>
2444
2445  <reference anchor="RFC6265">
2446    <front>
2447      <title>HTTP State Management Mechanism</title>
2448      <author initials="A." surname="Barth" fullname="Adam Barth">
2449        <organization abbrev="U.C. Berkeley">
2450          University of California, Berkeley
2451        </organization>
2452        <address><email>abarth@eecs.berkeley.edu</email></address>
2453      </author>
2454      <date year="2011" month="April" />
2455    </front>
2456    <seriesInfo name="RFC" value="6265"/>
2457  </reference>
2458
2459</references>
2460
2461<section anchor="changes.from.rfc.2616" title="Changes from RFC 2616">
2462<t>
2463  The specification has been substantially rewritten for clarity.
2464</t>
2465<t>
2466  The conditions under which an authenticated response can be cached have been
2467  clarified.
2468  (<xref target="caching.authenticated.responses" />)
2469</t>
2470<t>
2471  New status codes can now define that caches are allowed to use heuristic
2472  freshness with them.
2473  Caches are now allowed to calculate heuristic freshness for URIs with query
2474  components.
2475  (<xref target="heuristic.freshness" />)
2476</t>
2477<t>
2478  The algorithm for calculating age is now less conservative.
2479  Caches are now required to handle dates with timezones as if they're
2480  invalid, because it's not possible to accurately guess.
2481  (<xref target="age.calculations"/>)
2482</t>
2483<t>
2484  The <x:ref>Content-Location</x:ref> response header field is no longer used
2485  to determine the appropriate response to use when validating.
2486  (<xref target="validation.model" />)
2487</t>
2488<t>
2489  The algorithm for selecting a cached negotiated response to use has been
2490  clarified in several ways. In particular, it now explicitly allows
2491  header-specific canonicalization when processing selecting header fields.
2492  (<xref target="caching.negotiated.responses" />)
2493</t>
2494<t>
2495  Requirements regarding denial of service attack avoidance when performing
2496  invalidation have been clarified.
2497  (<xref target="invalidation" />)
2498</t>
2499<t>
2500  Cache invalidation only occurs when a successful response is received.
2501  (<xref target="invalidation" />)
2502</t>
2503<t>
2504  Cache directives are explicitly defined to be case-insensitive.
2505  Handling of multiple instances of cache directives when only one is
2506  expected is now defined.
2507  (<xref target="header.cache-control" />)
2508</t>
2509<t>
2510  The "no-store" cache request directive doesn't apply to responses; i.e.,
2511  a cache can satisfy a request with no-store on it, and does not invalidate
2512  it.
2513  (<xref target="cache-request-directive.no-store" />)
2514</t>
2515<t>
2516  The qualified forms of the private and no-cache cache directives are noted
2517  to not be widely implemented; e.g., "private=foo" is interpreted by many
2518  caches as simply "private". Additionally, the meaning of the qualified
2519  form of no-cache has been clarified.
2520  (<xref target="cache-response-directive" />)
2521</t>
2522<t>
2523  The "no-cache" response cache directive's meaning has been clarified.
2524  (<xref target="cache-response-directive.no-cache" />)
2525</t>
2526<t>
2527  The one-year limit on <x:ref>Expires</x:ref> header field values has been removed; instead,
2528  the reasoning for using a sensible value is given.
2529  (<xref target="header.expires" />)
2530</t>
2531<t>
2532  The <x:ref>Pragma</x:ref> header field is now only defined for backwards compatibility;
2533  future pragmas are deprecated.
2534  (<xref target="header.pragma" />)
2535</t>
2536<t>
2537  Some requirements regarding production and processing of the <x:ref>Warning</x:ref>
2538  header fields have been relaxed, as it is not widely implemented.
2539  Furthermore, the <x:ref>Warning</x:ref> header field no longer uses RFC 2047 encoding,
2540  nor allows multiple languages, as these aspects were not implemented.
2541  (<xref target="header.warning" />)
2542</t>
2543<t>
2544  This specification introduces the Cache Directive and Warn Code Registries,
2545  and defines considerations for new cache directives.
2546  (<xref target="cache.directive.registry"/> and <xref target="warn.code.registry"/>)
2547</t>
2548</section>
2549
2550<section title="Imported ABNF" anchor="imported.abnf">
2551   <x:anchor-alias value="ALPHA"/>
2552   <x:anchor-alias value="CR"/>
2553   <x:anchor-alias value="DIGIT"/>
2554   <x:anchor-alias value="DQUOTE"/>
2555   <x:anchor-alias value="LF"/>
2556   <x:anchor-alias value="OCTET"/>
2557   <x:anchor-alias value="SP"/>
2558   <x:anchor-alias value="VCHAR"/>
2559   <x:anchor-alias value="quoted-string"/>
2560   <x:anchor-alias value="token"/>
2561   <x:anchor-alias value="OWS"/>
2562   <x:anchor-alias value="field-name"/>
2563   <x:anchor-alias value="HTTP-date"/>
2564   <x:anchor-alias value="port"/>
2565   <x:anchor-alias value="pseudonym"/>
2566   <x:anchor-alias value="uri-host"/>
2567<t>
2568   The following core rules are included by reference, as defined in <xref
2569   target="RFC5234" x:fmt="of" x:sec="B.1"/>: ALPHA (letters), CR (carriage
2570   return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double
2571   quote), HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any 8-bit
2572   sequence of data), SP (space), and VCHAR (any visible US-ASCII character).
2573</t>
2574<t>
2575   The rules below are defined in <xref target="Part1"/>:
2576</t>
2577<figure><artwork type="abnf2616">
2578  <x:ref>OWS</x:ref>           = &lt;OWS, defined in &whitespace;&gt;
2579  <x:ref>field-name</x:ref>    = &lt;field-name, defined in &header-fields;&gt;
2580  <x:ref>quoted-string</x:ref> = &lt;quoted-string, defined in &field-components;&gt;
2581  <x:ref>token</x:ref>         = &lt;token, defined in &field-components;&gt;
2582
2583  <x:ref>port</x:ref>          = &lt;port, defined in &uri;&gt;
2584  <x:ref>pseudonym</x:ref>     = &lt;pseudonym, defined in &header-via;&gt;
2585  <x:ref>uri-host</x:ref>      = &lt;uri-host, defined in &uri;&gt;
2586</artwork></figure>
2587<t>
2588   The rules below are defined in other parts:
2589</t>
2590<figure><artwork type="abnf2616">
2591  <x:ref>HTTP-date</x:ref>     = &lt;HTTP-date, defined in &http-date;&gt;
2592</artwork></figure>
2593</section>
2594
2595<?BEGININC p6-cache.abnf-appendix ?>
2596<section xmlns:x="http://purl.org/net/xml2rfc/ext" title="Collected ABNF" anchor="collected.abnf">
2597<t>
2598  In the collected ABNF below, list rules are expanded as per <xref target="Part1" x:rel="#notation"/>.
2599</t><figure>
2600<artwork type="abnf" name="p6-cache.parsed-abnf">
2601<x:ref>Age</x:ref> = delta-seconds
2602
2603<x:ref>Cache-Control</x:ref> = *( "," OWS ) cache-directive *( OWS "," [ OWS
2604 cache-directive ] )
2605
2606<x:ref>Expires</x:ref> = HTTP-date
2607
2608<x:ref>HTTP-date</x:ref> = &lt;HTTP-date, defined in [Part2], Section 7.1.1.1&gt;
2609
2610<x:ref>OWS</x:ref> = &lt;OWS, defined in [Part1], Section 3.2.3&gt;
2611
2612<x:ref>Pragma</x:ref> = *( "," OWS ) pragma-directive *( OWS "," [ OWS
2613 pragma-directive ] )
2614
2615<x:ref>Warning</x:ref> = *( "," OWS ) warning-value *( OWS "," [ OWS warning-value ]
2616 )
2617
2618<x:ref>cache-directive</x:ref> = token [ "=" ( token / quoted-string ) ]
2619
2620<x:ref>delta-seconds</x:ref> = 1*DIGIT
2621
2622<x:ref>extension-pragma</x:ref> = token [ "=" ( token / quoted-string ) ]
2623
2624<x:ref>field-name</x:ref> = &lt;field-name, defined in [Part1], Section 3.2&gt;
2625
2626<x:ref>port</x:ref> = &lt;port, defined in [Part1], Section 2.7&gt;
2627<x:ref>pragma-directive</x:ref> = "no-cache" / extension-pragma
2628<x:ref>pseudonym</x:ref> = &lt;pseudonym, defined in [Part1], Section 5.7.1&gt;
2629
2630<x:ref>quoted-string</x:ref> = &lt;quoted-string, defined in [Part1], Section 3.2.6&gt;
2631
2632<x:ref>token</x:ref> = &lt;token, defined in [Part1], Section 3.2.6&gt;
2633
2634<x:ref>uri-host</x:ref> = &lt;uri-host, defined in [Part1], Section 2.7&gt;
2635
2636<x:ref>warn-agent</x:ref> = ( uri-host [ ":" port ] ) / pseudonym
2637<x:ref>warn-code</x:ref> = 3DIGIT
2638<x:ref>warn-date</x:ref> = DQUOTE HTTP-date DQUOTE
2639<x:ref>warn-text</x:ref> = quoted-string
2640<x:ref>warning-value</x:ref> = warn-code SP warn-agent SP warn-text [ SP warn-date
2641 ]
2642</artwork>
2643</figure>
2644</section>
2645<?ENDINC p6-cache.abnf-appendix ?>
2646
2647<section anchor="change.log" title="Change Log (to be removed by RFC Editor before publication)">
2648<t>
2649  Changes up to the first Working Group Last Call draft are summarized
2650  in <eref target="http://trac.tools.ietf.org/html/draft-ietf-httpbis-p6-cache-19#appendix-C"/>.
2651</t>
2652
2653<section title="Since draft-ietf-httpbis-p6-cache-19" anchor="changes.since.19">
2654<t>
2655  Closed issues:
2656  <list style="symbols">
2657    <t>
2658      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/307"/>:
2659      "untangle Cache-Control ABNF"
2660    </t>
2661    <t>
2662      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/353"/>:
2663      "Multiple values in Cache-Control header fields"
2664    </t>
2665    <t>
2666      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/355"/>:
2667      "Case sensitivity of header fields in CC values"
2668    </t>
2669    <t>
2670      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/356"/>:
2671      "Spurious 'MAYs'"
2672    </t>
2673    <t>
2674      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/360"/>:
2675      "enhance considerations for new cache control directives"
2676    </t>
2677    <t>
2678      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/361"/>:
2679      "ABNF requirements for recipients"
2680    </t>
2681    <t>
2682      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/368"/>:
2683      "note introduction of new IANA registries as normative changes"
2684    </t>
2685    <t>
2686      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/373"/>:
2687      "broken prose in description of 'Vary'"
2688    </t>
2689  </list>
2690</t>
2691</section>
2692
2693<section title="Since draft-ietf-httpbis-p6-cache-20" anchor="changes.since.20">
2694<t>
2695  Closed issues:
2696  <list style="symbols">
2697    <t>
2698      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/375"/>:
2699      "'Most Conservative'"
2700    </t>
2701  </list>
2702</t>
2703<t>
2704  Other changes:
2705  <list style="symbols">
2706    <t>
2707      Conformance criteria and considerations regarding error handling are
2708      now defined in Part 1.
2709    </t>
2710    <t>
2711      Move definition of "Vary" header field into Part 2.
2712    </t>
2713    <t>
2714      Add security considerations with respect to cache poisoning and
2715      the "Set-Cookie" header field.
2716    </t>
2717  </list>
2718</t>
2719</section>
2720
2721<section title="Since draft-ietf-httpbis-p6-cache-21" anchor="changes.since.21">
2722<t>
2723  Closed issues:
2724  <list style="symbols">
2725    <t>
2726      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/223"/>:
2727      "Allowing heuristic caching for new status codes"
2728    </t>
2729    <t>
2730      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/406"/>:
2731      "304 without validator"
2732    </t>
2733    <t>
2734      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/418"/>:
2735      "No-Transform"
2736    </t>
2737    <t>
2738      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/430"/>:
2739      "Revert prior change to the meaning of the public cache response
2740       directive.
2741    </t>
2742  </list>
2743</t>
2744</section>
2745
2746<section title="Since draft-ietf-httpbis-p6-cache-22" anchor="changes.since.22">
2747<t>
2748  Closed issues:
2749  <list style="symbols">
2750    <t>
2751      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/436"/>:
2752      "explain list expansion in ABNF appendices"
2753    </t>
2754    <t>
2755      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/453"/>:
2756      "Returning the freshest response"
2757    </t>
2758    <t>
2759      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/464"/>:
2760      "placement of extension point considerations"
2761    </t>
2762    <t>
2763      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/469"/>:
2764      "Editorial notes for p6"
2765    </t>
2766    <t>
2767      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/471"/>:
2768      "Vary and future requests"
2769    </t>
2770  </list>
2771</t>
2772</section>
2773
2774<section title="Since draft-ietf-httpbis-p6-cache-23" anchor="changes.since.23">
2775<t>
2776  Closed issues:
2777  <list style="symbols">
2778    <t>
2779      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/486"/>:
2780      "Requiring proxies to process warn-date"
2781    </t>
2782  </list>
2783</t>
2784</section>
2785</section>
2786  </back>
2787</rfc>
Note: See TracBrowser for help on using the repository browser.