source: draft-ietf-httpbis/07/draft-ietf-httpbis-p5-range-07.xml @ 605

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

Prepare release of -07 drafts.

File size: 58.5 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-07">
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 day="13" month="July" year="2009"/>
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.06"/>.
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><artwork type="abnf2616"><![CDATA[
280  HTTP-date  = <HTTP-date, defined in [Part1], Section 3.2>
281]]></artwork></figure>
282<figure><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. 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="example"><![CDATA[
541     bytes 0-499/1234
542   ]]></artwork></figure>
543      </t>   
544      <t>
545        The second 500 bytes:
546<figure><artwork type="example"><![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="example"><![CDATA[
553     bytes 500-1233/1234
554   ]]></artwork></figure>
555      </t>   
556      <t>
557        The last 500 bytes:
558<figure><artwork type="example"><![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</t>
613<t><list>
614  <t>
615    Note: clients cannot depend on servers to send a 416 (Requested
616    range not satisfiable) response instead of a 200 (OK) response for
617    an unsatisfiable Range request-header, since not all servers
618    implement this request-header.
619  </t>
620</list></t>
621</section>
622
623<section title="If-Range" anchor="header.if-range">
624  <iref primary="true" item="If-Range header"/>
625  <iref primary="true" item="Headers" subitem="If-Range"/>
626 
627 
628<t>
629   If a client has a partial copy of an entity in its cache, and wishes
630   to have an up-to-date copy of the entire entity in its cache, it
631   could use the Range request-header with a conditional GET (using
632   either or both of If-Unmodified-Since and If-Match.) However, if the
633   condition fails because the entity has been modified, the client
634   would then have to make a second request to obtain the entire current
635   entity-body.
636</t>
637<t>
638   The request header "If-Range" allows a client to "short-circuit" the second
639   request. Informally, its meaning is `if the entity is unchanged, send
640   me the part(s) that I am missing; otherwise, send me the entire new
641   entity'.
642</t>
643<figure><iref primary="true" item="Grammar" subitem="If-Range"/><iref primary="true" item="Grammar" subitem="If-Range-v"/><artwork type="abnf2616"><![CDATA[
644  If-Range   = "If-Range" ":" OWS If-Range-v
645  If-Range-v = entity-tag / HTTP-date
646]]></artwork></figure>
647<t>
648   If the client has no entity tag for an entity, but does have a Last-Modified
649   date, it MAY use that date in an If-Range header. (The
650   server can distinguish between a valid HTTP-date and any form of
651   entity-tag by examining no more than two characters.) The If-Range
652   header SHOULD only be used together with a Range header, and MUST be
653   ignored if the request does not include a Range header, or if the
654   server does not support the sub-range operation.
655</t>
656<t>
657   If the entity tag given in the If-Range header matches the current
658   entity tag for the entity, then the server SHOULD provide the
659   specified sub-range of the entity using a 206 (Partial Content)
660   response. If the entity tag does not match, then the server SHOULD
661   return the entire entity using a 200 (OK) response.
662</t>
663</section>
664
665<section title="Range" anchor="header.range">
666  <iref primary="true" item="Range header"/>
667  <iref primary="true" item="Headers" subitem="Range"/>
668
669<section title="Byte Ranges" anchor="byte.ranges">
670<t>
671   Since all HTTP entities are represented in HTTP messages as sequences
672   of bytes, the concept of a byte range is meaningful for any HTTP
673   entity. (However, not all clients and servers need to support byte-range
674   operations.)
675</t>
676<t>
677   Byte range specifications in HTTP apply to the sequence of bytes in
678   the entity-body (not necessarily the same as the message-body).
679</t>
680<t anchor="rule.ranges-specifier">
681 
682 
683 
684 
685 
686 
687 
688 
689
690   A byte range operation MAY specify a single range of bytes, or a set
691   of ranges within a single entity.
692</t>
693<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[
694  byte-ranges-specifier = bytes-unit "=" byte-range-set
695  byte-range-set  = 1#( byte-range-spec / suffix-byte-range-spec )
696  byte-range-spec = first-byte-pos "-" [ last-byte-pos ]
697  first-byte-pos  = 1*DIGIT
698  last-byte-pos   = 1*DIGIT
699]]></artwork></figure>
700<t>
701   The first-byte-pos value in a byte-range-spec gives the byte-offset
702   of the first byte in a range. The last-byte-pos value gives the
703   byte-offset of the last byte in the range; that is, the byte
704   positions specified are inclusive. Byte offsets start at zero.
705</t>
706<t>
707   If the last-byte-pos value is present, it MUST be greater than or
708   equal to the first-byte-pos in that byte-range-spec, or the byte-range-spec
709   is syntactically invalid. The recipient of a byte-range-set
710   that includes one or more syntactically invalid byte-range-spec
711   values MUST ignore the header field that includes that byte-range-set.
712</t>
713<t>
714   If the last-byte-pos value is absent, or if the value is greater than
715   or equal to the current length of the entity-body, last-byte-pos is
716   taken to be equal to one less than the current length of the entity-body
717   in bytes.
718</t>
719<t>
720   By its choice of last-byte-pos, a client can limit the number of
721   bytes retrieved without knowing the size of the entity.
722</t>
723<figure><iref primary="true" item="Grammar" subitem="suffix-byte-range-spec"/><iref primary="true" item="Grammar" subitem="suffix-length"/><artwork type="abnf2616"><![CDATA[
724  suffix-byte-range-spec = "-" suffix-length
725  suffix-length = 1*DIGIT
726]]></artwork></figure>
727<t>
728   A suffix-byte-range-spec is used to specify the suffix of the
729   entity-body, of a length given by the suffix-length value. (That is,
730   this form specifies the last N bytes of an entity-body.) If the
731   entity is shorter than the specified suffix-length, the entire
732   entity-body is used.
733</t>
734<t>
735   If a syntactically valid byte-range-set includes at least one byte-range-spec
736   whose first-byte-pos is less than the current length of
737   the entity-body, or at least one suffix-byte-range-spec with a non-zero
738   suffix-length, then the byte-range-set is satisfiable.
739   Otherwise, the byte-range-set is unsatisfiable. If the byte-range-set
740   is unsatisfiable, the server SHOULD return a response with a status
741   of 416 (Requested range not satisfiable). Otherwise, the server
742   SHOULD return a response with a status of 206 (Partial Content)
743   containing the satisfiable ranges of the entity-body.
744</t>
745<t>
746   Examples of byte-ranges-specifier values (assuming an entity-body of
747   length 10000):
748  <list style="symbols">
749     <t>The first 500 bytes (byte offsets 0-499, inclusive):
750<figure><artwork type="example"><![CDATA[
751     bytes=0-499
752   ]]></artwork></figure>
753    </t>
754     <t>The second 500 bytes (byte offsets 500-999, inclusive):
755<figure><artwork type="example"><![CDATA[
756     bytes=500-999
757   ]]></artwork></figure>
758    </t>
759     <t>The final 500 bytes (byte offsets 9500-9999, inclusive):
760<figure><artwork type="example"><![CDATA[
761     bytes=-500
762   ]]></artwork></figure>
763    Or:
764<figure><artwork type="example"><![CDATA[
765     bytes=9500-
766   ]]></artwork></figure>
767    </t>
768     <t>The first and last bytes only (bytes 0 and 9999):
769<figure><artwork type="example"><![CDATA[
770     bytes=0-0,-1
771   ]]></artwork></figure>
772     </t>
773     <t>Several legal but not canonical specifications of the second 500
774        bytes (byte offsets 500-999, inclusive):
775<figure><artwork type="example"><![CDATA[
776     bytes=500-600,601-999
777     bytes=500-700,601-999
778   ]]></artwork></figure>
779     </t>
780  </list>
781</t>
782</section>
783
784<section title="Range Retrieval Requests" anchor="range.retrieval.requests">
785 
786 
787 
788<t>
789   HTTP retrieval requests using conditional or unconditional GET
790   methods MAY request one or more sub-ranges of the entity, instead of
791   the entire entity, using the Range request header, which applies to
792   the entity returned as the result of the request:
793</t>
794<figure><iref primary="true" item="Grammar" subitem="Range"/><artwork type="abnf2616"><![CDATA[
795  Range   = "Range" ":" OWS Range-v
796  Range-v = byte-ranges-specifier
797          / other-ranges-specifier
798  other-ranges-specifier = 1*CHAR
799]]></artwork></figure>
800<t>
801   A server MAY ignore the Range header. However, HTTP/1.1 origin
802   servers and intermediate caches ought to support byte ranges when
803   possible, since Range supports efficient recovery from partially
804   failed transfers, and supports efficient partial retrieval of large
805   entities.
806</t>
807<t>
808   If the server supports the Range header and the specified range or
809   ranges are appropriate for the entity:
810  <list style="symbols">
811     <t>The presence of a Range header in an unconditional GET modifies
812        what is returned if the GET is otherwise successful. In other
813        words, the response carries a status code of 206 (Partial
814        Content) instead of 200 (OK).</t>
815
816     <t>The presence of a Range header in a conditional GET (a request
817        using one or both of If-Modified-Since and If-None-Match, or
818        one or both of If-Unmodified-Since and If-Match) modifies what
819        is returned if the GET is otherwise successful and the
820        condition is true. It does not affect the 304 (Not Modified)
821        response returned if the conditional is false.</t>
822  </list>
823</t>
824<t>
825   In some cases, it might be more appropriate to use the If-Range
826   header (see <xref target="header.if-range"/>) in addition to the Range header.
827</t>
828<t>
829   If a proxy that supports ranges receives a Range request, forwards
830   the request to an inbound server, and receives an entire entity in
831   reply, it SHOULD only return the requested range to its client. It
832   SHOULD store the entire received response in its cache if that is
833   consistent with its cache allocation policies.
834</t>
835</section>
836</section>
837</section>
838
839<section title="IANA Considerations" anchor="IANA.considerations">
840<section title="Message Header Registration" anchor="message.header.registration">
841<t>
842   The Message Header Registry located at <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/> should be updated
843   with the permanent registrations below (see <xref target="RFC3864"/>):
844</t>
845<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
846<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
847   <ttcol>Header Field Name</ttcol>
848   <ttcol>Protocol</ttcol>
849   <ttcol>Status</ttcol>
850   <ttcol>Reference</ttcol>
851
852   <c>Accept-Ranges</c>
853   <c>http</c>
854   <c>standard</c>
855   <c>
856      <xref target="header.accept-ranges"/>
857   </c>
858   <c>Content-Range</c>
859   <c>http</c>
860   <c>standard</c>
861   <c>
862      <xref target="header.content-range"/>
863   </c>
864   <c>If-Range</c>
865   <c>http</c>
866   <c>standard</c>
867   <c>
868      <xref target="header.if-range"/>
869   </c>
870   <c>Range</c>
871   <c>http</c>
872   <c>standard</c>
873   <c>
874      <xref target="header.range"/>
875   </c>
876</texttable>
877<!--(END)-->
878<t>
879   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
880</t>
881</section>
882</section>
883
884<section title="Security Considerations" anchor="security.considerations">
885<t>
886   No additional security considerations have been identified beyond
887   those applicable to HTTP in general <xref target="Part1"/>.
888</t>
889</section>
890
891<section title="Acknowledgments" anchor="ack">
892<t>
893   Most of the specification of ranges is based on work originally done
894   by Ari Luotonen and John Franks, with additional input from Steve
895   Zilles, Daniel W. Connolly, Roy T. Fielding, Jim Gettys, Martin Hamilton,
896   Koen Holtman, Shel Kaplan, Paul Leach, Alex Lopez-Ortiz, Larry Masinter,
897   Jeff Mogul, Lou Montulli, David W. Morris, Luigi Rizzo, and Bill Weihl.
898</t>
899</section>
900</middle>
901<back>
902
903<references title="Normative References">
904
905<reference anchor="Part1">
906  <front>
907    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
908    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
909      <organization abbrev="Day Software">Day Software</organization>
910      <address><email>fielding@gbiv.com</email></address>
911    </author>
912    <author initials="J." surname="Gettys" fullname="Jim Gettys">
913      <organization>One Laptop per Child</organization>
914      <address><email>jg@laptop.org</email></address>
915    </author>
916    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
917      <organization abbrev="HP">Hewlett-Packard Company</organization>
918      <address><email>JeffMogul@acm.org</email></address>
919    </author>
920    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
921      <organization abbrev="Microsoft">Microsoft Corporation</organization>
922      <address><email>henrikn@microsoft.com</email></address>
923    </author>
924    <author initials="L." surname="Masinter" fullname="Larry Masinter">
925      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
926      <address><email>LMM@acm.org</email></address>
927    </author>
928    <author initials="P." surname="Leach" fullname="Paul J. Leach">
929      <organization abbrev="Microsoft">Microsoft Corporation</organization>
930      <address><email>paulle@microsoft.com</email></address>
931    </author>
932    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
933      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
934      <address><email>timbl@w3.org</email></address>
935    </author>
936    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
937      <organization abbrev="W3C">World Wide Web Consortium</organization>
938      <address><email>ylafon@w3.org</email></address>
939    </author>
940    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
941      <organization abbrev="greenbytes">greenbytes GmbH</organization>
942      <address><email>julian.reschke@greenbytes.de</email></address>
943    </author>
944    <date month="July" year="2009"/>
945  </front>
946  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-07"/>
947 
948</reference>
949
950<reference anchor="Part3">
951  <front>
952    <title abbrev="HTTP/1.1">HTTP/1.1, part 3: Message Payload and Content Negotiation</title>
953    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
954      <organization abbrev="Day Software">Day Software</organization>
955      <address><email>fielding@gbiv.com</email></address>
956    </author>
957    <author initials="J." surname="Gettys" fullname="Jim Gettys">
958      <organization>One Laptop per Child</organization>
959      <address><email>jg@laptop.org</email></address>
960    </author>
961    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
962      <organization abbrev="HP">Hewlett-Packard Company</organization>
963      <address><email>JeffMogul@acm.org</email></address>
964    </author>
965    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
966      <organization abbrev="Microsoft">Microsoft Corporation</organization>
967      <address><email>henrikn@microsoft.com</email></address>
968    </author>
969    <author initials="L." surname="Masinter" fullname="Larry Masinter">
970      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
971      <address><email>LMM@acm.org</email></address>
972    </author>
973    <author initials="P." surname="Leach" fullname="Paul J. Leach">
974      <organization abbrev="Microsoft">Microsoft Corporation</organization>
975      <address><email>paulle@microsoft.com</email></address>
976    </author>
977    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
978      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
979      <address><email>timbl@w3.org</email></address>
980    </author>
981    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
982      <organization abbrev="W3C">World Wide Web Consortium</organization>
983      <address><email>ylafon@w3.org</email></address>
984    </author>
985    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
986      <organization abbrev="greenbytes">greenbytes GmbH</organization>
987      <address><email>julian.reschke@greenbytes.de</email></address>
988    </author>
989    <date month="July" year="2009"/>
990  </front>
991  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p3-payload-07"/>
992 
993</reference>
994
995<reference anchor="Part4">
996  <front>
997    <title abbrev="HTTP/1.1">HTTP/1.1, part 4: Conditional Requests</title>
998    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
999      <organization abbrev="Day Software">Day Software</organization>
1000      <address><email>fielding@gbiv.com</email></address>
1001    </author>
1002    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1003      <organization>One Laptop per Child</organization>
1004      <address><email>jg@laptop.org</email></address>
1005    </author>
1006    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1007      <organization abbrev="HP">Hewlett-Packard Company</organization>
1008      <address><email>JeffMogul@acm.org</email></address>
1009    </author>
1010    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1011      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1012      <address><email>henrikn@microsoft.com</email></address>
1013    </author>
1014    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1015      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1016      <address><email>LMM@acm.org</email></address>
1017    </author>
1018    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1019      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1020      <address><email>paulle@microsoft.com</email></address>
1021    </author>
1022    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1023      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1024      <address><email>timbl@w3.org</email></address>
1025    </author>
1026    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1027      <organization abbrev="W3C">World Wide Web Consortium</organization>
1028      <address><email>ylafon@w3.org</email></address>
1029    </author>
1030    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1031      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1032      <address><email>julian.reschke@greenbytes.de</email></address>
1033    </author>
1034    <date month="July" year="2009"/>
1035  </front>
1036  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p4-conditional-07"/>
1037 
1038</reference>
1039
1040<reference anchor="Part6">
1041  <front>
1042    <title abbrev="HTTP/1.1">HTTP/1.1, part 6: Caching</title>
1043    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1044      <organization abbrev="Day Software">Day Software</organization>
1045      <address><email>fielding@gbiv.com</email></address>
1046    </author>
1047    <author initials="J." surname="Gettys" fullname="Jim Gettys">
1048      <organization>One Laptop per Child</organization>
1049      <address><email>jg@laptop.org</email></address>
1050    </author>
1051    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
1052      <organization abbrev="HP">Hewlett-Packard Company</organization>
1053      <address><email>JeffMogul@acm.org</email></address>
1054    </author>
1055    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
1056      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1057      <address><email>henrikn@microsoft.com</email></address>
1058    </author>
1059    <author initials="L." surname="Masinter" fullname="Larry Masinter">
1060      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
1061      <address><email>LMM@acm.org</email></address>
1062    </author>
1063    <author initials="P." surname="Leach" fullname="Paul J. Leach">
1064      <organization abbrev="Microsoft">Microsoft Corporation</organization>
1065      <address><email>paulle@microsoft.com</email></address>
1066    </author>
1067    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
1068      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
1069      <address><email>timbl@w3.org</email></address>
1070    </author>
1071    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1072      <organization abbrev="W3C">World Wide Web Consortium</organization>
1073      <address><email>ylafon@w3.org</email></address>
1074    </author>
1075    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
1076      <organization/>
1077      <address><email>mnot@mnot.net</email></address>
1078    </author>
1079    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1080      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1081      <address><email>julian.reschke@greenbytes.de</email></address>
1082    </author>
1083    <date month="July" year="2009"/>
1084  </front>
1085  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-07"/>
1086 
1087</reference>
1088
1089<reference anchor="RFC2046">
1090  <front>
1091    <title abbrev="Media Types">Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title>
1092    <author initials="N." surname="Freed" fullname="Ned Freed">
1093      <organization>Innosoft International, Inc.</organization>
1094      <address><email>ned@innosoft.com</email></address>
1095    </author>
1096    <author initials="N." surname="Borenstein" fullname="Nathaniel S. Borenstein">
1097      <organization>First Virtual Holdings</organization>
1098      <address><email>nsb@nsb.fv.com</email></address>
1099    </author>
1100    <date month="November" year="1996"/>
1101  </front>
1102  <seriesInfo name="RFC" value="2046"/>
1103</reference>
1104
1105<reference anchor="RFC2119">
1106  <front>
1107    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1108    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1109      <organization>Harvard University</organization>
1110      <address><email>sob@harvard.edu</email></address>
1111    </author>
1112    <date month="March" year="1997"/>
1113  </front>
1114  <seriesInfo name="BCP" value="14"/>
1115  <seriesInfo name="RFC" value="2119"/>
1116</reference>
1117
1118<reference anchor="RFC5234">
1119  <front>
1120    <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
1121    <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
1122      <organization>Brandenburg InternetWorking</organization>
1123      <address>
1124      <postal>
1125      <street>675 Spruce Dr.</street>
1126      <city>Sunnyvale</city>
1127      <region>CA</region>
1128      <code>94086</code>
1129      <country>US</country></postal>
1130      <phone>+1.408.246.8253</phone>
1131      <email>dcrocker@bbiw.net</email></address> 
1132    </author>
1133    <author initials="P." surname="Overell" fullname="Paul Overell">
1134      <organization>THUS plc.</organization>
1135      <address>
1136      <postal>
1137      <street>1/2 Berkeley Square</street>
1138      <street>99 Berkely Street</street>
1139      <city>Glasgow</city>
1140      <code>G3 7HR</code>
1141      <country>UK</country></postal>
1142      <email>paul.overell@thus.net</email></address>
1143    </author>
1144    <date month="January" year="2008"/>
1145  </front>
1146  <seriesInfo name="STD" value="68"/>
1147  <seriesInfo name="RFC" value="5234"/>
1148</reference>
1149
1150</references>
1151
1152<references title="Informative References">
1153
1154<reference anchor="RFC2616">
1155  <front>
1156    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1157    <author initials="R." surname="Fielding" fullname="R. Fielding">
1158      <organization>University of California, Irvine</organization>
1159      <address><email>fielding@ics.uci.edu</email></address>
1160    </author>
1161    <author initials="J." surname="Gettys" fullname="J. Gettys">
1162      <organization>W3C</organization>
1163      <address><email>jg@w3.org</email></address>
1164    </author>
1165    <author initials="J." surname="Mogul" fullname="J. Mogul">
1166      <organization>Compaq Computer Corporation</organization>
1167      <address><email>mogul@wrl.dec.com</email></address>
1168    </author>
1169    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1170      <organization>MIT Laboratory for Computer Science</organization>
1171      <address><email>frystyk@w3.org</email></address>
1172    </author>
1173    <author initials="L." surname="Masinter" fullname="L. Masinter">
1174      <organization>Xerox Corporation</organization>
1175      <address><email>masinter@parc.xerox.com</email></address>
1176    </author>
1177    <author initials="P." surname="Leach" fullname="P. Leach">
1178      <organization>Microsoft Corporation</organization>
1179      <address><email>paulle@microsoft.com</email></address>
1180    </author>
1181    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1182      <organization>W3C</organization>
1183      <address><email>timbl@w3.org</email></address>
1184    </author>
1185    <date month="June" year="1999"/>
1186  </front>
1187  <seriesInfo name="RFC" value="2616"/>
1188</reference>
1189
1190<reference anchor="RFC3864">
1191  <front>
1192    <title>Registration Procedures for Message Header Fields</title>
1193    <author initials="G." surname="Klyne" fullname="G. Klyne">
1194      <organization>Nine by Nine</organization>
1195      <address><email>GK-IETF@ninebynine.org</email></address>
1196    </author>
1197    <author initials="M." surname="Nottingham" fullname="M. Nottingham">
1198      <organization>BEA Systems</organization>
1199      <address><email>mnot@pobox.com</email></address>
1200    </author>
1201    <author initials="J." surname="Mogul" fullname="J. Mogul">
1202      <organization>HP Labs</organization>
1203      <address><email>JeffMogul@acm.org</email></address>
1204    </author>
1205    <date year="2004" month="September"/>
1206  </front>
1207  <seriesInfo name="BCP" value="90"/>
1208  <seriesInfo name="RFC" value="3864"/>
1209</reference>
1210
1211<reference anchor="RFC4288">
1212  <front>
1213    <title>Media Type Specifications and Registration Procedures</title>
1214    <author initials="N." surname="Freed" fullname="N. Freed">
1215      <organization>Sun Microsystems</organization>
1216      <address>
1217        <email>ned.freed@mrochek.com</email>
1218      </address>
1219    </author>
1220    <author initials="J." surname="Klensin" fullname="J. Klensin">
1221      <organization/>
1222      <address>
1223        <email>klensin+ietf@jck.com</email>
1224      </address>
1225    </author>
1226    <date year="2005" month="December"/>
1227  </front>
1228  <seriesInfo name="BCP" value="13"/>
1229  <seriesInfo name="RFC" value="4288"/>
1230</reference>
1231
1232</references>
1233
1234<section title="Internet Media Type multipart/byteranges" anchor="internet.media.type.multipart.byteranges">
1235<iref item="Media Type" subitem="multipart/byteranges" primary="true"/>
1236<iref item="multipart/byteranges Media Type" primary="true"/>
1237<t>
1238   When an HTTP 206 (Partial Content) response message includes the
1239   content of multiple ranges (a response to a request for multiple
1240   non-overlapping ranges), these are transmitted as a multipart
1241   message-body (<xref target="RFC2046"/>, Section 5.1). The media type for this purpose is called
1242   "multipart/byteranges".  The following is to be registered with IANA <xref target="RFC4288"/>.
1243</t><t>
1244   The multipart/byteranges media type includes one or more parts, each
1245   with its own Content-Type and Content-Range fields. The required
1246   boundary parameter specifies the boundary string used to separate
1247   each body-part.
1248</t>
1249<t>
1250  <list style="hanging">
1251    <t hangText="Type name:">
1252      multipart
1253    </t>
1254    <t hangText="Subtype name:">
1255      byteranges
1256    </t>
1257    <t hangText="Required parameters:">
1258      boundary
1259    </t>
1260    <t hangText="Optional parameters:">
1261      none
1262    </t>
1263    <t hangText="Encoding considerations:">
1264      only "7bit", "8bit", or "binary" are permitted
1265    </t>
1266    <t hangText="Security considerations:">
1267      none
1268    </t>
1269    <t hangText="Interoperability considerations:">
1270      none
1271    </t>
1272    <t hangText="Published specification:">
1273      This specification (see <xref target="internet.media.type.multipart.byteranges"/>).
1274    </t>
1275    <t hangText="Applications that use this media type:">
1276    </t>
1277    <t hangText="Additional information:">
1278      <list style="hanging">
1279        <t hangText="Magic number(s):">none</t>
1280        <t hangText="File extension(s):">none</t>
1281        <t hangText="Macintosh file type code(s):">none</t>
1282      </list>
1283    </t>
1284    <t hangText="Person and email address to contact for further information:">
1285      See Authors Section.
1286    </t>
1287                <t hangText="Intended usage:">
1288                  COMMON
1289    </t>
1290                <t hangText="Restrictions on usage:">
1291                  none
1292    </t>
1293    <t hangText="Author/Change controller:">
1294      IESG
1295    </t>
1296  </list>
1297</t>
1298<figure><preamble>
1299   For example:
1300</preamble><artwork type="example"><![CDATA[
1301  HTTP/1.1 206 Partial Content
1302  Date: Wed, 15 Nov 1995 06:25:24 GMT
1303  Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
1304  Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
1305 
1306  --THIS_STRING_SEPARATES
1307  Content-type: application/pdf
1308  Content-range: bytes 500-999/8000
1309 
1310  ...the first range...
1311  --THIS_STRING_SEPARATES
1312  Content-type: application/pdf
1313  Content-range: bytes 7000-7999/8000
1314 
1315  ...the second range
1316  --THIS_STRING_SEPARATES--
1317]]></artwork></figure>
1318<t>
1319      Notes:
1320  <list style="numbers">
1321      <t>Additional CRLFs may precede the first boundary string in the
1322         entity.</t>
1323
1324      <t>Although <xref target="RFC2046"/> permits the boundary string to be
1325         quoted, some existing implementations handle a quoted boundary
1326         string incorrectly.</t>
1327
1328      <t>A number of browsers and servers were coded to an early draft
1329         of the byteranges specification to use a media type of
1330         multipart/x-byteranges<iref item="multipart/x-byteranges Media Type"/><iref item="Media Type" subitem="multipart/x-byteranges"/>, which is almost, but not quite
1331         compatible with the version documented in HTTP/1.1.</t>
1332  </list>
1333</t>
1334</section>
1335
1336<section title="Compatibility with Previous Versions" anchor="compatibility">
1337<section title="Changes from RFC 2068" anchor="changes.from.rfc.2068">
1338<t>
1339   Transfer-coding and message lengths all interact in ways that
1340   required fixing exactly when chunked encoding is used (to allow for
1341   transfer encoding that may not be self delimiting); it was important
1342   to straighten out exactly how message lengths are computed.
1343   (<xref target="header.content-range"/>,
1344   see also <xref target="Part1"/>, <xref target="Part3"/> and <xref target="Part6"/>)
1345</t>
1346<t>
1347   There are situations where a server (especially a proxy) does not
1348   know the full length of a response but is capable of serving a
1349   byterange request. We therefore need a mechanism to allow byteranges
1350   with a content-range not indicating the full length of the message.
1351   (<xref target="header.content-range"/>)
1352</t>
1353<t>
1354   Range request responses would become very verbose if all meta-data
1355   were always returned; by allowing the server to only send needed
1356   headers in a 206 response, this problem can be avoided.
1357   (Section <xref target="status.206" format="counter"/>
1358   and <xref target="header.if-range" format="counter"/>)
1359</t>
1360<t>
1361   Fix problem with unsatisfiable range requests; there are two cases:
1362   syntactic problems, and range doesn't exist in the document. The 416
1363   status code was needed to resolve this ambiguity needed to indicate
1364   an error for a byte range request that falls outside of the actual
1365   contents of a document. (Section <xref target="status.416" format="counter"/>, <xref target="header.content-range" format="counter"/>)
1366</t>
1367</section>
1368
1369<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1370<t>
1371  Clarify that it is not ok to use a weak cache validator in a 206 response.
1372  (<xref target="status.206"/>)
1373</t>
1374<t>
1375  Clarify that multipart/byteranges can consist of a single part.
1376  (<xref target="internet.media.type.multipart.byteranges"/>)
1377</t>
1378
1379</section>
1380
1381</section>
1382
1383<section title="Collected ABNF" anchor="collected.abnf">
1384<figure>
1385<artwork type="abnf" name="p5-range.parsed-abnf"><![CDATA[
1386Accept-Ranges = "Accept-Ranges:" OWS Accept-Ranges-v
1387Accept-Ranges-v = acceptable-ranges
1388
1389Content-Range = "Content-Range:" OWS Content-Range-v
1390Content-Range-v = content-range-spec
1391
1392HTTP-date = <HTTP-date, defined in [Part1], Section 3.2>
1393
1394If-Range = "If-Range:" OWS If-Range-v
1395If-Range-v = entity-tag / HTTP-date
1396
1397OWS = <OWS, defined in [Part1], Section 1.2.2>
1398
1399Range = "Range:" OWS Range-v
1400Range-v = byte-ranges-specifier / other-ranges-specifier
1401
1402acceptable-ranges = ( *( "," OWS ) range-unit *( OWS "," [ OWS
1403 range-unit ] ) ) / "none"
1404
1405byte-content-range-spec = bytes-unit SP byte-range-resp-spec "/" (
1406 instance-length / "*" )
1407byte-range-resp-spec = ( first-byte-pos "-" last-byte-pos ) / "*"
1408byte-range-set = ( *( "," OWS ) byte-range-spec ) / (
1409 suffix-byte-range-spec *( OWS "," [ ( OWS byte-range-spec ) /
1410 suffix-byte-range-spec ] ) )
1411byte-range-spec = first-byte-pos "-" [ last-byte-pos ]
1412byte-ranges-specifier = bytes-unit "=" byte-range-set
1413bytes-unit = "bytes"
1414
1415content-range-spec = byte-content-range-spec /
1416 other-content-range-spec
1417
1418entity-tag = <entity-tag, defined in [Part4], Section 2>
1419
1420first-byte-pos = 1*DIGIT
1421
1422instance-length = 1*DIGIT
1423
1424last-byte-pos = 1*DIGIT
1425
1426other-content-range-spec = other-range-unit SP other-range-resp-spec
1427other-range-resp-spec = *CHAR
1428other-range-unit = token
1429other-ranges-specifier = 1*CHAR
1430
1431range-unit = bytes-unit / other-range-unit
1432
1433suffix-byte-range-spec = "-" suffix-length
1434suffix-length = 1*DIGIT
1435
1436token = <token, defined in [Part1], Section 1.2.2>
1437
1438
1439]]></artwork>
1440</figure>
1441<figure><preamble>ABNF diagnostics:</preamble><artwork type="inline"><![CDATA[
1442; Accept-Ranges defined but not used
1443; Content-Range defined but not used
1444; If-Range defined but not used
1445; Range defined but not used
1446]]></artwork></figure></section>
1447
1448<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
1449
1450<section title="Since RFC2616">
1451<t>
1452  Extracted relevant partitions from <xref target="RFC2616"/>.
1453</t>
1454</section>
1455
1456<section title="Since draft-ietf-httpbis-p5-range-00">
1457<t>
1458  Closed issues:
1459  <list style="symbols"> 
1460    <t>
1461      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/18"/>:
1462      "Cache validators in 206 responses"
1463      (<eref target="http://purl.org/NET/http-errata#ifrange206"/>)
1464    </t>
1465    <t>
1466      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/35"/>:
1467      "Normative and Informative references"
1468    </t>
1469    <t>
1470      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/86"/>:
1471      "Normative up-to-date references"
1472    </t>
1473  </list>
1474</t>
1475</section>
1476
1477<section title="Since draft-ietf-httpbis-p5-range-01">
1478<t>
1479  Closed issues:
1480  <list style="symbols"> 
1481    <t>
1482      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/55"/>:
1483      "Updating to RFC4288"
1484    </t>
1485  </list>
1486</t>
1487<t>
1488  Ongoing work on ABNF conversion (<eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/36"/>):
1489  <list style="symbols"> 
1490    <t>
1491      Add explicit references to BNF syntax and rules imported from other parts of the specification.
1492    </t>
1493  </list>
1494</t>
1495</section>
1496
1497<section title="Since draft-ietf-httpbis-p5-range-02" anchor="changes.since.02">
1498<t>
1499  Ongoing work on IANA Message Header Registration (<eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/40"/>):
1500  <list style="symbols"> 
1501    <t>
1502      Reference RFC 3984, and update header registrations for headers defined
1503      in this document.
1504    </t>
1505  </list>
1506</t>
1507</section>
1508
1509<section title="Since draft-ietf-httpbis-p5-range-03" anchor="changes.since.03">
1510<t>
1511</t>
1512</section>
1513
1514<section title="Since draft-ietf-httpbis-p5-range-04" anchor="changes.since.04">
1515<t>
1516  Closed issues:
1517  <list style="symbols"> 
1518    <t>
1519      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/133"/>:
1520      "multipart/byteranges minimum number of parts"
1521    </t>
1522  </list>
1523</t>
1524<t>
1525  Ongoing work on ABNF conversion (<eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/36"/>):
1526  <list style="symbols"> 
1527    <t>
1528      Use "/" instead of "|" for alternatives.
1529    </t>
1530    <t>
1531      Introduce new ABNF rules for "bad" whitespace ("BWS"), optional
1532      whitespace ("OWS") and required whitespace ("RWS").
1533    </t>
1534    <t>
1535      Rewrite ABNFs to spell out whitespace rules, factor out
1536      header value format definitions.
1537    </t>
1538  </list>
1539</t>
1540</section>
1541
1542<section title="Since draft-ietf-httpbis-p5-range-05" anchor="changes.since.05">
1543<t>
1544  Closed issues:
1545  <list style="symbols"> 
1546    <t>
1547      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/142"/>:
1548      "State base for *-byte-pos and suffix-length"
1549    </t>
1550  </list>
1551</t>
1552<t>
1553  Ongoing work on Custom Ranges (<eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/85"/>):
1554  <list style="symbols"> 
1555    <t>
1556      Remove bias in favor of byte ranges; allow custom ranges in ABNF.
1557    </t>
1558  </list>
1559</t>
1560<t>
1561  Final work on ABNF conversion (<eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/36"/>):
1562  <list style="symbols"> 
1563    <t>
1564      Add appendix containing collected and expanded ABNF, reorganize ABNF introduction.
1565    </t>
1566  </list>
1567</t>
1568</section>
1569
1570<section title="Since draft-ietf-httpbis-p5-range-06" anchor="changes.since.06">
1571<t>
1572  Closed issues:
1573  <list style="symbols"> 
1574    <t>
1575      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/161"/>:
1576      "base for numeric protocol elements"
1577    </t>
1578  </list>
1579</t>
1580</section>
1581
1582</section>
1583
1584</back>
1585</rfc>
Note: See TracBrowser for help on using the repository browser.