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