1 |
|
---|
2 |
|
---|
3 |
|
---|
4 | HTTPbis Working Group R. Fielding, Ed.
|
---|
5 | Internet-Draft Day Software
|
---|
6 | Obsoletes: 2616 (if approved) J. Gettys
|
---|
7 | Intended status: Standards Track One Laptop per Child
|
---|
8 | Expires: September 9, 2010 J. Mogul
|
---|
9 | HP
|
---|
10 | H. Frystyk
|
---|
11 | Microsoft
|
---|
12 | L. Masinter
|
---|
13 | Adobe Systems
|
---|
14 | P. Leach
|
---|
15 | Microsoft
|
---|
16 | T. Berners-Lee
|
---|
17 | W3C/MIT
|
---|
18 | Y. Lafon, Ed.
|
---|
19 | W3C
|
---|
20 | J. Reschke, Ed.
|
---|
21 | greenbytes
|
---|
22 | March 8, 2010
|
---|
23 |
|
---|
24 |
|
---|
25 | HTTP/1.1, part 5: Range Requests and Partial Responses
|
---|
26 | draft-ietf-httpbis-p5-range-09
|
---|
27 |
|
---|
28 | Abstract
|
---|
29 |
|
---|
30 | The Hypertext Transfer Protocol (HTTP) is an application-level
|
---|
31 | protocol for distributed, collaborative, hypermedia information
|
---|
32 | systems. HTTP has been in use by the World Wide Web global
|
---|
33 | information initiative since 1990. This document is Part 5 of the
|
---|
34 | seven-part specification that defines the protocol referred to as
|
---|
35 | "HTTP/1.1" and, taken together, obsoletes RFC 2616. Part 5 defines
|
---|
36 | range-specific requests and the rules for constructing and combining
|
---|
37 | responses to those requests.
|
---|
38 |
|
---|
39 | Editorial Note (To be removed by RFC Editor)
|
---|
40 |
|
---|
41 | Discussion of this draft should take place on the HTTPBIS working
|
---|
42 | group mailing list (ietf-http-wg@w3.org). The current issues list is
|
---|
43 | at <http://tools.ietf.org/wg/httpbis/trac/report/11> and related
|
---|
44 | documents (including fancy diffs) can be found at
|
---|
45 | <http://tools.ietf.org/wg/httpbis/>.
|
---|
46 |
|
---|
47 | The changes in this draft are summarized in Appendix D.10.
|
---|
48 |
|
---|
49 | Status of this Memo
|
---|
50 |
|
---|
51 | This Internet-Draft is submitted to IETF in full conformance with the
|
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 | Fielding, et al. Expires September 9, 2010 [Page 1]
|
---|
56 |
|
---|
57 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
58 |
|
---|
59 |
|
---|
60 | provisions of BCP 78 and BCP 79.
|
---|
61 |
|
---|
62 | Internet-Drafts are working documents of the Internet Engineering
|
---|
63 | Task Force (IETF), its areas, and its working groups. Note that
|
---|
64 | other groups may also distribute working documents as Internet-
|
---|
65 | Drafts.
|
---|
66 |
|
---|
67 | Internet-Drafts are draft documents valid for a maximum of six months
|
---|
68 | and may be updated, replaced, or obsoleted by other documents at any
|
---|
69 | time. It is inappropriate to use Internet-Drafts as reference
|
---|
70 | material or to cite them other than as "work in progress."
|
---|
71 |
|
---|
72 | The list of current Internet-Drafts can be accessed at
|
---|
73 | http://www.ietf.org/ietf/1id-abstracts.txt.
|
---|
74 |
|
---|
75 | The list of Internet-Draft Shadow Directories can be accessed at
|
---|
76 | http://www.ietf.org/shadow.html.
|
---|
77 |
|
---|
78 | This Internet-Draft will expire on September 9, 2010.
|
---|
79 |
|
---|
80 | Copyright Notice
|
---|
81 |
|
---|
82 | Copyright (c) 2010 IETF Trust and the persons identified as the
|
---|
83 | document authors. All rights reserved.
|
---|
84 |
|
---|
85 | This document is subject to BCP 78 and the IETF Trust's Legal
|
---|
86 | Provisions Relating to IETF Documents
|
---|
87 | (http://trustee.ietf.org/license-info) in effect on the date of
|
---|
88 | publication of this document. Please review these documents
|
---|
89 | carefully, as they describe your rights and restrictions with respect
|
---|
90 | to this document. Code Components extracted from this document must
|
---|
91 | include Simplified BSD License text as described in Section 4.e of
|
---|
92 | the Trust Legal Provisions and are provided without warranty as
|
---|
93 | described in the BSD License.
|
---|
94 |
|
---|
95 | This document may contain material from IETF Documents or IETF
|
---|
96 | Contributions published or made publicly available before November
|
---|
97 | 10, 2008. The person(s) controlling the copyright in some of this
|
---|
98 | material may not have granted the IETF Trust the right to allow
|
---|
99 | modifications of such material outside the IETF Standards Process.
|
---|
100 | Without obtaining an adequate license from the person(s) controlling
|
---|
101 | the copyright in such materials, this document may not be modified
|
---|
102 | outside the IETF Standards Process, and derivative works of it may
|
---|
103 | not be created outside the IETF Standards Process, except to format
|
---|
104 | it for publication as an RFC or to translate it into languages other
|
---|
105 | than English.
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 | Fielding, et al. Expires September 9, 2010 [Page 2]
|
---|
112 |
|
---|
113 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
114 |
|
---|
115 |
|
---|
116 | Table of Contents
|
---|
117 |
|
---|
118 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4
|
---|
119 | 1.1. Requirements . . . . . . . . . . . . . . . . . . . . . . . 4
|
---|
120 | 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 4
|
---|
121 | 1.2.1. Core Rules . . . . . . . . . . . . . . . . . . . . . . 5
|
---|
122 | 1.2.2. ABNF Rules defined in other Parts of the
|
---|
123 | Specification . . . . . . . . . . . . . . . . . . . . 5
|
---|
124 | 2. Range Units . . . . . . . . . . . . . . . . . . . . . . . . . 5
|
---|
125 | 3. Status Code Definitions . . . . . . . . . . . . . . . . . . . 5
|
---|
126 | 3.1. 206 Partial Content . . . . . . . . . . . . . . . . . . . 6
|
---|
127 | 3.2. 416 Requested Range Not Satisfiable . . . . . . . . . . . 6
|
---|
128 | 4. Combining Ranges . . . . . . . . . . . . . . . . . . . . . . . 7
|
---|
129 | 5. Header Field Definitions . . . . . . . . . . . . . . . . . . . 7
|
---|
130 | 5.1. Accept-Ranges . . . . . . . . . . . . . . . . . . . . . . 7
|
---|
131 | 5.2. Content-Range . . . . . . . . . . . . . . . . . . . . . . 8
|
---|
132 | 5.3. If-Range . . . . . . . . . . . . . . . . . . . . . . . . . 10
|
---|
133 | 5.4. Range . . . . . . . . . . . . . . . . . . . . . . . . . . 11
|
---|
134 | 5.4.1. Byte Ranges . . . . . . . . . . . . . . . . . . . . . 11
|
---|
135 | 5.4.2. Range Retrieval Requests . . . . . . . . . . . . . . . 13
|
---|
136 | 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14
|
---|
137 | 6.1. Status Code Registration . . . . . . . . . . . . . . . . . 14
|
---|
138 | 6.2. Message Header Registration . . . . . . . . . . . . . . . 14
|
---|
139 | 7. Security Considerations . . . . . . . . . . . . . . . . . . . 14
|
---|
140 | 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 14
|
---|
141 | 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 15
|
---|
142 | 9.1. Normative References . . . . . . . . . . . . . . . . . . . 15
|
---|
143 | 9.2. Informative References . . . . . . . . . . . . . . . . . . 16
|
---|
144 | Appendix A. Internet Media Type multipart/byteranges . . . . . . 16
|
---|
145 | Appendix B. Compatibility with Previous Versions . . . . . . . . 18
|
---|
146 | B.1. Changes from RFC 2068 . . . . . . . . . . . . . . . . . . 18
|
---|
147 | B.2. Changes from RFC 2616 . . . . . . . . . . . . . . . . . . 19
|
---|
148 | Appendix C. Collected ABNF . . . . . . . . . . . . . . . . . . . 19
|
---|
149 | Appendix D. Change Log (to be removed by RFC Editor before
|
---|
150 | publication) . . . . . . . . . . . . . . . . . . . . 20
|
---|
151 | D.1. Since RFC2616 . . . . . . . . . . . . . . . . . . . . . . 20
|
---|
152 | D.2. Since draft-ietf-httpbis-p5-range-00 . . . . . . . . . . . 21
|
---|
153 | D.3. Since draft-ietf-httpbis-p5-range-01 . . . . . . . . . . . 21
|
---|
154 | D.4. Since draft-ietf-httpbis-p5-range-02 . . . . . . . . . . . 21
|
---|
155 | D.5. Since draft-ietf-httpbis-p5-range-03 . . . . . . . . . . . 21
|
---|
156 | D.6. Since draft-ietf-httpbis-p5-range-04 . . . . . . . . . . . 21
|
---|
157 | D.7. Since draft-ietf-httpbis-p5-range-05 . . . . . . . . . . . 22
|
---|
158 | D.8. Since draft-ietf-httpbis-p5-range-06 . . . . . . . . . . . 22
|
---|
159 | D.9. Since draft-ietf-httpbis-p5-range-07 . . . . . . . . . . . 22
|
---|
160 | D.10. Since draft-ietf-httpbis-p5-range-08 . . . . . . . . . . . 23
|
---|
161 | Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
|
---|
162 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 24
|
---|
163 |
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 | Fielding, et al. Expires September 9, 2010 [Page 3]
|
---|
168 |
|
---|
169 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
170 |
|
---|
171 |
|
---|
172 | 1. Introduction
|
---|
173 |
|
---|
174 | HTTP clients often encounter interrupted data transfers as a result
|
---|
175 | of cancelled requests or dropped connections. When a cache has
|
---|
176 | stored a partial representation, it is desirable to request the
|
---|
177 | remainder of that representation in a subsequent request rather than
|
---|
178 | transfer the entire representation. There are also a number of Web
|
---|
179 | applications that benefit from being able to request only a subset of
|
---|
180 | a larger representation, such as a single page of a very large
|
---|
181 | document or only part of an image to be rendered by a device with
|
---|
182 | limited local storage.
|
---|
183 |
|
---|
184 | This document defines HTTP/1.1 range requests, partial responses, and
|
---|
185 | the multipart/byteranges media type. The protocol for range requests
|
---|
186 | is an OPTIONAL feature of HTTP, designed so resources or recipients
|
---|
187 | that do not implement this feature can respond as if it is a normal
|
---|
188 | GET request without impacting interoperability. Partial responses
|
---|
189 | are indicated by a distinct status code to not be mistaken for full
|
---|
190 | responses by intermediate caches that might not implement the
|
---|
191 | feature.
|
---|
192 |
|
---|
193 | Although the HTTP range request mechanism is designed to allow for
|
---|
194 | extensible range types, this specification only defines requests for
|
---|
195 | byte ranges.
|
---|
196 |
|
---|
197 | 1.1. Requirements
|
---|
198 |
|
---|
199 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
---|
200 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
|
---|
201 | document are to be interpreted as described in [RFC2119].
|
---|
202 |
|
---|
203 | An implementation is not compliant if it fails to satisfy one or more
|
---|
204 | of the MUST or REQUIRED level requirements for the protocols it
|
---|
205 | implements. An implementation that satisfies all the MUST or
|
---|
206 | REQUIRED level and all the SHOULD level requirements for its
|
---|
207 | protocols is said to be "unconditionally compliant"; one that
|
---|
208 | satisfies all the MUST level requirements but not all the SHOULD
|
---|
209 | level requirements for its protocols is said to be "conditionally
|
---|
210 | compliant."
|
---|
211 |
|
---|
212 | 1.2. Syntax Notation
|
---|
213 |
|
---|
214 | This specification uses the ABNF syntax defined in Section 1.2 of
|
---|
215 | [Part1] (which extends the syntax defined in [RFC5234] with a list
|
---|
216 | rule). Appendix C shows the collected ABNF, with the list rule
|
---|
217 | expanded.
|
---|
218 |
|
---|
219 | The following core rules are included by reference, as defined in
|
---|
220 |
|
---|
221 |
|
---|
222 |
|
---|
223 | Fielding, et al. Expires September 9, 2010 [Page 4]
|
---|
224 |
|
---|
225 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
226 |
|
---|
227 |
|
---|
228 | [RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF
|
---|
229 | (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote),
|
---|
230 | HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any 8-bit
|
---|
231 | sequence of data), SP (space), VCHAR (any visible USASCII character),
|
---|
232 | and WSP (whitespace).
|
---|
233 |
|
---|
234 | 1.2.1. Core Rules
|
---|
235 |
|
---|
236 | The core rules below are defined in Section 1.2.2 of [Part1]:
|
---|
237 |
|
---|
238 | token = <token, defined in [Part1], Section 1.2.2>
|
---|
239 | OWS = <OWS, defined in [Part1], Section 1.2.2>
|
---|
240 |
|
---|
241 | 1.2.2. ABNF Rules defined in other Parts of the Specification
|
---|
242 |
|
---|
243 | The ABNF rules below are defined in other parts:
|
---|
244 |
|
---|
245 | HTTP-date = <HTTP-date, defined in [Part1], Section 6.1>
|
---|
246 |
|
---|
247 |
|
---|
248 | entity-tag = <entity-tag, defined in [Part4], Section 2>
|
---|
249 |
|
---|
250 |
|
---|
251 | 2. Range Units
|
---|
252 |
|
---|
253 | HTTP/1.1 allows a client to request that only part (a range of) the
|
---|
254 | response entity be included within the response. HTTP/1.1 uses range
|
---|
255 | units in the Range (Section 5.4) and Content-Range (Section 5.2)
|
---|
256 | header fields. An entity can be broken down into subranges according
|
---|
257 | to various structural units.
|
---|
258 |
|
---|
259 | range-unit = bytes-unit / other-range-unit
|
---|
260 | bytes-unit = "bytes"
|
---|
261 | other-range-unit = token
|
---|
262 |
|
---|
263 | HTTP/1.1 has been designed to allow implementations of applications
|
---|
264 | that do not depend on knowledge of ranges. The only range unit
|
---|
265 | defined by HTTP/1.1 is "bytes".
|
---|
266 |
|
---|
267 | If a range unit is not understood in a request, a server MUST ignore
|
---|
268 | the whole Range header (Section 5.4). If a range unit is not
|
---|
269 | understood in a response, an intermediary SHOULD pass the response to
|
---|
270 | the client; a client MUST fail.
|
---|
271 |
|
---|
272 |
|
---|
273 | 3. Status Code Definitions
|
---|
274 |
|
---|
275 |
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 | Fielding, et al. Expires September 9, 2010 [Page 5]
|
---|
280 |
|
---|
281 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
282 |
|
---|
283 |
|
---|
284 | 3.1. 206 Partial Content
|
---|
285 |
|
---|
286 | The server has fulfilled the partial GET request for the resource.
|
---|
287 | The request MUST have included a Range header field (Section 5.4)
|
---|
288 | indicating the desired range, and MAY have included an If-Range
|
---|
289 | header field (Section 5.3) to make the request conditional.
|
---|
290 |
|
---|
291 | The response MUST include the following header fields:
|
---|
292 |
|
---|
293 | o Either a Content-Range header field (Section 5.2) indicating the
|
---|
294 | range included with this response, or a multipart/byteranges
|
---|
295 | Content-Type including Content-Range fields for each part. If a
|
---|
296 | Content-Length header field is present in the response, its value
|
---|
297 | MUST match the actual number of OCTETs transmitted in the message-
|
---|
298 | body.
|
---|
299 |
|
---|
300 | o Date
|
---|
301 |
|
---|
302 | o ETag and/or Content-Location, if the header would have been sent
|
---|
303 | in a 200 response to the same request
|
---|
304 |
|
---|
305 | o Expires, Cache-Control, and/or Vary, if the field-value might
|
---|
306 | differ from that sent in any previous response for the same
|
---|
307 | variant
|
---|
308 |
|
---|
309 | If the 206 response is the result of an If-Range request, the
|
---|
310 | response SHOULD NOT include other entity-headers. Otherwise, the
|
---|
311 | response MUST include all of the entity-headers that would have been
|
---|
312 | returned with a 200 (OK) response to the same request.
|
---|
313 |
|
---|
314 | A cache MUST NOT combine a 206 response with other previously cached
|
---|
315 | content if the ETag or Last-Modified headers do not match exactly,
|
---|
316 | see Section 4.
|
---|
317 |
|
---|
318 | A cache that does not support the Range and Content-Range headers
|
---|
319 | MUST NOT cache 206 (Partial Content) responses. Furthermore, if a
|
---|
320 | response uses a range unit that is not understood by the cache, then
|
---|
321 | it MUST NOT be cached either.
|
---|
322 |
|
---|
323 | 3.2. 416 Requested Range Not Satisfiable
|
---|
324 |
|
---|
325 | A server SHOULD return a response with this status code if a request
|
---|
326 | included a Range request-header field (Section 5.4), and none of the
|
---|
327 | ranges-specifier values in this field overlap the current extent of
|
---|
328 | the selected resource, and the request did not include an If-Range
|
---|
329 | request-header field. (For byte-ranges, this means that the first-
|
---|
330 | byte-pos of all of the byte-range-spec values were greater than the
|
---|
331 | current length of the selected resource.)
|
---|
332 |
|
---|
333 |
|
---|
334 |
|
---|
335 | Fielding, et al. Expires September 9, 2010 [Page 6]
|
---|
336 |
|
---|
337 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
338 |
|
---|
339 |
|
---|
340 | When this status code is returned for a byte-range request, the
|
---|
341 | response SHOULD include a Content-Range entity-header field
|
---|
342 | specifying the current length of the selected resource (see
|
---|
343 | Section 5.2). This response MUST NOT use the multipart/byteranges
|
---|
344 | content-type.
|
---|
345 |
|
---|
346 |
|
---|
347 | 4. Combining Ranges
|
---|
348 |
|
---|
349 | A response might transfer only a subrange of an entity-body, either
|
---|
350 | because the request included one or more Range specifications, or
|
---|
351 | because a connection was broken prematurely. After several such
|
---|
352 | transfers, a cache might have received several ranges of the same
|
---|
353 | entity-body.
|
---|
354 |
|
---|
355 | If a cache has a stored non-empty set of subranges for an entity, and
|
---|
356 | an incoming response transfers another subrange, the cache MAY
|
---|
357 | combine the new subrange with the existing set if both the following
|
---|
358 | conditions are met:
|
---|
359 |
|
---|
360 | o Both the incoming response and the cache entry have a cache
|
---|
361 | validator.
|
---|
362 |
|
---|
363 | o The two cache validators match using the strong comparison
|
---|
364 | function (see Section 4 of [Part4]).
|
---|
365 |
|
---|
366 | If either requirement is not met, the cache MUST use only the most
|
---|
367 | recent partial response (based on the Date values transmitted with
|
---|
368 | every response, and using the incoming response if these values are
|
---|
369 | equal or missing), and MUST discard the other partial information.
|
---|
370 |
|
---|
371 |
|
---|
372 | 5. Header Field Definitions
|
---|
373 |
|
---|
374 | This section defines the syntax and semantics of HTTP/1.1 header
|
---|
375 | fields related to range requests and partial responses.
|
---|
376 |
|
---|
377 | For entity-header fields, both sender and recipient refer to either
|
---|
378 | the client or the server, depending on who sends and who receives the
|
---|
379 | entity.
|
---|
380 |
|
---|
381 | 5.1. Accept-Ranges
|
---|
382 |
|
---|
383 | The "Accept-Ranges" response-header field allows a resource to
|
---|
384 | indicate its acceptance of range requests.
|
---|
385 |
|
---|
386 | Accept-Ranges = "Accept-Ranges" ":" OWS Accept-Ranges-v
|
---|
387 | Accept-Ranges-v = acceptable-ranges
|
---|
388 |
|
---|
389 |
|
---|
390 |
|
---|
391 | Fielding, et al. Expires September 9, 2010 [Page 7]
|
---|
392 |
|
---|
393 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
394 |
|
---|
395 |
|
---|
396 | acceptable-ranges = 1#range-unit / "none"
|
---|
397 |
|
---|
398 | Origin servers that accept byte-range requests MAY send
|
---|
399 |
|
---|
400 | Accept-Ranges: bytes
|
---|
401 |
|
---|
402 | but are not required to do so. Clients MAY generate range requests
|
---|
403 | without having received this header for the resource involved. Range
|
---|
404 | units are defined in Section 2.
|
---|
405 |
|
---|
406 | Servers that do not accept any kind of range request for a resource
|
---|
407 | MAY send
|
---|
408 |
|
---|
409 | Accept-Ranges: none
|
---|
410 |
|
---|
411 | to advise the client not to attempt a range request.
|
---|
412 |
|
---|
413 | 5.2. Content-Range
|
---|
414 |
|
---|
415 | The "Content-Range" entity-header field is sent with a partial
|
---|
416 | entity-body to specify where in the full entity-body the partial body
|
---|
417 | should be applied. Range units are defined in Section 2.
|
---|
418 |
|
---|
419 | Content-Range = "Content-Range" ":" OWS Content-Range-v
|
---|
420 | Content-Range-v = content-range-spec
|
---|
421 |
|
---|
422 | content-range-spec = byte-content-range-spec
|
---|
423 | / other-content-range-spec
|
---|
424 | byte-content-range-spec = bytes-unit SP
|
---|
425 | byte-range-resp-spec "/"
|
---|
426 | ( instance-length / "*" )
|
---|
427 |
|
---|
428 | byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
|
---|
429 | / "*"
|
---|
430 |
|
---|
431 | instance-length = 1*DIGIT
|
---|
432 |
|
---|
433 | other-content-range-spec = other-range-unit SP
|
---|
434 | other-range-resp-spec
|
---|
435 | other-range-resp-spec = *CHAR
|
---|
436 |
|
---|
437 | The header SHOULD indicate the total length of the full entity-body,
|
---|
438 | unless this length is unknown or difficult to determine. The
|
---|
439 | asterisk "*" character means that the instance-length is unknown at
|
---|
440 | the time when the response was generated.
|
---|
441 |
|
---|
442 | Unlike byte-ranges-specifier values (see Section 5.4.1), a byte-
|
---|
443 | range-resp-spec MUST only specify one range, and MUST contain
|
---|
444 |
|
---|
445 |
|
---|
446 |
|
---|
447 | Fielding, et al. Expires September 9, 2010 [Page 8]
|
---|
448 |
|
---|
449 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
450 |
|
---|
451 |
|
---|
452 | absolute byte positions for both the first and last byte of the
|
---|
453 | range.
|
---|
454 |
|
---|
455 | A byte-content-range-spec with a byte-range-resp-spec whose last-
|
---|
456 | byte-pos value is less than its first-byte-pos value, or whose
|
---|
457 | instance-length value is less than or equal to its last-byte-pos
|
---|
458 | value, is invalid. The recipient of an invalid byte-content-range-
|
---|
459 | spec MUST ignore it and any content transferred along with it.
|
---|
460 |
|
---|
461 | In the case of a byte range request: A server sending a response with
|
---|
462 | status code 416 (Requested range not satisfiable) SHOULD include a
|
---|
463 | Content-Range field with a byte-range-resp-spec of "*". The
|
---|
464 | instance-length specifies the current length of the selected
|
---|
465 | resource. A response with status code 206 (Partial Content) MUST NOT
|
---|
466 | include a Content-Range field with a byte-range-resp-spec of "*".
|
---|
467 |
|
---|
468 | Examples of byte-content-range-spec values, assuming that the entity
|
---|
469 | contains a total of 1234 bytes:
|
---|
470 |
|
---|
471 | o The first 500 bytes:
|
---|
472 |
|
---|
473 | bytes 0-499/1234
|
---|
474 |
|
---|
475 | o The second 500 bytes:
|
---|
476 |
|
---|
477 | bytes 500-999/1234
|
---|
478 |
|
---|
479 | o All except for the first 500 bytes:
|
---|
480 |
|
---|
481 | bytes 500-1233/1234
|
---|
482 |
|
---|
483 | o The last 500 bytes:
|
---|
484 |
|
---|
485 | bytes 734-1233/1234
|
---|
486 |
|
---|
487 | When an HTTP message includes the content of a single range (for
|
---|
488 | example, a response to a request for a single range, or to a request
|
---|
489 | for a set of ranges that overlap without any holes), this content is
|
---|
490 | transmitted with a Content-Range header, and a Content-Length header
|
---|
491 | showing the number of bytes actually transferred. For example,
|
---|
492 |
|
---|
493 | HTTP/1.1 206 Partial Content
|
---|
494 | Date: Wed, 15 Nov 1995 06:25:24 GMT
|
---|
495 | Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
|
---|
496 | Content-Range: bytes 21010-47021/47022
|
---|
497 | Content-Length: 26012
|
---|
498 | Content-Type: image/gif
|
---|
499 |
|
---|
500 |
|
---|
501 |
|
---|
502 |
|
---|
503 | Fielding, et al. Expires September 9, 2010 [Page 9]
|
---|
504 |
|
---|
505 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
506 |
|
---|
507 |
|
---|
508 | When an HTTP message includes the content of multiple ranges (for
|
---|
509 | example, a response to a request for multiple non-overlapping
|
---|
510 | ranges), these are transmitted as a multipart message. The multipart
|
---|
511 | media type used for this purpose is "multipart/byteranges" as defined
|
---|
512 | in Appendix A. See Appendix B.1 for a compatibility issue.
|
---|
513 |
|
---|
514 | A response to a request for a single range MUST NOT be sent using the
|
---|
515 | multipart/byteranges media type. A response to a request for
|
---|
516 | multiple ranges, whose result is a single range, MAY be sent as a
|
---|
517 | multipart/byteranges media type with one part. A client that cannot
|
---|
518 | decode a multipart/byteranges message MUST NOT ask for multiple
|
---|
519 | ranges in a single request.
|
---|
520 |
|
---|
521 | When a client requests multiple ranges in one request, the server
|
---|
522 | SHOULD return them in the order that they appeared in the request.
|
---|
523 |
|
---|
524 | If the server ignores a byte-range-spec because it is syntactically
|
---|
525 | invalid, the server SHOULD treat the request as if the invalid Range
|
---|
526 | header field did not exist. (Normally, this means return a 200
|
---|
527 | response containing the full entity).
|
---|
528 |
|
---|
529 | If the server receives a request (other than one including an If-
|
---|
530 | Range request-header field) with an unsatisfiable Range request-
|
---|
531 | header field (that is, all of whose byte-range-spec values have a
|
---|
532 | first-byte-pos value greater than the current length of the selected
|
---|
533 | resource), it SHOULD return a response code of 416 (Requested range
|
---|
534 | not satisfiable) (Section 3.2).
|
---|
535 |
|
---|
536 | Note: Clients cannot depend on servers to send a 416 (Requested
|
---|
537 | range not satisfiable) response instead of a 200 (OK) response for
|
---|
538 | an unsatisfiable Range request-header, since not all servers
|
---|
539 | implement this request-header.
|
---|
540 |
|
---|
541 | 5.3. If-Range
|
---|
542 |
|
---|
543 | If a client has a partial copy of an entity in its cache, and wishes
|
---|
544 | to have an up-to-date copy of the entire entity in its cache, it
|
---|
545 | could use the Range request-header with a conditional GET (using
|
---|
546 | either or both of If-Unmodified-Since and If-Match.) However, if the
|
---|
547 | condition fails because the entity has been modified, the client
|
---|
548 | would then have to make a second request to obtain the entire current
|
---|
549 | entity-body.
|
---|
550 |
|
---|
551 | The "If-Range" request-header field allows a client to "short-
|
---|
552 | circuit" the second request. Informally, its meaning is "if the
|
---|
553 | entity is unchanged, send me the part(s) that I am missing;
|
---|
554 | otherwise, send me the entire new entity".
|
---|
555 |
|
---|
556 |
|
---|
557 |
|
---|
558 |
|
---|
559 | Fielding, et al. Expires September 9, 2010 [Page 10]
|
---|
560 |
|
---|
561 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
562 |
|
---|
563 |
|
---|
564 | If-Range = "If-Range" ":" OWS If-Range-v
|
---|
565 | If-Range-v = entity-tag / HTTP-date
|
---|
566 |
|
---|
567 | If the client has no entity tag for an entity, but does have a Last-
|
---|
568 | Modified date, it MAY use that date in an If-Range header. (The
|
---|
569 | server can distinguish between a valid HTTP-date and any form of
|
---|
570 | entity-tag by examining no more than two characters.) The If-Range
|
---|
571 | header SHOULD only be used together with a Range header, and MUST be
|
---|
572 | ignored if the request does not include a Range header, or if the
|
---|
573 | server does not support the sub-range operation.
|
---|
574 |
|
---|
575 | If the entity tag given in the If-Range header matches the current
|
---|
576 | cache validator for the entity, then the server SHOULD provide the
|
---|
577 | specified sub-range of the entity using a 206 (Partial Content)
|
---|
578 | response. If the cache validator does not match, then the server
|
---|
579 | SHOULD return the entire entity using a 200 (OK) response.
|
---|
580 |
|
---|
581 | 5.4. Range
|
---|
582 |
|
---|
583 | 5.4.1. Byte Ranges
|
---|
584 |
|
---|
585 | Since all HTTP entities are represented in HTTP messages as sequences
|
---|
586 | of bytes, the concept of a byte range is meaningful for any HTTP
|
---|
587 | entity. (However, not all clients and servers need to support byte-
|
---|
588 | range operations.)
|
---|
589 |
|
---|
590 | Byte range specifications in HTTP apply to the sequence of bytes in
|
---|
591 | the entity-body (not necessarily the same as the message-body).
|
---|
592 |
|
---|
593 | A byte range operation MAY specify a single range of bytes, or a set
|
---|
594 | of ranges within a single entity.
|
---|
595 |
|
---|
596 | byte-ranges-specifier = bytes-unit "=" byte-range-set
|
---|
597 | byte-range-set = 1#( byte-range-spec / suffix-byte-range-spec )
|
---|
598 | byte-range-spec = first-byte-pos "-" [ last-byte-pos ]
|
---|
599 | first-byte-pos = 1*DIGIT
|
---|
600 | last-byte-pos = 1*DIGIT
|
---|
601 |
|
---|
602 | The first-byte-pos value in a byte-range-spec gives the byte-offset
|
---|
603 | of the first byte in a range. The last-byte-pos value gives the
|
---|
604 | byte-offset of the last byte in the range; that is, the byte
|
---|
605 | positions specified are inclusive. Byte offsets start at zero.
|
---|
606 |
|
---|
607 | If the last-byte-pos value is present, it MUST be greater than or
|
---|
608 | equal to the first-byte-pos in that byte-range-spec, or the byte-
|
---|
609 | range-spec is syntactically invalid. The recipient of a byte-range-
|
---|
610 | set that includes one or more syntactically invalid byte-range-spec
|
---|
611 | values MUST ignore the header field that includes that byte-range-
|
---|
612 |
|
---|
613 |
|
---|
614 |
|
---|
615 | Fielding, et al. Expires September 9, 2010 [Page 11]
|
---|
616 |
|
---|
617 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
618 |
|
---|
619 |
|
---|
620 | set.
|
---|
621 |
|
---|
622 | If the last-byte-pos value is absent, or if the value is greater than
|
---|
623 | or equal to the current length of the entity-body, last-byte-pos is
|
---|
624 | taken to be equal to one less than the current length of the entity-
|
---|
625 | body in bytes.
|
---|
626 |
|
---|
627 | By its choice of last-byte-pos, a client can limit the number of
|
---|
628 | bytes retrieved without knowing the size of the entity.
|
---|
629 |
|
---|
630 | suffix-byte-range-spec = "-" suffix-length
|
---|
631 | suffix-length = 1*DIGIT
|
---|
632 |
|
---|
633 | A suffix-byte-range-spec is used to specify the suffix of the entity-
|
---|
634 | body, of a length given by the suffix-length value. (That is, this
|
---|
635 | form specifies the last N bytes of an entity-body.) If the entity is
|
---|
636 | shorter than the specified suffix-length, the entire entity-body is
|
---|
637 | used.
|
---|
638 |
|
---|
639 | If a syntactically valid byte-range-set includes at least one byte-
|
---|
640 | range-spec whose first-byte-pos is less than the current length of
|
---|
641 | the entity-body, or at least one suffix-byte-range-spec with a non-
|
---|
642 | zero suffix-length, then the byte-range-set is satisfiable.
|
---|
643 | Otherwise, the byte-range-set is unsatisfiable. If the byte-range-
|
---|
644 | set is unsatisfiable, the server SHOULD return a response with a
|
---|
645 | status of 416 (Requested range not satisfiable). Otherwise, the
|
---|
646 | server SHOULD return a response with a status of 206 (Partial
|
---|
647 | Content) containing the satisfiable ranges of the entity-body.
|
---|
648 |
|
---|
649 | Examples of byte-ranges-specifier values (assuming an entity-body of
|
---|
650 | length 10000):
|
---|
651 |
|
---|
652 | o The first 500 bytes (byte offsets 0-499, inclusive):
|
---|
653 |
|
---|
654 | bytes=0-499
|
---|
655 |
|
---|
656 | o The second 500 bytes (byte offsets 500-999, inclusive):
|
---|
657 |
|
---|
658 | bytes=500-999
|
---|
659 |
|
---|
660 | o The final 500 bytes (byte offsets 9500-9999, inclusive):
|
---|
661 |
|
---|
662 | bytes=-500
|
---|
663 |
|
---|
664 | Or:
|
---|
665 |
|
---|
666 | bytes=9500-
|
---|
667 |
|
---|
668 |
|
---|
669 |
|
---|
670 |
|
---|
671 | Fielding, et al. Expires September 9, 2010 [Page 12]
|
---|
672 |
|
---|
673 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
674 |
|
---|
675 |
|
---|
676 | o The first and last bytes only (bytes 0 and 9999):
|
---|
677 |
|
---|
678 | bytes=0-0,-1
|
---|
679 |
|
---|
680 | o Several legal but not canonical specifications of the second 500
|
---|
681 | bytes (byte offsets 500-999, inclusive):
|
---|
682 |
|
---|
683 | bytes=500-600,601-999
|
---|
684 | bytes=500-700,601-999
|
---|
685 |
|
---|
686 | 5.4.2. Range Retrieval Requests
|
---|
687 |
|
---|
688 | The "Range" request-header field defines the GET method (conditional
|
---|
689 | or not) to request one or more sub-ranges of the response entity-
|
---|
690 | body, instead of the entire entity body.
|
---|
691 |
|
---|
692 | Range = "Range" ":" OWS Range-v
|
---|
693 | Range-v = byte-ranges-specifier
|
---|
694 | / other-ranges-specifier
|
---|
695 | other-ranges-specifier = other-range-unit "=" other-range-set
|
---|
696 | other-range-set = 1*CHAR
|
---|
697 |
|
---|
698 | A server MAY ignore the Range header. However, HTTP/1.1 origin
|
---|
699 | servers and intermediate caches ought to support byte ranges when
|
---|
700 | possible, since Range supports efficient recovery from partially
|
---|
701 | failed transfers, and supports efficient partial retrieval of large
|
---|
702 | entities.
|
---|
703 |
|
---|
704 | If the server supports the Range header and the specified range or
|
---|
705 | ranges are appropriate for the entity:
|
---|
706 |
|
---|
707 | o The presence of a Range header in an unconditional GET modifies
|
---|
708 | what is returned if the GET is otherwise successful. In other
|
---|
709 | words, the response carries a status code of 206 (Partial Content)
|
---|
710 | instead of 200 (OK).
|
---|
711 |
|
---|
712 | o The presence of a Range header in a conditional GET (a request
|
---|
713 | using one or both of If-Modified-Since and If-None-Match, or one
|
---|
714 | or both of If-Unmodified-Since and If-Match) modifies what is
|
---|
715 | returned if the GET is otherwise successful and the condition is
|
---|
716 | true. It does not affect the 304 (Not Modified) response returned
|
---|
717 | if the conditional is false.
|
---|
718 |
|
---|
719 | In some cases, it might be more appropriate to use the If-Range
|
---|
720 | header (see Section 5.3) in addition to the Range header.
|
---|
721 |
|
---|
722 | If a proxy that supports ranges receives a Range request, forwards
|
---|
723 | the request to an inbound server, and receives an entire entity in
|
---|
724 |
|
---|
725 |
|
---|
726 |
|
---|
727 | Fielding, et al. Expires September 9, 2010 [Page 13]
|
---|
728 |
|
---|
729 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
730 |
|
---|
731 |
|
---|
732 | reply, it SHOULD only return the requested range to its client. It
|
---|
733 | SHOULD store the entire received response in its cache if that is
|
---|
734 | consistent with its cache allocation policies.
|
---|
735 |
|
---|
736 |
|
---|
737 | 6. IANA Considerations
|
---|
738 |
|
---|
739 | 6.1. Status Code Registration
|
---|
740 |
|
---|
741 | The HTTP Status Code Registry located at
|
---|
742 | <http://www.iana.org/assignments/http-status-codes> should be updated
|
---|
743 | with the registrations below:
|
---|
744 |
|
---|
745 | +-------+---------------------------------+-------------+
|
---|
746 | | Value | Description | Reference |
|
---|
747 | +-------+---------------------------------+-------------+
|
---|
748 | | 206 | Partial Content | Section 3.1 |
|
---|
749 | | 416 | Requested Range Not Satisfiable | Section 3.2 |
|
---|
750 | +-------+---------------------------------+-------------+
|
---|
751 |
|
---|
752 | 6.2. Message Header Registration
|
---|
753 |
|
---|
754 | The Message Header Registry located at <http://www.iana.org/
|
---|
755 | assignments/message-headers/message-header-index.html> should be
|
---|
756 | updated with the permanent registrations below (see [RFC3864]):
|
---|
757 |
|
---|
758 | +-------------------+----------+----------+-------------+
|
---|
759 | | Header Field Name | Protocol | Status | Reference |
|
---|
760 | +-------------------+----------+----------+-------------+
|
---|
761 | | Accept-Ranges | http | standard | Section 5.1 |
|
---|
762 | | Content-Range | http | standard | Section 5.2 |
|
---|
763 | | If-Range | http | standard | Section 5.3 |
|
---|
764 | | Range | http | standard | Section 5.4 |
|
---|
765 | +-------------------+----------+----------+-------------+
|
---|
766 |
|
---|
767 | The change controller is: "IETF (iesg@ietf.org) - Internet
|
---|
768 | Engineering Task Force".
|
---|
769 |
|
---|
770 |
|
---|
771 | 7. Security Considerations
|
---|
772 |
|
---|
773 | No additional security considerations have been identified beyond
|
---|
774 | those applicable to HTTP in general [Part1].
|
---|
775 |
|
---|
776 |
|
---|
777 | 8. Acknowledgments
|
---|
778 |
|
---|
779 | Most of the specification of ranges is based on work originally done
|
---|
780 |
|
---|
781 |
|
---|
782 |
|
---|
783 | Fielding, et al. Expires September 9, 2010 [Page 14]
|
---|
784 |
|
---|
785 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
786 |
|
---|
787 |
|
---|
788 | by Ari Luotonen and John Franks, with additional input from Steve
|
---|
789 | Zilles, Daniel W. Connolly, Roy T. Fielding, Jim Gettys, Martin
|
---|
790 | Hamilton, Koen Holtman, Shel Kaplan, Paul Leach, Alex Lopez-Ortiz,
|
---|
791 | Larry Masinter, Jeff Mogul, Lou Montulli, David W. Morris, Luigi
|
---|
792 | Rizzo, and Bill Weihl.
|
---|
793 |
|
---|
794 |
|
---|
795 | 9. References
|
---|
796 |
|
---|
797 | 9.1. Normative References
|
---|
798 |
|
---|
799 | [Part1] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
|
---|
800 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
|
---|
801 | and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections,
|
---|
802 | and Message Parsing", draft-ietf-httpbis-p1-messaging-09
|
---|
803 | (work in progress), March 2010.
|
---|
804 |
|
---|
805 | [Part3] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
|
---|
806 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
|
---|
807 | and J. Reschke, Ed., "HTTP/1.1, part 3: Message Payload
|
---|
808 | and Content Negotiation", draft-ietf-httpbis-p3-payload-09
|
---|
809 | (work in progress), March 2010.
|
---|
810 |
|
---|
811 | [Part4] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
|
---|
812 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
|
---|
813 | and J. Reschke, Ed., "HTTP/1.1, part 4: Conditional
|
---|
814 | Requests", draft-ietf-httpbis-p4-conditional-09 (work in
|
---|
815 | progress), March 2010.
|
---|
816 |
|
---|
817 | [Part6] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
|
---|
818 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
|
---|
819 | Nottingham, M., Ed., and J. Reschke, Ed., "HTTP/1.1, part
|
---|
820 | 6: Caching", draft-ietf-httpbis-p6-cache-09 (work in
|
---|
821 | progress), March 2010.
|
---|
822 |
|
---|
823 | [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
|
---|
824 | Extensions (MIME) Part Two: Media Types", RFC 2046,
|
---|
825 | November 1996.
|
---|
826 |
|
---|
827 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
|
---|
828 | Requirement Levels", BCP 14, RFC 2119, March 1997.
|
---|
829 |
|
---|
830 | [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
|
---|
831 | Specifications: ABNF", STD 68, RFC 5234, January 2008.
|
---|
832 |
|
---|
833 |
|
---|
834 |
|
---|
835 |
|
---|
836 |
|
---|
837 |
|
---|
838 |
|
---|
839 | Fielding, et al. Expires September 9, 2010 [Page 15]
|
---|
840 |
|
---|
841 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
842 |
|
---|
843 |
|
---|
844 | 9.2. Informative References
|
---|
845 |
|
---|
846 | [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
|
---|
847 | Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
|
---|
848 | Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
|
---|
849 |
|
---|
850 | [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
|
---|
851 | Procedures for Message Header Fields", BCP 90, RFC 3864,
|
---|
852 | September 2004.
|
---|
853 |
|
---|
854 | [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and
|
---|
855 | Registration Procedures", BCP 13, RFC 4288, December 2005.
|
---|
856 |
|
---|
857 |
|
---|
858 | Appendix A. Internet Media Type multipart/byteranges
|
---|
859 |
|
---|
860 | When an HTTP 206 (Partial Content) response message includes the
|
---|
861 | content of multiple ranges (a response to a request for multiple non-
|
---|
862 | overlapping ranges), these are transmitted as a multipart message-
|
---|
863 | body ([RFC2046], Section 5.1). The media type for this purpose is
|
---|
864 | called "multipart/byteranges". The following is to be registered
|
---|
865 | with IANA [RFC4288].
|
---|
866 |
|
---|
867 | Note: Despite the name "multipart/byteranges" is not limited to
|
---|
868 | the byte ranges only.
|
---|
869 |
|
---|
870 | The multipart/byteranges media type includes one or more parts, each
|
---|
871 | with its own Content-Type and Content-Range fields. The required
|
---|
872 | boundary parameter specifies the boundary string used to separate
|
---|
873 | each body-part.
|
---|
874 |
|
---|
875 | Type name: multipart
|
---|
876 |
|
---|
877 | Subtype name: byteranges
|
---|
878 |
|
---|
879 | Required parameters: boundary
|
---|
880 |
|
---|
881 | Optional parameters: none
|
---|
882 |
|
---|
883 | Encoding considerations: only "7bit", "8bit", or "binary" are
|
---|
884 | permitted
|
---|
885 |
|
---|
886 | Security considerations: none
|
---|
887 |
|
---|
888 | Interoperability considerations: none
|
---|
889 |
|
---|
890 |
|
---|
891 |
|
---|
892 |
|
---|
893 |
|
---|
894 |
|
---|
895 | Fielding, et al. Expires September 9, 2010 [Page 16]
|
---|
896 |
|
---|
897 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
898 |
|
---|
899 |
|
---|
900 | Published specification: This specification (see Appendix A).
|
---|
901 |
|
---|
902 | Applications that use this media type:
|
---|
903 |
|
---|
904 | Additional information:
|
---|
905 |
|
---|
906 | Magic number(s): none
|
---|
907 |
|
---|
908 | File extension(s): none
|
---|
909 |
|
---|
910 | Macintosh file type code(s): none
|
---|
911 |
|
---|
912 | Person and email address to contact for further information: See
|
---|
913 | Authors Section.
|
---|
914 |
|
---|
915 | Intended usage: COMMON
|
---|
916 |
|
---|
917 | Restrictions on usage: none
|
---|
918 |
|
---|
919 | Author/Change controller: IESG
|
---|
920 |
|
---|
921 | For example:
|
---|
922 |
|
---|
923 | HTTP/1.1 206 Partial Content
|
---|
924 | Date: Wed, 15 Nov 1995 06:25:24 GMT
|
---|
925 | Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
|
---|
926 | Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
|
---|
927 |
|
---|
928 | --THIS_STRING_SEPARATES
|
---|
929 | Content-type: application/pdf
|
---|
930 | Content-range: bytes 500-999/8000
|
---|
931 |
|
---|
932 | ...the first range...
|
---|
933 | --THIS_STRING_SEPARATES
|
---|
934 | Content-type: application/pdf
|
---|
935 | Content-range: bytes 7000-7999/8000
|
---|
936 |
|
---|
937 | ...the second range
|
---|
938 | --THIS_STRING_SEPARATES--
|
---|
939 |
|
---|
940 |
|
---|
941 |
|
---|
942 |
|
---|
943 |
|
---|
944 |
|
---|
945 |
|
---|
946 |
|
---|
947 |
|
---|
948 |
|
---|
949 |
|
---|
950 |
|
---|
951 | Fielding, et al. Expires September 9, 2010 [Page 17]
|
---|
952 |
|
---|
953 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
954 |
|
---|
955 |
|
---|
956 | Other example:
|
---|
957 |
|
---|
958 | HTTP/1.1 206 Partial Content
|
---|
959 | Date: Tue, 14 Nov 1995 06:25:24 GMT
|
---|
960 | Last-Modified: Tue, 14 July 04:58:08 GMT
|
---|
961 | Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
|
---|
962 |
|
---|
963 | --THIS_STRING_SEPARATES
|
---|
964 | Content-type: video/example
|
---|
965 | Content-range: exampleunit 1.2-4.3/25
|
---|
966 |
|
---|
967 | ...the first range...
|
---|
968 | --THIS_STRING_SEPARATES
|
---|
969 | Content-type: video/example
|
---|
970 | Content-range: exampleunit 11.2-14.3/25
|
---|
971 |
|
---|
972 | ...the second range
|
---|
973 | --THIS_STRING_SEPARATES--
|
---|
974 |
|
---|
975 | Notes:
|
---|
976 |
|
---|
977 | 1. Additional CRLFs may precede the first boundary string in the
|
---|
978 | entity.
|
---|
979 |
|
---|
980 | 2. Although [RFC2046] permits the boundary string to be quoted, some
|
---|
981 | existing implementations handle a quoted boundary string
|
---|
982 | incorrectly.
|
---|
983 |
|
---|
984 | 3. A number of browsers and servers were coded to an early draft of
|
---|
985 | the byteranges specification to use a media type of multipart/
|
---|
986 | x-byteranges, which is almost, but not quite compatible with the
|
---|
987 | version documented in HTTP/1.1.
|
---|
988 |
|
---|
989 |
|
---|
990 | Appendix B. Compatibility with Previous Versions
|
---|
991 |
|
---|
992 | B.1. Changes from RFC 2068
|
---|
993 |
|
---|
994 | Transfer-coding and message lengths all interact in ways that
|
---|
995 | required fixing exactly when chunked encoding is used (to allow for
|
---|
996 | transfer encoding that may not be self delimiting); it was important
|
---|
997 | to straighten out exactly how message lengths are computed.
|
---|
998 | (Section 5.2, see also [Part1], [Part3] and [Part6])
|
---|
999 |
|
---|
1000 | There are situations where a server (especially a proxy) does not
|
---|
1001 | know the full length of a response but is capable of serving a
|
---|
1002 | byterange request. We therefore need a mechanism to allow byteranges
|
---|
1003 | with a content-range not indicating the full length of the message.
|
---|
1004 |
|
---|
1005 |
|
---|
1006 |
|
---|
1007 | Fielding, et al. Expires September 9, 2010 [Page 18]
|
---|
1008 |
|
---|
1009 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1010 |
|
---|
1011 |
|
---|
1012 | (Section 5.2)
|
---|
1013 |
|
---|
1014 | Range request responses would become very verbose if all meta-data
|
---|
1015 | were always returned; by allowing the server to only send needed
|
---|
1016 | headers in a 206 response, this problem can be avoided. (Section 3.1
|
---|
1017 | and 5.3)
|
---|
1018 |
|
---|
1019 | Fix problem with unsatisfiable range requests; there are two cases:
|
---|
1020 | syntactic problems, and range doesn't exist in the document. The 416
|
---|
1021 | status code was needed to resolve this ambiguity needed to indicate
|
---|
1022 | an error for a byte range request that falls outside of the actual
|
---|
1023 | contents of a document. (Section 3.2, 5.2)
|
---|
1024 |
|
---|
1025 | B.2. Changes from RFC 2616
|
---|
1026 |
|
---|
1027 | Clarify that it is not ok to use a weak cache validator in a 206
|
---|
1028 | response. (Section 3.1)
|
---|
1029 |
|
---|
1030 | Clarify that multipart/byteranges can consist of a single part.
|
---|
1031 | (Appendix A)
|
---|
1032 |
|
---|
1033 |
|
---|
1034 | Appendix C. Collected ABNF
|
---|
1035 |
|
---|
1036 | Accept-Ranges = "Accept-Ranges:" OWS Accept-Ranges-v
|
---|
1037 | Accept-Ranges-v = acceptable-ranges
|
---|
1038 |
|
---|
1039 | Content-Range = "Content-Range:" OWS Content-Range-v
|
---|
1040 | Content-Range-v = content-range-spec
|
---|
1041 |
|
---|
1042 | HTTP-date = <HTTP-date, defined in [Part1], Section 6.1>
|
---|
1043 |
|
---|
1044 | If-Range = "If-Range:" OWS If-Range-v
|
---|
1045 | If-Range-v = entity-tag / HTTP-date
|
---|
1046 |
|
---|
1047 | OWS = <OWS, defined in [Part1], Section 1.2.2>
|
---|
1048 |
|
---|
1049 | Range = "Range:" OWS Range-v
|
---|
1050 | Range-v = byte-ranges-specifier / other-ranges-specifier
|
---|
1051 |
|
---|
1052 | acceptable-ranges = ( *( "," OWS ) range-unit *( OWS "," [ OWS
|
---|
1053 | range-unit ] ) ) / "none"
|
---|
1054 |
|
---|
1055 | byte-content-range-spec = bytes-unit SP byte-range-resp-spec "/" (
|
---|
1056 | instance-length / "*" )
|
---|
1057 | byte-range-resp-spec = ( first-byte-pos "-" last-byte-pos ) / "*"
|
---|
1058 |
|
---|
1059 |
|
---|
1060 |
|
---|
1061 |
|
---|
1062 |
|
---|
1063 | Fielding, et al. Expires September 9, 2010 [Page 19]
|
---|
1064 |
|
---|
1065 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1066 |
|
---|
1067 |
|
---|
1068 | byte-range-set = ( *( "," OWS ) byte-range-spec ) / (
|
---|
1069 | suffix-byte-range-spec *( OWS "," [ ( OWS byte-range-spec ) /
|
---|
1070 | suffix-byte-range-spec ] ) )
|
---|
1071 | byte-range-spec = first-byte-pos "-" [ last-byte-pos ]
|
---|
1072 | byte-ranges-specifier = bytes-unit "=" byte-range-set
|
---|
1073 | bytes-unit = "bytes"
|
---|
1074 |
|
---|
1075 | content-range-spec = byte-content-range-spec /
|
---|
1076 | other-content-range-spec
|
---|
1077 |
|
---|
1078 | entity-tag = <entity-tag, defined in [Part4], Section 2>
|
---|
1079 |
|
---|
1080 | first-byte-pos = 1*DIGIT
|
---|
1081 |
|
---|
1082 | instance-length = 1*DIGIT
|
---|
1083 |
|
---|
1084 | last-byte-pos = 1*DIGIT
|
---|
1085 |
|
---|
1086 | other-content-range-spec = other-range-unit SP other-range-resp-spec
|
---|
1087 | other-range-resp-spec = *CHAR
|
---|
1088 | other-range-set = 1*CHAR
|
---|
1089 | other-range-unit = token
|
---|
1090 | other-ranges-specifier = other-range-unit "=" other-range-set
|
---|
1091 |
|
---|
1092 | range-unit = bytes-unit / other-range-unit
|
---|
1093 |
|
---|
1094 | suffix-byte-range-spec = "-" suffix-length
|
---|
1095 | suffix-length = 1*DIGIT
|
---|
1096 |
|
---|
1097 | token = <token, defined in [Part1], Section 1.2.2>
|
---|
1098 |
|
---|
1099 | ABNF diagnostics:
|
---|
1100 |
|
---|
1101 | ; Accept-Ranges defined but not used
|
---|
1102 | ; Content-Range defined but not used
|
---|
1103 | ; If-Range defined but not used
|
---|
1104 | ; Range defined but not used
|
---|
1105 |
|
---|
1106 |
|
---|
1107 | Appendix D. Change Log (to be removed by RFC Editor before publication)
|
---|
1108 |
|
---|
1109 | D.1. Since RFC2616
|
---|
1110 |
|
---|
1111 | Extracted relevant partitions from [RFC2616].
|
---|
1112 |
|
---|
1113 |
|
---|
1114 |
|
---|
1115 |
|
---|
1116 |
|
---|
1117 |
|
---|
1118 |
|
---|
1119 | Fielding, et al. Expires September 9, 2010 [Page 20]
|
---|
1120 |
|
---|
1121 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1122 |
|
---|
1123 |
|
---|
1124 | D.2. Since draft-ietf-httpbis-p5-range-00
|
---|
1125 |
|
---|
1126 | Closed issues:
|
---|
1127 |
|
---|
1128 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/18>: "Cache
|
---|
1129 | validators in 206 responses"
|
---|
1130 | (<http://purl.org/NET/http-errata#ifrange206>)
|
---|
1131 |
|
---|
1132 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/35>: "Normative and
|
---|
1133 | Informative references"
|
---|
1134 |
|
---|
1135 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/86>: "Normative up-
|
---|
1136 | to-date references"
|
---|
1137 |
|
---|
1138 | D.3. Since draft-ietf-httpbis-p5-range-01
|
---|
1139 |
|
---|
1140 | Closed issues:
|
---|
1141 |
|
---|
1142 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/55>: "Updating to
|
---|
1143 | RFC4288"
|
---|
1144 |
|
---|
1145 | Ongoing work on ABNF conversion
|
---|
1146 | (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>):
|
---|
1147 |
|
---|
1148 | o Add explicit references to BNF syntax and rules imported from
|
---|
1149 | other parts of the specification.
|
---|
1150 |
|
---|
1151 | D.4. Since draft-ietf-httpbis-p5-range-02
|
---|
1152 |
|
---|
1153 | Ongoing work on IANA Message Header Registration
|
---|
1154 | (<http://tools.ietf.org/wg/httpbis/trac/ticket/40>):
|
---|
1155 |
|
---|
1156 | o Reference RFC 3984, and update header registrations for headers
|
---|
1157 | defined in this document.
|
---|
1158 |
|
---|
1159 | D.5. Since draft-ietf-httpbis-p5-range-03
|
---|
1160 |
|
---|
1161 | D.6. Since draft-ietf-httpbis-p5-range-04
|
---|
1162 |
|
---|
1163 | Closed issues:
|
---|
1164 |
|
---|
1165 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/133>: "multipart/
|
---|
1166 | byteranges minimum number of parts"
|
---|
1167 |
|
---|
1168 | Ongoing work on ABNF conversion
|
---|
1169 | (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>):
|
---|
1170 |
|
---|
1171 |
|
---|
1172 |
|
---|
1173 |
|
---|
1174 |
|
---|
1175 | Fielding, et al. Expires September 9, 2010 [Page 21]
|
---|
1176 |
|
---|
1177 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1178 |
|
---|
1179 |
|
---|
1180 | o Use "/" instead of "|" for alternatives.
|
---|
1181 |
|
---|
1182 | o Introduce new ABNF rules for "bad" whitespace ("BWS"), optional
|
---|
1183 | whitespace ("OWS") and required whitespace ("RWS").
|
---|
1184 |
|
---|
1185 | o Rewrite ABNFs to spell out whitespace rules, factor out header
|
---|
1186 | value format definitions.
|
---|
1187 |
|
---|
1188 | D.7. Since draft-ietf-httpbis-p5-range-05
|
---|
1189 |
|
---|
1190 | Closed issues:
|
---|
1191 |
|
---|
1192 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/142>: "State base
|
---|
1193 | for *-byte-pos and suffix-length"
|
---|
1194 |
|
---|
1195 | Ongoing work on Custom Ranges
|
---|
1196 | (<http://tools.ietf.org/wg/httpbis/trac/ticket/85>):
|
---|
1197 |
|
---|
1198 | o Remove bias in favor of byte ranges; allow custom ranges in ABNF.
|
---|
1199 |
|
---|
1200 | Final work on ABNF conversion
|
---|
1201 | (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>):
|
---|
1202 |
|
---|
1203 | o Add appendix containing collected and expanded ABNF, reorganize
|
---|
1204 | ABNF introduction.
|
---|
1205 |
|
---|
1206 | D.8. Since draft-ietf-httpbis-p5-range-06
|
---|
1207 |
|
---|
1208 | Closed issues:
|
---|
1209 |
|
---|
1210 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/161>: "base for
|
---|
1211 | numeric protocol elements"
|
---|
1212 |
|
---|
1213 | D.9. Since draft-ietf-httpbis-p5-range-07
|
---|
1214 |
|
---|
1215 | Closed issues:
|
---|
1216 |
|
---|
1217 | o Fixed discrepancy in the If-Range definition about allowed
|
---|
1218 | validators.
|
---|
1219 |
|
---|
1220 | o <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/150>:
|
---|
1221 | "multipart/byteranges for custom range units"
|
---|
1222 |
|
---|
1223 | o <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/151>: "range
|
---|
1224 | unit missing from other-ranges-specifier in Range header"
|
---|
1225 |
|
---|
1226 | o <http://tools.ietf.org/wg/httpbis/trac/ticket/198>: "move IANA
|
---|
1227 | registrations for optional status codes"
|
---|
1228 |
|
---|
1229 |
|
---|
1230 |
|
---|
1231 | Fielding, et al. Expires September 9, 2010 [Page 22]
|
---|
1232 |
|
---|
1233 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1234 |
|
---|
1235 |
|
---|
1236 | D.10. Since draft-ietf-httpbis-p5-range-08
|
---|
1237 |
|
---|
1238 | No significant changes.
|
---|
1239 |
|
---|
1240 |
|
---|
1241 | Index
|
---|
1242 |
|
---|
1243 | 2
|
---|
1244 | 206 Partial Content (status code) 6
|
---|
1245 |
|
---|
1246 | 4
|
---|
1247 | 416 Requested Range Not Satisfiable (status code) 6
|
---|
1248 |
|
---|
1249 | A
|
---|
1250 | Accept-Ranges header 7
|
---|
1251 |
|
---|
1252 | C
|
---|
1253 | Content-Range header 8
|
---|
1254 |
|
---|
1255 | G
|
---|
1256 | Grammar
|
---|
1257 | Accept-Ranges 7
|
---|
1258 | Accept-Ranges-v 7
|
---|
1259 | acceptable-ranges 7
|
---|
1260 | byte-content-range-spec 8
|
---|
1261 | byte-range-resp-spec 8
|
---|
1262 | byte-range-set 11
|
---|
1263 | byte-range-spec 11
|
---|
1264 | byte-ranges-specifier 11
|
---|
1265 | bytes-unit 5
|
---|
1266 | Content-Range 8
|
---|
1267 | content-range-spec 8
|
---|
1268 | Content-Range-v 8
|
---|
1269 | first-byte-pos 11
|
---|
1270 | If-Range 11
|
---|
1271 | If-Range-v 11
|
---|
1272 | instance-length 8
|
---|
1273 | last-byte-pos 11
|
---|
1274 | other-range-unit 5
|
---|
1275 | Range 13
|
---|
1276 | range-unit 5
|
---|
1277 | ranges-specifier 11
|
---|
1278 | suffix-byte-range-spec 12
|
---|
1279 | suffix-length 12
|
---|
1280 |
|
---|
1281 | H
|
---|
1282 | Headers
|
---|
1283 | Accept-Ranges 7
|
---|
1284 |
|
---|
1285 |
|
---|
1286 |
|
---|
1287 | Fielding, et al. Expires September 9, 2010 [Page 23]
|
---|
1288 |
|
---|
1289 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1290 |
|
---|
1291 |
|
---|
1292 | Content-Range 8
|
---|
1293 | If-Range 10
|
---|
1294 | Range 11
|
---|
1295 |
|
---|
1296 | I
|
---|
1297 | If-Range header 10
|
---|
1298 |
|
---|
1299 | M
|
---|
1300 | Media Type
|
---|
1301 | multipart/byteranges 16
|
---|
1302 | multipart/x-byteranges 18
|
---|
1303 | multipart/byteranges Media Type 16
|
---|
1304 | multipart/x-byteranges Media Type 18
|
---|
1305 |
|
---|
1306 | R
|
---|
1307 | Range header 11
|
---|
1308 |
|
---|
1309 | S
|
---|
1310 | Status Codes
|
---|
1311 | 206 Partial Content 6
|
---|
1312 | 416 Requested Range Not Satisfiable 6
|
---|
1313 |
|
---|
1314 |
|
---|
1315 | Authors' Addresses
|
---|
1316 |
|
---|
1317 | Roy T. Fielding (editor)
|
---|
1318 | Day Software
|
---|
1319 | 23 Corporate Plaza DR, Suite 280
|
---|
1320 | Newport Beach, CA 92660
|
---|
1321 | USA
|
---|
1322 |
|
---|
1323 | Phone: +1-949-706-5300
|
---|
1324 | Fax: +1-949-706-5305
|
---|
1325 | Email: fielding@gbiv.com
|
---|
1326 | URI: http://roy.gbiv.com/
|
---|
1327 |
|
---|
1328 |
|
---|
1329 | Jim Gettys
|
---|
1330 | One Laptop per Child
|
---|
1331 | 21 Oak Knoll Road
|
---|
1332 | Carlisle, MA 01741
|
---|
1333 | USA
|
---|
1334 |
|
---|
1335 | Email: jg@laptop.org
|
---|
1336 | URI: http://www.laptop.org/
|
---|
1337 |
|
---|
1338 |
|
---|
1339 |
|
---|
1340 |
|
---|
1341 |
|
---|
1342 |
|
---|
1343 | Fielding, et al. Expires September 9, 2010 [Page 24]
|
---|
1344 |
|
---|
1345 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1346 |
|
---|
1347 |
|
---|
1348 | Jeffrey C. Mogul
|
---|
1349 | Hewlett-Packard Company
|
---|
1350 | HP Labs, Large Scale Systems Group
|
---|
1351 | 1501 Page Mill Road, MS 1177
|
---|
1352 | Palo Alto, CA 94304
|
---|
1353 | USA
|
---|
1354 |
|
---|
1355 | Email: JeffMogul@acm.org
|
---|
1356 |
|
---|
1357 |
|
---|
1358 | Henrik Frystyk Nielsen
|
---|
1359 | Microsoft Corporation
|
---|
1360 | 1 Microsoft Way
|
---|
1361 | Redmond, WA 98052
|
---|
1362 | USA
|
---|
1363 |
|
---|
1364 | Email: henrikn@microsoft.com
|
---|
1365 |
|
---|
1366 |
|
---|
1367 | Larry Masinter
|
---|
1368 | Adobe Systems, Incorporated
|
---|
1369 | 345 Park Ave
|
---|
1370 | San Jose, CA 95110
|
---|
1371 | USA
|
---|
1372 |
|
---|
1373 | Email: LMM@acm.org
|
---|
1374 | URI: http://larry.masinter.net/
|
---|
1375 |
|
---|
1376 |
|
---|
1377 | Paul J. Leach
|
---|
1378 | Microsoft Corporation
|
---|
1379 | 1 Microsoft Way
|
---|
1380 | Redmond, WA 98052
|
---|
1381 |
|
---|
1382 | Email: paulle@microsoft.com
|
---|
1383 |
|
---|
1384 |
|
---|
1385 | Tim Berners-Lee
|
---|
1386 | World Wide Web Consortium
|
---|
1387 | MIT Computer Science and Artificial Intelligence Laboratory
|
---|
1388 | The Stata Center, Building 32
|
---|
1389 | 32 Vassar Street
|
---|
1390 | Cambridge, MA 02139
|
---|
1391 | USA
|
---|
1392 |
|
---|
1393 | Email: timbl@w3.org
|
---|
1394 | URI: http://www.w3.org/People/Berners-Lee/
|
---|
1395 |
|
---|
1396 |
|
---|
1397 |
|
---|
1398 |
|
---|
1399 | Fielding, et al. Expires September 9, 2010 [Page 25]
|
---|
1400 |
|
---|
1401 | Internet-Draft HTTP/1.1, Part 5 March 2010
|
---|
1402 |
|
---|
1403 |
|
---|
1404 | Yves Lafon (editor)
|
---|
1405 | World Wide Web Consortium
|
---|
1406 | W3C / ERCIM
|
---|
1407 | 2004, rte des Lucioles
|
---|
1408 | Sophia-Antipolis, AM 06902
|
---|
1409 | France
|
---|
1410 |
|
---|
1411 | Email: ylafon@w3.org
|
---|
1412 | URI: http://www.raubacapeu.net/people/yves/
|
---|
1413 |
|
---|
1414 |
|
---|
1415 | Julian F. Reschke (editor)
|
---|
1416 | greenbytes GmbH
|
---|
1417 | Hafenweg 16
|
---|
1418 | Muenster, NW 48155
|
---|
1419 | Germany
|
---|
1420 |
|
---|
1421 | Phone: +49 251 2807760
|
---|
1422 | Fax: +49 251 2807761
|
---|
1423 | Email: julian.reschke@greenbytes.de
|
---|
1424 | URI: http://greenbytes.de/tech/webdav/
|
---|
1425 |
|
---|
1426 |
|
---|
1427 |
|
---|
1428 |
|
---|
1429 |
|
---|
1430 |
|
---|
1431 |
|
---|
1432 |
|
---|
1433 |
|
---|
1434 |
|
---|
1435 |
|
---|
1436 |
|
---|
1437 |
|
---|
1438 |
|
---|
1439 |
|
---|
1440 |
|
---|
1441 |
|
---|
1442 |
|
---|
1443 |
|
---|
1444 |
|
---|
1445 |
|
---|
1446 |
|
---|
1447 |
|
---|
1448 |
|
---|
1449 |
|
---|
1450 |
|
---|
1451 |
|
---|
1452 |
|
---|
1453 |
|
---|
1454 |
|
---|
1455 | Fielding, et al. Expires September 9, 2010 [Page 26]
|
---|
1456 |
|
---|