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