source: draft-ietf-httpbis/latest/p5-range.xml @ 31

Last change on this file since 31 was 31, checked in by julian.reschke@…, 12 years ago

Insert cross-document references.

  • Property svn:eol-style set to native
File size: 37.5 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE rfc [
3  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
4  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
5  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
6  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
7  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
8  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
9  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
10  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
11  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
12  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
13  <!ENTITY ID-VERSION "latest">
14  <!ENTITY ID-MONTH "December">
15  <!ENTITY ID-YEAR "2007">
16  <!ENTITY messaging                  "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
17  <!ENTITY weak-and-strong-validators "<xref target='Part4' x:rel='#weak.and.strong.validators' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
18]>
19<?rfc toc="yes" ?>
20<?rfc symrefs="yes" ?>
21<?rfc sortrefs="yes" ?>
22<?rfc compact="yes"?>
23<?rfc subcompact="no" ?>
24<?rfc linkmailto="no" ?>
25<?rfc editing="no" ?>
26<?rfc-ext allow-markup-in-artwork="yes" ?>
27<?rfc-ext include-references-in-index="yes" ?>
28<rfc obsoletes="2068, 2616, 2617" category="std"
29     ipr="full3978" docName="draft-ietf-httpbis-p5-range-&ID-VERSION;"
30     xmlns:x='http://purl.org/net/xml2rfc/ext' xmlns:ed="http://greenbytes.de/2002/rfcedit">
31<front>
32
33  <title abbrev="HTTP/1.1">HTTP/1.1, part 5: Range Requests and Partial Responses</title>
34
35  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
36    <organization abbrev="Day Software">Day Software</organization>
37    <address>
38      <postal>
39        <street>23 Corporate Plaza DR, Suite 280</street>
40        <city>Newport Beach</city>
41        <region>CA</region>
42        <code>92660</code>
43        <country>USA</country>
44      </postal>
45      <phone>+1-949-706-5300</phone>
46      <facsimile>+1-949-706-5305</facsimile>
47      <email>fielding@gbiv.com</email>
48      <uri>http://roy.gbiv.com/</uri>
49    </address>
50  </author>
51
52  <author initials="J." surname="Gettys" fullname="Jim Gettys">
53    <organization>One Laptop per Child</organization>
54    <address>
55      <postal>
56        <street>21 Oak Knoll Road</street>
57        <city>Carlisle</city>
58        <region>MA</region>
59        <code>01741</code>
60        <country>USA</country>
61      </postal>
62      <email>jg@laptop.org</email>
63      <uri>http://www.laptop.org/</uri>
64    </address>
65  </author>
66 
67  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
68    <organization abbrev="HP">Hewlett-Packard Company</organization>
69    <address>
70      <postal>
71        <street>HP Labs, Large Scale Systems Group</street>
72        <street>1501 Page Mill Road, MS 1177</street>
73        <city>Palo Alto</city>
74        <region>CA</region>
75        <code>94304</code>
76        <country>USA</country>
77      </postal>
78      <email>JeffMogul@acm.org</email>
79    </address>
80  </author>
81
82  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
83    <organization abbrev="Microsoft">Microsoft Corporation</organization>
84    <address>
85      <postal>
86        <street>1 Microsoft Way</street>
87        <city>Redmond</city>
88        <region>WA</region>
89        <code>98052</code>
90        <country>USA</country>
91      </postal>
92      <email>henrikn@microsoft.com</email>
93    </address>
94  </author>
95
96  <author initials="L." surname="Masinter" fullname="Larry Masinter">
97    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
98    <address>
99      <postal>
100        <street>345 Park Ave</street>
101        <city>San Jose</city>
102        <region>CA</region>
103        <code>95110</code>
104        <country>USA</country>
105      </postal>
106      <email>LMM@acm.org</email>
107      <uri>http://larry.masinter.net/</uri>
108    </address>
109  </author>
110 
111  <author initials="P." surname="Leach" fullname="Paul J. Leach">
112    <organization abbrev="Microsoft">Microsoft Corporation</organization>
113    <address>
114      <postal>
115        <street>1 Microsoft Way</street>
116        <city>Redmond</city>
117        <region>WA</region>
118        <code>98052</code>
119      </postal>
120      <email>paulle@microsoft.com</email>
121    </address>
122  </author>
123   
124  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
125    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
126    <address>
127      <postal>
128        <street>MIT Laboratory for Computer Science</street>
129        <street>545 Technology Square</street>
130        <city>Cambridge</city>
131        <region>MA</region>
132        <code>02139</code>
133        <country>USA</country>
134      </postal>
135      <facsimile>+1 (617) 258 8682</facsimile>
136      <email>timbl@w3.org</email>
137    </address>
138  </author>
139
140  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
141
142<abstract>
143<t>
144   The Hypertext Transfer Protocol (HTTP) is an application-level
145   protocol for distributed, collaborative, hypermedia information
146   systems. HTTP has been in use by the World Wide Web global information
147   initiative since 1990. This document is Part 5 of the eight-part specification
148   that defines the protocol referred to as "HTTP/1.1" and, taken together,
149   updates RFC 2616 and RFC 2617.  Part 5 defines range-specific requests and
150   the rules for constructing and combining responses to those requests.
151</t>
152</abstract>
153</front>
154<middle>
155<section title="Introduction" anchor="introduction">
156<t>
157   This document will define aspects of HTTP related to range requests,
158   partial responses, and the multipart/byteranges media type.  Right now
159   it only includes the extracted relevant sections of
160   <xref target="RFC2616">RFC 2616</xref> without edit.
161</t>
162</section>
163
164<section title="Range Units" anchor="range.units">
165<t>
166   HTTP/1.1 allows a client to request that only part (a range of) the
167   response entity be included within the response. HTTP/1.1 uses range
168   units in the Range (<xref target="header.range"/>) and Content-Range (<xref target="header.content-range"/>)
169   header fields. An entity can be broken down into subranges according
170   to various structural units.
171</t>
172<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="range-unit"/><iref primary="true" item="Grammar" subitem="bytes-unit"/><iref primary="true" item="Grammar" subitem="other-range-unit"/>
173   range-unit       = bytes-unit | other-range-unit
174   bytes-unit       = "bytes"
175   other-range-unit = token
176</artwork></figure>
177<t>
178   The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
179   implementations &MAY; ignore ranges specified using other units.
180</t>
181<t>
182   HTTP/1.1 has been designed to allow implementations of applications
183   that do not depend on knowledge of ranges.
184</t>
185</section>
186
187<section title="206 Partial Content" anchor="status.206">
188  <iref primary="true" item="206 Partial Content (status code)" x:for-anchor=""/>
189  <iref primary="true" item="Status Codes" subitem="206 Partial Content" x:for-anchor=""/>
190<t>
191   The server has fulfilled the partial GET request for the resource.
192   The request &MUST; have included a Range header field (<xref target="header.range"/>)
193   indicating the desired range, and &MAY; have included an If-Range
194   header field (<xref target="header.if-range"/>) to make the request conditional.
195</t>
196<t>
197   The response &MUST; include the following header fields:
198  <list style="symbols">
199    <t>
200        Either a Content-Range header field (<xref target="header.content-range"/>) indicating
201        the range included with this response, or a multipart/byteranges
202        Content-Type including Content-Range fields for each part. If a
203        Content-Length header field is present in the response, its
204        value &MUST; match the actual number of OCTETs transmitted in the
205        message-body.
206    </t>
207    <t>
208        Date
209    </t>
210    <t>
211        ETag and/or Content-Location, if the header would have been sent
212        in a 200 response to the same request
213    </t>
214    <t>
215        Expires, Cache-Control, and/or Vary, if the field-value might
216        differ from that sent in any previous response for the same
217        variant
218    </t>
219  </list>
220</t>
221<t>
222   If the 206 response is the result of an If-Range request that used a
223   strong cache validator (see &weak-and-strong-validators;), the response &SHOULD-NOT; 
224   include other entity-headers. If the response is the result of an
225   If-Range request that used a weak validator, the response &MUST-NOT;
226   include other entity-headers; this prevents inconsistencies between
227   cached entity-bodies and updated headers. Otherwise, the response
228   &MUST; include all of the entity-headers that would have been returned
229   with a 200 (OK) response to the same request.
230</t>
231<t>
232   A cache &MUST-NOT; combine a 206 response with other previously cached
233   content if the ETag or Last-Modified headers do not match exactly,
234   see <xref target="combining.byte.ranges" format="counter"/>.
235</t>
236<t>
237   A cache that does not support the Range and Content-Range headers
238   &MUST-NOT; cache 206 (Partial) responses.
239</t>
240</section>
241
242<section title="416 Requested Range Not Satisfiable" anchor="status.416">
243  <iref primary="true" item="416 Requested Range Not Satisfiable (status code)" x:for-anchor=""/>
244  <iref primary="true" item="Status Codes" subitem="416 Requested Range Not Satisfiable" x:for-anchor=""/>
245<t>
246   A server &SHOULD; return a response with this status code if a request
247   included a Range request-header field (<xref target="header.range"/>), and none of
248   the range-specifier values in this field overlap the current extent
249   of the selected resource, and the request did not include an If-Range
250   request-header field. (For byte-ranges, this means that the first-byte-pos
251   of all of the byte-range-spec values were greater than the
252   current length of the selected resource.)
253</t>
254<t>
255   When this status code is returned for a byte-range request, the
256   response &SHOULD; include a Content-Range entity-header field
257   specifying the current length of the selected resource (see <xref target="header.content-range"/>).
258   This response &MUST-NOT; use the multipart/byteranges content-type.
259</t>
260</section>
261
262<section title="Combining Byte Ranges" anchor="combining.byte.ranges">
263<t>
264   A response might transfer only a subrange of the bytes of an entity-body,
265   either because the request included one or more Range
266   specifications, or because a connection was broken prematurely. After
267   several such transfers, a cache might have received several ranges of
268   the same entity-body.
269</t>
270<t>
271   If a cache has a stored non-empty set of subranges for an entity, and
272   an incoming response transfers another subrange, the cache &MAY;
273   combine the new subrange with the existing set if both the following
274   conditions are met:
275  <list style="symbols">
276    <t>Both the incoming response and the cache entry have a cache
277        validator.</t>
278    <t>The two cache validators match using the strong comparison
279        function (see &weak-and-strong-validators;).</t>
280  </list>
281</t>
282<t>
283   If either requirement is not met, the cache &MUST; use only the most
284   recent partial response (based on the Date values transmitted with
285   every response, and using the incoming response if these values are
286   equal or missing), and &MUST; discard the other partial information.
287</t>
288</section>
289
290<section title="Header Field Definitions" anchor="header.fields">
291<t>
292   This section defines the syntax and semantics of all standard
293   HTTP/1.1 header fields. For entity-header fields, both sender and
294   recipient refer to either the client or the server, depending on who
295   sends and who receives the entity.
296</t>
297<section title="Accept-Ranges" anchor="header.accept-ranges">
298  <iref primary="true" item="Accept-Ranges header" x:for-anchor=""/>
299  <iref primary="true" item="Headers" subitem="Accept-Ranges" x:for-anchor=""/>
300<t>
301      The Accept-Ranges response-header field allows the server to
302      indicate its acceptance of range requests for a resource:
303</t>
304<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Ranges"/><iref primary="true" item="Grammar" subitem="acceptable-ranges"/>
305       Accept-Ranges     = "Accept-Ranges" ":" acceptable-ranges
306       acceptable-ranges = 1#range-unit | "none"
307</artwork></figure>
308<t>
309      Origin servers that accept byte-range requests &MAY; send
310</t>
311<figure><artwork type="example">
312       Accept-Ranges: bytes
313</artwork></figure>
314<t>
315      but are not required to do so. Clients &MAY; generate byte-range
316      requests without having received this header for the resource
317      involved. Range units are defined in <xref target="range.units"/>.
318</t>
319<t>
320      Servers that do not accept any kind of range request for a
321      resource &MAY; send
322</t>
323<figure><artwork type="example">
324       Accept-Ranges: none
325</artwork></figure>
326<t>
327      to advise the client not to attempt a range request.
328</t>
329</section>
330
331<section title="Content-Range" anchor="header.content-range">
332  <iref primary="true" item="Content-Range header" x:for-anchor=""/>
333  <iref primary="true" item="Headers" subitem="Content-Range" x:for-anchor=""/>
334<t>
335   The Content-Range entity-header is sent with a partial entity-body to
336   specify where in the full entity-body the partial body should be
337   applied. Range units are defined in <xref target="range.units"/>.
338</t>
339<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Range"/><iref primary="true" item="Grammar" subitem="content-range-spec"/><iref primary="true" item="Grammar" subitem="byte-content-range-spec"/><iref primary="true" item="Grammar" subitem="byte-range-resp-spec"/><iref primary="true" item="Grammar" subitem="instance-length"/>
340    Content-Range = "Content-Range" ":" content-range-spec
341
342    content-range-spec      = byte-content-range-spec
343    byte-content-range-spec = bytes-unit SP
344                              byte-range-resp-spec "/"
345                              ( instance-length | "*" )
346
347    byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
348                                   | "*"
349    instance-length           = 1*DIGIT
350</artwork></figure>
351<t>
352   The header &SHOULD; indicate the total length of the full entity-body,
353   unless this length is unknown or difficult to determine. The asterisk
354   "*" character means that the instance-length is unknown at the time
355   when the response was generated.
356</t>
357<t>
358   Unlike byte-ranges-specifier values (see <xref target="byte.ranges"/>), a byte-range-resp-spec
359   &MUST; only specify one range, and &MUST; contain
360   absolute byte positions for both the first and last byte of the
361   range.
362</t>
363<t>
364   A byte-content-range-spec with a byte-range-resp-spec whose last-byte-pos
365   value is less than its first-byte-pos value, or whose
366   instance-length value is less than or equal to its last-byte-pos
367   value, is invalid. The recipient of an invalid byte-content-range-spec
368   &MUST; ignore it and any content transferred along with it.
369</t>
370<t>
371   A server sending a response with status code 416 (Requested range not
372   satisfiable) &SHOULD; include a Content-Range field with a byte-range-resp-spec
373   of "*". The instance-length specifies the current length of
374   the selected resource. A response with status code 206 (Partial
375   Content) &MUST-NOT; include a Content-Range field with a byte-range-resp-spec of "*".
376</t>
377<t>
378   Examples of byte-content-range-spec values, assuming that the entity
379   contains a total of 1234 bytes:
380   <list style="symbols">
381      <t>
382        The first 500 bytes:
383<figure><artwork type="text/plain">
384   bytes 0-499/1234
385</artwork></figure>
386      </t>   
387      <t>
388        The second 500 bytes:
389<figure><artwork type="text/plain">
390   bytes 500-999/1234
391</artwork></figure>
392      </t>   
393      <t>
394        All except for the first 500 bytes:
395<figure><artwork type="text/plain">
396   bytes 500-1233/1234
397</artwork></figure>
398      </t>   
399      <t>
400        The last 500 bytes:
401<figure><artwork type="text/plain">
402   bytes 734-1233/1234
403</artwork></figure>
404      </t>   
405   </list>
406</t>
407<t>
408   When an HTTP message includes the content of a single range (for
409   example, a response to a request for a single range, or to a request
410   for a set of ranges that overlap without any holes), this content is
411   transmitted with a Content-Range header, and a Content-Length header
412   showing the number of bytes actually transferred. For example,
413</t>
414<figure><artwork type="example">
415    HTTP/1.1 206 Partial content
416    Date: Wed, 15 Nov 1995 06:25:24 GMT
417    Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
418    Content-Range: bytes 21010-47021/47022
419    Content-Length: 26012
420    Content-Type: image/gif
421</artwork></figure>
422<t>
423   When an HTTP message includes the content of multiple ranges (for
424   example, a response to a request for multiple non-overlapping
425   ranges), these are transmitted as a multipart message. The multipart
426   media type used for this purpose is "multipart/byteranges" as defined
427   in <xref target="internet.media.type.multipart.byteranges"/>. See <xref target="changes.from.rfc.2068"/> for a compatibility issue.
428</t>
429<t>
430   A response to a request for a single range &MUST-NOT; be sent using the
431   multipart/byteranges media type.  A response to a request for
432   multiple ranges, whose result is a single range, &MAY; be sent as a
433   multipart/byteranges media type with one part. A client that cannot
434   decode a multipart/byteranges message &MUST-NOT; ask for multiple
435   byte-ranges in a single request.
436</t>
437<t>
438   When a client requests multiple byte-ranges in one request, the
439   server &SHOULD; return them in the order that they appeared in the
440   request.
441</t>
442<t>
443   If the server ignores a byte-range-spec because it is syntactically
444   invalid, the server &SHOULD; treat the request as if the invalid Range
445   header field did not exist. (Normally, this means return a 200
446   response containing the full entity).
447</t>
448<t>
449   If the server receives a request (other than one including an If-Range
450   request-header field) with an unsatisfiable Range request-header
451   field (that is, all of whose byte-range-spec values have a
452   first-byte-pos value greater than the current length of the selected
453   resource), it &SHOULD; return a response code of 416 (Requested range
454   not satisfiable) (<xref target="status.416"/>).
455  <list><t>
456      <x:h>Note:</x:h> clients cannot depend on servers to send a 416 (Requested
457      range not satisfiable) response instead of a 200 (OK) response for
458      an unsatisfiable Range request-header, since not all servers
459      implement this request-header.
460  </t></list>
461</t>
462</section>
463
464<section title="If-Range" anchor="header.if-range">
465  <iref primary="true" item="If-Range header" x:for-anchor=""/>
466  <iref primary="true" item="Headers" subitem="If-Range" x:for-anchor=""/>
467<t>
468   If a client has a partial copy of an entity in its cache, and wishes
469   to have an up-to-date copy of the entire entity in its cache, it
470   could use the Range request-header with a conditional GET (using
471   either or both of If-Unmodified-Since and If-Match.) However, if the
472   condition fails because the entity has been modified, the client
473   would then have to make a second request to obtain the entire current
474   entity-body.
475</t>
476<t>
477   The If-Range header allows a client to "short-circuit" the second
478   request. Informally, its meaning is `if the entity is unchanged, send
479   me the part(s) that I am missing; otherwise, send me the entire new
480   entity'.
481</t>
482<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Range"/>
483     If-Range = "If-Range" ":" ( entity-tag | HTTP-date )
484</artwork></figure>
485<t>
486   If the client has no entity tag for an entity, but does have a Last-Modified
487   date, it &MAY; use that date in an If-Range header. (The
488   server can distinguish between a valid HTTP-date and any form of
489   entity-tag by examining no more than two characters.) The If-Range
490   header &SHOULD; only be used together with a Range header, and &MUST; be
491   ignored if the request does not include a Range header, or if the
492   server does not support the sub-range operation.
493</t>
494<t>
495   If the entity tag given in the If-Range header matches the current
496   entity tag for the entity, then the server &SHOULD; provide the
497   specified sub-range of the entity using a 206 (Partial content)
498   response. If the entity tag does not match, then the server &SHOULD;
499   return the entire entity using a 200 (OK) response.
500</t>
501</section>
502
503<section title="Range" anchor="header.range">
504  <iref primary="true" item="Range header" x:for-anchor=""/>
505  <iref primary="true" item="Headers" subitem="Range" x:for-anchor=""/>
506
507<section title="Byte Ranges" anchor="byte.ranges">
508<t>
509   Since all HTTP entities are represented in HTTP messages as sequences
510   of bytes, the concept of a byte range is meaningful for any HTTP
511   entity. (However, not all clients and servers need to support byte-range
512   operations.)
513</t>
514<t>
515   Byte range specifications in HTTP apply to the sequence of bytes in
516   the entity-body (not necessarily the same as the message-body).
517</t>
518<t>
519   A byte range operation &MAY; specify a single range of bytes, or a set
520   of ranges within a single entity.
521</t>
522<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ranges-specifier"/><iref primary="true" item="Grammar" subitem="byte-ranges-specifier"/><iref primary="true" item="Grammar" subitem="byte-range-set"/><iref primary="true" item="Grammar" subitem="byte-range-spec"/><iref primary="true" item="Grammar" subitem="first-byte-pos"/><iref primary="true" item="Grammar" subitem="last-byte-pos"/>
523    ranges-specifier = byte-ranges-specifier
524    byte-ranges-specifier = bytes-unit "=" byte-range-set
525    byte-range-set  = 1#( byte-range-spec | suffix-byte-range-spec )
526    byte-range-spec = first-byte-pos "-" [last-byte-pos]
527    first-byte-pos  = 1*DIGIT
528    last-byte-pos   = 1*DIGIT
529</artwork></figure>
530<t>
531   The first-byte-pos value in a byte-range-spec gives the byte-offset
532   of the first byte in a range. The last-byte-pos value gives the
533   byte-offset of the last byte in the range; that is, the byte
534   positions specified are inclusive. Byte offsets start at zero.
535</t>
536<t>
537   If the last-byte-pos value is present, it &MUST; be greater than or
538   equal to the first-byte-pos in that byte-range-spec, or the byte-range-spec
539   is syntactically invalid. The recipient of a byte-range-set
540   that includes one or more syntactically invalid byte-range-spec
541   values &MUST; ignore the header field that includes that byte-range-set.
542</t>
543<t>
544   If the last-byte-pos value is absent, or if the value is greater than
545   or equal to the current length of the entity-body, last-byte-pos is
546   taken to be equal to one less than the current length of the entity-body
547   in bytes.
548</t>
549<t>
550   By its choice of last-byte-pos, a client can limit the number of
551   bytes retrieved without knowing the size of the entity.
552</t>
553<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="suffix-byte-range-spec"/><iref primary="true" item="Grammar" subitem="suffix-length"/>
554    suffix-byte-range-spec = "-" suffix-length
555    suffix-length = 1*DIGIT
556</artwork></figure>
557<t>
558   A suffix-byte-range-spec is used to specify the suffix of the
559   entity-body, of a length given by the suffix-length value. (That is,
560   this form specifies the last N bytes of an entity-body.) If the
561   entity is shorter than the specified suffix-length, the entire
562   entity-body is used.
563</t>
564<t>
565   If a syntactically valid byte-range-set includes at least one byte-range-spec
566   whose first-byte-pos is less than the current length of
567   the entity-body, or at least one suffix-byte-range-spec with a non-zero
568   suffix-length, then the byte-range-set is satisfiable.
569   Otherwise, the byte-range-set is unsatisfiable. If the byte-range-set
570   is unsatisfiable, the server &SHOULD; return a response with a status
571   of 416 (Requested range not satisfiable). Otherwise, the server
572   &SHOULD; return a response with a status of 206 (Partial Content)
573   containing the satisfiable ranges of the entity-body.
574</t>
575<t>
576   Examples of byte-ranges-specifier values (assuming an entity-body of
577   length 10000):
578  <list style="symbols">
579     <t>The first 500 bytes (byte offsets 0-499, inclusive):  bytes=0-499</t>
580
581     <t>The second 500 bytes (byte offsets 500-999, inclusive):
582        bytes=500-999</t>
583
584     <t>The final 500 bytes (byte offsets 9500-9999, inclusive):
585        bytes=-500</t>
586
587     <t>Or bytes=9500-</t>
588
589     <t>The first and last bytes only (bytes 0 and 9999):  bytes=0-0,-1</t>
590
591     <t>Several legal but not canonical specifications of the second 500
592        bytes (byte offsets 500-999, inclusive):
593        <vspace/>
594         bytes=500-600,601-999<vspace/>
595         bytes=500-700,601-999</t>
596  </list>
597</t>
598</section>
599
600<section title="Range Retrieval Requests" anchor="range.retrieval.requests">
601<t>
602   HTTP retrieval requests using conditional or unconditional GET
603   methods &MAY; request one or more sub-ranges of the entity, instead of
604   the entire entity, using the Range request header, which applies to
605   the entity returned as the result of the request:
606</t>
607<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Range"/>
608   Range = "Range" ":" ranges-specifier
609</artwork></figure>
610<t>
611   A server &MAY; ignore the Range header. However, HTTP/1.1 origin
612   servers and intermediate caches ought to support byte ranges when
613   possible, since Range supports efficient recovery from partially
614   failed transfers, and supports efficient partial retrieval of large
615   entities.
616</t>
617<t>
618   If the server supports the Range header and the specified range or
619   ranges are appropriate for the entity:
620  <list style="symbols">
621     <t>The presence of a Range header in an unconditional GET modifies
622        what is returned if the GET is otherwise successful. In other
623        words, the response carries a status code of 206 (Partial
624        Content) instead of 200 (OK).</t>
625
626     <t>The presence of a Range header in a conditional GET (a request
627        using one or both of If-Modified-Since and If-None-Match, or
628        one or both of If-Unmodified-Since and If-Match) modifies what
629        is returned if the GET is otherwise successful and the
630        condition is true. It does not affect the 304 (Not Modified)
631        response returned if the conditional is false.</t>
632  </list>
633</t>
634<t>
635   In some cases, it might be more appropriate to use the If-Range
636   header (see <xref target="header.if-range"/>) in addition to the Range header.
637</t>
638<t>
639   If a proxy that supports ranges receives a Range request, forwards
640   the request to an inbound server, and receives an entire entity in
641   reply, it &SHOULD; only return the requested range to its client. It
642   &SHOULD; store the entire received response in its cache if that is
643   consistent with its cache allocation policies.
644</t>
645</section>
646</section>
647</section>
648
649<section title="IANA Considerations" anchor="IANA.considerations">
650<t>
651   TBD.
652</t>
653</section>
654
655<section title="Security Considerations" anchor="security.considerations">
656<t>
657   No additional security considerations have been identified beyond
658   those applicable to HTTP in general &messaging;.
659</t>
660</section>
661
662<section title="Acknowledgments" anchor="ack">
663<t>
664   Most of the specification of ranges is based on work originally done
665   by Ari Luotonen and John Franks, with additional input from Steve
666   Zilles.
667</t>
668<t>
669   Based on an XML translation of RFC 2616 by Julian Reschke.
670</t>
671</section>
672</middle>
673<back>
674<references>
675
676<reference anchor="Part1">
677  <front>
678    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
679 
680    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
681      <organization abbrev="Day Software">Day Software</organization>
682      <address>
683        <email>fielding@gbiv.com</email>
684      </address>
685    </author>
686 
687    <author initials="J." surname="Gettys" fullname="Jim Gettys">
688      <organization>One Laptop per Child</organization>
689      <address>
690        <email>jg@laptop.org</email>
691      </address>
692    </author>
693   
694    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
695      <organization abbrev="HP">Hewlett-Packard Company</organization>
696      <address>
697        <email>JeffMogul@acm.org</email>
698      </address>
699    </author>
700 
701    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
702      <organization abbrev="Microsoft">Microsoft Corporation</organization>
703      <address>
704        <email>henrikn@microsoft.com</email>
705      </address>
706    </author>
707 
708    <author initials="L." surname="Masinter" fullname="Larry Masinter">
709      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
710      <address>
711        <email>LMM@acm.org</email>
712      </address>
713    </author>
714   
715    <author initials="P." surname="Leach" fullname="Paul J. Leach">
716      <organization abbrev="Microsoft">Microsoft Corporation</organization>
717      <address>
718        <email>paulle@microsoft.com</email>
719      </address>
720    </author>
721     
722    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
723      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
724      <address>
725        <email>timbl@w3.org</email>
726      </address>
727    </author>
728 
729    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
730  </front>
731  <seriesInfo name="Internet-Draft" value="draft-fielding-p1-messaging-&ID-VERSION;"/>
732  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
733</reference>
734
735<reference anchor="Part4">
736  <front>
737    <title abbrev="HTTP/1.1">HTTP/1.1, part 4: Conditional Requests</title>
738 
739    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
740      <organization abbrev="Day Software">Day Software</organization>
741      <address>
742        <email>fielding@gbiv.com</email>
743      </address>
744    </author>
745 
746    <author initials="J." surname="Gettys" fullname="Jim Gettys">
747      <organization>One Laptop per Child</organization>
748      <address>
749        <email>jg@laptop.org</email>
750      </address>
751    </author>
752   
753    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
754      <organization abbrev="HP">Hewlett-Packard Company</organization>
755      <address>
756        <email>JeffMogul@acm.org</email>
757      </address>
758    </author>
759 
760    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
761      <organization abbrev="Microsoft">Microsoft Corporation</organization>
762      <address>
763        <email>henrikn@microsoft.com</email>
764      </address>
765    </author>
766 
767    <author initials="L." surname="Masinter" fullname="Larry Masinter">
768      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
769      <address>
770        <email>LMM@acm.org</email>
771      </address>
772    </author>
773   
774    <author initials="P." surname="Leach" fullname="Paul J. Leach">
775      <organization abbrev="Microsoft">Microsoft Corporation</organization>
776      <address>
777        <email>paulle@microsoft.com</email>
778      </address>
779    </author>
780     
781    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
782      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
783      <address>
784        <email>timbl@w3.org</email>
785      </address>
786    </author>
787 
788    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
789  </front>
790  <seriesInfo name="Internet-Draft" value="draft-fielding-p4-conditional-&ID-VERSION;"/>
791  <x:source href="p4-conditional.xml" basename="p4-conditional"/>
792</reference>
793
794<reference anchor="RFC2046">
795<front>
796<title abbrev="Media Types">Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title>
797<author initials="N." surname="Freed" fullname="Ned Freed">
798<organization>Innosoft International, Inc.</organization>
799<address>
800<postal>
801<street>1050 East Garvey Avenue South</street>
802<city>West Covina</city>
803<region>CA</region>
804<code>91790</code>
805<country>US</country></postal>
806<phone>+1 818 919 3600</phone>
807<facsimile>+1 818 919 3614</facsimile>
808<email>ned@innosoft.com</email></address></author>
809<author initials="N." surname="Borenstein" fullname="Nathaniel S. Borenstein">
810<organization>First Virtual Holdings</organization>
811<address>
812<postal>
813<street>25 Washington Avenue</street>
814<city>Morristown</city>
815<region>NJ</region>
816<code>07960</code>
817<country>US</country></postal>
818<phone>+1 201 540 8967</phone>
819<facsimile>+1 201 993 3032</facsimile>
820<email>nsb@nsb.fv.com</email></address></author>
821<date month="November" year="1996"/>
822</front>
823<seriesInfo name="RFC" value="2046"/>
824</reference>
825
826   <reference anchor="RFC2616">
827     <front>
828       <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
829       <author initials="R." surname="Fielding" fullname="R. Fielding">
830         <organization>University of California, Irvine</organization>
831         <address><email>fielding@ics.uci.edu</email></address>
832       </author>
833       <author initials="J." surname="Gettys" fullname="J. Gettys">
834         <organization>W3C</organization>
835         <address><email>jg@w3.org</email></address>
836       </author>
837       <author initials="J." surname="Mogul" fullname="J. Mogul">
838         <organization>Compaq Computer Corporation</organization>
839         <address><email>mogul@wrl.dec.com</email></address>
840       </author>
841       <author initials="H." surname="Frystyk" fullname="H. Frystyk">
842         <organization>MIT Laboratory for Computer Science</organization>
843         <address><email>frystyk@w3.org</email></address>
844       </author>
845       <author initials="L." surname="Masinter" fullname="L. Masinter">
846         <organization>Xerox Corporation</organization>
847         <address><email>masinter@parc.xerox.com</email></address>
848       </author>
849       <author initials="P." surname="Leach" fullname="P. Leach">
850         <organization>Microsoft Corporation</organization>
851         <address><email>paulle@microsoft.com</email></address>
852       </author>
853       <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
854         <organization>W3C</organization>
855         <address><email>timbl@w3.org</email></address>
856       </author>
857       <date month="June" year="1999"/>
858     </front>
859     <seriesInfo name="RFC" value="2616"/>
860   </reference>
861
862</references>
863
864<section title="Internet Media Type multipart/byteranges" anchor="internet.media.type.multipart.byteranges">
865<iref item="Media Type" subitem="multipart/byteranges" primary="true"/>
866<iref item="multipart/byteranges Media Type" primary="true"/>
867<t>
868   When an HTTP 206 (Partial Content) response message includes the
869   content of multiple ranges (a response to a request for multiple
870   non-overlapping ranges), these are transmitted as a multipart
871   message-body. The media type for this purpose is called
872   "multipart/byteranges".
873</t><t>
874   The multipart/byteranges media type includes two or more parts, each
875   with its own Content-Type and Content-Range fields. The required
876   boundary parameter specifies the boundary string used to separate
877   each body-part.
878</t>
879<t>
880  <list style="hanging" x:indent="12em">
881    <t hangText="Media Type name:">
882      multipart
883    </t>
884    <t hangText="Media subtype name:">
885      byteranges
886    </t>
887    <t hangText="Required parameters:">
888      boundary
889    </t>
890    <t hangText="Optional parameters:">
891      none
892    </t>
893    <t hangText="Encoding considerations:">
894      only "7bit", "8bit", or "binary" are permitted
895    </t>
896    <t hangText="Security considerations:">
897      none
898    </t>
899  </list>
900</t>
901<figure><preamble>
902   For example:
903</preamble><artwork type="example">
904   HTTP/1.1 206 Partial Content
905   Date: Wed, 15 Nov 1995 06:25:24 GMT
906   Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
907   Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
908
909   --THIS_STRING_SEPARATES
910   Content-type: application/pdf
911   Content-range: bytes 500-999/8000
912
913   ...the first range...
914   --THIS_STRING_SEPARATES
915   Content-type: application/pdf
916   Content-range: bytes 7000-7999/8000
917
918   ...the second range
919   --THIS_STRING_SEPARATES--
920</artwork></figure>
921<t>
922      Notes:
923  <list style="numbers">
924      <t>Additional CRLFs may precede the first boundary string in the
925         entity.</t>
926
927      <t>Although RFC 2046 <xref target="RFC2046"/> permits the boundary string to be
928         quoted, some existing implementations handle a quoted boundary
929         string incorrectly.</t>
930
931      <t>A number of browsers and servers were coded to an early draft
932         of the byteranges specification to use a media type of
933         multipart/x-byteranges<iref item="multipart/x-byteranges Media Type"/><iref item="Media Type" subitem="multipart/x-byteranges"/>, which is almost, but not quite
934         compatible with the version documented in HTTP/1.1.</t>
935  </list>
936</t>
937</section>
938
939<section title="Changes from RFC 2068" anchor="changes.from.rfc.2068">
940<t>
941   There are situations where a server (especially a proxy) does not
942   know the full length of a response but is capable of serving a
943   byterange request. We therefore need a mechanism to allow byteranges
944   with a content-range not indicating the full length of the message.
945   (<xref target="header.content-range"/>)
946</t>
947<t>
948   Range request responses would become very verbose if all meta-data
949   were always returned; by allowing the server to only send needed
950   headers in a 206 response, this problem can be avoided.
951</t>
952<t>
953   Fix problem with unsatisfiable range requests; there are two cases:
954   syntactic problems, and range doesn't exist in the document. The 416
955   status code was needed to resolve this ambiguity needed to indicate
956   an error for a byte range request that falls outside of the actual
957   contents of a document. (Section <xref target="status.416" format="counter"/>, <xref target="header.content-range" format="counter"/>)
958</t>
959</section>
960
961</back>
962</rfc>
Note: See TracBrowser for help on using the repository browser.