source: draft-ietf-httpbis/06/draft-ietf-httpbis-p5-range-06.xml @ 558

Last change on this file since 558 was 558, checked in by fielding@…, 11 years ago

Draft 06 (as recorded by www.ietf.org)

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