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

Last change on this file since 2705 was 2691, checked in by julian.reschke@…, 6 years ago

editorial fixes (#553)

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