/[suikacvs]/webroot/www/2004/id/draft-ietf-http-range-retrieval-00.txt
Suika

Contents of /webroot/www/2004/id/draft-ietf-http-range-retrieval-00.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Jun 15 08:04:04 2004 UTC (19 years, 11 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
New

1
2 INTERNET-DRAFT Ari Luotonen
3 Expires: August, 1996 Netscape Communications Corporation
4 John Franks
5 Northwestern University
6 <draft-ietf-http-range-retrieval-00.txt> February 22, 1996
7
8
9 Byte Range Retrieval Extension to HTTP
10
11
12 STATUS OF THIS MEMO
13
14 This document supersedes <draft-luotonen-http-url-byterage-02.txt>.
15
16 A subgroup of the HTTP working group has developed this after several
17 rounds of discussion. Some but not all parts of this proposal are
18 currently implemented in commercial Web servers and browsers.
19
20 This document is an Internet-Draft. Internet-Drafts are working
21 documents of the Internet Engineering Task Force (IETF), its areas,
22 and its working groups. Note that other groups may also distribute
23 working documents as Internet-Drafts.
24
25 Internet-Drafts are draft documents valid for a maximum of six months
26 and may be updated, replaced, or obsoleted by other documents at any
27 time. It is inappropriate to use Internet-Drafts as reference
28 material or to cite them other than as ``work in progress.''
29
30 To learn the current status of any Internet-Draft, please check the
31 ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
32 Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
33 munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
34 ftp.isi.edu (US West Coast).
35
36
37 TABLE OF CONTENTS
38
39 1. Overview ................................................. 2
40
41 2. Accept-Ranges HTTP response header ....................... 3
42
43 3. Byte range HTTP request .................................. 3
44 3.1. The Range HTTP request header ............................ 3
45 3.2. Conditional Range retrievals.............................. 5
46
47 4. Byte range HTTP response ................................. 7
48 4.1. 206 Partial Content status code .......................... 7
49 4.2. The Content-Range HTTP response header ................... 8
50
51
52
53 Luotonen, Franks [Page 1]
54
55 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
56
57
58 4.3. Multiple ranges as multipart MIME messages ............... 9
59 4.4. Caching issues .......................................... 10
60
61 5. Future considerations ................................... 10
62 5.1. Extending Accept-Ranges, Range and Content-Range headers 10
63 5.2. Other possible ranges ................................... 11
64
65 6. References .............................................. 12
66
67 7. Authors' Addresses ...................................... 12
68 Contributors ............................................ 12
69
70
71 1. OVERVIEW
72
73 It is possible in Web clients to interrupt the connection before the
74 data transfer has finished. As a result the client may have partial
75 documents or images loaded into its memory. It would be useful to be
76 able to request the server to return the missing portion of the
77 document only, instead of retransferring the entire file, if the page
78 is re-entered later.
79
80 There are also a number of Web applications that would benefit from
81 being able to request the server to give a byte range of a document.
82 As an example an Adobe PDF viewer would need to be able to access
83 individual pages by byte range; the table that defines those ranges
84 is located at the end of the PDF file (this is the case in the new
85 to-be-released PDF format).
86
87 Setting this standard will promote interoperability between clients,
88 servers and intermediate proxy servers, make (partial) caching
89 effective, and save bandwidth.
90
91 This specification defines only the byte ranges. It shows other
92 types of ranges as an example of how this specification could be
93 extended, as proof of its generality. Those examples should not be
94 viewed as their definition.
95
96 This specification is simple enough to be adopted quickly by the
97 server authors/vendors, and be quickly and easily exploited on the
98 client side. The proposed solution will be backward compatible with
99 existing proxy servers, and once this specification becomes official
100 it will actually be possible to support this in a smart way in proxy
101 servers.
102
103 This specification can be applied to document types for which byte
104 ranges make sense; there are types for which they don't, and this
105 specification is not trying to enforce semantics for byte ranges for
106
107
108
109 Luotonen, Franks [Page 2]
110
111 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
112
113
114 them. In practice most of the data in the Web is represented as a
115 byte stream, and can be addressed with a byte range to retrieve a
116 desired portion of it. This is especially useful when there is a
117 partial copy of the document, the transfer of which was interrupted
118 by the user, but later resumed, in which case only the missing
119 portion needs to be transferred.
120
121 Byte range requests are typically generated by software, not written
122 by humans.
123
124
125 2. ACCEPT-RANGES HTTP RESPONSE HEADER
126
127 The server needs to let the client know that it can support byte
128 ranges. This is done through the Accept-Ranges HTTP header when a
129 server is returning a document that supports byte ranges:
130
131 Accept-Ranges: bytes
132
133 The server will send this header only for documents for which it will
134 be able to satisfy the byte range request, e.g. for PDF documents, or
135 images, which can be partially reloaded if the user interrupts the
136 page load, and image gets only partially cached.
137
138 Because of the architecture of the byte range request and response,
139 the client is not limited to attempting to use byte ranges only when
140 this header is present. The Request-Range header is simply ignored
141 by a server that does not support it, and it will send the entire
142 document as a response.
143
144
145 3. BYTE RANGE HTTP REQUEST
146
147 Byte range request is made like any other HTTP request, with the
148 addition of the Range: HTTP Request header.
149
150
151 3.1. The Range HTTP Request Header
152
153 The client requests a byte range via the Range: HTTP header:
154
155 Range: bytes=0-500,5000-
156
157
158 The Range: header is defined extensibly so that it can take a generic
159 parameter specifying the type of range. The parameter name for byte
160 ranges is "bytes". The syntax of this parameter is described below.
161
162
163
164
165 Luotonen, Franks [Page 3]
166
167 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
168
169
170 The name of the byte range parameter is bytes. It is passed to the
171 server in the Range: HTTP request header, followed by an equal sign
172 and the byte range specification. (In an earlier version of this
173 draft, it was passed to the server appended to the end of the path
174 part of the URL, separated by a semicolon).
175
176
177 Note About CGI Applications
178
179 As defined by the CGI/1.1 specification, the value of the Range:
180 header will be passed to CGI scripts in the HTTP_RANGE environment
181 variable. The CGI applications can choose to support it if they
182 so desire, and if it is possible. If the CGI applications do not
183 support it, or if the content they return changes from call to
184 call, they simply ignore the presence of that header, and return
185 the entire document.
186
187
188 Each range consists of one or two non-negative integers, separated by
189 a hyphen. The first integer must always be less than or equal to the
190 second one. One of these integers may be missing, but not both at the
191 same time. The hyphen is always there, so it is possible to tell
192 which number is missing.
193
194 If the first number is missing, it means to return the n last bytes
195 of the document, where n is the second number. If n is equal to, or
196 larger than, the size of the document minus one, then the entire file
197 is returned.
198
199 If the second number is missing, it means the end of document. That
200 is, all the bytes starting from byte n until the end of the document,
201 where n is the first number.
202
203 The first byte in a document is byte number 0.
204
205 If the second number is larger than the size of the document minus
206 one, it is taken to mean the size of the document minus one (that is,
207 the end of the document).
208
209 The range is inclusive; as an example, the range 500-1000 includes
210 bytes from 500 to 1000, including 500 and 1000.
211
212 There may be multiple ranges, separated by a comma. The order of the
213 ranges is the preferred order in which the ranges should be returned.
214
215 In the case that the second integer is smaller than the first one,
216 that particular range is tagged as invalid, and ignored. If it was
217 the only requested byte range, the entire document is returned.
218
219
220
221 Luotonen, Franks [Page 4]
222
223 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
224
225
226 Otherwise the remaining valid ranges will be returned.
227
228 The byte ranges refer to ranges in data as they are transferred over
229 the network (and retrieved by the client). E.g. if in an imaginary
230 system the server stores all lines terminated by CR LF, but turns
231 them into a single LF before sending the data, then byte ranges refer
232 to ranges inside this modified data (the one with single LF line
233 separators). That is, the ranges refer to the data that the client
234 would see.
235
236 The byte ranges apply to the "raw" data, that is, the data encoded by
237 Content-encoding; but not to the "armored" data, that is, the data
238 encoded by content-transfer-encoding.
239
240
241 Examples of the Range: header with the bytes parameter
242
243 The first 500 bytes:
244
245 Range: bytes=0-499
246
247 The second 500 bytes:
248
249 Range: bytes=500-999
250
251 All bytes except for the first 500 until the end of document:
252
253 Range: bytes=500-
254
255 The last 500 bytes of the document:
256
257 Range: bytes=-500
258
259 Two separate ranges:
260
261 Range: bytes=50-99,200-249
262
263 The first 100 bytes, 1000 bytes starting from the byte number 500,
264 and the remainder of the document starting from byte number 4000
265 (byte numbering starts from zero):
266
267 Range: bytes=0-99,500-1499,4000-
268
269 The first 100 bytes, 1000 bytes starting from the byte number 500,
270 and the last 200 bytes of the document:
271
272 Range: bytes=0-99,500-1499,-200
273
274
275
276
277 Luotonen, Franks [Page 5]
278
279 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
280
281
282 3.2 Conditional Range Retrievals
283
284 There are three cases of Range retrievals:
285
286 A) Unconditional
287 B) Insertion
288 C) Tentative
289
290 A) Unconditional Range Retrieval
291
292 An unconditional range retrieval always returns the selected range
293 (if it exists).
294
295 Servers that do not support Range: return entire resource.
296
297 B) Insertion Range Retrieval
298
299 Insertion type range retrieval returns the selected range if the
300 request-validator is valid, otherwise returns entire resource.
301
302 Servers that do not support Range: return entire resource if the
303 validator is valid, else return nothing + "306 Modified".
304
305 Case (B) is for filling in a hole in a cached resource, perhaps after
306 an interrupted retrieval, or perhaps after a previous Unconditional
307 or Tentative Range: request.
308
309 Note that if the server does not support Range:, it requires an extra
310 round-trip to update a cached resource with a hole in it.
311
312 C) Tentative Range Retrieval
313
314 A tentative range retrieval returns the selected range if the
315 request-validator is NOT valid, otherwise returns nothing + "304 Not
316 Modified"
317
318 Servers that do not support Range: return entire resource if the
319 validator is not valid, else return nothing + "304 Not Modified".
320
321 Case (C) is a way of asking only for a specified range, but in a way
322 that reloads it only if the client's cache is stale. For example,
323 you may have a large GIF image in your cache, and you may want to
324 know if its GIF header has changed (so that you can do an early
325 rendering of the enclosing HTML file), but you do not want to
326 retrieve the whole image right away.
327
328 Examples
329
330
331
332
333 Luotonen, Franks [Page 6]
334
335 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
336
337
338 The three cases are implemented in HTTP/1.1 using some combination of
339 these three headers
340 Range:
341 If-invalid:
342 If-valid:
343 or
344 Range:
345 If-Modified-Since:
346 Unless-Modified-Since:
347
348 See (*) below for more about using *-Modified-Since.
349
350 Case A (Unconditional) is done using
351
352 GET /image.gif HTTP/1.0
353 Range: bytes=0-128
354
355 Case B (Insertion) is done using
356
357 GET /image.gif HTTP/1.0
358 Range: bytes=0-128
359 If-valid: "xxxyxxyx"
360 or
361 GET /image.gif HTTP/1.0
362 Range: bytes=0-128
363 Unless-modified-since: Wed, 15 Nov 1995 06:25:15 GMT
364
365 Case C (Tentative) is done using
366
367 GET /image.gif HTTP/1.0
368 Range: bytes=0-128
369 If-invalid: "xxxyxxyx"
370 or
371 GET /image.gif HTTP/1.0
372 Range: bytes=0-128
373 If-modified-since: Wed, 15 Nov 1995 06:25:15 GMT
374
375
376 (*) We can get rid of "Unless-modified-since:" if we adopt the rule
377 that the "If-valid:" header either takes a quoted string (in which
378 case it is an opaque validator) or a string that does not include
379 quotes (in which case it must be an HTTP-date value). This saves a
380 few header bytes.
381
382
383 4. BYTE RANGE HTTP RESPONSE
384
385 4.1. 206 Partial Content Status Code
386
387
388
389 Luotonen, Franks [Page 7]
390
391 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
392
393
394 The byte range response uses the 206 Partial Content HTTP response
395 status. Servers and CGI applications not supporting byte ranges will
396 simply ignore the Range: header in the request, and return the entire
397 document in a 200 response.
398
399 Existing proxy servers only cache 200 Ok responses. This way
400 intermediate proxy servers will not mistakenly cache a partial
401 document as if it was the entire document.
402
403 If the request includes multiple ranges, the response is sent back as
404 a multipart MIME message, with content-type multipart/x-byteranges.
405 A server may, but is not required to, send also a single byte range
406 as a multipart message.
407
408 If there are overlapping ranges the behavior for each range doesn't
409 change. That is, a range will not be truncated, merged, or left out,
410 just because there is an overlap.
411
412 If a request that includes a Range: header also includes an Unless-
413 Modified-Since header and the resource was modified since the
414 specified time, or also includes an If-Valid header and the validator
415 does not match,
416
417 if the server supports Range:, it will send a normal 200 OK
418 response, and transfer the entire resource instead.
419
420 if the server does not support Range:, it will send 306 Modified
421 response, and will not transfer any part of the resource.
422
423 if the server supports neither Range: nor the validation header
424 (Unless-Modified-Since or If-Valid) then it will send a normal 200
425 OK response, and transfer the entire resource.
426
427 If a request that includes a Range: header also includes an If-
428 Modified-Since header and the resource was not modified since the
429 specified time, or also includes an If-Invalid header and the
430 validator matches, the server will send a 304 Not Modified response,
431 and will not transfer any part of the resource.
432
433
434 4.2 The Content-Range HTTP Response Header
435
436 The Content-Range HTTP response header is sent back to provide
437 verification and information about the range and total size of the
438 document. This header can be used by the client to determine which
439 one of the requested ranges is in question. Syntax:
440
441 Content-Range: bytes X-Y/Z
442
443
444
445 Luotonen, Franks [Page 8]
446
447 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
448
449
450 where:
451
452 X is the number of the first byte returned (the first byte is
453 byte number zero).
454
455 Y is the number of the last byte returned (in case of the end of
456 the document this is one smaller than the size of the document
457 in bytes).
458
459 Z is the total size of the document in bytes.
460
461
462 Examples of the Content-Range: HTTP Response Header
463
464 The first 500 bytes of a 1234 byte document:
465
466 Content-Range: bytes 0-499/1234
467
468 The second 500 bytes of the same document:
469
470 Content-Range: bytes 500-999/1234
471
472 All bytes until the end of document, except for the first 500 bytes:
473
474 Content-Range: bytes 500-1233/1234
475
476 The last 500 bytes of the same document:
477
478 Content-Range: bytes 734-1233/1234
479
480
481 Example of a response:
482
483 HTTP/1.0 206 Partial content
484 Server: Netscape-Communications/2.0
485 Date: Wed, 15 Nov 1995 06:25:24 GMT
486 Last-modified: Wed, 15 Nov 1995 04:58:08 GMT
487 Content-range: 21010-47021/47022
488 Content-length: 26012
489 Content-type: image/gif
490
491
492
493 4.3. Multiple Ranges as Multipart MIME Messages
494
495 Multipart MIME is defined in [RFC-1521]. With byteranges, the
496 multipart MIME message uses content-type multipart/x-byteranges, with
497 a boundary parameter.
498
499
500
501 Luotonen, Franks [Page 9]
502
503 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
504
505
506 Example:
507
508 Content-type: multipart/x-byteranges; boundary=THIS_STRING_SEPARATES
509
510 --THIS_STRING_SEPARATES
511 Content-type: application/x-pdf
512 Content-range: bytes 500-999/8000
513
514 ...the first range...
515 --THIS_STRING_SEPARATES
516 Content-type: application/x-pdf
517 Content-range: bytes 7000-7999/8000
518
519 ...the second range...
520 --THIS_STRING_SEPARATES--
521
522
523 4.4. Caching Issues
524
525 The server must give Last-modified headers for each range request
526 whenever possible, and the client side must take care of having all
527 the fragments in sync. Conditional GET (the GET request with the If-
528 modified-since header) works as expected with byte ranges. That is,
529 the requested range is returned if the document has been modified
530 since the given date. Otherwise, a 304 Not Modified response is
531 sent.
532
533 Ranges can be cached, and if the Last-modified header matches they
534 can be combined. If a received Last-modified date at any time
535 differs from the ones in the cache, all the cached ranges will be
536 discarded.
537
538 The client side should monitor the Last-modified header value
539 returned by the server, and make sure that all of its individual
540 fragments are in sync. If there are older ones they should be
541 immediately discarded and re-retrieved.
542
543
544 5. FUTURE CONSIDERATIONS
545
546 5.1. Extending Accept-Ranges, Range and Content-Range headers
547
548 If at some point there will be additional parameters for the Range:
549 header, they should be separated by the semicolon character.
550
551 Example:
552
553 Range: param1=bar; param2=xyzzy
554
555
556
557 Luotonen, Franks [Page 10]
558
559 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
560
561
562 This specification does not define semantics for cases with multiple
563 Range: parameters. Future specifications should define semantics for
564 these. Until then, Range: headers with parameters that cannot be
565 understood should be ignored.
566
567
568 5.2. Other Possible Ranges
569
570 There are other kinds of ranges that can be addressed in a similar
571 fashion; this document does not define them, but both the Range: HTTP
572 request header and the Content-Range: HTTP header are defined so that
573 it is possible to extend them.
574
575 As an example, there might be a "lines" parameter, with the same kind
576 of range specification, and the Content-Range: header would then
577 specify the numbers in lines. Example:
578
579 GET /dir/foo HTTP/1.0
580 Range: lines=20-30
581
582 The response from a 123 line document would be:
583
584 HTTP/1.0 206 Partial Content
585 Content-Range: lines 20-30/123
586 Last-Modified: ...
587 Content-Length: 773
588 Content-Type: text/plain
589
590 This could be useful for such things as structured text files like
591 address lists or digests of mail and news, but isn't meaningful to
592 such document types as GIF or PDF.
593
594 Other examples might be document format specific ranges, such as
595 chapters:
596
597 GET /dir/foo HTTP/1.0
598 Range: chapters=6-9
599
600 206 Partial Content
601 Content-Range: chapters 6-9/12
602 Last-Modified: ...
603 Content-Length: 36023
604 Content-Type: application/x-book-type
605
606
607
608
609
610
611
612
613 Luotonen, Franks [Page 11]
614
615 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
616
617
618 6. References
619
620 [RFC-1521] N. Borenstein, N. Freed, "MIME (Multipurpose Internet Mail
621 Extensions), Part One: Mechanisms for Specifying and
622 Describing the Format of Internet Message Bodies",
623 RFC 1521, Bellcore, Innosoft, September 1993
624
625 [HTTP] T. Berners-Lee, R. Fielding, H. Frystyk, "Hypertext
626 Transfer Protocol -- HTTP/1.0",
627 draft-ietf-http-v10-spec-04.html, October 14, 1995.
628
629 [CGI] R. McCool et al, "Common Gateway Interface -- CGI/1.1",
630 http://hoohoo.ncsa.uiuc.edu/cgi/, NCSA, 1994.
631
632
633 7. Authors' Addresses:
634
635 Ari Luotonen <ari@netscape.com>
636 Netscape Communications Corporation
637 501 E. Middlefield Road
638 Mountain View, CA 94043
639 USA
640
641 John Franks <john@math.nwu.edu>
642 Department of Mathematics
643 Northwestern University
644 Evanston, IL 60208-2730
645
646 The subgroup of the HTTP working group that contributed in producing
647 this draft (in alphabetical order; apologies for any omissions):
648
649 Daniel W. Connolly connolly@beach.w3.org
650 Roy T. Fielding fielding@avron.ics.uci.edu
651 John Franks john@math.nwu.edu
652 Jim Gettys jg@w3.org
653 Martin Hamilton martin@mrrl.lut.ac.uk
654 Koen Holtman koen@win.tue.nl
655 Shel Kaplan sjk@amazon.com
656 Paul Leach paulle@microsoft.com
657 Alex Lopez-Ortiz alopez-o@barrow.uwaterloo.ca
658 Ari Luotonen luotonen@netscape.com
659 Larry Masinter masinter@parc.xerox.com
660 Jeff Mogul mogul@pa.dec.com
661 Lou Montulli montulli@mozilla.com
662 David W. Morris dwm@shell.portal.com
663 Luigi Rizzo luigi@labinfo.iet.unipi.it
664 Bill Weihl weihl@pa.dec.com
665 Steve Zilles szilles@mv.us.adobe.com
666
667
668
669 Luotonen, Franks [Page 12]
670
671 BYTE RANGE RETRIEVAL EXTENSION TO HTTP INTERNET-DRAFT February 1996
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725 Luotonen, Franks [Page 13]
726

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24