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 "March"> |
---|
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 messaging "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
26 | <!ENTITY semantics "<xref target='Part2' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
27 | <!ENTITY http-date "<xref target='Part2' x:rel='#http.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
28 | <!ENTITY representation "<xref target='Part2' x:rel='#representations' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
29 | <!ENTITY entity-tags "<xref target='Part4' x:rel='#header.etag' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
30 | <!ENTITY weak-and-strong-validators "<xref target='Part4' x:rel='#weak.and.strong.validators' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
31 | <!ENTITY lastmod-comparison "<xref target='Part4' x:rel='#lastmod.comparison' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
32 | <!ENTITY p6-heuristic "<xref target='Part6' x:rel='#heuristic.freshness' xmlns:x='http://purl.org/net/xml2rfc/ext'/>"> |
---|
33 | ]> |
---|
34 | <?rfc toc="yes" ?> |
---|
35 | <?rfc symrefs="yes" ?> |
---|
36 | <?rfc sortrefs="yes" ?> |
---|
37 | <?rfc compact="yes"?> |
---|
38 | <?rfc subcompact="no" ?> |
---|
39 | <?rfc linkmailto="no" ?> |
---|
40 | <?rfc editing="no" ?> |
---|
41 | <?rfc comments="yes"?> |
---|
42 | <?rfc inline="yes"?> |
---|
43 | <?rfc rfcedstyle="yes"?> |
---|
44 | <?rfc-ext allow-markup-in-artwork="yes" ?> |
---|
45 | <?rfc-ext include-references-in-index="yes" ?> |
---|
46 | <rfc obsoletes="2616" category="std" x:maturity-level="proposed" |
---|
47 | ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p5-range-&ID-VERSION;" |
---|
48 | xmlns:x='http://purl.org/net/xml2rfc/ext'> |
---|
49 | <x:link rel="prev" basename="p4-conditional"/> |
---|
50 | <x:link rel="next" basename="p6-cache"/> |
---|
51 | <x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&body=<{ref}>:"/> |
---|
52 | <front> |
---|
53 | |
---|
54 | <title abbrev="HTTP/1.1 Range Requests">Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title> |
---|
55 | |
---|
56 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
57 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
58 | <address> |
---|
59 | <postal> |
---|
60 | <street>345 Park Ave</street> |
---|
61 | <city>San Jose</city> |
---|
62 | <region>CA</region> |
---|
63 | <code>95110</code> |
---|
64 | <country>USA</country> |
---|
65 | </postal> |
---|
66 | <email>fielding@gbiv.com</email> |
---|
67 | <uri>http://roy.gbiv.com/</uri> |
---|
68 | </address> |
---|
69 | </author> |
---|
70 | |
---|
71 | <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor"> |
---|
72 | <organization abbrev="W3C">World Wide Web Consortium</organization> |
---|
73 | <address> |
---|
74 | <postal> |
---|
75 | <street>W3C / ERCIM</street> |
---|
76 | <street>2004, rte des Lucioles</street> |
---|
77 | <city>Sophia-Antipolis</city> |
---|
78 | <region>AM</region> |
---|
79 | <code>06902</code> |
---|
80 | <country>France</country> |
---|
81 | </postal> |
---|
82 | <email>ylafon@w3.org</email> |
---|
83 | <uri>http://www.raubacapeu.net/people/yves/</uri> |
---|
84 | </address> |
---|
85 | </author> |
---|
86 | |
---|
87 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
88 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
89 | <address> |
---|
90 | <postal> |
---|
91 | <street>Hafenweg 16</street> |
---|
92 | <city>Muenster</city><region>NW</region><code>48155</code> |
---|
93 | <country>Germany</country> |
---|
94 | </postal> |
---|
95 | <email>julian.reschke@greenbytes.de</email> |
---|
96 | <uri>http://greenbytes.de/tech/webdav/</uri> |
---|
97 | </address> |
---|
98 | </author> |
---|
99 | |
---|
100 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
101 | <workgroup>HTTPbis Working Group</workgroup> |
---|
102 | |
---|
103 | <abstract> |
---|
104 | <t> |
---|
105 | The Hypertext Transfer Protocol (HTTP) is an application-level protocol for |
---|
106 | distributed, collaborative, hypertext information systems. This document |
---|
107 | defines range requests and the rules for constructing and combining |
---|
108 | responses to those requests. |
---|
109 | </t> |
---|
110 | </abstract> |
---|
111 | |
---|
112 | <note title="Editorial Note (To be removed by RFC Editor)"> |
---|
113 | <t> |
---|
114 | Discussion of this draft takes place on the HTTPBIS working group |
---|
115 | mailing list (ietf-http-wg@w3.org), which is archived at |
---|
116 | <eref target="http://lists.w3.org/Archives/Public/ietf-http-wg/"/>. |
---|
117 | </t> |
---|
118 | <t> |
---|
119 | The current issues list is at |
---|
120 | <eref target="http://tools.ietf.org/wg/httpbis/trac/report/3"/> and related |
---|
121 | documents (including fancy diffs) can be found at |
---|
122 | <eref target="http://tools.ietf.org/wg/httpbis/"/>. |
---|
123 | </t> |
---|
124 | <t> |
---|
125 | The changes in this draft are summarized in <xref target="changes.since.22"/>. |
---|
126 | </t> |
---|
127 | </note> |
---|
128 | </front> |
---|
129 | <middle> |
---|
130 | <section title="Introduction" anchor="introduction"> |
---|
131 | <t> |
---|
132 | Hypertext Transfer Protocol (HTTP) clients often encounter interrupted data |
---|
133 | transfers as a result of canceled requests or dropped connections. When a |
---|
134 | client has stored a partial representation, it is desirable to request the |
---|
135 | remainder of that representation in a subsequent request rather than |
---|
136 | transfer the entire representation. Likewise, devices with limited local |
---|
137 | storage might benefit from being able to request only a subset of a larger |
---|
138 | representation, such as a single page of a very large document, or the |
---|
139 | dimensions of an embedded image. |
---|
140 | </t> |
---|
141 | <t> |
---|
142 | This document defines HTTP/1.1 range requests, partial responses, and the |
---|
143 | multipart/byteranges media type, obsoleting those parts previously defined |
---|
144 | in <xref target="RFC2616"/>. Range requests are an &OPTIONAL; feature |
---|
145 | of HTTP, designed so that recipients not implementing this feature (or not |
---|
146 | supporting it for the target resource) can respond as if it is a normal |
---|
147 | GET request without impacting interoperability. Partial responses are |
---|
148 | indicated by a distinct status code to not be mistaken for full responses |
---|
149 | by caches that might not implement the feature. |
---|
150 | </t> |
---|
151 | <t> |
---|
152 | Although the range request mechanism is designed to allow for |
---|
153 | extensible range types, this specification only defines requests for |
---|
154 | byte ranges. |
---|
155 | </t> |
---|
156 | |
---|
157 | <section title="Conformance and Error Handling" anchor="conformance"> |
---|
158 | <t> |
---|
159 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
---|
160 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
---|
161 | document are to be interpreted as described in <xref target="RFC2119"/>. |
---|
162 | </t> |
---|
163 | <t> |
---|
164 | Conformance criteria and considerations regarding error handling |
---|
165 | are defined in &conformance;. |
---|
166 | </t> |
---|
167 | </section> |
---|
168 | |
---|
169 | <section title="Syntax Notation" anchor="notation"> |
---|
170 | <t> |
---|
171 | This specification uses the Augmented Backus-Naur Form (ABNF) notation |
---|
172 | of <xref target="RFC5234"/> with the list rule extension defined in |
---|
173 | ¬ation;. <xref target="imported.abnf"/> describes rules imported from |
---|
174 | other documents. <xref target="collected.abnf"/> shows the collected ABNF |
---|
175 | with the list rule expanded. |
---|
176 | </t> |
---|
177 | </section> |
---|
178 | </section> |
---|
179 | |
---|
180 | |
---|
181 | <section title="Range Units" anchor="range.units"> |
---|
182 | <x:anchor-alias value="range-unit"/> |
---|
183 | <x:anchor-alias value="range unit"/> |
---|
184 | <t> |
---|
185 | A representation can be partitioned into subranges according to various |
---|
186 | structural units, depending on the structure inherent in the |
---|
187 | representation's media type. This "<x:dfn>range unit</x:dfn>" is used |
---|
188 | in the <x:ref>Accept-Ranges</x:ref> (<xref target="header.accept-ranges"/>) |
---|
189 | response header field to advertise support for range requests, the |
---|
190 | <x:ref>Range</x:ref> (<xref target="header.range"/>) request header field |
---|
191 | to delineate the parts of a representation that are requested, and the |
---|
192 | <x:ref>Content-Range</x:ref> (<xref target="header.content-range"/>) |
---|
193 | payload header field to describe which part of a representation is being |
---|
194 | transferred. |
---|
195 | </t> |
---|
196 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="range-unit"/><iref item="Grammar" subitem="bytes-unit"/><iref item="Grammar" subitem="other-range-unit"/> |
---|
197 | <x:ref>range-unit</x:ref> = <x:ref>bytes-unit</x:ref> / <x:ref>other-range-unit</x:ref> |
---|
198 | </artwork></figure> |
---|
199 | |
---|
200 | <section title="Byte Ranges" anchor="byte.ranges"> |
---|
201 | <x:anchor-alias value="bytes-unit"/> |
---|
202 | <t> |
---|
203 | Since representation data is transferred in payloads as a sequence of |
---|
204 | octets, a byte range is a meaningful substructure for any representation |
---|
205 | transferable over HTTP (&representation;). We define the "bytes" range |
---|
206 | unit for expressing subranges of the data's octet sequence. |
---|
207 | </t> |
---|
208 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="bytes-unit"/> |
---|
209 | <x:ref>bytes-unit</x:ref> = "bytes" |
---|
210 | </artwork></figure> |
---|
211 | <t anchor="rule.ranges-specifier"> |
---|
212 | <x:anchor-alias value="byte-range-set"/> |
---|
213 | <x:anchor-alias value="byte-range-spec"/> |
---|
214 | <x:anchor-alias value="byte-ranges-specifier"/> |
---|
215 | <x:anchor-alias value="first-byte-pos"/> |
---|
216 | <x:anchor-alias value="last-byte-pos"/> |
---|
217 | <x:anchor-alias value="ranges-specifier"/> |
---|
218 | <x:anchor-alias value="suffix-byte-range-spec"/> |
---|
219 | <x:anchor-alias value="suffix-length"/> |
---|
220 | A byte range operation &MAY; specify a single range of bytes, or a set |
---|
221 | of ranges within a single representation. |
---|
222 | </t> |
---|
223 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ranges-specifier"/><iref primary="true" item="Grammar" subitem="byte-ranges-specifier"/><iref primary="true" item="Grammar" subitem="byte-range-set"/><iref primary="true" item="Grammar" subitem="byte-range-spec"/><iref primary="true" item="Grammar" subitem="first-byte-pos"/><iref primary="true" item="Grammar" subitem="last-byte-pos"/> |
---|
224 | <x:ref>byte-ranges-specifier</x:ref> = <x:ref>bytes-unit</x:ref> "=" <x:ref>byte-range-set</x:ref> |
---|
225 | <x:ref>byte-range-set</x:ref> = 1#( <x:ref>byte-range-spec</x:ref> / <x:ref>suffix-byte-range-spec</x:ref> ) |
---|
226 | <x:ref>byte-range-spec</x:ref> = <x:ref>first-byte-pos</x:ref> "-" [ <x:ref>last-byte-pos</x:ref> ] |
---|
227 | <x:ref>first-byte-pos</x:ref> = 1*<x:ref>DIGIT</x:ref> |
---|
228 | <x:ref>last-byte-pos</x:ref> = 1*<x:ref>DIGIT</x:ref> |
---|
229 | </artwork></figure> |
---|
230 | <t> |
---|
231 | The <x:ref>first-byte-pos</x:ref> value in a <x:ref>byte-range-spec</x:ref> |
---|
232 | gives the byte-offset of the first byte in a range. |
---|
233 | The <x:ref>last-byte-pos</x:ref> value gives the byte-offset of the last |
---|
234 | byte in the range; that is, the byte positions specified are inclusive. |
---|
235 | Byte offsets start at zero. |
---|
236 | </t> |
---|
237 | <t> |
---|
238 | Examples of <x:ref>byte-ranges-specifier</x:ref> values: |
---|
239 | <list style="symbols"> |
---|
240 | <t>The first 500 bytes (byte offsets 0-499, inclusive): |
---|
241 | <figure><artwork type="example" x:indent-with=" "> |
---|
242 | bytes=0-499 |
---|
243 | </artwork></figure> |
---|
244 | </t> |
---|
245 | <t>The second 500 bytes (byte offsets 500-999, inclusive): |
---|
246 | <figure><artwork type="example" x:indent-with=" "> |
---|
247 | bytes=500-999 |
---|
248 | </artwork></figure> |
---|
249 | </t> |
---|
250 | </list> |
---|
251 | </t> |
---|
252 | <t> |
---|
253 | A <x:ref>byte-range-spec</x:ref> is invalid if the |
---|
254 | <x:ref>last-byte-pos</x:ref> value is present and less than the |
---|
255 | <x:ref>first-byte-pos</x:ref>. |
---|
256 | </t> |
---|
257 | <t> |
---|
258 | A client can limit the number of bytes requested without knowing the size |
---|
259 | of the selected representation. |
---|
260 | If the <x:ref>last-byte-pos</x:ref> value is absent, or if the value is |
---|
261 | greater than or equal to the current length of the representation data, the |
---|
262 | byte range is interpreted as the remainder of the representation (i.e., the |
---|
263 | server replaces the value of <x:ref>last-byte-pos</x:ref> with a value that |
---|
264 | is one less than the current length of the selected representation). |
---|
265 | </t> |
---|
266 | <t> |
---|
267 | A client can request the last N bytes of the selected representation using |
---|
268 | a <x:ref>suffix-byte-range-spec</x:ref>. |
---|
269 | </t> |
---|
270 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="suffix-byte-range-spec"/><iref primary="true" item="Grammar" subitem="suffix-length"/> |
---|
271 | <x:ref>suffix-byte-range-spec</x:ref> = "-" <x:ref>suffix-length</x:ref> |
---|
272 | <x:ref>suffix-length</x:ref> = 1*<x:ref>DIGIT</x:ref> |
---|
273 | </artwork></figure> |
---|
274 | <t> |
---|
275 | If the selected representation is shorter than the specified |
---|
276 | <x:ref>suffix-length</x:ref>, the entire representation is used. |
---|
277 | For example (assuming a representation of length 10000): |
---|
278 | <list style="symbols"> |
---|
279 | <t>The final 500 bytes (byte offsets 9500-9999, inclusive): |
---|
280 | <figure><artwork type="example" x:indent-with=" "> |
---|
281 | bytes=-500 |
---|
282 | </artwork></figure> |
---|
283 | Or: |
---|
284 | <figure><artwork type="example" x:indent-with=" "> |
---|
285 | bytes=9500- |
---|
286 | </artwork></figure> |
---|
287 | </t> |
---|
288 | <t>The first and last bytes only (bytes 0 and 9999): |
---|
289 | <figure><artwork type="example" x:indent-with=" "> |
---|
290 | bytes=0-0,-1 |
---|
291 | </artwork></figure> |
---|
292 | </t> |
---|
293 | <t>Other valid (but not canonical) specifications of the second 500 |
---|
294 | bytes (byte offsets 500-999, inclusive): |
---|
295 | <figure><artwork type="example" x:indent-with=" "> |
---|
296 | bytes=500-600,601-999 |
---|
297 | bytes=500-700,601-999 |
---|
298 | </artwork></figure> |
---|
299 | </t> |
---|
300 | </list> |
---|
301 | </t> |
---|
302 | <t> |
---|
303 | If a valid <x:ref>byte-range-set</x:ref> includes at least one |
---|
304 | <x:ref>byte-range-spec</x:ref> with a <x:ref>first-byte-pos</x:ref> that is |
---|
305 | less than the current length of the representation, or at least one |
---|
306 | <x:ref>suffix-byte-range-spec</x:ref> with a non-zero |
---|
307 | <x:ref>suffix-length</x:ref>, then the <x:ref>byte-range-set</x:ref> is |
---|
308 | satisfiable. Otherwise, the <x:ref>byte-range-set</x:ref> is unsatisfiable. |
---|
309 | </t> |
---|
310 | <t> |
---|
311 | In the byte range syntax, <x:ref>first-byte-pos</x:ref>, |
---|
312 | <x:ref>last-byte-pos</x:ref>, and <x:ref>suffix-length</x:ref> are |
---|
313 | expressed as decimal number of octets. Since there is no predefined limit |
---|
314 | to the length of a payload, recipients ought to anticipate potentially |
---|
315 | large decimal numerals and prevent parsing errors due to integer conversion |
---|
316 | overflows. |
---|
317 | </t> |
---|
318 | </section> |
---|
319 | |
---|
320 | <section title="Other Range Units" anchor="range.units.other"> |
---|
321 | <x:anchor-alias value="other-range-unit"/> |
---|
322 | <t> |
---|
323 | Range units are intended to be extensible. New range units ought to be |
---|
324 | registered with IANA, as defined in <xref target="range.unit.registry"/>. |
---|
325 | </t> |
---|
326 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="other-range-unit"/> |
---|
327 | <x:ref>other-range-unit</x:ref> = <x:ref>token</x:ref> |
---|
328 | </artwork></figure> |
---|
329 | </section> |
---|
330 | |
---|
331 | <section title="Accept-Ranges" anchor="header.accept-ranges"> |
---|
332 | <iref primary="true" item="Accept-Ranges header field" x:for-anchor=""/> |
---|
333 | <x:anchor-alias value="Accept-Ranges"/> |
---|
334 | <x:anchor-alias value="acceptable-ranges"/> |
---|
335 | <t> |
---|
336 | The "Accept-Ranges" header field allows a server to indicate that it |
---|
337 | supports range requests for the target resource. |
---|
338 | </t> |
---|
339 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Ranges"/><iref primary="true" item="Grammar" subitem="acceptable-ranges"/> |
---|
340 | <x:ref>Accept-Ranges</x:ref> = <x:ref>acceptable-ranges</x:ref> |
---|
341 | <x:ref>acceptable-ranges</x:ref> = 1#<x:ref>range-unit</x:ref> / "none" |
---|
342 | </artwork></figure> |
---|
343 | <t> |
---|
344 | Origin servers that support byte-range requests &MAY; send |
---|
345 | </t> |
---|
346 | <figure><artwork type="example"> |
---|
347 | Accept-Ranges: bytes |
---|
348 | </artwork></figure> |
---|
349 | <t> |
---|
350 | but are not required to do so. Clients &MAY; generate range |
---|
351 | requests without having received this header field for the resource |
---|
352 | involved. Range units are defined in <xref target="range.units"/>. |
---|
353 | </t> |
---|
354 | <t> |
---|
355 | Servers that do not support any kind of range request for the target |
---|
356 | resource resource &MAY; send |
---|
357 | </t> |
---|
358 | <figure><artwork type="example"> |
---|
359 | Accept-Ranges: none |
---|
360 | </artwork></figure> |
---|
361 | <t> |
---|
362 | to advise the client not to attempt a range request. |
---|
363 | </t> |
---|
364 | </section> |
---|
365 | </section> |
---|
366 | |
---|
367 | |
---|
368 | <section title="Range Requests" anchor="range.requests"> |
---|
369 | <section title="Range" anchor="header.range"> |
---|
370 | <iref primary="true" item="Range header field" x:for-anchor=""/> |
---|
371 | <x:anchor-alias value="Range"/> |
---|
372 | <x:anchor-alias value="other-ranges-specifier"/> |
---|
373 | <x:anchor-alias value="other-range-set"/> |
---|
374 | <t> |
---|
375 | The "Range" header field on a GET request modifies the method semantics to |
---|
376 | request transfer of only one or more subranges of the selected |
---|
377 | representation data, rather than the entire selected representation data. |
---|
378 | </t> |
---|
379 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Range"/> |
---|
380 | <x:ref>Range</x:ref> = <x:ref>byte-ranges-specifier</x:ref> / <x:ref>other-ranges-specifier</x:ref> |
---|
381 | <x:ref>other-ranges-specifier</x:ref> = <x:ref>other-range-unit</x:ref> "=" <x:ref>other-range-set</x:ref> |
---|
382 | <x:ref>other-range-set</x:ref> = 1*<x:ref>CHAR</x:ref> |
---|
383 | </artwork></figure> |
---|
384 | <t> |
---|
385 | A server &MAY; ignore the Range header field. However, origin servers and |
---|
386 | intermediate caches ought to support byte ranges when possible, since Range |
---|
387 | supports efficient recovery from partially failed transfers and partial |
---|
388 | retrieval of large representations. A server &MUST; ignore a Range header |
---|
389 | field received with a request method other than GET. |
---|
390 | </t> |
---|
391 | <t> |
---|
392 | An origin server &MUST; ignore a Range header field that contains a range |
---|
393 | unit it does not understand. A proxy &MAY; either discard a Range header |
---|
394 | field that contains a range unit it does not understand or pass it to the |
---|
395 | next inbound server when forwarding the request. |
---|
396 | </t> |
---|
397 | <t> |
---|
398 | A server that supports range requests ought to ignore or reject a |
---|
399 | <x:ref>Range</x:ref> header field that consists of more than two |
---|
400 | overlapping ranges, or a set of many small ranges that are not listed |
---|
401 | in ascending order, since both are indications of either a broken client or |
---|
402 | a deliberate denial of service attack (<xref target="overlapping.ranges"/>). |
---|
403 | A client &SHOULD-NOT; request multiple ranges that are inherently less |
---|
404 | efficient to process and transfer than a single range that encompasses the |
---|
405 | same data. |
---|
406 | </t> |
---|
407 | <t> |
---|
408 | A client that is requesting multiple ranges &SHOULD; list those ranges in |
---|
409 | ascending order (the order in which they would typically be received in a |
---|
410 | complete representation) unless there is a specific need to request a later |
---|
411 | part earlier. For example, a user agent processing a large representation |
---|
412 | with an internal catalog of parts might need to request later parts first, |
---|
413 | particularly if the representation consists of pages stored in reverse |
---|
414 | order and the user agent wishes to transfer one page at a time. |
---|
415 | </t> |
---|
416 | <t> |
---|
417 | The Range header field is evaluated after evaluating the preconditions of |
---|
418 | <xref target="Part4"/> and only if the result of their evaluation is |
---|
419 | leading toward a <x:ref>200 (OK)</x:ref> response. In other words, Range |
---|
420 | is ignored when a conditional GET would result in a |
---|
421 | <x:ref>304 (Not Modified)</x:ref> response. |
---|
422 | </t> |
---|
423 | <t> |
---|
424 | The If-Range header field (<xref target="header.if-range"/>) can be used as |
---|
425 | a precondition to applying the Range header field. |
---|
426 | </t> |
---|
427 | <t> |
---|
428 | If all of the preconditions are true, the server supports the Range header |
---|
429 | field for the target resource, and the specified range(s) are valid and |
---|
430 | satisfiable (as defined in <xref target="byte.ranges"/>), the |
---|
431 | server &SHOULD; send a <x:ref>206 (Partial Content)</x:ref> response with a |
---|
432 | payload containing one or more partial representations that correspond to |
---|
433 | the satisfiable ranges requested, as defined in |
---|
434 | <xref target="range.response"/>. |
---|
435 | </t> |
---|
436 | <t> |
---|
437 | If all of the preconditions are true, the server supports the Range header |
---|
438 | field for the target resource, and the specified range(s) are invalid or |
---|
439 | unsatisfiable, the server &SHOULD; send a |
---|
440 | <x:ref>416 (Range Not Satisfiable)</x:ref> response. |
---|
441 | </t> |
---|
442 | </section> |
---|
443 | |
---|
444 | <section title="If-Range" anchor="header.if-range"> |
---|
445 | <iref primary="true" item="If-Range header field" x:for-anchor=""/> |
---|
446 | <x:anchor-alias value="If-Range"/> |
---|
447 | <t> |
---|
448 | If a client has a partial copy of a representation and wishes |
---|
449 | to have an up-to-date copy of the entire representation, it could use the |
---|
450 | <x:ref>Range</x:ref> header field with a conditional GET (using |
---|
451 | either or both of <x:ref>If-Unmodified-Since</x:ref> and |
---|
452 | <x:ref>If-Match</x:ref>.) However, if the condition fails because the |
---|
453 | representation has been modified, the client would then have to make a |
---|
454 | second request to obtain the entire current representation. |
---|
455 | </t> |
---|
456 | <t> |
---|
457 | The "If-Range" header field allows a client to "short-circuit" the second |
---|
458 | request. Informally, its meaning is: if the representation is unchanged, |
---|
459 | send me the part(s) that I am requesting in Range; otherwise, send me the |
---|
460 | entire representation. |
---|
461 | </t> |
---|
462 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Range"/> |
---|
463 | <x:ref>If-Range</x:ref> = <x:ref>entity-tag</x:ref> / <x:ref>HTTP-date</x:ref> |
---|
464 | </artwork></figure> |
---|
465 | <t> |
---|
466 | Clients &MUST-NOT; use an entity-tag marked as weak in an If-Range |
---|
467 | field value and &MUST-NOT; use a <x:ref>Last-Modified</x:ref> date in an |
---|
468 | If-Range field value unless it has no entity-tag for the representation and |
---|
469 | the Last-Modified date it does have for the representation is strong |
---|
470 | in the sense defined by &lastmod-comparison;. |
---|
471 | </t> |
---|
472 | <t> |
---|
473 | A server that evaluates a conditional range request that is applicable |
---|
474 | to one of its representations &MUST; evaluate the condition as false if |
---|
475 | the entity-tag used as a validator is marked as weak or, when an HTTP-date |
---|
476 | is used as the validator, if the date value is not strong in the sense |
---|
477 | defined by &lastmod-comparison;. (A server can distinguish between a |
---|
478 | valid HTTP-date and any form of entity-tag by examining the first |
---|
479 | two characters.) |
---|
480 | </t> |
---|
481 | <t> |
---|
482 | A client &MUST-NOT; generate an If-Range header field in a request that |
---|
483 | does not contain a <x:ref>Range</x:ref> header field. |
---|
484 | A server &MUST; ignore an If-Range header field received in a request that |
---|
485 | does not contain a <x:ref>Range</x:ref> header field. |
---|
486 | An origin server &MUST; ignore an If-Range header field received in a |
---|
487 | request for a target resource that does not support Range requests. |
---|
488 | </t> |
---|
489 | <t> |
---|
490 | If the validator given in the If-Range header field matches the current |
---|
491 | validator for the selected representation of the target resource, then |
---|
492 | the server &SHOULD; process the Range header field as requested. |
---|
493 | If the validator does not match, then the server &MUST; ignore the |
---|
494 | <x:ref>Range</x:ref> header field. |
---|
495 | </t> |
---|
496 | </section> |
---|
497 | </section> |
---|
498 | |
---|
499 | |
---|
500 | <section title="Responses to a Range Request" anchor="range.response"> |
---|
501 | |
---|
502 | <section title="206 Partial Content" anchor="status.206"> |
---|
503 | <iref primary="true" item="206 Partial Content (status code)" x:for-anchor=""/> |
---|
504 | <x:anchor-alias value="206"/> |
---|
505 | <x:anchor-alias value="206 (Partial Content)"/> |
---|
506 | <t> |
---|
507 | The <x:dfn>206 (Partial Content)</x:dfn> status code indicates that the |
---|
508 | server is successfully fulfilling a range request for the target resource |
---|
509 | by transferring one or more parts of the selected representation that |
---|
510 | correspond to the satisfiable ranges found in the requests's |
---|
511 | <x:ref>Range</x:ref> header field (<xref target="header.range"/>). |
---|
512 | </t> |
---|
513 | <t> |
---|
514 | If a single part is being transferred, the server generating the 206 |
---|
515 | response &MUST; generate a <x:ref>Content-Range</x:ref> header field, |
---|
516 | describing what range of the selected representation is enclosed, and a |
---|
517 | payload consisting of the range. For example: |
---|
518 | </t> |
---|
519 | <figure><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
---|
520 | HTTP/1.1 206 Partial Content |
---|
521 | Date: Wed, 15 Nov 1995 06:25:24 GMT |
---|
522 | Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT |
---|
523 | Content-Range: bytes 21010-47021/47022 |
---|
524 | Content-Length: 26012 |
---|
525 | Content-Type: image/gif |
---|
526 | |
---|
527 | ... 26012 bytes of partial image data ... |
---|
528 | </artwork></figure> |
---|
529 | <t> |
---|
530 | If multiple parts are being transferred, the server generating the 206 |
---|
531 | response &MUST; generate a "multipart/byteranges" payload, as defined |
---|
532 | in <xref target="internet.media.type.multipart.byteranges"/>, and a |
---|
533 | <x:ref>Content-Type</x:ref> header field containing the |
---|
534 | multipart/byteranges media type and its required boundary parameter. |
---|
535 | To avoid confusion with single part responses, a server &MUST-NOT; generate |
---|
536 | a <x:ref>Content-Range</x:ref> header field in the HTTP header block of a |
---|
537 | multiple part response (this field will be sent in each part instead). |
---|
538 | </t> |
---|
539 | <t> |
---|
540 | Within the header area of each body part in the multipart payload, the |
---|
541 | server &MUST; generate a <x:ref>Content-Range</x:ref> header field |
---|
542 | corresponding to the range being enclosed in that body part. |
---|
543 | If the selected representation would have had a <x:ref>Content-Type</x:ref> |
---|
544 | header field in a <x:ref>200 (OK)</x:ref> response, the server &SHOULD; |
---|
545 | generate that same <x:ref>Content-Type</x:ref> field in the header area of |
---|
546 | each body part. For example: |
---|
547 | </t> |
---|
548 | <figure><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
---|
549 | HTTP/1.1 206 Partial Content |
---|
550 | Date: Wed, 15 Nov 1995 06:25:24 GMT |
---|
551 | Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT |
---|
552 | Content-Length: 1741 |
---|
553 | Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES |
---|
554 | |
---|
555 | --THIS_STRING_SEPARATES |
---|
556 | Content-Type: application/pdf |
---|
557 | Content-Range: bytes 500-999/8000 |
---|
558 | |
---|
559 | ...the first range... |
---|
560 | --THIS_STRING_SEPARATES |
---|
561 | Content-Type: application/pdf |
---|
562 | Content-Range: bytes 7000-7999/8000 |
---|
563 | |
---|
564 | ...the second range |
---|
565 | --THIS_STRING_SEPARATES-- |
---|
566 | </artwork></figure> |
---|
567 | <t> |
---|
568 | When multiple ranges are requested, a server &MAY; coalesce any of the |
---|
569 | ranges that overlap or that are separated by a gap that is smaller than the |
---|
570 | overhead of sending multiple parts, regardless of the order in which the |
---|
571 | corresponding byte-range-spec appeared in the received <x:ref>Range</x:ref> |
---|
572 | header field. Since the typical overhead between parts of a |
---|
573 | multipart/byteranges payload is around 80 bytes, depending on the selected |
---|
574 | representation's media type and the chosen boundary parameter length, it |
---|
575 | can be less efficient to transfer many small disjoint parts than it is to |
---|
576 | transfer the entire selected representation. |
---|
577 | </t> |
---|
578 | <t> |
---|
579 | A server &MUST-NOT; generate a multipart response to a request for a single |
---|
580 | range, since a client that does not request multiple parts might not |
---|
581 | support multipart responses. However, a server &MAY; generate a |
---|
582 | multipart/byteranges payload with only a single body part if multiple |
---|
583 | ranges were requested and only one range was found to be satisfiable or |
---|
584 | only one range remained after coalescing. |
---|
585 | A client that cannot process a multipart/byteranges response &MUST-NOT; ask |
---|
586 | for multiple ranges in a single request. |
---|
587 | </t> |
---|
588 | <t> |
---|
589 | When a multipart response payload is generated, the server &SHOULD; send |
---|
590 | the parts in the same order that the corresponding byte-range-spec appeared |
---|
591 | in the received <x:ref>Range</x:ref> header field, excluding those ranges |
---|
592 | that were deemed unsatisfiable or that were coalesced into other ranges. |
---|
593 | A client that receives a multipart response &MUST; inspect the |
---|
594 | <x:ref>Content-Range</x:ref> header field present in each body part in |
---|
595 | order to determine which range is contained in that body part; a client |
---|
596 | cannot rely on receiving the same ranges that it requested, nor the same |
---|
597 | order that it requested. |
---|
598 | </t> |
---|
599 | <t> |
---|
600 | When a 206 response is generated, the server &MUST; generate the following |
---|
601 | header fields, in addition to those required above, if the field would |
---|
602 | have been sent in a <x:ref>200 (OK)</x:ref> response to the same request: |
---|
603 | <x:ref>Date</x:ref>, <x:ref>Cache-Control</x:ref>, <x:ref>ETag</x:ref>, |
---|
604 | <x:ref>Expires</x:ref>, <x:ref>Content-Location</x:ref>, and |
---|
605 | <x:ref>Vary</x:ref>. |
---|
606 | </t> |
---|
607 | <t> |
---|
608 | If a 206 is generated in response to a request with an <x:ref>If-Range</x:ref> |
---|
609 | header field, the sender &SHOULD-NOT; generate other representation header |
---|
610 | fields beyond those required above, because the client is understood to |
---|
611 | already have a prior response containing those header fields. |
---|
612 | Otherwise, the sender &MUST; generate all of the representation header |
---|
613 | fields that would have been sent in a <x:ref>200 (OK)</x:ref> response |
---|
614 | to the same request. |
---|
615 | </t> |
---|
616 | <t> |
---|
617 | A 206 response is cacheable unless otherwise indicated by |
---|
618 | explicit cache controls (see &p6-heuristic;). |
---|
619 | </t> |
---|
620 | </section> |
---|
621 | |
---|
622 | <section title="Content-Range" anchor="header.content-range"> |
---|
623 | <iref primary="true" item="Content-Range header field" x:for-anchor=""/> |
---|
624 | <x:anchor-alias value="Content-Range"/> |
---|
625 | <x:anchor-alias value="byte-content-range"/> |
---|
626 | <x:anchor-alias value="byte-range-resp"/> |
---|
627 | <x:anchor-alias value="byte-range"/> |
---|
628 | <x:anchor-alias value="unsatisfied-range"/> |
---|
629 | <x:anchor-alias value="complete-length"/> |
---|
630 | <x:anchor-alias value="other-content-range"/> |
---|
631 | <x:anchor-alias value="other-range-resp"/> |
---|
632 | <t> |
---|
633 | The "Content-Range" header field is sent in a single part |
---|
634 | <x:ref>206 (Partial Content)</x:ref> response to indicate the partial range |
---|
635 | of the selected representation enclosed as the message payload, sent in |
---|
636 | each part of a multipart 206 response to indicate the range enclosed within |
---|
637 | each body part, and sent in <x:ref>416 (Range Not Satisfiable)</x:ref> |
---|
638 | responses to provide information about the selected representation. |
---|
639 | </t> |
---|
640 | <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Range"/><iref primary="true" item="Grammar" subitem="byte-content-range"/><iref primary="true" item="Grammar" subitem="byte-range-resp"/><iref primary="true" item="Grammar" subitem="byte-range"/><iref primary="true" item="Grammar" subitem="unsatisfied-range"/><iref primary="true" item="Grammar" subitem="other-content-range"/><iref primary="true" item="Grammar" subitem="other-range-resp"/><iref primary="true" item="Grammar" subitem="complete-length"/> |
---|
641 | <x:ref>Content-Range</x:ref> = <x:ref>byte-content-range</x:ref> |
---|
642 | / <x:ref>other-content-range</x:ref> |
---|
643 | |
---|
644 | <x:ref>byte-content-range</x:ref> = <x:ref>bytes-unit</x:ref> <x:ref>SP</x:ref> |
---|
645 | ( <x:ref>byte-range-resp</x:ref> / <x:ref>unsatisfied-range</x:ref> ) |
---|
646 | |
---|
647 | <x:ref>byte-range-resp</x:ref> = <x:ref>byte-range</x:ref> "/" ( <x:ref>complete-length</x:ref> / "*" ) |
---|
648 | <x:ref>byte-range</x:ref> = <x:ref>first-byte-pos</x:ref> "-" <x:ref>last-byte-pos</x:ref> |
---|
649 | <x:ref>unsatisfied-range</x:ref> = "*/" <x:ref>complete-length</x:ref> |
---|
650 | |
---|
651 | <x:ref>complete-length</x:ref> = 1*<x:ref>DIGIT</x:ref> |
---|
652 | |
---|
653 | <x:ref>other-content-range</x:ref> = <x:ref>other-range-unit</x:ref> <x:ref>SP</x:ref> <x:ref>other-range-resp</x:ref> |
---|
654 | <x:ref>other-range-resp</x:ref> = *<x:ref>CHAR</x:ref> |
---|
655 | </artwork></figure> |
---|
656 | <t> |
---|
657 | If a <x:ref>206 (Partial Content)</x:ref> response contains a |
---|
658 | <x:ref>Content-Range</x:ref> header field with a <x:ref>range unit</x:ref> |
---|
659 | (<xref target="range.units"/>) that the recipient does not understand, the |
---|
660 | recipient &MUST-NOT; attempt to recombine it with a stored representation. |
---|
661 | A proxy that receives such a message &SHOULD; forward it downstream. |
---|
662 | </t> |
---|
663 | <t> |
---|
664 | For byte ranges, a sender &SHOULD; indicate the complete length of the |
---|
665 | representation from which the range has been extracted, unless the complete |
---|
666 | length is unknown or difficult to determine. An asterisk character ("*") in |
---|
667 | place of the complete-length indicates that the representation length was |
---|
668 | unknown when the header field was generated. |
---|
669 | </t> |
---|
670 | <t> |
---|
671 | The following example illustrates when the complete length of the selected |
---|
672 | representation is known by the sender to be 1234 bytes: |
---|
673 | </t> |
---|
674 | <figure><artwork type="example"> |
---|
675 | Content-Range: bytes 42-1233/1234 |
---|
676 | </artwork></figure> |
---|
677 | <t> |
---|
678 | and this second example illustrates when the complete length is unknown: |
---|
679 | </t> |
---|
680 | <figure><artwork type="example"> |
---|
681 | Content-Range: bytes 42-1233/* |
---|
682 | </artwork></figure> |
---|
683 | <t> |
---|
684 | A Content-Range field value is invalid if it contains a |
---|
685 | <x:ref>byte-range-resp</x:ref> that has a <x:ref>last-byte-pos</x:ref> |
---|
686 | value less than its <x:ref>first-byte-pos</x:ref> value, or a |
---|
687 | <x:ref>complete-length</x:ref> value less than or equal to its |
---|
688 | <x:ref>last-byte-pos</x:ref> value. The recipient of an invalid |
---|
689 | <x:ref>Content-Range</x:ref> &MUST-NOT; attempt to recombine the received |
---|
690 | content with a stored representation. |
---|
691 | </t> |
---|
692 | <t> |
---|
693 | A server generating a <x:ref>416 (Range Not Satisfiable)</x:ref> response |
---|
694 | to a byte range request &SHOULD; send a Content-Range header field with an |
---|
695 | <x:ref>unsatisfied-range</x:ref> value, as in the following example: |
---|
696 | </t> |
---|
697 | <figure><artwork type="example"> |
---|
698 | Content-Range: bytes */1234 |
---|
699 | </artwork></figure> |
---|
700 | <t> |
---|
701 | The complete-length in a 416 response indicates the current length of the |
---|
702 | selected representation. |
---|
703 | </t> |
---|
704 | <t> |
---|
705 | The "Content-Range" header field has no meaning for status codes that do |
---|
706 | not explicitly describe its semantic. For this specification, only the |
---|
707 | <x:ref>206 (Partial Content)</x:ref> and |
---|
708 | <x:ref>416 (Range Not Satisfiable)</x:ref> status codes describe a meaning |
---|
709 | for Content-Range. |
---|
710 | </t> |
---|
711 | <t> |
---|
712 | The following are examples of Content-Range values in which the |
---|
713 | selected representation contains a total of 1234 bytes: |
---|
714 | <list style="symbols"> |
---|
715 | <t> |
---|
716 | The first 500 bytes: |
---|
717 | <figure><artwork type="example" x:indent-with=" "> |
---|
718 | Content-Range: bytes 0-499/1234 |
---|
719 | </artwork></figure> |
---|
720 | </t> |
---|
721 | <t> |
---|
722 | The second 500 bytes: |
---|
723 | <figure><artwork type="example" x:indent-with=" "> |
---|
724 | Content-Range: bytes 500-999/1234 |
---|
725 | </artwork></figure> |
---|
726 | </t> |
---|
727 | <t> |
---|
728 | All except for the first 500 bytes: |
---|
729 | <figure><artwork type="example" x:indent-with=" "> |
---|
730 | Content-Range: bytes 500-1233/1234 |
---|
731 | </artwork></figure> |
---|
732 | </t> |
---|
733 | <t> |
---|
734 | The last 500 bytes: |
---|
735 | <figure><artwork type="example" x:indent-with=" "> |
---|
736 | Content-Range: bytes 734-1233/1234 |
---|
737 | </artwork></figure> |
---|
738 | </t> |
---|
739 | </list> |
---|
740 | </t> |
---|
741 | </section> |
---|
742 | |
---|
743 | <section title="Combining Ranges" anchor="combining.byte.ranges"> |
---|
744 | <t> |
---|
745 | A response might transfer only a subrange of a representation if the |
---|
746 | connection closed prematurely or if the request used one or more Range |
---|
747 | specifications. After several such transfers, a client might have |
---|
748 | received several ranges of the same representation. These ranges can only |
---|
749 | be safely combined if they all have in common the same strong validator, |
---|
750 | where "strong validator" is defined to be either an entity-tag that is |
---|
751 | not marked as weak (&entity-tags;) or, if no entity-tag is provided, a |
---|
752 | <x:ref>Last-Modified</x:ref> value that is strong in the sense defined by |
---|
753 | &lastmod-comparison;. |
---|
754 | </t> |
---|
755 | <t> |
---|
756 | A client that has received multiple partial responses to GET requests on a |
---|
757 | target resource &MAY; combine those responses into a larger continuous |
---|
758 | range if they share the same strong validator. |
---|
759 | </t> |
---|
760 | <t> |
---|
761 | If the most recent response is an incomplete <x:ref>200 (OK)</x:ref> |
---|
762 | response, then the header fields of that response are used for any |
---|
763 | combined response and replace those of the matching stored responses. |
---|
764 | </t> |
---|
765 | <t> |
---|
766 | If the most recent response is a <x:ref>206 (Partial Content)</x:ref> |
---|
767 | response and at least one of the matching stored responses is a |
---|
768 | <x:ref>200 (OK)</x:ref>, then the combined response header fields consist |
---|
769 | of the most recent 200 response's header fields. If all of the matching |
---|
770 | stored responses are 206 responses, then the stored response with the most |
---|
771 | recent header fields is used as the source of header fields for the |
---|
772 | combined response, except that the client &MUST; use other header fields |
---|
773 | provided in the new response, aside from <x:ref>Content-Range</x:ref>, to |
---|
774 | replace all instances of the corresponding header fields in the stored |
---|
775 | response. |
---|
776 | </t> |
---|
777 | <t> |
---|
778 | The combined response message body consists of the union of partial |
---|
779 | content ranges in the new response and each of the selected responses. |
---|
780 | If the union consists of the entire range of the representation, then the |
---|
781 | client &MUST; record the combined response as if it were a complete |
---|
782 | <x:ref>200 (OK)</x:ref> response, including a <x:ref>Content-Length</x:ref> |
---|
783 | header field that reflects the complete length. |
---|
784 | Otherwise, the client &MUST; record the set of continuous ranges as one of |
---|
785 | the following: |
---|
786 | an incomplete <x:ref>200 (OK)</x:ref> response if the combined response is |
---|
787 | a prefix of the representation, |
---|
788 | a single <x:ref>206 (Partial Content)</x:ref> response containing a |
---|
789 | multipart/byteranges body, or |
---|
790 | multiple <x:ref>206 (Partial Content)</x:ref> responses, each with one |
---|
791 | continuous range that is indicated by a <x:ref>Content-Range</x:ref> header |
---|
792 | field. |
---|
793 | </t> |
---|
794 | </section> |
---|
795 | |
---|
796 | <section title="416 Range Not Satisfiable" anchor="status.416"> |
---|
797 | <iref primary="true" item="416 Range Not Satisfiable (status code)" x:for-anchor=""/> |
---|
798 | <x:anchor-alias value="416 (Range Not Satisfiable)"/> |
---|
799 | <t> |
---|
800 | The <x:dfn>416 (Range Not Satisfiable)</x:dfn> status code indicates that |
---|
801 | none of the ranges in the request's <x:ref>Range</x:ref> header field |
---|
802 | (<xref target="header.range"/>) overlap the current extent of the selected |
---|
803 | resource or that the set of ranges requested has been rejected due to |
---|
804 | invalid ranges or an excessive request of small or overlapping ranges. |
---|
805 | </t> |
---|
806 | <t> |
---|
807 | For byte ranges, failing to overlap the current extent means that the |
---|
808 | <x:ref>first-byte-pos</x:ref> of all of the <x:ref>byte-range-spec</x:ref> |
---|
809 | values were greater than the current length of the selected representation. |
---|
810 | When this status code is generated in response to a byte range request, the |
---|
811 | sender &SHOULD; generate a <x:ref>Content-Range</x:ref> header field |
---|
812 | specifying the current length of the selected representation |
---|
813 | (<xref target="header.content-range"/>). |
---|
814 | </t> |
---|
815 | <figure> |
---|
816 | <preamble>For example:</preamble> |
---|
817 | <artwork type="message/http; msgtype="response"" x:indent-with=" "> |
---|
818 | HTTP/1.1 416 Range Not Satisfiable |
---|
819 | Date: Mon, 20 Jan 2012 15:41:54 GMT |
---|
820 | Content-Range: bytes */47022 |
---|
821 | </artwork></figure> |
---|
822 | <x:note> |
---|
823 | <t> |
---|
824 | &Note; Because servers are free to ignore <x:ref>Range</x:ref>, many |
---|
825 | implementations will simply respond with <x:ref>200 (OK)</x:ref> if the |
---|
826 | requested ranges are invalid or not satisfiable. That is partly because |
---|
827 | most clients are prepared to receive a <x:ref>200 (OK)</x:ref> to |
---|
828 | complete the task (albeit less efficiently) and partly because clients |
---|
829 | might not stop making an invalid partial request until they have received |
---|
830 | a complete representation. Thus, clients cannot depend on receiving a |
---|
831 | <x:ref>416 (Range Not Satisfiable)</x:ref> response even when it is most |
---|
832 | appropriate. |
---|
833 | </t> |
---|
834 | </x:note> |
---|
835 | </section> |
---|
836 | </section> |
---|
837 | |
---|
838 | <section title="IANA Considerations" anchor="IANA.considerations"> |
---|
839 | |
---|
840 | <section title="Range Unit Registry" anchor="range.unit.registry"> |
---|
841 | <t> |
---|
842 | The HTTP Range Unit Registry defines the name space for the range |
---|
843 | unit names and refers to their corresponding specifications. |
---|
844 | The registry is maintained at |
---|
845 | <eref target="http://www.iana.org/assignments/http-parameters"/>. |
---|
846 | </t> |
---|
847 | |
---|
848 | <section title="Procedure" anchor="range.unit.registry.procedure"> |
---|
849 | <t> |
---|
850 | Registration of an HTTP Range Unit &MUST; include the following fields: |
---|
851 | <list style="symbols"> |
---|
852 | <t>Name</t> |
---|
853 | <t>Description</t> |
---|
854 | <t>Pointer to specification text</t> |
---|
855 | </list> |
---|
856 | </t> |
---|
857 | <t> |
---|
858 | Values to be added to this name space require IETF Review |
---|
859 | (see <xref target="RFC5226" x:fmt="," x:sec="4.1"/>). |
---|
860 | </t> |
---|
861 | </section> |
---|
862 | |
---|
863 | <section title="Registrations" anchor="range.unit.registration"> |
---|
864 | <t> |
---|
865 | The initial HTTP Range Unit Registry shall contain the registrations |
---|
866 | below: |
---|
867 | </t> |
---|
868 | <texttable align="left" suppress-title="true" anchor="iana.range.units.table"> |
---|
869 | <ttcol>Range Unit Name</ttcol> |
---|
870 | <ttcol>Description</ttcol> |
---|
871 | <ttcol>Reference</ttcol> |
---|
872 | |
---|
873 | <c>bytes</c> |
---|
874 | <c>a range of octets</c> |
---|
875 | <c><xref target="byte.ranges"/></c> |
---|
876 | |
---|
877 | <c>none</c> |
---|
878 | <c>reserved as keyword, indicating no ranges are supported</c> |
---|
879 | <c><xref target="header.accept-ranges"/></c> |
---|
880 | </texttable> |
---|
881 | <t> |
---|
882 | The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force". |
---|
883 | </t> |
---|
884 | </section> |
---|
885 | </section> |
---|
886 | |
---|
887 | <section title="Status Code Registration" anchor="status.code.registration"> |
---|
888 | <t> |
---|
889 | The HTTP Status Code Registry located at <eref target="http://www.iana.org/assignments/http-status-codes"/> |
---|
890 | shall be updated with the registrations below: |
---|
891 | </t> |
---|
892 | <?BEGININC p5-range.iana-status-codes ?> |
---|
893 | <!--AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually--> |
---|
894 | <texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table"> |
---|
895 | <ttcol>Value</ttcol> |
---|
896 | <ttcol>Description</ttcol> |
---|
897 | <ttcol>Reference</ttcol> |
---|
898 | <c>206</c> |
---|
899 | <c>Partial Content</c> |
---|
900 | <c> |
---|
901 | <xref target="status.206"/> |
---|
902 | </c> |
---|
903 | <c>416</c> |
---|
904 | <c>Range Not Satisfiable</c> |
---|
905 | <c> |
---|
906 | <xref target="status.416"/> |
---|
907 | </c> |
---|
908 | </texttable> |
---|
909 | <!--(END)--> |
---|
910 | <?ENDINC p5-range.iana-status-codes ?> |
---|
911 | </section> |
---|
912 | |
---|
913 | <section title="Header Field Registration" anchor="header.field.registration"> |
---|
914 | <t> |
---|
915 | The Message Header Field Registry located at <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/> shall be updated |
---|
916 | with the permanent registrations below (see <xref target="BCP90"/>): |
---|
917 | </t> |
---|
918 | <?BEGININC p5-range.iana-headers ?> |
---|
919 | <!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually--> |
---|
920 | <texttable align="left" suppress-title="true" anchor="iana.header.registration.table"> |
---|
921 | <ttcol>Header Field Name</ttcol> |
---|
922 | <ttcol>Protocol</ttcol> |
---|
923 | <ttcol>Status</ttcol> |
---|
924 | <ttcol>Reference</ttcol> |
---|
925 | |
---|
926 | <c>Accept-Ranges</c> |
---|
927 | <c>http</c> |
---|
928 | <c>standard</c> |
---|
929 | <c> |
---|
930 | <xref target="header.accept-ranges"/> |
---|
931 | </c> |
---|
932 | <c>Content-Range</c> |
---|
933 | <c>http</c> |
---|
934 | <c>standard</c> |
---|
935 | <c> |
---|
936 | <xref target="header.content-range"/> |
---|
937 | </c> |
---|
938 | <c>If-Range</c> |
---|
939 | <c>http</c> |
---|
940 | <c>standard</c> |
---|
941 | <c> |
---|
942 | <xref target="header.if-range"/> |
---|
943 | </c> |
---|
944 | <c>Range</c> |
---|
945 | <c>http</c> |
---|
946 | <c>standard</c> |
---|
947 | <c> |
---|
948 | <xref target="header.range"/> |
---|
949 | </c> |
---|
950 | </texttable> |
---|
951 | <!--(END)--> |
---|
952 | <?ENDINC p5-range.iana-headers ?> |
---|
953 | <t> |
---|
954 | The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force". |
---|
955 | </t> |
---|
956 | </section> |
---|
957 | |
---|
958 | </section> |
---|
959 | |
---|
960 | <section title="Security Considerations" anchor="security.considerations"> |
---|
961 | <t> |
---|
962 | This section is meant to inform developers, information providers, and |
---|
963 | users of known security concerns specific to the HTTP/1.1 range |
---|
964 | request mechanisms. More general security considerations are addressed |
---|
965 | in HTTP messaging &messaging; and semantics &semantics;. |
---|
966 | </t> |
---|
967 | |
---|
968 | <section title="Denial of Service Attacks using Range" anchor="overlapping.ranges"> |
---|
969 | <t> |
---|
970 | Unconstrained multiple range requests are susceptible to denial of service |
---|
971 | attacks because the effort required to request many overlapping ranges of |
---|
972 | the same data is tiny compared to the time, memory, and bandwidth consumed |
---|
973 | by attempting to serve the requested data in many parts. |
---|
974 | Servers ought to ignore, coalesce, or reject egregious range requests, such |
---|
975 | as requests for more than two overlapping ranges or for many small ranges |
---|
976 | in a single set, particularly when the ranges are requested out of order |
---|
977 | for no apparent reason. Multipart range requests are not designed to |
---|
978 | support random access. |
---|
979 | </t> |
---|
980 | </section> |
---|
981 | </section> |
---|
982 | |
---|
983 | <section title="Acknowledgments" anchor="acks"> |
---|
984 | <t> |
---|
985 | See &acks;. |
---|
986 | </t> |
---|
987 | </section> |
---|
988 | </middle> |
---|
989 | <back> |
---|
990 | |
---|
991 | <references title="Normative References"> |
---|
992 | |
---|
993 | <reference anchor="Part1"> |
---|
994 | <front> |
---|
995 | <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title> |
---|
996 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
997 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
998 | <address><email>fielding@gbiv.com</email></address> |
---|
999 | </author> |
---|
1000 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1001 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1002 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1003 | </author> |
---|
1004 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1005 | </front> |
---|
1006 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/> |
---|
1007 | <x:source href="p1-messaging.xml" basename="p1-messaging"> |
---|
1008 | <x:defines>Content-Length</x:defines> |
---|
1009 | </x:source> |
---|
1010 | </reference> |
---|
1011 | |
---|
1012 | <reference anchor="Part2"> |
---|
1013 | <front> |
---|
1014 | <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title> |
---|
1015 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1016 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1017 | <address><email>fielding@gbiv.com</email></address> |
---|
1018 | </author> |
---|
1019 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1020 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1021 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1022 | </author> |
---|
1023 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1024 | </front> |
---|
1025 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;"/> |
---|
1026 | <x:source href="p2-semantics.xml" basename="p2-semantics"> |
---|
1027 | <x:defines>200 (OK)</x:defines> |
---|
1028 | <x:defines>410 (Gone)</x:defines> |
---|
1029 | <x:defines>Content-Location</x:defines> |
---|
1030 | <x:defines>Content-Type</x:defines> |
---|
1031 | <x:defines>Date</x:defines> |
---|
1032 | <x:defines>Location</x:defines> |
---|
1033 | <x:defines>Vary</x:defines> |
---|
1034 | </x:source> |
---|
1035 | </reference> |
---|
1036 | |
---|
1037 | <reference anchor="Part4"> |
---|
1038 | <front> |
---|
1039 | <title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title> |
---|
1040 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1041 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1042 | <address><email>fielding@gbiv.com</email></address> |
---|
1043 | </author> |
---|
1044 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1045 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1046 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1047 | </author> |
---|
1048 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1049 | </front> |
---|
1050 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"/> |
---|
1051 | <x:source href="p4-conditional.xml" basename="p4-conditional"> |
---|
1052 | <x:defines>304 (Not Modified)</x:defines> |
---|
1053 | <x:defines>ETag</x:defines> |
---|
1054 | <x:defines>If-Match</x:defines> |
---|
1055 | <x:defines>If-Modified-Since</x:defines> |
---|
1056 | <x:defines>If-None-Match</x:defines> |
---|
1057 | <x:defines>If-Unmodified-Since</x:defines> |
---|
1058 | <x:defines>Last-Modified</x:defines> |
---|
1059 | </x:source> |
---|
1060 | </reference> |
---|
1061 | |
---|
1062 | <reference anchor="Part6"> |
---|
1063 | <front> |
---|
1064 | <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title> |
---|
1065 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
---|
1066 | <organization abbrev="Adobe">Adobe Systems Incorporated</organization> |
---|
1067 | <address><email>fielding@gbiv.com</email></address> |
---|
1068 | </author> |
---|
1069 | <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor"> |
---|
1070 | <organization>Akamai</organization> |
---|
1071 | <address><email>mnot@mnot.net</email></address> |
---|
1072 | </author> |
---|
1073 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
1074 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
1075 | <address><email>julian.reschke@greenbytes.de</email></address> |
---|
1076 | </author> |
---|
1077 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
---|
1078 | </front> |
---|
1079 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/> |
---|
1080 | <x:source href="p6-cache.xml" basename="p6-cache"> |
---|
1081 | <x:defines>Cache-Control</x:defines> |
---|
1082 | <x:defines>Expires</x:defines> |
---|
1083 | </x:source> |
---|
1084 | </reference> |
---|
1085 | |
---|
1086 | <reference anchor="RFC2046"> |
---|
1087 | <front> |
---|
1088 | <title abbrev="Media Types">Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title> |
---|
1089 | <author initials="N." surname="Freed" fullname="Ned Freed"> |
---|
1090 | <organization>Innosoft International, Inc.</organization> |
---|
1091 | <address><email>ned@innosoft.com</email></address> |
---|
1092 | </author> |
---|
1093 | <author initials="N." surname="Borenstein" fullname="Nathaniel S. Borenstein"> |
---|
1094 | <organization>First Virtual Holdings</organization> |
---|
1095 | <address><email>nsb@nsb.fv.com</email></address> |
---|
1096 | </author> |
---|
1097 | <date month="November" year="1996"/> |
---|
1098 | </front> |
---|
1099 | <seriesInfo name="RFC" value="2046"/> |
---|
1100 | </reference> |
---|
1101 | |
---|
1102 | <reference anchor="RFC2119"> |
---|
1103 | <front> |
---|
1104 | <title>Key words for use in RFCs to Indicate Requirement Levels</title> |
---|
1105 | <author initials="S." surname="Bradner" fullname="Scott Bradner"> |
---|
1106 | <organization>Harvard University</organization> |
---|
1107 | <address><email>sob@harvard.edu</email></address> |
---|
1108 | </author> |
---|
1109 | <date month="March" year="1997"/> |
---|
1110 | </front> |
---|
1111 | <seriesInfo name="BCP" value="14"/> |
---|
1112 | <seriesInfo name="RFC" value="2119"/> |
---|
1113 | </reference> |
---|
1114 | |
---|
1115 | <reference anchor="RFC5234"> |
---|
1116 | <front> |
---|
1117 | <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title> |
---|
1118 | <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor"> |
---|
1119 | <organization>Brandenburg InternetWorking</organization> |
---|
1120 | <address> |
---|
1121 | <email>dcrocker@bbiw.net</email> |
---|
1122 | </address> |
---|
1123 | </author> |
---|
1124 | <author initials="P." surname="Overell" fullname="Paul Overell"> |
---|
1125 | <organization>THUS plc.</organization> |
---|
1126 | <address> |
---|
1127 | <email>paul.overell@thus.net</email> |
---|
1128 | </address> |
---|
1129 | </author> |
---|
1130 | <date month="January" year="2008"/> |
---|
1131 | </front> |
---|
1132 | <seriesInfo name="STD" value="68"/> |
---|
1133 | <seriesInfo name="RFC" value="5234"/> |
---|
1134 | </reference> |
---|
1135 | |
---|
1136 | </references> |
---|
1137 | |
---|
1138 | <references title="Informative References"> |
---|
1139 | |
---|
1140 | <reference anchor="RFC2616"> |
---|
1141 | <front> |
---|
1142 | <title>Hypertext Transfer Protocol -- HTTP/1.1</title> |
---|
1143 | <author initials="R." surname="Fielding" fullname="R. Fielding"> |
---|
1144 | <organization>University of California, Irvine</organization> |
---|
1145 | <address><email>fielding@ics.uci.edu</email></address> |
---|
1146 | </author> |
---|
1147 | <author initials="J." surname="Gettys" fullname="J. Gettys"> |
---|
1148 | <organization>W3C</organization> |
---|
1149 | <address><email>jg@w3.org</email></address> |
---|
1150 | </author> |
---|
1151 | <author initials="J." surname="Mogul" fullname="J. Mogul"> |
---|
1152 | <organization>Compaq Computer Corporation</organization> |
---|
1153 | <address><email>mogul@wrl.dec.com</email></address> |
---|
1154 | </author> |
---|
1155 | <author initials="H." surname="Frystyk" fullname="H. Frystyk"> |
---|
1156 | <organization>MIT Laboratory for Computer Science</organization> |
---|
1157 | <address><email>frystyk@w3.org</email></address> |
---|
1158 | </author> |
---|
1159 | <author initials="L." surname="Masinter" fullname="L. Masinter"> |
---|
1160 | <organization>Xerox Corporation</organization> |
---|
1161 | <address><email>masinter@parc.xerox.com</email></address> |
---|
1162 | </author> |
---|
1163 | <author initials="P." surname="Leach" fullname="P. Leach"> |
---|
1164 | <organization>Microsoft Corporation</organization> |
---|
1165 | <address><email>paulle@microsoft.com</email></address> |
---|
1166 | </author> |
---|
1167 | <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee"> |
---|
1168 | <organization>W3C</organization> |
---|
1169 | <address><email>timbl@w3.org</email></address> |
---|
1170 | </author> |
---|
1171 | <date month="June" year="1999"/> |
---|
1172 | </front> |
---|
1173 | <seriesInfo name="RFC" value="2616"/> |
---|
1174 | </reference> |
---|
1175 | |
---|
1176 | <reference anchor='BCP90'> |
---|
1177 | <front> |
---|
1178 | <title>Registration Procedures for Message Header Fields</title> |
---|
1179 | <author initials='G.' surname='Klyne' fullname='G. Klyne'> |
---|
1180 | <organization>Nine by Nine</organization> |
---|
1181 | <address><email>GK-IETF@ninebynine.org</email></address> |
---|
1182 | </author> |
---|
1183 | <author initials='M.' surname='Nottingham' fullname='M. Nottingham'> |
---|
1184 | <organization>BEA Systems</organization> |
---|
1185 | <address><email>mnot@pobox.com</email></address> |
---|
1186 | </author> |
---|
1187 | <author initials='J.' surname='Mogul' fullname='J. Mogul'> |
---|
1188 | <organization>HP Labs</organization> |
---|
1189 | <address><email>JeffMogul@acm.org</email></address> |
---|
1190 | </author> |
---|
1191 | <date year='2004' month='September' /> |
---|
1192 | </front> |
---|
1193 | <seriesInfo name='BCP' value='90' /> |
---|
1194 | <seriesInfo name='RFC' value='3864' /> |
---|
1195 | </reference> |
---|
1196 | |
---|
1197 | <reference anchor="BCP13"> |
---|
1198 | <front> |
---|
1199 | <title>Media Type Specifications and Registration Procedures</title> |
---|
1200 | <author initials="N." surname="Freed" fullname="Ned Freed"> |
---|
1201 | <organization>Oracle</organization> |
---|
1202 | <address> |
---|
1203 | <email>ned+ietf@mrochek.com</email> |
---|
1204 | </address> |
---|
1205 | </author> |
---|
1206 | <author initials="J." surname="Klensin" fullname="John C. Klensin"> |
---|
1207 | <address> |
---|
1208 | <email>john+ietf@jck.com</email> |
---|
1209 | </address> |
---|
1210 | </author> |
---|
1211 | <author initials="T." surname="Hansen" fullname="Tony Hansen"> |
---|
1212 | <organization>AT&T Laboratories</organization> |
---|
1213 | <address> |
---|
1214 | <email>tony+mtsuffix@maillennium.att.com</email> |
---|
1215 | </address> |
---|
1216 | </author> |
---|
1217 | <date year="2013" month="January"/> |
---|
1218 | </front> |
---|
1219 | <seriesInfo name="BCP" value="13"/> |
---|
1220 | <seriesInfo name="RFC" value="6838"/> |
---|
1221 | </reference> |
---|
1222 | |
---|
1223 | <reference anchor='RFC5226'> |
---|
1224 | <front> |
---|
1225 | <title>Guidelines for Writing an IANA Considerations Section in RFCs</title> |
---|
1226 | <author initials='T.' surname='Narten' fullname='T. Narten'> |
---|
1227 | <organization>IBM</organization> |
---|
1228 | <address><email>narten@us.ibm.com</email></address> |
---|
1229 | </author> |
---|
1230 | <author initials='H.' surname='Alvestrand' fullname='H. Alvestrand'> |
---|
1231 | <organization>Google</organization> |
---|
1232 | <address><email>Harald@Alvestrand.no</email></address> |
---|
1233 | </author> |
---|
1234 | <date year='2008' month='May' /> |
---|
1235 | </front> |
---|
1236 | <seriesInfo name='BCP' value='26' /> |
---|
1237 | <seriesInfo name='RFC' value='5226' /> |
---|
1238 | </reference> |
---|
1239 | |
---|
1240 | </references> |
---|
1241 | |
---|
1242 | <section title="Internet Media Type multipart/byteranges" anchor="internet.media.type.multipart.byteranges"> |
---|
1243 | <iref item="Media Type" subitem="multipart/byteranges" primary="true"/> |
---|
1244 | <iref item="multipart/byteranges Media Type" primary="true"/> |
---|
1245 | <t> |
---|
1246 | When a <x:ref>206 (Partial Content)</x:ref> response message includes the |
---|
1247 | content of multiple ranges, they are transmitted as body parts in a |
---|
1248 | multipart message body (<xref target="RFC2046" x:fmt="," x:sec="5.1"/>) |
---|
1249 | with the media type of "multipart/byteranges". The following definition is |
---|
1250 | to be registered with IANA <xref target="BCP13"/>. |
---|
1251 | </t> |
---|
1252 | <t> |
---|
1253 | The multipart/byteranges media type includes one or more body parts, each |
---|
1254 | with its own <x:ref>Content-Type</x:ref> and <x:ref>Content-Range</x:ref> |
---|
1255 | fields. The required boundary parameter specifies the boundary string used |
---|
1256 | to separate each body part. |
---|
1257 | </t> |
---|
1258 | <t> |
---|
1259 | <list style="hanging" x:indent="12em"> |
---|
1260 | <t hangText="Type name:"> |
---|
1261 | multipart |
---|
1262 | </t> |
---|
1263 | <t hangText="Subtype name:"> |
---|
1264 | byteranges |
---|
1265 | </t> |
---|
1266 | <t hangText="Required parameters:"> |
---|
1267 | boundary |
---|
1268 | </t> |
---|
1269 | <t hangText="Optional parameters:"> |
---|
1270 | none |
---|
1271 | </t> |
---|
1272 | <t hangText="Encoding considerations:"> |
---|
1273 | only "7bit", "8bit", or "binary" are permitted |
---|
1274 | </t> |
---|
1275 | <t hangText="Security considerations:"> |
---|
1276 | none |
---|
1277 | </t> |
---|
1278 | <t hangText="Interoperability considerations:"> |
---|
1279 | none |
---|
1280 | </t> |
---|
1281 | <t hangText="Published specification:"> |
---|
1282 | This specification (see <xref target="internet.media.type.multipart.byteranges"/>). |
---|
1283 | </t> |
---|
1284 | <t hangText="Applications that use this media type:"> |
---|
1285 | HTTP components supporting multiple ranges in a single request. |
---|
1286 | </t> |
---|
1287 | <t hangText="Additional information:"> |
---|
1288 | <list style="hanging"> |
---|
1289 | <t hangText="Magic number(s):">none</t> |
---|
1290 | <t hangText="File extension(s):">none</t> |
---|
1291 | <t hangText="Macintosh file type code(s):">none</t> |
---|
1292 | </list> |
---|
1293 | </t> |
---|
1294 | <t hangText="Person and email address to contact for further information:"> |
---|
1295 | See Authors Section. |
---|
1296 | </t> |
---|
1297 | <t hangText="Intended usage:"> |
---|
1298 | COMMON |
---|
1299 | </t> |
---|
1300 | <t hangText="Restrictions on usage:"> |
---|
1301 | none |
---|
1302 | </t> |
---|
1303 | <t hangText="Author/Change controller:"> |
---|
1304 | IESG |
---|
1305 | </t> |
---|
1306 | </list> |
---|
1307 | </t> |
---|
1308 | <t> |
---|
1309 | Implementation Notes: |
---|
1310 | <list style="numbers"> |
---|
1311 | <t>Additional CRLFs might precede the first boundary string in the body.</t> |
---|
1312 | |
---|
1313 | <t>Although <xref target="RFC2046"/> permits the boundary string to be |
---|
1314 | quoted, some existing implementations handle a quoted boundary |
---|
1315 | string incorrectly.</t> |
---|
1316 | |
---|
1317 | <t>A number of clients and servers were coded to an early draft |
---|
1318 | of the byteranges specification that used a media type of |
---|
1319 | multipart/x-byteranges<iref item="multipart/x-byteranges Media Type"/><iref item="Media Type" subitem="multipart/x-byteranges"/>, |
---|
1320 | which is almost (but not quite) compatible with this type.</t> |
---|
1321 | </list> |
---|
1322 | </t> |
---|
1323 | <t> |
---|
1324 | Despite the name, the "multipart/byteranges" media type is not limited to |
---|
1325 | byte ranges. The following example uses an "exampleunit" range unit: |
---|
1326 | </t> |
---|
1327 | <figure><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
---|
1328 | HTTP/1.1 206 Partial Content |
---|
1329 | Date: Tue, 14 Nov 1995 06:25:24 GMT |
---|
1330 | Last-Modified: Tue, 14 July 04:58:08 GMT |
---|
1331 | Content-Length: 2331785 |
---|
1332 | Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES |
---|
1333 | |
---|
1334 | --THIS_STRING_SEPARATES |
---|
1335 | Content-Type: video/example |
---|
1336 | Content-Range: exampleunit 1.2-4.3/25 |
---|
1337 | |
---|
1338 | ...the first range... |
---|
1339 | --THIS_STRING_SEPARATES |
---|
1340 | Content-Type: video/example |
---|
1341 | Content-Range: exampleunit 11.2-14.3/25 |
---|
1342 | |
---|
1343 | ...the second range |
---|
1344 | --THIS_STRING_SEPARATES-- |
---|
1345 | </artwork> |
---|
1346 | </figure> |
---|
1347 | </section> |
---|
1348 | |
---|
1349 | <section title="Changes from RFC 2616" anchor="changes.from.rfc.2616"> |
---|
1350 | |
---|
1351 | <t> |
---|
1352 | A weak validator cannot be used in a <x:ref>206</x:ref> response. |
---|
1353 | (<xref target="status.206"/>) |
---|
1354 | </t> |
---|
1355 | <t> |
---|
1356 | The Content-Range header field only has meaning when the status code |
---|
1357 | explicitly defines its use. |
---|
1358 | (<xref target="header.content-range" />) |
---|
1359 | </t> |
---|
1360 | <t> |
---|
1361 | Servers are given more leeway in how they respond to a range request, |
---|
1362 | in order to mitigate abuse by malicious (or just greedy) clients. |
---|
1363 | </t> |
---|
1364 | <t> |
---|
1365 | multipart/byteranges can consist of a single part. |
---|
1366 | (<xref target="internet.media.type.multipart.byteranges"/>) |
---|
1367 | </t> |
---|
1368 | <t> |
---|
1369 | This specification introduces a Range Unit Registry. |
---|
1370 | (<xref target="range.unit.registry"/>) |
---|
1371 | </t> |
---|
1372 | </section> |
---|
1373 | |
---|
1374 | <section title="Imported ABNF" anchor="imported.abnf"> |
---|
1375 | <x:anchor-alias value="ALPHA"/> |
---|
1376 | <x:anchor-alias value="CHAR"/> |
---|
1377 | <x:anchor-alias value="CR"/> |
---|
1378 | <x:anchor-alias value="DIGIT"/> |
---|
1379 | <x:anchor-alias value="LF"/> |
---|
1380 | <x:anchor-alias value="OCTET"/> |
---|
1381 | <x:anchor-alias value="SP"/> |
---|
1382 | <x:anchor-alias value="VCHAR"/> |
---|
1383 | <x:anchor-alias value="token"/> |
---|
1384 | <x:anchor-alias value="OWS"/> |
---|
1385 | <x:anchor-alias value="HTTP-date"/> |
---|
1386 | <x:anchor-alias value="entity-tag"/> |
---|
1387 | <t> |
---|
1388 | The following core rules are included by |
---|
1389 | reference, as defined in <xref target="RFC5234" x:fmt="of" x:sec="B.1"/>: |
---|
1390 | ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), |
---|
1391 | DIGIT (decimal 0-9), DQUOTE (double quote), |
---|
1392 | HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), |
---|
1393 | OCTET (any 8-bit sequence of data), SP (space), and |
---|
1394 | VCHAR (any visible US-ASCII character). |
---|
1395 | </t> |
---|
1396 | <t> |
---|
1397 | Note that all rules derived from <x:ref>token</x:ref> are to |
---|
1398 | be compared case-insensitively, like <x:ref>range-unit</x:ref> and |
---|
1399 | <x:ref>acceptable-ranges</x:ref>. |
---|
1400 | </t> |
---|
1401 | <t> |
---|
1402 | The rules below are defined in <xref target="Part1"/>: |
---|
1403 | </t> |
---|
1404 | <figure><artwork type="abnf2616"> |
---|
1405 | <x:ref>OWS</x:ref> = <OWS, defined in &whitespace;> |
---|
1406 | <x:ref>token</x:ref> = <token, defined in &field-components;> |
---|
1407 | </artwork></figure> |
---|
1408 | <t> |
---|
1409 | The rules below are defined in other parts: |
---|
1410 | </t> |
---|
1411 | <figure><artwork type="abnf2616"> |
---|
1412 | <x:ref>HTTP-date</x:ref> = <HTTP-date, defined in &http-date;> |
---|
1413 | <x:ref>entity-tag</x:ref> = <entity-tag, defined in &entity-tags;> |
---|
1414 | </artwork></figure> |
---|
1415 | </section> |
---|
1416 | |
---|
1417 | <?BEGININC p5-range.abnf-appendix ?> |
---|
1418 | <section xmlns:x="http://purl.org/net/xml2rfc/ext" title="Collected ABNF" anchor="collected.abnf"> |
---|
1419 | <figure> |
---|
1420 | <artwork type="abnf" name="p5-range.parsed-abnf"> |
---|
1421 | <x:ref>Accept-Ranges</x:ref> = acceptable-ranges |
---|
1422 | |
---|
1423 | <x:ref>Content-Range</x:ref> = byte-content-range / other-content-range |
---|
1424 | |
---|
1425 | <x:ref>HTTP-date</x:ref> = <HTTP-date, defined in [Part2], Section 7.1.1.1> |
---|
1426 | |
---|
1427 | <x:ref>If-Range</x:ref> = entity-tag / HTTP-date |
---|
1428 | |
---|
1429 | <x:ref>OWS</x:ref> = <OWS, defined in [Part1], Section 3.2.3> |
---|
1430 | |
---|
1431 | <x:ref>Range</x:ref> = byte-ranges-specifier / other-ranges-specifier |
---|
1432 | |
---|
1433 | <x:ref>acceptable-ranges</x:ref> = ( *( "," OWS ) range-unit *( OWS "," [ OWS |
---|
1434 | range-unit ] ) ) / "none" |
---|
1435 | |
---|
1436 | <x:ref>byte-content-range</x:ref> = bytes-unit SP ( byte-range-resp / |
---|
1437 | unsatisfied-range ) |
---|
1438 | <x:ref>byte-range</x:ref> = first-byte-pos "-" last-byte-pos |
---|
1439 | <x:ref>byte-range-resp</x:ref> = byte-range "/" ( complete-length / "*" ) |
---|
1440 | <x:ref>byte-range-set</x:ref> = *( "," OWS ) ( byte-range-spec / |
---|
1441 | suffix-byte-range-spec ) *( OWS "," [ OWS ( byte-range-spec / |
---|
1442 | suffix-byte-range-spec ) ] ) |
---|
1443 | <x:ref>byte-range-spec</x:ref> = first-byte-pos "-" [ last-byte-pos ] |
---|
1444 | <x:ref>byte-ranges-specifier</x:ref> = bytes-unit "=" byte-range-set |
---|
1445 | <x:ref>bytes-unit</x:ref> = "bytes" |
---|
1446 | |
---|
1447 | <x:ref>complete-length</x:ref> = 1*DIGIT |
---|
1448 | |
---|
1449 | <x:ref>entity-tag</x:ref> = <entity-tag, defined in [Part4], Section 2.3> |
---|
1450 | |
---|
1451 | <x:ref>first-byte-pos</x:ref> = 1*DIGIT |
---|
1452 | |
---|
1453 | <x:ref>last-byte-pos</x:ref> = 1*DIGIT |
---|
1454 | |
---|
1455 | <x:ref>other-content-range</x:ref> = other-range-unit SP other-range-resp |
---|
1456 | <x:ref>other-range-resp</x:ref> = *CHAR |
---|
1457 | <x:ref>other-range-set</x:ref> = 1*CHAR |
---|
1458 | <x:ref>other-range-unit</x:ref> = token |
---|
1459 | <x:ref>other-ranges-specifier</x:ref> = other-range-unit "=" other-range-set |
---|
1460 | |
---|
1461 | <x:ref>range-unit</x:ref> = bytes-unit / other-range-unit |
---|
1462 | |
---|
1463 | <x:ref>suffix-byte-range-spec</x:ref> = "-" suffix-length |
---|
1464 | <x:ref>suffix-length</x:ref> = 1*DIGIT |
---|
1465 | |
---|
1466 | <x:ref>token</x:ref> = <token, defined in [Part1], Section 3.2.6> |
---|
1467 | |
---|
1468 | <x:ref>unsatisfied-range</x:ref> = "*/" complete-length |
---|
1469 | </artwork> |
---|
1470 | </figure> |
---|
1471 | </section> |
---|
1472 | <?ENDINC p5-range.abnf-appendix ?> |
---|
1473 | |
---|
1474 | |
---|
1475 | <section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log"> |
---|
1476 | <t> |
---|
1477 | Changes up to the first Working Group Last Call draft are summarized |
---|
1478 | in <eref target="http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-19#appendix-D"/>. |
---|
1479 | </t> |
---|
1480 | |
---|
1481 | <section title="Since draft-ietf-httpbis-p5-range-19" anchor="changes.since.19"> |
---|
1482 | <t> |
---|
1483 | Closed issues: |
---|
1484 | <list style="symbols"> |
---|
1485 | <t> |
---|
1486 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/358"/>: |
---|
1487 | "ABNF list expansion code problem" |
---|
1488 | </t> |
---|
1489 | <t> |
---|
1490 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/361"/>: |
---|
1491 | "ABNF requirements for recipients" |
---|
1492 | </t> |
---|
1493 | <t> |
---|
1494 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/367"/>: |
---|
1495 | "reserve 'none' as byte range unit" |
---|
1496 | </t> |
---|
1497 | <t> |
---|
1498 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/368"/>: |
---|
1499 | "note introduction of new IANA registries as normative changes" |
---|
1500 | </t> |
---|
1501 | <t> |
---|
1502 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/369"/>: |
---|
1503 | "range units vs leading zeroes vs size" |
---|
1504 | </t> |
---|
1505 | </list> |
---|
1506 | </t> |
---|
1507 | </section> |
---|
1508 | |
---|
1509 | <section title="Since draft-ietf-httpbis-p5-range-20" anchor="changes.since.20"> |
---|
1510 | <t> |
---|
1511 | <list style="symbols"> |
---|
1512 | <t> |
---|
1513 | Conformance criteria and considerations regarding error handling are |
---|
1514 | now defined in Part 1. |
---|
1515 | </t> |
---|
1516 | </list> |
---|
1517 | </t> |
---|
1518 | </section> |
---|
1519 | |
---|
1520 | <section title="Since draft-ietf-httpbis-p5-range-21" anchor="changes.since.21"> |
---|
1521 | <t> |
---|
1522 | Closed issues: |
---|
1523 | <list style="symbols"> |
---|
1524 | <t> |
---|
1525 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/175"/>: |
---|
1526 | "Security consideration: range flooding" |
---|
1527 | </t> |
---|
1528 | <t> |
---|
1529 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/223"/>: |
---|
1530 | "Allowing heuristic caching for new status codes" |
---|
1531 | </t> |
---|
1532 | <t> |
---|
1533 | <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/311"/>: |
---|
1534 | "Add limitations to Range to reduce its use as a denial-of-service tool" |
---|
1535 | </t> |
---|
1536 | </list> |
---|
1537 | </t> |
---|
1538 | </section> |
---|
1539 | |
---|
1540 | <section title="Since draft-ietf-httpbis-p5-range-22" anchor="changes.since.22"> |
---|
1541 | <t> |
---|
1542 | None yet. |
---|
1543 | </t> |
---|
1544 | </section> |
---|
1545 | </section> |
---|
1546 | |
---|
1547 | </back> |
---|
1548 | </rfc> |
---|