1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?> |
---|
3 | <!DOCTYPE rfc [ |
---|
4 | <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>"> |
---|
5 | <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>"> |
---|
6 | <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>"> |
---|
7 | <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>"> |
---|
8 | <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>"> |
---|
9 | <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>"> |
---|
10 | <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>"> |
---|
11 | <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>"> |
---|
12 | <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>"> |
---|
13 | <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>"> |
---|
14 | <!ENTITY ID-VERSION "latest"> |
---|
15 | <!ENTITY ID-MONTH "August"> |
---|
16 | <!ENTITY ID-YEAR "2013"> |
---|
17 | <!ENTITY Note "<x:h xmlns:x='http://purl.org/net/xml2rfc/ext'>Note:</x:h>"> |
---|
18 | <!ENTITY architecture "<xref target='Part1' x:rel='#architecture' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
19 | <!ENTITY conformance "<xref target='Part1' x:rel='#conformance' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
20 | <!ENTITY notation "<xref target='Part1' x:rel='#notation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
21 | <!ENTITY abnf-extension "<xref target='Part1' x:rel='#abnf.extension' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
22 | <!ENTITY acks "<xref target='Part1' x:rel='#acks' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
23 | <!ENTITY whitespace "<xref target='Part1' x:rel='#whitespace' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
24 | <!ENTITY field-components "<xref target='Part1' x:rel='#field.components' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
25 | <!ENTITY header-date "<xref target='Part2' x:rel='#header.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
26 | <!ENTITY safe-methods "<xref target='Part2' x:rel='#safe.methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
27 | <!ENTITY representation "<xref target='Part2' x:rel='#representations' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
28 | <!ENTITY messaging "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
29 | <!ENTITY semantics "<xref target='Part2' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
30 | <!ENTITY caching "<xref target='Part6' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
31 | <!ENTITY cache-key "<xref target='Part6' x:rel='#constructing.responses.from.caches' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
32 | <!ENTITY freshening-responses "<xref target='Part6' x:rel='#freshening.responses' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
33 | <!ENTITY header-accept-encoding "<xref target='Part2' x:rel='#header.accept-encoding' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
34 | <!ENTITY header-if-range "<xref target='Part5' x:rel='#header.if-range' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
35 | <!ENTITY header-range "<xref target='Part5' x:rel='#header.range' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
36 | <!ENTITY header-vary "<xref target='Part2' x:rel='#header.vary' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
37 | <!ENTITY http-date "<xref target='Part2' x:rel='#http.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
38 | <!ENTITY transfer-codings "<xref target='Part1' x:rel='#transfer.codings' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
39 | <!ENTITY content-negotiation "<xref target='Part2' x:rel='#content.negotiation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
40 | ]> |
---|
41 | <?rfc toc="yes" ?> |
---|
42 | <?rfc symrefs="yes" ?> |
---|
43 | <?rfc sortrefs="yes" ?> |
---|
44 | <?rfc compact="yes"?> |
---|
45 | <?rfc subcompact="no" ?> |
---|
46 | <?rfc linkmailto="no" ?> |
---|
47 | <?rfc editing="no" ?> |
---|
48 | <?rfc comments="yes"?> |
---|
49 | <?rfc inline="yes"?> |
---|
50 | <?rfc rfcedstyle="yes"?> |
---|
51 | <?rfc-ext allow-markup-in-artwork="yes" ?> |
---|
52 | <?rfc-ext include-references-in-index="yes" ?> |
---|
53 | <rfc obsoletes="2616" category="std" x:maturity-level="proposed" |
---|
54 | ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;" |
---|
55 | xmlns:x='http://purl.org/net/xml2rfc/ext'> |
---|
56 | <x:link rel="prev" basename="p2-semantics"/> |
---|
57 | <x:link rel="next" basename="p5-range"/> |
---|
58 | <x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&body=<{ref}>:"/> |
---|
59 | <front> |
---|
60 | |
---|
61 | <title abbrev="HTTP/1.1 Conditional Requests">Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title> |
---|
62 | |
---|
63 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
64 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
65 | <address> |
---|
66 | <postal> |
---|
67 | <street>345 Park Ave</street> |
---|
68 | <city>San Jose</city> |
---|
69 | <region>CA</region> |
---|
70 | <code>95110</code> |
---|
71 | <country>USA</country> |
---|
72 | </postal> |
---|
73 | <email>fielding@gbiv.com</email> |
---|
74 | <uri>http://roy.gbiv.com/</uri> |
---|
75 | </address> |
---|
76 | </author> |
---|
77 | |
---|
78 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
79 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
80 | <address> |
---|
81 | <postal> |
---|
82 | <street>Hafenweg 16</street> |
---|
83 | <city>Muenster</city><region>NW</region><code>48155</code> |
---|
84 | <country>Germany</country> |
---|
85 | </postal> |
---|
86 | <email>julian.reschke@greenbytes.de</email> |
---|
87 | <uri>http://greenbytes.de/tech/webdav/</uri> |
---|
88 | </address> |
---|
89 | </author> |
---|
90 | |
---|
91 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
92 | <workgroup>HTTPbis Working Group</workgroup> |
---|
93 | |
---|
94 | <abstract> |
---|
95 | <t> |
---|
96 | The Hypertext Transfer Protocol (HTTP) is an application-level protocol for |
---|
97 | distributed, collaborative, hypertext information systems. This document |
---|
98 | defines HTTP/1.1 conditional requests, including metadata header fields |
---|
99 | for indicating state changes, request header fields for making |
---|
100 | preconditions on such state, and rules for constructing the responses to a |
---|
101 | conditional request when one or more preconditions evaluate to false. |
---|
102 | </t> |
---|
103 | </abstract> |
---|
104 | |
---|
105 | <note title="Editorial Note (To be removed by RFC Editor)"> |
---|
106 | <t> |
---|
107 | Discussion of this draft takes place on the HTTPBIS working group |
---|
108 | mailing list (ietf-http-wg@w3.org), which is archived at |
---|
109 | <eref target="http://lists.w3.org/Archives/Public/ietf-http-wg/"/>. |
---|
110 | </t> |
---|
111 | <t> |
---|
112 | The current issues list is at |
---|
113 | <eref target="http://tools.ietf.org/wg/httpbis/trac/report/3"/> and related |
---|
114 | documents (including fancy diffs) can be found at |
---|
115 | <eref target="http://tools.ietf.org/wg/httpbis/"/>. |
---|
116 | </t> |
---|
117 | <t> |
---|
118 | The changes in this draft are summarized in <xref target="changes.since.23"/>. |
---|
119 | </t> |
---|
120 | </note> |
---|
121 | </front> |
---|
122 | |
---|
123 | <middle> |
---|
124 | <section title="Introduction" anchor="introduction"> |
---|
125 | <t> |
---|
126 | Conditional requests are HTTP requests <xref target="Part2"/> that include |
---|
127 | one or more header fields indicating a precondition to be tested before |
---|
128 | applying the method semantics to the target resource. |
---|
129 | This document defines the HTTP/1.1 conditional request mechanisms in terms |
---|
130 | of the architecture, syntax notation, and conformance criteria defined in |
---|
131 | <xref target="Part1"/>. |
---|
132 | </t> |
---|
133 | <t> |
---|
134 | Conditional GET requests are the most efficient mechanism for HTTP |
---|
135 | cache updates &caching;. Conditionals can also be |
---|
136 | applied to state-changing methods, such as PUT and DELETE, to prevent |
---|
137 | the "lost update" problem: one client accidentally overwriting |
---|
138 | the work of another client that has been acting in parallel. |
---|
139 | </t> |
---|
140 | <t><iref primary="true" item="selected representation"/> |
---|
141 | Conditional request preconditions are based on the state of the target |
---|
142 | resource as a whole (its current value set) or the state as observed |
---|
143 | in a previously obtained representation (one value in that set). |
---|
144 | A resource might have multiple current representations, each with its |
---|
145 | own observable state. The conditional request mechanisms assume that |
---|
146 | the mapping of requests to a "selected representation" (&representation;) |
---|
147 | will be consistent over time if the server intends to take advantage of |
---|
148 | conditionals. Regardless, if the mapping is inconsistent and the server is |
---|
149 | unable to select the appropriate representation, then no harm will result |
---|
150 | when the precondition evaluates to false. |
---|
151 | </t> |
---|
152 | <t> |
---|
153 | The conditional request preconditions defined by this specification are |
---|
154 | evaluated by comparing the validators provided in the conditional request |
---|
155 | header fields to the current validators for the selected representation |
---|
156 | in the order defined by <xref target="precedence"/>. |
---|
157 | </t> |
---|
158 | |
---|
159 | <section title="Conformance and Error Handling" anchor="conformance"> |
---|
160 | <t> |
---|
161 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
---|
162 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
---|
163 | document are to be interpreted as described in <xref target="RFC2119"/>. |
---|
164 | </t> |
---|
165 | <t> |
---|
166 | Conformance criteria and considerations regarding error handling |
---|
167 | are defined in &conformance;. |
---|
168 | </t> |
---|
169 | </section> |
---|
170 | |
---|
171 | <section title="Syntax Notation" anchor="notation"> |
---|
172 | <t> |
---|
173 | This specification uses the Augmented Backus-Naur Form (ABNF) notation |
---|
174 | of <xref target="RFC5234"/> with the list rule extension defined in |
---|
175 | ¬ation;. <xref target="imported.abnf"/> describes rules imported from |
---|
176 | other documents. <xref target="collected.abnf"/> shows the collected ABNF |
---|
177 | with the list rule expanded. |
---|
178 | </t> |
---|
179 | </section> |
---|
180 | </section> |
---|
181 | |
---|
182 | <section title="Validators" anchor="validators"> |
---|
183 | <iref primary="true" item="metadata"/> |
---|
184 | <iref primary="true" item="validator"/> |
---|
185 | <t> |
---|
186 | This specification defines two forms of metadata that are commonly used |
---|
187 | to observe resource state and test for preconditions: modification dates |
---|
188 | (<xref target="header.last-modified"/>) and opaque entity tags |
---|
189 | (<xref target="header.etag"/>). Additional metadata that reflects resource state |
---|
190 | has been defined by various extensions of HTTP, such as WebDAV |
---|
191 | <xref target="RFC4918"/>, that are beyond the scope of this specification. |
---|
192 | A resource metadata value is referred to as a "<x:dfn>validator</x:dfn>" |
---|
193 | when it is used within a precondition. |
---|
194 | </t> |
---|
195 | |
---|
196 | <section title="Weak versus Strong" anchor="weak.and.strong.validators"> |
---|
197 | <iref primary="true" item="validator" subitem="weak"/> |
---|
198 | <iref primary="true" item="validator" subitem="strong"/> |
---|
199 | <t> |
---|
200 | Validators come in two flavors: strong or weak. Weak validators are easy |
---|
201 | to generate but are far less useful for comparisons. Strong validators |
---|
202 | are ideal for comparisons but can be very difficult (and occasionally |
---|
203 | impossible) to generate efficiently. Rather than impose that all forms |
---|
204 | of resource adhere to the same strength of validator, HTTP exposes the |
---|
205 | type of validator in use and imposes restrictions on when weak validators |
---|
206 | can be used as preconditions. |
---|
207 | </t> |
---|
208 | <t> |
---|
209 | A "strong validator" is representation metadata that changes value whenever |
---|
210 | a change occurs to the representation data that would be observable in the |
---|
211 | payload body of a <x:ref>200 (OK)</x:ref> response to GET. |
---|
212 | </t> |
---|
213 | <t> |
---|
214 | A strong validator might change for other reasons, such as when a |
---|
215 | semantically significant part of the representation metadata is changed |
---|
216 | (e.g., <x:ref>Content-Type</x:ref>), but it is in the best interests of the |
---|
217 | origin server to only change the value when it is necessary to invalidate |
---|
218 | the stored responses held by remote caches and authoring tools. A strong |
---|
219 | validator is unique across all representations of a given resource, such |
---|
220 | that no two representations of that resource can share the same validator |
---|
221 | unless their representation data is identical. |
---|
222 | </t> |
---|
223 | <t> |
---|
224 | Cache entries might persist for arbitrarily long periods, regardless |
---|
225 | of expiration times. Thus, a cache might attempt to validate an |
---|
226 | entry using a validator that it obtained in the distant past. |
---|
227 | A strong validator is unique across all versions of all |
---|
228 | representations associated with a particular resource over time. |
---|
229 | However, there is no implication of uniqueness across representations |
---|
230 | of different resources (i.e., the same strong validator might be |
---|
231 | in use for representations of multiple resources at the same time |
---|
232 | and does not imply that those representations are equivalent). |
---|
233 | </t> |
---|
234 | <t> |
---|
235 | There are a variety of strong validators used in practice. The best are |
---|
236 | based on strict revision control, wherein each change to a representation |
---|
237 | always results in a unique node name and revision identifier being assigned |
---|
238 | before the representation is made accessible to GET. A collision-resistant hash |
---|
239 | function applied to the representation data is also sufficient if the data |
---|
240 | is available prior to the response header fields being sent and the digest |
---|
241 | does not need to be recalculated every time a validation request is |
---|
242 | received. However, if a resource has distinct representations that differ |
---|
243 | only in their metadata, such as might occur with content negotiation over |
---|
244 | media types that happen to share the same data format, then the origin |
---|
245 | server &SHOULD; incorporate additional information in the validator to |
---|
246 | distinguish those representations. |
---|
247 | </t> |
---|
248 | <t> |
---|
249 | In contrast, a "weak validator" is representation metadata that |
---|
250 | might not change for every change to the representation data. This |
---|
251 | weakness might be due to limitations in how the value is calculated, such |
---|
252 | as clock resolution or an inability to ensure uniqueness for all possible |
---|
253 | representations of the resource, or due to a desire by the resource owner |
---|
254 | to group representations by some self-determined set of equivalency |
---|
255 | rather than unique sequences of data. An origin server &SHOULD; change a |
---|
256 | weak entity-tag whenever it considers prior representations to be |
---|
257 | unacceptable as a substitute for the current representation. In other words, |
---|
258 | a weak entity-tag ought to change whenever the origin server wants caches to |
---|
259 | invalidate old responses. |
---|
260 | </t> |
---|
261 | <t> |
---|
262 | For example, the representation of a weather report that changes in |
---|
263 | content every second, based on dynamic measurements, might be grouped |
---|
264 | into sets of equivalent representations (from the origin server's |
---|
265 | perspective) with the same weak validator in order to allow cached |
---|
266 | representations to be valid for a reasonable period of time (perhaps |
---|
267 | adjusted dynamically based on server load or weather quality). |
---|
268 | Likewise, a representation's modification time, if defined with only |
---|
269 | one-second resolution, might be a weak validator if it is possible |
---|
270 | for the representation to be modified twice during a single second and |
---|
271 | retrieved between those modifications. |
---|
272 | </t> |
---|
273 | <t> |
---|
274 | Likewise, a validator is weak if it is shared by two or more |
---|
275 | representations of a given resource at the same time, unless those |
---|
276 | representations have identical representation data. For example, if the |
---|
277 | origin server sends the same validator for a representation with a gzip |
---|
278 | content coding applied as it does for a representation with no content |
---|
279 | coding, then that validator is weak. However, two simultaneous |
---|
280 | representations might share the same strong validator if they differ only |
---|
281 | in the representation metadata, such as when two different media types are |
---|
282 | available for the same representation data. |
---|
283 | </t> |
---|
284 | <t> |
---|
285 | A "use" of a validator occurs when either a client generates a request |
---|
286 | and includes the validator in a precondition or when a server |
---|
287 | compares two validators. |
---|
288 | Weak validators are only usable in contexts that do not depend on exact |
---|
289 | equality of the representation data. |
---|
290 | Strong validators are usable and preferred for all conditional requests, |
---|
291 | including cache validation, partial content ranges, and "lost update" |
---|
292 | avoidance. |
---|
293 | </t> |
---|
294 | </section> |
---|
295 | |
---|
296 | <section title="Last-Modified" anchor="header.last-modified"> |
---|
297 | <iref primary="true" item="Last-Modified header field" x:for-anchor=""/> |
---|
298 | <x:anchor-alias value="Last-Modified"/> |
---|
299 | <t> |
---|
300 | The "Last-Modified" header field in a response provides a timestamp |
---|
301 | indicating the date and time at which the origin server believes the |
---|
302 | selected representation was last modified, as determined at the conclusion |
---|
303 | of handling the request. |
---|
304 | </t> |
---|
305 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/> |
---|
306 | <x:ref>Last-Modified</x:ref> = <x:ref>HTTP-date</x:ref> |
---|
307 | </artwork></figure> |
---|
308 | <t> |
---|
309 | An example of its use is |
---|
310 | </t> |
---|
311 | <figure><artwork type="example"> |
---|
312 | Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT |
---|
313 | </artwork></figure> |
---|
314 | |
---|
315 | <section title="Generation" anchor="lastmod.generation"> |
---|
316 | <t> |
---|
317 | Origin servers &SHOULD; send Last-Modified for any selected |
---|
318 | representation for which a last modification date can be reasonably |
---|
319 | and consistently determined, since its use in conditional requests |
---|
320 | and evaluating cache freshness (&caching;) results in a substantial |
---|
321 | reduction of HTTP traffic on the Internet and can be a significant |
---|
322 | factor in improving service scalability and reliability. |
---|
323 | </t> |
---|
324 | <t> |
---|
325 | A representation is typically the sum of many parts behind the |
---|
326 | resource interface. The last-modified time would usually be |
---|
327 | the most recent time that any of those parts were changed. |
---|
328 | How that value is determined for any given resource is an |
---|
329 | implementation detail beyond the scope of this specification. |
---|
330 | What matters to HTTP is how recipients of the Last-Modified |
---|
331 | header field can use its value to make conditional requests |
---|
332 | and test the validity of locally cached responses. |
---|
333 | </t> |
---|
334 | <t> |
---|
335 | An origin server &SHOULD; obtain the Last-Modified value of the |
---|
336 | representation as close as possible to the time that it generates the |
---|
337 | <x:ref>Date</x:ref> field value for its response. This allows a recipient to |
---|
338 | make an accurate assessment of the representation's modification time, |
---|
339 | especially if the representation changes near the time that the |
---|
340 | response is generated. |
---|
341 | </t> |
---|
342 | <t> |
---|
343 | An origin server with a clock &MUST-NOT; send a Last-Modified date |
---|
344 | that is later than the server's time of message origination (<x:ref>Date</x:ref>). |
---|
345 | If the last modification time is derived from implementation-specific |
---|
346 | metadata that evaluates to some time in the future, according to the |
---|
347 | origin server's clock, then the origin server &MUST; replace that |
---|
348 | value with the message origination date. This prevents a future |
---|
349 | modification date from having an adverse impact on cache validation. |
---|
350 | </t> |
---|
351 | <t> |
---|
352 | An origin server without a clock &MUST-NOT; assign Last-Modified |
---|
353 | values to a response unless these values were associated |
---|
354 | with the resource by some other system or user with a reliable clock. |
---|
355 | </t> |
---|
356 | </section> |
---|
357 | |
---|
358 | <section title="Comparison" anchor="lastmod.comparison"> |
---|
359 | <t> |
---|
360 | A Last-Modified time, when used as a validator in a request, is |
---|
361 | implicitly weak unless it is possible to deduce that it is strong, |
---|
362 | using the following rules: |
---|
363 | <list style="symbols"> |
---|
364 | <t>The validator is being compared by an origin server to the |
---|
365 | actual current validator for the representation and,</t> |
---|
366 | <t>That origin server reliably knows that the associated representation did |
---|
367 | not change twice during the second covered by the presented |
---|
368 | validator.</t> |
---|
369 | </list> |
---|
370 | </t> |
---|
371 | <t> |
---|
372 | or |
---|
373 | <list style="symbols"> |
---|
374 | <t>The validator is about to be used by a client in an <x:ref>If-Modified-Since</x:ref>, |
---|
375 | <x:ref>If-Unmodified-Since</x:ref> header field, because the client has |
---|
376 | a cache entry, or <x:ref>If-Range</x:ref> for the associated |
---|
377 | representation, and</t> |
---|
378 | <t>That cache entry includes a <x:ref>Date</x:ref> value, which gives the |
---|
379 | time when the origin server sent the original response, and</t> |
---|
380 | <t>The presented Last-Modified time is at least 60 seconds before |
---|
381 | the Date value.</t> |
---|
382 | </list> |
---|
383 | </t> |
---|
384 | <t> |
---|
385 | or |
---|
386 | <list style="symbols"> |
---|
387 | <t>The validator is being compared by an intermediate cache to the |
---|
388 | validator stored in its cache entry for the representation, and</t> |
---|
389 | <t>That cache entry includes a <x:ref>Date</x:ref> value, which gives the |
---|
390 | time when the origin server sent the original response, and</t> |
---|
391 | <t>The presented Last-Modified time is at least 60 seconds before |
---|
392 | the Date value.</t> |
---|
393 | </list> |
---|
394 | </t> |
---|
395 | <t> |
---|
396 | This method relies on the fact that if two different responses were |
---|
397 | sent by the origin server during the same second, but both had the |
---|
398 | same Last-Modified time, then at least one of those responses would |
---|
399 | have a <x:ref>Date</x:ref> value equal to its Last-Modified time. The |
---|
400 | arbitrary 60-second limit guards against the possibility that the Date and |
---|
401 | Last-Modified values are generated from different clocks, or at somewhat |
---|
402 | different times during the preparation of the response. An |
---|
403 | implementation &MAY; use a value larger than 60 seconds, if it is |
---|
404 | believed that 60 seconds is too short. |
---|
405 | </t> |
---|
406 | </section> |
---|
407 | </section> |
---|
408 | |
---|
409 | <section title="ETag" anchor="header.etag"> |
---|
410 | <iref primary="true" item="ETag header field" x:for-anchor=""/> |
---|
411 | <x:anchor-alias value="ETag"/> |
---|
412 | <x:anchor-alias value="entity-tag"/> |
---|
413 | <x:anchor-alias value="opaque-tag"/> |
---|
414 | <x:anchor-alias value="weak"/> |
---|
415 | <x:anchor-alias value="etagc"/> |
---|
416 | <t> |
---|
417 | The "ETag" header field in a response provides the current entity-tag for |
---|
418 | the selected representation, as determined at the conclusion of handling |
---|
419 | the request. |
---|
420 | An entity-tag is an opaque validator for differentiating between |
---|
421 | multiple representations of the same resource, regardless of whether |
---|
422 | those multiple representations are due to resource state changes over |
---|
423 | time, content negotiation resulting in multiple representations being |
---|
424 | valid at the same time, or both. An entity-tag consists of an opaque |
---|
425 | quoted string, possibly prefixed by a weakness indicator. |
---|
426 | </t> |
---|
427 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/><iref primary="true" item="Grammar" subitem="entity-tag"/><iref primary="true" item="Grammar" subitem="weak"/><iref primary="true" item="Grammar" subitem="opaque-tag"/><iref primary="true" item="Grammar" subitem="etagc"/> |
---|
428 | <x:ref>ETag</x:ref> = <x:ref>entity-tag</x:ref> |
---|
429 | |
---|
430 | <x:ref>entity-tag</x:ref> = [ <x:ref>weak</x:ref> ] <x:ref>opaque-tag</x:ref> |
---|
431 | <x:ref>weak</x:ref> = <x:abnf-char-sequence>"W/"</x:abnf-char-sequence> ; "W/", case-sensitive |
---|
432 | <x:ref>opaque-tag</x:ref> = <x:ref>DQUOTE</x:ref> *<x:ref>etagc</x:ref> <x:ref>DQUOTE</x:ref> |
---|
433 | <x:ref>etagc</x:ref> = %x21 / %x23-7E / <x:ref>obs-text</x:ref> |
---|
434 | ; <x:ref>VCHAR</x:ref> except double quotes, plus obs-text |
---|
435 | </artwork></figure> |
---|
436 | <x:note> |
---|
437 | <t> |
---|
438 | &Note; Previously, opaque-tag was defined to be a quoted-string |
---|
439 | (<xref target="RFC2616" x:fmt="," x:sec="3.11"/>), thus some recipients |
---|
440 | might perform backslash unescaping. Servers therefore ought to avoid |
---|
441 | backslash characters in entity tags. |
---|
442 | </t> |
---|
443 | </x:note> |
---|
444 | <t> |
---|
445 | An entity-tag can be more reliable for validation than a modification |
---|
446 | date in situations where it is inconvenient to store modification |
---|
447 | dates, where the one-second resolution of HTTP date values is not |
---|
448 | sufficient, or where modification dates are not consistently maintained. |
---|
449 | </t> |
---|
450 | <figure><preamble> |
---|
451 | Examples: |
---|
452 | </preamble> |
---|
453 | <artwork type="example"> |
---|
454 | ETag: "xyzzy" |
---|
455 | ETag: W/"xyzzy" |
---|
456 | ETag: "" |
---|
457 | </artwork></figure> |
---|
458 | <t> |
---|
459 | An entity-tag can be either a weak or strong validator, with |
---|
460 | strong being the default. If an origin server provides an entity-tag |
---|
461 | for a representation and the generation of that entity-tag does not satisfy |
---|
462 | all of the characteristics of a strong validator |
---|
463 | (<xref target="weak.and.strong.validators"/>), then the origin server |
---|
464 | &MUST; mark the entity-tag as weak by prefixing its opaque value |
---|
465 | with "W/" (case-sensitive). |
---|
466 | </t> |
---|
467 | |
---|
468 | <section title="Generation" anchor="entity.tag.generation"> |
---|
469 | <t> |
---|
470 | The principle behind entity-tags is that only the service author |
---|
471 | knows the implementation of a resource well enough to select the |
---|
472 | most accurate and efficient validation mechanism for that resource, |
---|
473 | and that any such mechanism can be mapped to a simple sequence of |
---|
474 | octets for easy comparison. Since the value is opaque, there is no |
---|
475 | need for the client to be aware of how each entity-tag is constructed. |
---|
476 | </t> |
---|
477 | <t> |
---|
478 | For example, a resource that has implementation-specific versioning |
---|
479 | applied to all changes might use an internal revision number, perhaps |
---|
480 | combined with a variance identifier for content negotiation, to |
---|
481 | accurately differentiate between representations. |
---|
482 | Other implementations might use a collision-resistant hash of |
---|
483 | representation content, |
---|
484 | a combination of various filesystem attributes, or a modification |
---|
485 | timestamp that has sub-second resolution. |
---|
486 | </t> |
---|
487 | <t> |
---|
488 | Origin servers &SHOULD; send ETag for any selected representation |
---|
489 | for which detection of changes can be reasonably and consistently |
---|
490 | determined, since the entity-tag's use in conditional requests and |
---|
491 | evaluating cache freshness (&caching;) can result in a substantial |
---|
492 | reduction of HTTP network traffic and can be a significant factor in |
---|
493 | improving service scalability and reliability. |
---|
494 | </t> |
---|
495 | </section> |
---|
496 | |
---|
497 | <section title="Comparison" anchor="entity.tag.comparison"> |
---|
498 | <x:anchor-alias value="validator.comparison"/> |
---|
499 | <x:anchor-alias value="strong comparison"/> |
---|
500 | <x:anchor-alias value="weak comparison"/> |
---|
501 | <t> |
---|
502 | There are two entity-tag comparison functions, depending |
---|
503 | on whether the comparison context allows the use of weak validators |
---|
504 | or not: |
---|
505 | <list style="symbols"> |
---|
506 | <t><x:dfn>Strong comparison</x:dfn>: two entity-tags are equivalent if both |
---|
507 | are not weak and their opaque-tags match character-by-character.</t> |
---|
508 | <t><x:dfn>Weak comparison</x:dfn>: two entity-tags are equivalent if their opaque-tags |
---|
509 | match character-by-character, regardless of either or both |
---|
510 | being tagged as "weak".</t> |
---|
511 | </list> |
---|
512 | </t> |
---|
513 | <t> |
---|
514 | The example below shows the results for a set of entity-tag pairs, |
---|
515 | and both the weak and strong comparison function results: |
---|
516 | </t> |
---|
517 | <texttable align="left"> |
---|
518 | <ttcol>ETag 1</ttcol> |
---|
519 | <ttcol>ETag 2</ttcol> |
---|
520 | <ttcol>Strong Comparison</ttcol> |
---|
521 | <ttcol>Weak Comparison</ttcol> |
---|
522 | |
---|
523 | <c>W/"1"</c> |
---|
524 | <c>W/"1"</c> |
---|
525 | <c>no match</c> |
---|
526 | <c>match</c> |
---|
527 | |
---|
528 | <c>W/"1"</c> |
---|
529 | <c>W/"2"</c> |
---|
530 | <c>no match</c> |
---|
531 | <c>no match</c> |
---|
532 | |
---|
533 | <c>W/"1"</c> |
---|
534 | <c>"1"</c> |
---|
535 | <c>no match</c> |
---|
536 | <c>match</c> |
---|
537 | |
---|
538 | <c>"1"</c> |
---|
539 | <c>"1"</c> |
---|
540 | <c>match</c> |
---|
541 | <c>match</c> |
---|
542 | </texttable> |
---|
543 | </section> |
---|
544 | |
---|
545 | <section title="Example: Entity-tags Varying on Content-Negotiated Resources" anchor="example.entity.tag.vs.conneg"> |
---|
546 | <t> |
---|
547 | Consider a resource that is subject to content negotiation |
---|
548 | (&content-negotiation;), and where the representations sent in response to |
---|
549 | a GET request vary based on the <x:ref>Accept-Encoding</x:ref> request |
---|
550 | header field (&header-accept-encoding;): |
---|
551 | </t> |
---|
552 | <figure><preamble>>> Request:</preamble><artwork type="message/http; msgtype="request"" x:indent-with=" "> |
---|
553 | GET /index HTTP/1.1 |
---|
554 | Host: www.example.com |
---|
555 | Accept-Encoding: gzip |
---|
556 | |
---|
557 | </artwork></figure> |
---|
558 | <t> |
---|
559 | In this case, the response might or might not use the gzip content coding. |
---|
560 | If it does not, the response might look like: |
---|
561 | </t> |
---|
562 | <figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
---|
563 | HTTP/1.1 200 OK |
---|
564 | Date: Fri, 26 Mar 2010 00:05:00 GMT |
---|
565 | ETag: "123-a" |
---|
566 | Content-Length: <x:length-of target="exbody"/> |
---|
567 | Vary: Accept-Encoding |
---|
568 | Content-Type: text/plain |
---|
569 | |
---|
570 | <x:span anchor="exbody">Hello World! |
---|
571 | Hello World! |
---|
572 | Hello World! |
---|
573 | Hello World! |
---|
574 | Hello World! |
---|
575 | </x:span></artwork></figure> |
---|
576 | <t> |
---|
577 | An alternative representation that does use gzip content coding would be: |
---|
578 | </t> |
---|
579 | <figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
---|
580 | HTTP/1.1 200 OK |
---|
581 | Date: Fri, 26 Mar 2010 00:05:00 GMT |
---|
582 | ETag: "123-b" |
---|
583 | Content-Length: 43 |
---|
584 | Vary: Accept-Encoding |
---|
585 | Content-Type: text/plain |
---|
586 | Content-Encoding: gzip |
---|
587 | |
---|
588 | <spanx>...binary data...</spanx></artwork></figure> |
---|
589 | <x:note> |
---|
590 | <t> |
---|
591 | &Note; Content codings are a property of the representation, |
---|
592 | so therefore an entity-tag of an encoded representation has to be distinct |
---|
593 | from an unencoded representation to prevent conflicts during cache updates |
---|
594 | and range requests. In contrast, transfer codings (&transfer-codings;) |
---|
595 | apply only during message transfer and do not require distinct entity-tags. |
---|
596 | </t> |
---|
597 | </x:note> |
---|
598 | </section> |
---|
599 | </section> |
---|
600 | |
---|
601 | <section title="When to Use Entity-tags and Last-Modified Dates" anchor="when.to.use.entity.tags.and.last-modified.dates"> |
---|
602 | <t> |
---|
603 | We adopt a set of rules and recommendations for origin servers, |
---|
604 | clients, and caches regarding when various validator types ought to |
---|
605 | be used, and for what purposes. |
---|
606 | </t> |
---|
607 | <t> |
---|
608 | In <x:ref>200 (OK)</x:ref> responses to GET or HEAD, an origin server: |
---|
609 | <list style="symbols"> |
---|
610 | <t>&SHOULD; send an entity-tag validator unless it is not feasible to |
---|
611 | generate one.</t> |
---|
612 | |
---|
613 | <t>&MAY; send a weak entity-tag instead of a strong entity-tag, if |
---|
614 | performance considerations support the use of weak entity-tags, |
---|
615 | or if it is unfeasible to send a strong entity-tag.</t> |
---|
616 | |
---|
617 | <t>&SHOULD; send a <x:ref>Last-Modified</x:ref> value if it is feasible to |
---|
618 | send one.</t> |
---|
619 | </list> |
---|
620 | </t> |
---|
621 | <t> |
---|
622 | In other words, the preferred behavior for an origin server |
---|
623 | is to send both a strong entity-tag and a <x:ref>Last-Modified</x:ref> |
---|
624 | value in successful responses to a retrieval request. |
---|
625 | </t> |
---|
626 | <t> |
---|
627 | A client: |
---|
628 | <list style="symbols"> |
---|
629 | <t>&MUST; use that entity-tag in any cache-conditional request (using |
---|
630 | <x:ref>If-Match</x:ref> or <x:ref>If-None-Match</x:ref>) if an |
---|
631 | entity-tag has been provided by the origin server.</t> |
---|
632 | |
---|
633 | <t>&SHOULD; use the <x:ref>Last-Modified</x:ref> value in non-subrange |
---|
634 | cache-conditional requests (using <x:ref>If-Modified-Since</x:ref>) |
---|
635 | if only a Last-Modified value has been provided by the origin server.</t> |
---|
636 | |
---|
637 | <t>&MAY; use the <x:ref>Last-Modified</x:ref> value in subrange |
---|
638 | cache-conditional requests (using <x:ref>If-Unmodified-Since</x:ref>) |
---|
639 | if only a Last-Modified value has been provided by an HTTP/1.0 origin |
---|
640 | server. The user agent &SHOULD; provide a way to disable this, in case |
---|
641 | of difficulty.</t> |
---|
642 | |
---|
643 | <t>&SHOULD; use both validators in cache-conditional requests if both an |
---|
644 | entity-tag and a <x:ref>Last-Modified</x:ref> value have been provided |
---|
645 | by the origin server. This allows both HTTP/1.0 and HTTP/1.1 caches to |
---|
646 | respond appropriately.</t> |
---|
647 | </list> |
---|
648 | </t> |
---|
649 | </section> |
---|
650 | </section> |
---|
651 | |
---|
652 | <section title="Precondition Header Fields" anchor="header.field.definitions"> |
---|
653 | <t> |
---|
654 | This section defines the syntax and semantics of HTTP/1.1 header fields |
---|
655 | for applying preconditions on requests. |
---|
656 | <xref target="precedence"/> defines when the preconditions are applied and |
---|
657 | the order of evaluation when more than one precondition is present. |
---|
658 | </t> |
---|
659 | |
---|
660 | <section title="If-Match" anchor="header.if-match"> |
---|
661 | <iref primary="true" item="If-Match header field" x:for-anchor=""/> |
---|
662 | <x:anchor-alias value="If-Match"/> |
---|
663 | <t> |
---|
664 | The "If-Match" header field makes the request method conditional on either |
---|
665 | the existence of a current representation for the target resource, when |
---|
666 | the field-value is "*", or on the selected representation having an |
---|
667 | entity-tag that matches one of those provided in the field-value. |
---|
668 | </t> |
---|
669 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/> |
---|
670 | <x:ref>If-Match</x:ref> = "*" / 1#<x:ref>entity-tag</x:ref> |
---|
671 | </artwork></figure> |
---|
672 | <t> |
---|
673 | Examples: |
---|
674 | </t> |
---|
675 | <figure><artwork type="example"> |
---|
676 | If-Match: "xyzzy" |
---|
677 | If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz" |
---|
678 | If-Match: * |
---|
679 | </artwork></figure> |
---|
680 | <t> |
---|
681 | If the request semantics (method and header fields) allow the request to be |
---|
682 | satisfied with a cached response, a cache &SHOULD; evaluate the condition |
---|
683 | based on its currently stored set of suitable responses for that request |
---|
684 | (see &cache-key;). |
---|
685 | If the field-value is "*" and any suitable response is currently stored, |
---|
686 | or if the field-value is a list of entity-tag values and at least one of |
---|
687 | the suitable responses has an <x:ref>ETag</x:ref> header field with a |
---|
688 | value matching an entity-tag in that list, then the cache &SHOULD; reuse |
---|
689 | the most suitable of those matching responses to satisfy the request. |
---|
690 | If the condition is not met, none of the cached responses is suitable for |
---|
691 | reuse in response to this request. |
---|
692 | </t> |
---|
693 | <t> |
---|
694 | If the request semantics cannot be satisfied with a cached response, the |
---|
695 | conditional is only evaluated when received by an origin server. |
---|
696 | For example, If-Match is most often used with state-changing requests, |
---|
697 | such as PUT, to prevent accidental overwrites when multiple user agents |
---|
698 | might be acting in parallel on the same resource (i.e., to prevent the |
---|
699 | "lost update" problem). |
---|
700 | </t> |
---|
701 | <t> |
---|
702 | When the If-Match field-value consists of a list of entity-tag values, |
---|
703 | the condition is met if any of the entity-tags listed match, using the weak |
---|
704 | comparison function (as per <xref target="entity.tag.comparison"/>), the |
---|
705 | entity-tag of the selected representation. |
---|
706 | When the If-Match field-value is "*", the condition is met if any current |
---|
707 | representation exists for the target resource. |
---|
708 | </t> |
---|
709 | <t> |
---|
710 | If the condition is met, the origin server &MAY; perform the requested |
---|
711 | method. |
---|
712 | </t> |
---|
713 | <t> |
---|
714 | An origin server &MUST-NOT; perform the requested method if the condition |
---|
715 | is not met; instead the origin server &MUST; respond with either: |
---|
716 | a) the <x:ref>412 (Precondition Failed)</x:ref> status code; or, |
---|
717 | b) one of the <x:ref>2xx (Successful)</x:ref> status codes if the origin |
---|
718 | server has verified that a state change is being requested and the final |
---|
719 | state is already reflected in the current state of the target resource |
---|
720 | (i.e., the change requested by the user agent has already succeeded, but |
---|
721 | the user agent might not be aware of that because the prior response message |
---|
722 | was lost or a compatible change was made by some other user agent). |
---|
723 | In the latter case, the origin server &MUST-NOT; send a validator header |
---|
724 | field in the response unless it can verify that the request is a duplicate |
---|
725 | of an immediately prior change made by the same user agent. |
---|
726 | </t> |
---|
727 | </section> |
---|
728 | |
---|
729 | <section title="If-None-Match" anchor="header.if-none-match"> |
---|
730 | <iref primary="true" item="If-None-Match header field" x:for-anchor=""/> |
---|
731 | <x:anchor-alias value="If-None-Match"/> |
---|
732 | <t> |
---|
733 | The "If-None-Match" header field can be used to make a request method |
---|
734 | conditional on not matching any of the current entity-tag values for |
---|
735 | representations of the target resource. |
---|
736 | </t> |
---|
737 | <t> |
---|
738 | If-None-Match is primarily used in conditional GET requests to enable |
---|
739 | efficient updates of cached information with a minimum amount of transaction |
---|
740 | overhead. A client that has one or more representations previously obtained |
---|
741 | from the target resource can send If-None-Match with a list of the |
---|
742 | associated entity-tags in the hope of receiving a <x:ref>304 (Not |
---|
743 | Modified)</x:ref> response if at least one of those representations matches |
---|
744 | the selected representation. |
---|
745 | </t> |
---|
746 | <t> |
---|
747 | If-None-Match can also be used with a value of "*" to prevent an unsafe |
---|
748 | request method (e.g., PUT) from inadvertently modifying an existing |
---|
749 | representation of the target resource when the client believes that |
---|
750 | the resource does not have a current representation (&safe-methods;). |
---|
751 | This is a variation on the "lost update" problem that might arise if more |
---|
752 | than one client attempts to create an initial representation for the target |
---|
753 | resource. |
---|
754 | </t> |
---|
755 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/> |
---|
756 | <x:ref>If-None-Match</x:ref> = "*" / 1#<x:ref>entity-tag</x:ref> |
---|
757 | </artwork></figure> |
---|
758 | <t> |
---|
759 | The If-None-Match condition is met if and only if none of the entity-tags |
---|
760 | listed in the If-None-Match field value match the entity-tag of the selected |
---|
761 | representation using the weak comparison function (as per <xref |
---|
762 | target="entity.tag.comparison"/>), or if "*" is given and no current |
---|
763 | representation exists for that resource. |
---|
764 | </t> |
---|
765 | <t> |
---|
766 | If the condition is not met, the server &MUST-NOT; perform the requested |
---|
767 | method. Instead, if the request method was GET or HEAD, the server &SHOULD; |
---|
768 | respond with a <x:ref>304 (Not Modified)</x:ref> status code, including the |
---|
769 | cache-related header fields (particularly <x:ref>ETag</x:ref>) of the |
---|
770 | selected representation that has a matching entity-tag. For all other |
---|
771 | request methods, the server &MUST; respond with a <x:ref>412 (Precondition |
---|
772 | Failed)</x:ref> status code when the condition is not met. |
---|
773 | </t> |
---|
774 | <t> |
---|
775 | If the condition is met, the server &MAY; perform the requested method and |
---|
776 | &MUST; ignore any <x:ref>If-Modified-Since</x:ref> header field(s) in the |
---|
777 | request. That is, if no entity-tags match, then the server &MUST-NOT; send |
---|
778 | a <x:ref>304 (Not Modified)</x:ref> response. |
---|
779 | </t> |
---|
780 | <t> |
---|
781 | Examples: |
---|
782 | </t> |
---|
783 | <figure><artwork type="example"> |
---|
784 | If-None-Match: "xyzzy" |
---|
785 | If-None-Match: W/"xyzzy" |
---|
786 | If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz" |
---|
787 | If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz" |
---|
788 | If-None-Match: * |
---|
789 | </artwork></figure> |
---|
790 | </section> |
---|
791 | |
---|
792 | <section title="If-Modified-Since" anchor="header.if-modified-since"> |
---|
793 | <iref primary="true" item="If-Modified-Since header field" x:for-anchor=""/> |
---|
794 | <x:anchor-alias value="If-Modified-Since"/> |
---|
795 | <t> |
---|
796 | The "If-Modified-Since" header field can be used with GET or HEAD to make |
---|
797 | the method conditional by modification date: if the selected representation |
---|
798 | has not been modified since the time specified in this field, then |
---|
799 | do not perform the request method; instead, respond as detailed below. |
---|
800 | </t> |
---|
801 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/> |
---|
802 | <x:ref>If-Modified-Since</x:ref> = <x:ref>HTTP-date</x:ref> |
---|
803 | </artwork></figure> |
---|
804 | <t> |
---|
805 | An example of the field is: |
---|
806 | </t> |
---|
807 | <figure><artwork type="example"> |
---|
808 | If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT |
---|
809 | </artwork></figure> |
---|
810 | <t> |
---|
811 | A GET method with an If-Modified-Since header field and no <x:ref>Range</x:ref> |
---|
812 | header field requests that the selected representation be transferred only if |
---|
813 | it has been modified since the date given by the If-Modified-Since |
---|
814 | header field. |
---|
815 | The algorithm for determining this includes the following cases: |
---|
816 | <list style="numbers"> |
---|
817 | <t>If the request would normally result in anything other than a |
---|
818 | <x:ref>200 (OK)</x:ref> status code, or if the passed If-Modified-Since date is |
---|
819 | invalid, the response is exactly the same as for a normal GET. |
---|
820 | A date that is later than the server's current time is |
---|
821 | invalid.</t> |
---|
822 | |
---|
823 | <t>If the selected representation has been modified since the |
---|
824 | If-Modified-Since date, the response is exactly the same as for |
---|
825 | a normal GET.</t> |
---|
826 | |
---|
827 | <t>If the selected representation has not been modified since a valid |
---|
828 | If-Modified-Since date, the server &SHOULD; send a |
---|
829 | <x:ref>304 (Not Modified)</x:ref> response.</t> |
---|
830 | </list> |
---|
831 | </t> |
---|
832 | <t> |
---|
833 | The two purposes of this feature are to allow efficient updates of cached |
---|
834 | information, with a minimum amount of transaction overhead, and to limit |
---|
835 | the scope of a web traversal to resources that have recently changed. |
---|
836 | </t> |
---|
837 | <t> |
---|
838 | When used for cache updates, a cache will typically use the value of the |
---|
839 | cached message's <x:ref>Last-Modified</x:ref> field to generate the field |
---|
840 | value of If-Modified-Since. This behavior is most interoperable for cases |
---|
841 | where clocks are poorly synchronized or when the server has chosen to only |
---|
842 | honor exact timestamp matches (due to a problem with Last-Modified dates |
---|
843 | that appear to go "back in time" when the origin server's clock is |
---|
844 | corrected or a representation is restored from an archived backup). |
---|
845 | However, caches occasionally generate the field value based on other data, |
---|
846 | such as the <x:ref>Date</x:ref> header field of the cached message or the |
---|
847 | local clock time that the message was received, particularly when the |
---|
848 | cached message does not contain a <x:ref>Last-Modified</x:ref> field. |
---|
849 | </t> |
---|
850 | <t> |
---|
851 | When used for limiting the scope of retrieval to a recent time window, a |
---|
852 | user agent will generate an If-Modified-Since field value based on either |
---|
853 | its own local clock or a <x:ref>Date</x:ref> header field received from the |
---|
854 | server during a past run. Origin servers that choose an exact timestamp |
---|
855 | match based on the selected representation's <x:ref>Last-Modified</x:ref> |
---|
856 | field will not be able to help the user agent limit its data transfers to |
---|
857 | only those changed during the specified window. |
---|
858 | </t> |
---|
859 | <x:note> |
---|
860 | <t> |
---|
861 | &Note; If a client uses an arbitrary date in the If-Modified-Since |
---|
862 | header field instead of a date taken from a <x:ref>Last-Modified</x:ref> |
---|
863 | or <x:ref>Date</x:ref> header field from the origin server, the client |
---|
864 | ought to be aware that its date will be interpreted according to the |
---|
865 | server's understanding of time. |
---|
866 | </t> |
---|
867 | </x:note> |
---|
868 | </section> |
---|
869 | |
---|
870 | <section title="If-Unmodified-Since" anchor="header.if-unmodified-since"> |
---|
871 | <iref primary="true" item="If-Unmodified-Since header field" x:for-anchor=""/> |
---|
872 | <x:anchor-alias value="If-Unmodified-Since"/> |
---|
873 | <t> |
---|
874 | The "If-Unmodified-Since" header field makes the request method conditional |
---|
875 | on the selected representation's last modification date being earlier or |
---|
876 | equal to the date provided in the field-value. This field accomplishes the |
---|
877 | same purpose as <x:ref>If-Match</x:ref> for cases where the user agent does |
---|
878 | not have an entity-tag for the representation. |
---|
879 | </t> |
---|
880 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/> |
---|
881 | <x:ref>If-Unmodified-Since</x:ref> = <x:ref>HTTP-date</x:ref> |
---|
882 | </artwork></figure> |
---|
883 | <t> |
---|
884 | An example of the field is: |
---|
885 | </t> |
---|
886 | <figure><artwork type="example"> |
---|
887 | If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT |
---|
888 | </artwork></figure> |
---|
889 | <t> |
---|
890 | A server &MUST; ignore If-Unmodified-Since if the selected representation |
---|
891 | has an entity-tag and the request contains an If-Match header field; |
---|
892 | the condition in If-Match, when applicable, is considered to be a more |
---|
893 | accurate replacement for the condition in If-Unmodified-Since. |
---|
894 | </t> |
---|
895 | <t> |
---|
896 | A server &MUST; ignore the If-Unmodified-Since header field if the |
---|
897 | received field-value is not a valid HTTP-date. |
---|
898 | </t> |
---|
899 | <t> |
---|
900 | If the request semantics (method and header fields) allow the request to be |
---|
901 | satisfied with a cached response, a cache &SHOULD; evaluate the condition |
---|
902 | based on its currently stored set of suitable responses for that request |
---|
903 | (see &cache-key;). |
---|
904 | If the most suitable response has a <x:ref>Last-Modified</x:ref> date that |
---|
905 | is earlier or equal to the date given in If-Unmodified-Since, the |
---|
906 | cache &SHOULD; reuse that response to satisfy the request. |
---|
907 | If the condition is not met, none of the stored responses is suitable for |
---|
908 | reuse in response to this request. |
---|
909 | </t> |
---|
910 | <t> |
---|
911 | If the request semantics cannot be satisfied with a cached response, the |
---|
912 | conditional is only evaluated when received by an origin server. |
---|
913 | If the selected representation has not been modified since the time |
---|
914 | specified in this field, then the condition is met. |
---|
915 | </t> |
---|
916 | <t> |
---|
917 | If the condition is met, the origin server &MAY; perform the requested |
---|
918 | method. |
---|
919 | </t> |
---|
920 | <t> |
---|
921 | An origin server &MUST-NOT; perform the requested method if the condition |
---|
922 | is not met; instead the origin server &MUST; respond with either: |
---|
923 | a) the <x:ref>412 (Precondition Failed)</x:ref> status code; or, |
---|
924 | b) one of the <x:ref>2xx (Successful)</x:ref> status codes if the origin |
---|
925 | server has verified that a state change is being requested and the final |
---|
926 | state is already reflected in the current state of the target resource |
---|
927 | (i.e., the change requested by the user agent has already succeeded, but |
---|
928 | the user agent might not be aware of that because the prior response message |
---|
929 | was lost or a compatible change was made by some other user agent). |
---|
930 | In the latter case, the origin server &MUST-NOT; send a validator header |
---|
931 | field in the response unless it can verify that the request is a duplicate |
---|
932 | of an immediately prior change made by the same user agent. |
---|
933 | </t> |
---|
934 | </section> |
---|
935 | |
---|
936 | <section title="If-Range" anchor="header.if-range"> |
---|
937 | <t> |
---|
938 | The "If-Range" header field provides a special conditional request |
---|
939 | mechanism that is similar to <x:ref>If-Match</x:ref> and |
---|
940 | <x:ref>If-Unmodified-Since</x:ref> but specific to range requests. |
---|
941 | If-Range is defined in &header-if-range;. |
---|
942 | </t> |
---|
943 | </section> |
---|
944 | |
---|
945 | </section> |
---|
946 | |
---|
947 | <section title="Status Code Definitions" anchor="status.code.definitions"> |
---|
948 | <section title="304 Not Modified" anchor="status.304"> |
---|
949 | <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/> |
---|
950 | <x:anchor-alias value="304"/> |
---|
951 | <x:anchor-alias value="304 (Not Modified)"/> |
---|
952 | <t> |
---|
953 | The <x:dfn>304 (Not Modified)</x:dfn> status code indicates that a |
---|
954 | conditional GET or HEAD request has been |
---|
955 | received and would have resulted in a <x:ref>200 (OK)</x:ref> response |
---|
956 | if it were not for the fact that the condition has evaluated to false. |
---|
957 | In other words, there is no need for the server to transfer a |
---|
958 | representation of the target resource because the request indicates that |
---|
959 | the client, which made the request conditional, already has a valid |
---|
960 | representation; the server is therefore redirecting the client to make |
---|
961 | use of that stored representation as if it were the payload of a |
---|
962 | <x:ref>200 (OK)</x:ref> response. |
---|
963 | </t> |
---|
964 | <t> |
---|
965 | The server generating a 304 response &MUST; generate any of the following |
---|
966 | header fields that would have been sent in a <x:ref>200 (OK)</x:ref> |
---|
967 | response to the same request: |
---|
968 | <x:ref>Cache-Control</x:ref>, |
---|
969 | <x:ref>Content-Location</x:ref>, |
---|
970 | <x:ref>ETag</x:ref>, |
---|
971 | <x:ref>Expires</x:ref>, and |
---|
972 | <x:ref>Vary</x:ref>. |
---|
973 | </t> |
---|
974 | <t> |
---|
975 | Since the goal of a 304 response is to minimize information transfer |
---|
976 | when the recipient already has one or more cached representations, |
---|
977 | a sender &SHOULD-NOT; generate representation metadata other |
---|
978 | than the above listed fields unless said metadata exists for the |
---|
979 | purpose of guiding cache updates (e.g., <x:ref>Last-Modified</x:ref> might |
---|
980 | be useful if the response does not have an <x:ref>ETag</x:ref> field). |
---|
981 | </t> |
---|
982 | <t> |
---|
983 | Requirements on a cache that receives a 304 response are defined in |
---|
984 | &freshening-responses;. If the conditional request originated with an |
---|
985 | outbound client, such as a user agent with its own cache sending a |
---|
986 | conditional GET to a shared proxy, then the proxy &SHOULD; forward the |
---|
987 | 304 response to that client. |
---|
988 | </t> |
---|
989 | <t> |
---|
990 | A 304 response cannot contain a message-body; it is always |
---|
991 | terminated by the first empty line after the header fields. |
---|
992 | </t> |
---|
993 | </section> |
---|
994 | |
---|
995 | <section title="412 Precondition Failed" anchor="status.412"> |
---|
996 | <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/> |
---|
997 | <x:anchor-alias value="412 (Precondition Failed)"/> |
---|
998 | <t> |
---|
999 | The <x:dfn>412 (Precondition Failed)</x:dfn> status code indicates that one |
---|
1000 | or more preconditions given in the request header fields evaluated to false |
---|
1001 | when tested on the server. This response code allows the client to place |
---|
1002 | preconditions on the current resource state (its current representations |
---|
1003 | and metadata) and thus prevent the request method from being applied if the |
---|
1004 | target resource is in an unexpected state. |
---|
1005 | </t> |
---|
1006 | </section> |
---|
1007 | </section> |
---|
1008 | |
---|
1009 | <section title="Evaluation and Precedence" anchor="precedence"> |
---|
1010 | <t> |
---|
1011 | For each conditional request, a server &MUST; evaluate the request |
---|
1012 | preconditions after it has successfully performed its normal request checks |
---|
1013 | (i.e., just before it would perform the action associated with the request |
---|
1014 | method). Preconditions are ignored if the server determines that an error |
---|
1015 | or redirect response applies before they are evaluated. Otherwise, the |
---|
1016 | evaluation depends on both the method semantics and the choice of |
---|
1017 | conditional. |
---|
1018 | </t> |
---|
1019 | <t> |
---|
1020 | A conditional request header field that is designed specifically for cache |
---|
1021 | validation, which includes <x:ref>If-None-Match</x:ref> and |
---|
1022 | <x:ref>If-Modified-Since</x:ref> when used in a GET or HEAD request, |
---|
1023 | allows cached representations to be refreshed without repeatedly |
---|
1024 | transferring data already held by the client. Evaluating to false is thus |
---|
1025 | an indication that the client can continue to use its local copy of the |
---|
1026 | selected representation, as indicated by the server generating a |
---|
1027 | <x:ref>304 (Not Modified)</x:ref> response that includes only those header |
---|
1028 | fields useful for refreshing the cached representation. |
---|
1029 | </t> |
---|
1030 | <t> |
---|
1031 | All other conditionals are intended to signal failure when the |
---|
1032 | precondition evaluates to false. For example, an <x:ref>If-Match</x:ref> |
---|
1033 | conditional sent with a state-changing method (e.g., POST, PUT, DELETE) is |
---|
1034 | intended to prevent the request from taking effect on the target resource |
---|
1035 | if the resource state does not match the expected state. In other words, |
---|
1036 | evaluating the condition to false means that the resource has been changed |
---|
1037 | by some other client, perhaps by another user attempting to edit the same |
---|
1038 | resource, and thus preventing the request from being applied saves the |
---|
1039 | client from overwriting some other client's work. This result is indicated |
---|
1040 | by the server generating a <x:ref>412 (Precondition Failed)</x:ref> |
---|
1041 | response. |
---|
1042 | </t> |
---|
1043 | <t> |
---|
1044 | The conditional request header fields defined by this specification are |
---|
1045 | ignored for request methods that never involve the selection or |
---|
1046 | modification of a <x:ref>selected representation</x:ref> (e.g., CONNECT, |
---|
1047 | OPTIONS, and TRACE). Other conditional request header fields, defined by |
---|
1048 | extensions to HTTP, might place conditions on the state of the target |
---|
1049 | resource in general, or on a group of resources. For instance, the If header |
---|
1050 | field in WebDAV can make a request conditional on various aspects (such |
---|
1051 | as locks) of multiple resources |
---|
1052 | (<xref target="RFC4918" x:fmt="," x:sec="10.4"/>). |
---|
1053 | </t> |
---|
1054 | <t> |
---|
1055 | When more than one conditional request header field is present in a request, |
---|
1056 | the order in which the fields are evaluated becomes important. In practice, |
---|
1057 | the fields defined in this document are consistently implemented in a |
---|
1058 | single, logical order, due to the fact that entity tags are presumed to be |
---|
1059 | more accurate than date validators. For example, the only reason to send |
---|
1060 | both <x:ref>If-Modified-Since</x:ref> and <x:ref>If-None-Match</x:ref> in |
---|
1061 | the same GET request is to support intermediary caches that might not have |
---|
1062 | implemented <x:ref>If-None-Match</x:ref>, so it makes sense to ignore the |
---|
1063 | <x:ref>If-Modified-Since</x:ref> when entity tags are understood and |
---|
1064 | available for the selected representation. |
---|
1065 | </t> |
---|
1066 | <t> |
---|
1067 | The general rule of conditional precedence is that exact match conditions |
---|
1068 | are evaluated before cache-validating conditions and, within that order, |
---|
1069 | last-modified conditions are only evaluated if the corresponding |
---|
1070 | entity tag condition is not present (or not applicable because the |
---|
1071 | selected representation does not have an entity tag). |
---|
1072 | </t> |
---|
1073 | <t> |
---|
1074 | Specifically, the fields defined by this specification are evaluated |
---|
1075 | as follows: |
---|
1076 | <list style="numbers"> |
---|
1077 | <t anchor="precedence1">When <x:ref>If-Match</x:ref> is present, evaluate it: |
---|
1078 | <list style="symbols"> |
---|
1079 | <t>if true, continue to step <xref target="precedence3" format="counter"/></t> |
---|
1080 | <t>if false, respond <x:ref>412 (Precondition Failed)</x:ref> unless |
---|
1081 | it can be determined that the state-changing request has already |
---|
1082 | succeeded (see <xref target="header.if-match"/>)</t> |
---|
1083 | </list> |
---|
1084 | </t> |
---|
1085 | <t anchor="precedence2">When <x:ref>If-Match</x:ref> is not present and |
---|
1086 | <x:ref>If-Unmodified-Since</x:ref> is present, evaluate it: |
---|
1087 | <list style="symbols"> |
---|
1088 | <t>if true, continue to step <xref target="precedence3" format="counter"/></t> |
---|
1089 | <t>if false, respond <x:ref>412 (Precondition Failed)</x:ref> unless |
---|
1090 | it can be determined that the state-changing request has already |
---|
1091 | succeeded (see <xref target="header.if-unmodified-since"/>)</t> |
---|
1092 | </list> |
---|
1093 | </t> |
---|
1094 | <t anchor="precedence3">When <x:ref>If-None-Match</x:ref> is present, evaluate it: |
---|
1095 | <list style="symbols"> |
---|
1096 | <t>if true, continue to step <xref target="precedence5" format="counter"/></t> |
---|
1097 | <t>if false for GET/HEAD, respond <x:ref>304 (Not Modified)</x:ref></t> |
---|
1098 | <t>if false for other methods, respond <x:ref>412 (Precondition Failed)</x:ref></t> |
---|
1099 | </list> |
---|
1100 | </t> |
---|
1101 | <t anchor="precedence4">When the method is GET or HEAD, |
---|
1102 | <x:ref>If-None-Match</x:ref> is not present, and |
---|
1103 | <x:ref>If-Modified-Since</x:ref> is present, evaluate it: |
---|
1104 | <list style="symbols"> |
---|
1105 | <t>if true, continue to step <xref target="precedence5" format="counter"/></t> |
---|
1106 | <t>if false, respond <x:ref>304 (Not Modified)</x:ref></t> |
---|
1107 | </list> |
---|
1108 | </t> |
---|
1109 | <t anchor="precedence5">When the method is GET and both <x:ref>Range</x:ref> and |
---|
1110 | <x:ref>If-Range</x:ref> are present, evaluate If-Range: |
---|
1111 | <list style="symbols"> |
---|
1112 | <t>if the validator matches and the Range specification is |
---|
1113 | applicable to the selected representation, respond |
---|
1114 | <x:ref>206 (Partial Content)</x:ref> <xref target="Part5"/></t> |
---|
1115 | </list> |
---|
1116 | </t> |
---|
1117 | <t anchor="precedencelast">Otherwise, |
---|
1118 | <list style="symbols"> |
---|
1119 | <t>all conditions are met, so perform the requested action and |
---|
1120 | respond according to its success or failure.</t> |
---|
1121 | </list> |
---|
1122 | </t> |
---|
1123 | </list> |
---|
1124 | </t> |
---|
1125 | <t> |
---|
1126 | Any extension to HTTP/1.1 that defines additional conditional request |
---|
1127 | header fields ought to define its own expectations regarding the order |
---|
1128 | for evaluating such fields in relation to those defined in this document |
---|
1129 | and other conditionals that might be found in practice. |
---|
1130 | </t> |
---|
1131 | </section> |
---|
1132 | |
---|
1133 | <section title="IANA Considerations" anchor="IANA.considerations"> |
---|
1134 | |
---|
1135 | <section title="Status Code Registration" anchor="status.code.registration"> |
---|
1136 | <t> |
---|
1137 | The HTTP Status Code Registry located at <eref target="http://www.iana.org/assignments/http-status-codes"/> |
---|
1138 | shall be updated with the registrations below: |
---|
1139 | </t> |
---|
1140 | <?BEGININC p4-conditional.iana-status-codes ?> |
---|
1141 | <!--AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually--> |
---|
1142 | <texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table"> |
---|
1143 | <ttcol>Value</ttcol> |
---|
1144 | <ttcol>Description</ttcol> |
---|
1145 | <ttcol>Reference</ttcol> |
---|
1146 | <c>304</c> |
---|
1147 | <c>Not Modified</c> |
---|
1148 | <c> |
---|
1149 | <xref target="status.304"/> |
---|
1150 | </c> |
---|
1151 | <c>412</c> |
---|
1152 | <c>Precondition Failed</c> |
---|
1153 | <c> |
---|
1154 | <xref target="status.412"/> |
---|
1155 | </c> |
---|
1156 | </texttable> |
---|
1157 | <!--(END)--> |
---|
1158 | <?ENDINC p4-conditional.iana-status-codes ?> |
---|
1159 | </section> |
---|
1160 | |
---|
1161 | <section title="Header Field Registration" anchor="header.field.registration"> |
---|
1162 | <t> |
---|
1163 | HTTP header fields are registered within the Message Header Field Registry |
---|
1164 | maintained at |
---|
1165 | <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/>. |
---|
1166 | </t> |
---|
1167 | <t> |
---|
1168 | This document defines the following HTTP header fields, so their |
---|
1169 | associated registry entries shall be updated according to the permanent |
---|
1170 | registrations below (see <xref target="BCP90"/>): |
---|
1171 | </t> |
---|
1172 | <?BEGININC p4-conditional.iana-headers ?> |
---|
1173 | <!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually--> |
---|
1174 | <texttable align="left" suppress-title="true" anchor="iana.header.registration.table"> |
---|
1175 | <ttcol>Header Field Name</ttcol> |
---|
1176 | <ttcol>Protocol</ttcol> |
---|
1177 | <ttcol>Status</ttcol> |
---|
1178 | <ttcol>Reference</ttcol> |
---|
1179 | |
---|
1180 | <c>ETag</c> |
---|
1181 | <c>http</c> |
---|
1182 | <c>standard</c> |
---|
1183 | <c> |
---|
1184 | <xref target="header.etag"/> |
---|
1185 | </c> |
---|
1186 | <c>If-Match</c> |
---|
1187 | <c>http</c> |
---|
1188 | <c>standard</c> |
---|
1189 | <c> |
---|
1190 | <xref target="header.if-match"/> |
---|
1191 | </c> |
---|
1192 | <c>If-Modified-Since</c> |
---|
1193 | <c>http</c> |
---|
1194 | <c>standard</c> |
---|
1195 | <c> |
---|
1196 | <xref target="header.if-modified-since"/> |
---|
1197 | </c> |
---|
1198 | <c>If-None-Match</c> |
---|
1199 | <c>http</c> |
---|
1200 | <c>standard</c> |
---|
1201 | <c> |
---|
1202 | <xref target="header.if-none-match"/> |
---|
1203 | </c> |
---|
1204 | <c>If-Unmodified-Since</c> |
---|
1205 | <c>http</c> |
---|
1206 | <c>standard</c> |
---|
1207 | <c> |
---|
1208 | <xref target="header.if-unmodified-since"/> |
---|
1209 | </c> |
---|
1210 | <c>Last-Modified</c> |
---|
1211 | <c>http</c> |
---|
1212 | <c>standard</c> |
---|
1213 | <c> |
---|
1214 | <xref target="header.last-modified"/> |
---|
1215 | </c> |
---|
1216 | </texttable> |
---|
1217 | <!--(END)--> |
---|
1218 | <?ENDINC p4-conditional.iana-headers ?> |
---|
1219 | <t> |
---|
1220 | The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force". |
---|
1221 | </t> |
---|
1222 | </section> |
---|
1223 | </section> |
---|
1224 | |
---|
1225 | <section title="Security Considerations" anchor="security.considerations"> |
---|
1226 | <t> |
---|
1227 | This section is meant to inform developers, information providers, and |
---|
1228 | users of known security concerns specific to the HTTP/1.1 conditional |
---|
1229 | request mechanisms. More general security considerations are addressed |
---|
1230 | in HTTP messaging &messaging; and semantics &semantics;. |
---|
1231 | </t> |
---|
1232 | <t> |
---|
1233 | The validators defined by this specification are not intended to ensure |
---|
1234 | the validity of a representation, guard against malicious changes, or |
---|
1235 | detect man-in-the-middle attacks. At best, they enable more efficient cache |
---|
1236 | updates and optimistic concurrent writes when all participants are behaving |
---|
1237 | nicely. At worst, the conditions will fail and the client will receive a |
---|
1238 | response that is no more harmful than an HTTP exchange without conditional |
---|
1239 | requests. |
---|
1240 | </t> |
---|
1241 | <t> |
---|
1242 | An entity-tag can be abused in ways that create privacy risks. For example, |
---|
1243 | a site might deliberately construct a semantically invalid entity-tag that |
---|
1244 | is unique to the user or user agent, send it in a cacheable response with a |
---|
1245 | long freshness time, and then read that entity-tag in later conditional |
---|
1246 | requests as a means of re-identifying that user or user agent. Such an |
---|
1247 | identifying tag would become a persistent identifier for as long as the |
---|
1248 | user agent retained the original cache entry. User agents that cache |
---|
1249 | representations ought to ensure that the cache is cleared or replaced |
---|
1250 | whenever the user performs privacy-maintaining actions, such as clearing |
---|
1251 | stored cookies or changing to a private browsing mode. |
---|
1252 | </t> |
---|
1253 | </section> |
---|
1254 | |
---|
1255 | <section title="Acknowledgments" anchor="acks"> |
---|
1256 | <t> |
---|
1257 | See &acks;. |
---|
1258 | </t> |
---|
1259 | </section> |
---|
1260 | </middle> |
---|
1261 | <back> |
---|
1262 | |
---|
1263 | <references title="Normative References"> |
---|
1264 | |
---|
1265 | <reference anchor="Part1"> |
---|
1266 | <front> |
---|
1267 | <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title> |
---|
1268 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1269 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1270 | <address><email>fielding@gbiv.com</email></address> |
---|
1271 | </author> |
---|
1272 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1273 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1274 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1275 | </author> |
---|
1276 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1277 | </front> |
---|
1278 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/> |
---|
1279 | <x:source href="p1-messaging.xml" basename="p1-messaging"/> |
---|
1280 | </reference> |
---|
1281 | |
---|
1282 | <reference anchor="Part2"> |
---|
1283 | <front> |
---|
1284 | <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title> |
---|
1285 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1286 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1287 | <address><email>fielding@gbiv.com</email></address> |
---|
1288 | </author> |
---|
1289 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1290 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1291 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1292 | </author> |
---|
1293 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1294 | </front> |
---|
1295 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;"/> |
---|
1296 | <x:source href="p2-semantics.xml" basename="p2-semantics"> |
---|
1297 | <x:defines>2xx</x:defines> |
---|
1298 | <x:defines>2xx (Successful)</x:defines> |
---|
1299 | <x:defines>200 (OK)</x:defines> |
---|
1300 | <x:defines>204 (No Content)</x:defines> |
---|
1301 | <x:defines>Accept-Encoding</x:defines> |
---|
1302 | <x:defines>Content-Location</x:defines> |
---|
1303 | <x:defines>Content-Type</x:defines> |
---|
1304 | <x:defines>Date</x:defines> |
---|
1305 | <x:defines>Location</x:defines> |
---|
1306 | <x:defines>Vary</x:defines> |
---|
1307 | <x:defines>selected representation</x:defines> |
---|
1308 | </x:source> |
---|
1309 | </reference> |
---|
1310 | |
---|
1311 | <reference anchor="Part5"> |
---|
1312 | <front> |
---|
1313 | <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title> |
---|
1314 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1315 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1316 | <address><email>fielding@gbiv.com</email></address> |
---|
1317 | </author> |
---|
1318 | <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor"> |
---|
1319 | <organization abbrev="W3C">World Wide Web Consortium</organization> |
---|
1320 | <address><email>ylafon@w3.org</email></address> |
---|
1321 | </author> |
---|
1322 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1323 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1324 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1325 | </author> |
---|
1326 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1327 | </front> |
---|
1328 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/> |
---|
1329 | <x:source href="p5-range.xml" basename="p5-range"> |
---|
1330 | <x:defines>If-Range</x:defines> |
---|
1331 | <x:defines>Range</x:defines> |
---|
1332 | <x:defines>206 (Partial Content)</x:defines> |
---|
1333 | </x:source> |
---|
1334 | </reference> |
---|
1335 | |
---|
1336 | <reference anchor="Part6"> |
---|
1337 | <front> |
---|
1338 | <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title> |
---|
1339 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1340 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1341 | <address><email>fielding@gbiv.com</email></address> |
---|
1342 | </author> |
---|
1343 | <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor"> |
---|
1344 | <organization>Akamai</organization> |
---|
1345 | <address><email>mnot@mnot.net</email></address> |
---|
1346 | </author> |
---|
1347 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1348 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1349 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1350 | </author> |
---|
1351 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1352 | </front> |
---|
1353 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/> |
---|
1354 | <x:source href="p6-cache.xml" basename="p6-cache"> |
---|
1355 | <x:defines>Cache-Control</x:defines> |
---|
1356 | <x:defines>Expires</x:defines> |
---|
1357 | </x:source> |
---|
1358 | </reference> |
---|
1359 | |
---|
1360 | <reference anchor="RFC2119"> |
---|
1361 | <front> |
---|
1362 | <title>Key words for use in RFCs to Indicate Requirement Levels</title> |
---|
1363 | <author initials="S." surname="Bradner" fullname="Scott Bradner"> |
---|
1364 | <organization>Harvard University</organization> |
---|
1365 | <address><email>sob@harvard.edu</email></address> |
---|
1366 | </author> |
---|
1367 | <date month="March" year="1997"/> |
---|
1368 | </front> |
---|
1369 | <seriesInfo name="BCP" value="14"/> |
---|
1370 | <seriesInfo name="RFC" value="2119"/> |
---|
1371 | </reference> |
---|
1372 | |
---|
1373 | <reference anchor="RFC5234"> |
---|
1374 | <front> |
---|
1375 | <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title> |
---|
1376 | <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor"> |
---|
1377 | <organization>Brandenburg InternetWorking</organization> |
---|
1378 | <address> |
---|
1379 | <email>dcrocker@bbiw.net</email> |
---|
1380 | </address> |
---|
1381 | </author> |
---|
1382 | <author initials="P." surname="Overell" fullname="Paul Overell"> |
---|
1383 | <organization>THUS plc.</organization> |
---|
1384 | <address> |
---|
1385 | <email>paul.overell@thus.net</email> |
---|
1386 | </address> |
---|
1387 | </author> |
---|
1388 | <date month="January" year="2008"/> |
---|
1389 | </front> |
---|
1390 | <seriesInfo name="STD" value="68"/> |
---|
1391 | <seriesInfo name="RFC" value="5234"/> |
---|
1392 | </reference> |
---|
1393 | |
---|
1394 | </references> |
---|
1395 | |
---|
1396 | <references title="Informative References"> |
---|
1397 | |
---|
1398 | <reference anchor="RFC2616"> |
---|
1399 | <front> |
---|
1400 | <title>Hypertext Transfer Protocol -- HTTP/1.1</title> |
---|
1401 | <author initials="R." surname="Fielding" fullname="R. Fielding"> |
---|
1402 | <organization>University of California, Irvine</organization> |
---|
1403 | <address><email>fielding@ics.uci.edu</email></address> |
---|
1404 | </author> |
---|
1405 | <author initials="J." surname="Gettys" fullname="J. Gettys"> |
---|
1406 | <organization>W3C</organization> |
---|
1407 | <address><email>jg@w3.org</email></address> |
---|
1408 | </author> |
---|
1409 | <author initials="J." surname="Mogul" fullname="J. Mogul"> |
---|
1410 | <organization>Compaq Computer Corporation</organization> |
---|
1411 | <address><email>mogul@wrl.dec.com</email></address> |
---|
1412 | </author> |
---|
1413 | <author initials="H." surname="Frystyk" fullname="H. Frystyk"> |
---|
1414 | <organization>MIT Laboratory for Computer Science</organization> |
---|
1415 | <address><email>frystyk@w3.org</email></address> |
---|
1416 | </author> |
---|
1417 | <author initials="L." surname="Masinter" fullname="L. Masinter"> |
---|
1418 | <organization>Xerox Corporation</organization> |
---|
1419 | <address><email>masinter@parc.xerox.com</email></address> |
---|
1420 | </author> |
---|
1421 | <author initials="P." surname="Leach" fullname="P. Leach"> |
---|
1422 | <organization>Microsoft Corporation</organization> |
---|
1423 | <address><email>paulle@microsoft.com</email></address> |
---|
1424 | </author> |
---|
1425 | <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee"> |
---|
1426 | <organization>W3C</organization> |
---|
1427 | <address><email>timbl@w3.org</email></address> |
---|
1428 | </author> |
---|
1429 | <date month="June" year="1999"/> |
---|
1430 | </front> |
---|
1431 | <seriesInfo name="RFC" value="2616"/> |
---|
1432 | </reference> |
---|
1433 | |
---|
1434 | <reference anchor='BCP90'> |
---|
1435 | <front> |
---|
1436 | <title>Registration Procedures for Message Header Fields</title> |
---|
1437 | <author initials='G.' surname='Klyne' fullname='G. Klyne'> |
---|
1438 | <organization>Nine by Nine</organization> |
---|
1439 | <address><email>GK-IETF@ninebynine.org</email></address> |
---|
1440 | </author> |
---|
1441 | <author initials='M.' surname='Nottingham' fullname='M. Nottingham'> |
---|
1442 | <organization>BEA Systems</organization> |
---|
1443 | <address><email>mnot@pobox.com</email></address> |
---|
1444 | </author> |
---|
1445 | <author initials='J.' surname='Mogul' fullname='J. Mogul'> |
---|
1446 | <organization>HP Labs</organization> |
---|
1447 | <address><email>JeffMogul@acm.org</email></address> |
---|
1448 | </author> |
---|
1449 | <date year='2004' month='September' /> |
---|
1450 | </front> |
---|
1451 | <seriesInfo name='BCP' value='90' /> |
---|
1452 | <seriesInfo name='RFC' value='3864' /> |
---|
1453 | </reference> |
---|
1454 | |
---|
1455 | <reference anchor='RFC4918'> |
---|
1456 | <front> |
---|
1457 | <title>HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</title> |
---|
1458 | <author initials="L.M." surname="Dusseault" fullname="Lisa Dusseault" role="editor" > |
---|
1459 | <organization abbrev="CommerceNet">CommerceNet</organization> |
---|
1460 | <address><email>ldusseault@commerce.net</email></address> |
---|
1461 | </author> |
---|
1462 | <date month="June" year="2007" /> |
---|
1463 | </front> |
---|
1464 | <seriesInfo name='RFC' value='4918' /> |
---|
1465 | </reference> |
---|
1466 | </references> |
---|
1467 | |
---|
1468 | <section title="Changes from RFC 2616" anchor="changes.from.rfc.2616"> |
---|
1469 | <t> |
---|
1470 | The definition of validator weakness has been expanded and clarified. |
---|
1471 | (<xref target="weak.and.strong.validators" />) |
---|
1472 | </t> |
---|
1473 | <t> |
---|
1474 | Weak entity-tags are now allowed in all requests except range requests |
---|
1475 | (Sections <xref target="weak.and.strong.validators" format="counter"/> and |
---|
1476 | <xref target="header.if-none-match" format="counter"/>). |
---|
1477 | </t> |
---|
1478 | <t> |
---|
1479 | The <x:ref>ETag</x:ref> header field ABNF has been changed to not use |
---|
1480 | quoted-string, thus avoiding escaping issues. |
---|
1481 | (<xref target="header.etag" />) |
---|
1482 | </t> |
---|
1483 | <t> |
---|
1484 | ETag is defined to provide an entity tag for the selected representation, |
---|
1485 | thereby clarifying what it applies to in various situations (such as a |
---|
1486 | PUT response). |
---|
1487 | (<xref target="header.etag" />) |
---|
1488 | </t> |
---|
1489 | <t> |
---|
1490 | The precedence for evaluation of conditional requests has been defined. |
---|
1491 | (<xref target="precedence" />) |
---|
1492 | </t> |
---|
1493 | </section> |
---|
1494 | |
---|
1495 | <section title="Imported ABNF" anchor="imported.abnf"> |
---|
1496 | <x:anchor-alias value="ALPHA"/> |
---|
1497 | <x:anchor-alias value="CR"/> |
---|
1498 | <x:anchor-alias value="DIGIT"/> |
---|
1499 | <x:anchor-alias value="DQUOTE"/> |
---|
1500 | <x:anchor-alias value="LF"/> |
---|
1501 | <x:anchor-alias value="OCTET"/> |
---|
1502 | <x:anchor-alias value="VCHAR"/> |
---|
1503 | <x:anchor-alias value="core.rules"/> |
---|
1504 | <x:anchor-alias value="obs-text"/> |
---|
1505 | <x:anchor-alias value="OWS"/> |
---|
1506 | <x:anchor-alias value="HTTP-date"/> |
---|
1507 | <t> |
---|
1508 | The following core rules are included by |
---|
1509 | reference, as defined in <xref target="RFC5234" x:fmt="of" x:sec="B.1"/>: |
---|
1510 | ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), |
---|
1511 | DIGIT (decimal 0-9), DQUOTE (double quote), |
---|
1512 | HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), |
---|
1513 | OCTET (any 8-bit sequence of data), SP (space), and |
---|
1514 | VCHAR (any visible US-ASCII character). |
---|
1515 | </t> |
---|
1516 | <t> |
---|
1517 | The rules below are defined in <xref target="Part1"/>: |
---|
1518 | </t> |
---|
1519 | <figure><artwork type="abnf2616"> |
---|
1520 | <x:ref>OWS</x:ref> = <OWS, defined in &whitespace;> |
---|
1521 | <x:ref>obs-text</x:ref> = <obs-text, defined in &field-components;> |
---|
1522 | </artwork></figure> |
---|
1523 | <t> |
---|
1524 | The rules below are defined in other parts: |
---|
1525 | </t> |
---|
1526 | <figure><artwork type="abnf2616"> |
---|
1527 | <x:ref>HTTP-date</x:ref> = <HTTP-date, defined in &http-date;> |
---|
1528 | </artwork></figure> |
---|
1529 | </section> |
---|
1530 | |
---|
1531 | <?BEGININC p4-conditional.abnf-appendix ?> |
---|
1532 | <section xmlns:x="http://purl.org/net/xml2rfc/ext" title="Collected ABNF" anchor="collected.abnf"> |
---|
1533 | <t> |
---|
1534 | In the collected ABNF below, list rules are expanded as per <xref target="Part1" x:rel="#notation"/>. |
---|
1535 | </t><figure> |
---|
1536 | <artwork type="abnf" name="p4-conditional.parsed-abnf"> |
---|
1537 | <x:ref>ETag</x:ref> = entity-tag |
---|
1538 | |
---|
1539 | <x:ref>HTTP-date</x:ref> = <HTTP-date, defined in [Part2], Section 7.1.1.1> |
---|
1540 | |
---|
1541 | <x:ref>If-Match</x:ref> = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS |
---|
1542 | entity-tag ] ) ) |
---|
1543 | <x:ref>If-Modified-Since</x:ref> = HTTP-date |
---|
1544 | <x:ref>If-None-Match</x:ref> = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS |
---|
1545 | entity-tag ] ) ) |
---|
1546 | <x:ref>If-Unmodified-Since</x:ref> = HTTP-date |
---|
1547 | |
---|
1548 | <x:ref>Last-Modified</x:ref> = HTTP-date |
---|
1549 | |
---|
1550 | <x:ref>OWS</x:ref> = <OWS, defined in [Part1], Section 3.2.3> |
---|
1551 | |
---|
1552 | <x:ref>entity-tag</x:ref> = [ weak ] opaque-tag |
---|
1553 | <x:ref>etagc</x:ref> = "!" / %x23-7E ; '#'-'~' |
---|
1554 | / obs-text |
---|
1555 | |
---|
1556 | <x:ref>obs-text</x:ref> = <obs-text, defined in [Part1], Section 3.2.6> |
---|
1557 | <x:ref>opaque-tag</x:ref> = DQUOTE *etagc DQUOTE |
---|
1558 | |
---|
1559 | <x:ref>weak</x:ref> = %x57.2F ; W/ |
---|
1560 | </artwork> |
---|
1561 | </figure> |
---|
1562 | </section> |
---|
1563 | <?ENDINC p4-conditional.abnf-appendix ?> |
---|
1564 | |
---|
1565 | <section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log"> |
---|
1566 | <t> |
---|
1567 | Changes up to the first Working Group Last Call draft are summarized |
---|
1568 | in <eref target="http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-19#appendix-C"/>. |
---|
1569 | </t> |
---|
1570 | |
---|
1571 | <section title="Since draft-ietf-httpbis-p4-conditional-19" anchor="changes.since.19"> |
---|
1572 | <t> |
---|
1573 | Closed issues: |
---|
1574 | <list style="symbols"> |
---|
1575 | <t> |
---|
1576 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/241"/>: |
---|
1577 | "Need to clarify eval order/interaction of conditional headers" |
---|
1578 | </t> |
---|
1579 | <t> |
---|
1580 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/345"/>: |
---|
1581 | "Required headers on 304 and 206" |
---|
1582 | </t> |
---|
1583 | <t> |
---|
1584 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/350"/>: |
---|
1585 | "Optionality of Conditional Request Support" |
---|
1586 | </t> |
---|
1587 | <t> |
---|
1588 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/354"/>: |
---|
1589 | "ETags and Conditional Requests" |
---|
1590 | </t> |
---|
1591 | <t> |
---|
1592 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/361"/>: |
---|
1593 | "ABNF requirements for recipients" |
---|
1594 | </t> |
---|
1595 | <t> |
---|
1596 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/363"/>: |
---|
1597 | "Rare cases" |
---|
1598 | </t> |
---|
1599 | <t> |
---|
1600 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/365"/>: |
---|
1601 | "Conditional Request Security Considerations" |
---|
1602 | </t> |
---|
1603 | <t> |
---|
1604 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/371"/>: |
---|
1605 | "If-Modified-Since lacks definition for method != GET" |
---|
1606 | </t> |
---|
1607 | <t> |
---|
1608 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/372"/>: |
---|
1609 | "refactor conditional header field descriptions" |
---|
1610 | </t> |
---|
1611 | </list> |
---|
1612 | </t> |
---|
1613 | </section> |
---|
1614 | |
---|
1615 | <section title="Since draft-ietf-httpbis-p4-conditional-20" anchor="changes.since.20"> |
---|
1616 | <t> |
---|
1617 | <list style="symbols"> |
---|
1618 | <t> |
---|
1619 | Conformance criteria and considerations regarding error handling are |
---|
1620 | now defined in Part 1. |
---|
1621 | </t> |
---|
1622 | </list> |
---|
1623 | </t> |
---|
1624 | </section> |
---|
1625 | |
---|
1626 | <section title="Since draft-ietf-httpbis-p4-conditional-21" anchor="changes.since.21"> |
---|
1627 | <t> |
---|
1628 | Closed issues: |
---|
1629 | <list style="symbols"> |
---|
1630 | <t> |
---|
1631 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/96"/>: |
---|
1632 | "Conditional GET text" |
---|
1633 | </t> |
---|
1634 | <t> |
---|
1635 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/350"/>: |
---|
1636 | "Optionality of Conditional Request Support" |
---|
1637 | </t> |
---|
1638 | <t> |
---|
1639 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/384"/>: |
---|
1640 | "unclear prose in definition of 304" |
---|
1641 | </t> |
---|
1642 | <t> |
---|
1643 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/401"/>: |
---|
1644 | "ETags and Conneg" |
---|
1645 | </t> |
---|
1646 | <t> |
---|
1647 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/402"/>: |
---|
1648 | "Comparison function for If-Match and If-None-Match" |
---|
1649 | </t> |
---|
1650 | <t> |
---|
1651 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/406"/>: |
---|
1652 | "304 without validator" |
---|
1653 | </t> |
---|
1654 | <t> |
---|
1655 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/427"/>: |
---|
1656 | "If-Match and 428" |
---|
1657 | </t> |
---|
1658 | </list> |
---|
1659 | </t> |
---|
1660 | </section> |
---|
1661 | |
---|
1662 | <section title="Since draft-ietf-httpbis-p4-conditional-22" anchor="changes.since.22"> |
---|
1663 | <t> |
---|
1664 | Closed issues: |
---|
1665 | <list style="symbols"> |
---|
1666 | <t> |
---|
1667 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/436"/>: |
---|
1668 | "explain list expansion in ABNF appendices" |
---|
1669 | </t> |
---|
1670 | <t> |
---|
1671 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/437"/>: |
---|
1672 | "incorrect example dates" |
---|
1673 | </t> |
---|
1674 | </list> |
---|
1675 | </t> |
---|
1676 | <t> |
---|
1677 | Partly resolved issues: |
---|
1678 | <list style="symbols"> |
---|
1679 | <t> |
---|
1680 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/461"/>: |
---|
1681 | "Editorial suggestions" |
---|
1682 | </t> |
---|
1683 | </list> |
---|
1684 | </t> |
---|
1685 | </section> |
---|
1686 | |
---|
1687 | <section title="Since draft-ietf-httpbis-p4-conditional-23" anchor="changes.since.23"> |
---|
1688 | <t> |
---|
1689 | Closed issues: |
---|
1690 | <list style="symbols"> |
---|
1691 | <t> |
---|
1692 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/455"/>: |
---|
1693 | "PUT + If-Match over-constrained?" |
---|
1694 | </t> |
---|
1695 | </list> |
---|
1696 | </t> |
---|
1697 | </section> |
---|
1698 | </section> |
---|
1699 | |
---|
1700 | </back> |
---|
1701 | </rfc> |
---|