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

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

(editorial) move discussion of single or multiple parts inside the 206 definition

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/xml
File size: 59.5 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?>
3<!DOCTYPE rfc [
4  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
5  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
6  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
7  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
8  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
9  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
10  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
11  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
12  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
13  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
14  <!ENTITY ID-VERSION "latest">
15  <!ENTITY ID-MONTH "January">
16  <!ENTITY ID-YEAR "2013">
17  <!ENTITY Note "<x:h xmlns:x='http://purl.org/net/xml2rfc/ext'>Note:</x:h>">
18  <!ENTITY architecture               "<xref target='Part1' x:rel='#architecture' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
19  <!ENTITY conformance                "<xref target='Part1' x:rel='#conformance' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
20  <!ENTITY notation                   "<xref target='Part1' x:rel='#notation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
21  <!ENTITY abnf-extension             "<xref target='Part1' x:rel='#abnf.extension' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
22  <!ENTITY acks                       "<xref target='Part1' x:rel='#acks' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
23  <!ENTITY whitespace                 "<xref target='Part1' x:rel='#whitespace' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
24  <!ENTITY field-components           "<xref target='Part1' x:rel='#field.components' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
25  <!ENTITY messaging                  "<xref target='Part1' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
26  <!ENTITY semantics                  "<xref target='Part2' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
27  <!ENTITY http-date                  "<xref target='Part2' x:rel='#http.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
28  <!ENTITY representation             "<xref target='Part2' x:rel='#representations' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
29  <!ENTITY entity-tags                "<xref target='Part4' x:rel='#header.etag' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
30  <!ENTITY weak-and-strong-validators "<xref target='Part4' x:rel='#weak.and.strong.validators' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
31  <!ENTITY lastmod-comparison         "<xref target='Part4' x:rel='#lastmod.comparison' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
32  <!ENTITY p6-heuristic               "<xref target='Part6' x:rel='#heuristic.freshness' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
33]>
34<?rfc toc="yes" ?>
35<?rfc symrefs="yes" ?>
36<?rfc sortrefs="yes" ?>
37<?rfc compact="yes"?>
38<?rfc subcompact="no" ?>
39<?rfc linkmailto="no" ?>
40<?rfc editing="no" ?>
41<?rfc comments="yes"?>
42<?rfc inline="yes"?>
43<?rfc rfcedstyle="yes"?>
44<?rfc-ext allow-markup-in-artwork="yes" ?>
45<?rfc-ext include-references-in-index="yes" ?>
46<rfc obsoletes="2616" category="std" x:maturity-level="proposed"
47     ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p5-range-&ID-VERSION;"
48     xmlns:x='http://purl.org/net/xml2rfc/ext'>
49<x:link rel="prev" basename="p4-conditional"/>
50<x:link rel="next" basename="p6-cache"/>
51<x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=&lt;{ref}&gt;:"/>
52<front>
53
54  <title abbrev="HTTP/1.1 Range Requests">Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
55
56  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
57    <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
58    <address>
59      <postal>
60        <street>345 Park Ave</street>
61        <city>San Jose</city>
62        <region>CA</region>
63        <code>95110</code>
64        <country>USA</country>
65      </postal>
66      <email>fielding@gbiv.com</email>
67      <uri>http://roy.gbiv.com/</uri>
68    </address>
69  </author>
70
71  <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
72    <organization abbrev="W3C">World Wide Web Consortium</organization>
73    <address>
74      <postal>
75        <street>W3C / ERCIM</street>
76        <street>2004, rte des Lucioles</street>
77        <city>Sophia-Antipolis</city>
78        <region>AM</region>
79        <code>06902</code>
80        <country>France</country>
81      </postal>
82      <email>ylafon@w3.org</email>
83      <uri>http://www.raubacapeu.net/people/yves/</uri>
84    </address>
85  </author>
86
87  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
88    <organization abbrev="greenbytes">greenbytes GmbH</organization>
89    <address>
90      <postal>
91        <street>Hafenweg 16</street>
92        <city>Muenster</city><region>NW</region><code>48155</code>
93        <country>Germany</country>
94      </postal>
95      <email>julian.reschke@greenbytes.de</email>
96      <uri>http://greenbytes.de/tech/webdav/</uri>
97    </address>
98  </author>
99
100  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
101  <workgroup>HTTPbis Working Group</workgroup>
102
103<abstract>
104<t>
105   The Hypertext Transfer Protocol (HTTP) is an application-level protocol for
106   distributed, collaborative, hypertext information systems. This document
107   defines range requests and the rules for constructing and combining
108   responses to those requests.
109</t>
110</abstract>
111
112<note title="Editorial Note (To be removed by RFC Editor)">
113  <t>
114    Discussion of this draft takes place on the HTTPBIS working group
115    mailing list (ietf-http-wg@w3.org), which is archived at
116    <eref target="http://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
117  </t>
118  <t>
119    The current issues list is at
120    <eref target="http://tools.ietf.org/wg/httpbis/trac/report/3"/> and related
121    documents (including fancy diffs) can be found at
122    <eref target="http://tools.ietf.org/wg/httpbis/"/>.
123  </t>
124  <t>
125    The changes in this draft are summarized in <xref target="changes.since.21"/>.
126  </t>
127</note>
128</front>
129<middle>
130<section title="Introduction" anchor="introduction">
131<t>
132   Hypertext Transfer Protocol (HTTP) clients often encounter interrupted data
133   transfers as a result of canceled requests or dropped connections. When a
134   client has stored a partial representation, it is desirable to request the
135   remainder of that representation in a subsequent request rather than
136   transfer the entire representation. Likewise, devices with limited local
137   storage might benefit from being able to request only a subset of a larger
138   representation, such as a single page of a very large document, or the
139   dimensions of an embedded image.
140</t>
141<t>
142   This document defines HTTP/1.1 range requests, partial responses, and the
143   multipart/byteranges media type, obsoleting those parts previously defined
144   in <xref target="RFC2616"/>. Range requests are an &OPTIONAL; feature
145   of HTTP, designed so that recipients not implementing this feature (or not
146   supporting it for the target resource) can respond as if it is a normal
147   GET request without impacting interoperability. Partial responses are
148   indicated by a distinct status code to not be mistaken for full responses
149   by caches that might not implement the feature.
150</t>
151<t>
152   Although the range request mechanism is designed to allow for
153   extensible range types, this specification only defines requests for
154   byte ranges.
155</t>
156
157<section title="Conformance and Error Handling" anchor="conformance">
158<t>
159   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
160   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
161   document are to be interpreted as described in <xref target="RFC2119"/>.
162</t>
163<t>
164   Conformance criteria and considerations regarding error handling
165   are defined in &conformance;.
166</t>
167</section>
168
169<section title="Syntax Notation" anchor="notation">
170<t>
171   This specification uses the Augmented Backus-Naur Form (ABNF) notation
172   of <xref target="RFC5234"/> with the list rule extension defined in
173   &notation;. <xref target="imported.abnf"/> describes rules imported from
174   other documents. <xref target="collected.abnf"/> shows the collected ABNF
175   with the list rule expanded.
176</t>
177</section>
178</section>
179
180
181<section title="Range Units" anchor="range.units">
182  <x:anchor-alias value="range-unit"/>
183  <x:anchor-alias value="range unit"/>
184<t>
185   A representation can be partitioned into subranges according to various
186   structural units, depending on the structure inherent in the
187   representation's media type. This "<x:dfn>range unit</x:dfn>" is used
188   in the <x:ref>Accept-Ranges</x:ref> (<xref target="header.accept-ranges"/>)
189   response header field to advertise support for range requests, the
190   <x:ref>Range</x:ref> (<xref target="header.range"/>) request header field
191   to delineate the parts of a representation that are requested, and the
192   <x:ref>Content-Range</x:ref> (<xref target="header.content-range"/>)
193   payload header field to describe which part of a representation is being
194   transferred.
195</t>
196<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="range-unit"/><iref item="Grammar" subitem="bytes-unit"/><iref item="Grammar" subitem="other-range-unit"/>
197  <x:ref>range-unit</x:ref>       = <x:ref>bytes-unit</x:ref> / <x:ref>other-range-unit</x:ref>
198</artwork></figure>
199
200<section title="Byte Ranges" anchor="byte.ranges">
201  <x:anchor-alias value="bytes-unit"/>
202<t>
203   Since representation data is transferred in payloads as a sequence of
204   octets, a byte range is a meaningful substructure for any representation
205   transferable over HTTP (&representation;). We define the "bytes" range
206   unit for expressing subranges of the data's octet sequence.
207</t>
208<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="bytes-unit"/>
209  <x:ref>bytes-unit</x:ref>       = "bytes"
210</artwork></figure>
211<t anchor="rule.ranges-specifier">
212  <x:anchor-alias value="byte-range-set"/>
213  <x:anchor-alias value="byte-range-spec"/>
214  <x:anchor-alias value="byte-ranges-specifier"/>
215  <x:anchor-alias value="first-byte-pos"/>
216  <x:anchor-alias value="last-byte-pos"/>
217  <x:anchor-alias value="ranges-specifier"/>
218  <x:anchor-alias value="suffix-byte-range-spec"/>
219  <x:anchor-alias value="suffix-length"/>
220   A byte range operation &MAY; specify a single range of bytes, or a set
221   of ranges within a single representation.
222</t>
223<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ranges-specifier"/><iref primary="true" item="Grammar" subitem="byte-ranges-specifier"/><iref primary="true" item="Grammar" subitem="byte-range-set"/><iref primary="true" item="Grammar" subitem="byte-range-spec"/><iref primary="true" item="Grammar" subitem="first-byte-pos"/><iref primary="true" item="Grammar" subitem="last-byte-pos"/>
224  <x:ref>byte-ranges-specifier</x:ref> = <x:ref>bytes-unit</x:ref> "=" <x:ref>byte-range-set</x:ref>
225  <x:ref>byte-range-set</x:ref>  = 1#( <x:ref>byte-range-spec</x:ref> / <x:ref>suffix-byte-range-spec</x:ref> )
226  <x:ref>byte-range-spec</x:ref> = <x:ref>first-byte-pos</x:ref> "-" [ <x:ref>last-byte-pos</x:ref> ]
227  <x:ref>first-byte-pos</x:ref>  = 1*<x:ref>DIGIT</x:ref>
228  <x:ref>last-byte-pos</x:ref>   = 1*<x:ref>DIGIT</x:ref>
229</artwork></figure>
230<t>
231   The <x:ref>first-byte-pos</x:ref> value in a <x:ref>byte-range-spec</x:ref>
232   gives the byte-offset of the first byte in a range.
233   The <x:ref>last-byte-pos</x:ref> value gives the byte-offset of the last
234   byte in the range; that is, the byte positions specified are inclusive.
235   Byte offsets start at zero.
236</t>
237<t>
238   Examples of <x:ref>byte-ranges-specifier</x:ref> values:
239  <list style="symbols">
240     <t>The first 500 bytes (byte offsets 0-499, inclusive):
241<figure><artwork type="example" x:indent-with="   ">
242  bytes=0-499
243</artwork></figure>
244    </t>
245     <t>The second 500 bytes (byte offsets 500-999, inclusive):
246<figure><artwork type="example" x:indent-with="   ">
247  bytes=500-999
248</artwork></figure>
249    </t>
250  </list>
251</t>
252<t>
253   A <x:ref>byte-range-spec</x:ref> is invalid if the
254   <x:ref>last-byte-pos</x:ref> value is present and less than the
255   <x:ref>first-byte-pos</x:ref>.
256</t>
257<t>
258   A client can limit the number of bytes requested without knowing the size
259   of the selected representation.
260   If the <x:ref>last-byte-pos</x:ref> value is absent, or if the value is
261   greater than or equal to the current length of the representation data, the
262   byte range is interpreted as the remainder of the representation (i.e., the
263   server replaces the value of <x:ref>last-byte-pos</x:ref> with a value that
264   is one less than the current length of the selected representation).
265</t>
266<t>
267   A client can request the last N bytes of the selected representation using
268   a <x:ref>suffix-byte-range-spec</x:ref>.
269</t>
270<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="suffix-byte-range-spec"/><iref primary="true" item="Grammar" subitem="suffix-length"/>
271  <x:ref>suffix-byte-range-spec</x:ref> = "-" <x:ref>suffix-length</x:ref>
272  <x:ref>suffix-length</x:ref> = 1*<x:ref>DIGIT</x:ref>
273</artwork></figure>
274<t>
275   If the selected representation is shorter than the specified
276   <x:ref>suffix-length</x:ref>, the entire representation is used.
277   For example (assuming a representation of length 10000):
278  <list style="symbols">
279     <t>The final 500 bytes (byte offsets 9500-9999, inclusive):
280<figure><artwork type="example" x:indent-with="   ">
281  bytes=-500
282</artwork></figure>
283    Or:
284<figure><artwork type="example" x:indent-with="   ">
285  bytes=9500-
286</artwork></figure>
287    </t>
288     <t>The first and last bytes only (bytes 0 and 9999):
289<figure><artwork type="example" x:indent-with="   ">
290  bytes=0-0,-1
291</artwork></figure>
292     </t>
293     <t>Other valid (but not canonical) specifications of the second 500
294        bytes (byte offsets 500-999, inclusive):
295<figure><artwork type="example" x:indent-with="   ">
296  bytes=500-600,601-999
297  bytes=500-700,601-999
298</artwork></figure>
299     </t>
300  </list>
301</t>
302<t>
303   If a valid <x:ref>byte-range-set</x:ref> includes at least one
304   <x:ref>byte-range-spec</x:ref> with a <x:ref>first-byte-pos</x:ref> that is
305   less than the current length of the representation, or at least one
306   <x:ref>suffix-byte-range-spec</x:ref> with a non-zero
307   <x:ref>suffix-length</x:ref>, then the <x:ref>byte-range-set</x:ref> is
308   satisfiable. Otherwise, the <x:ref>byte-range-set</x:ref> is unsatisfiable.
309</t>
310<t>
311   In the byte range syntax, <x:ref>first-byte-pos</x:ref>,
312   <x:ref>last-byte-pos</x:ref>, and <x:ref>suffix-length</x:ref> are
313   expressed as decimal number of octets. Since there is no predefined limit
314   to the length of a payload, recipients ought to anticipate potentially
315   large decimal numerals and prevent parsing errors due to integer conversion
316   overflows.
317</t>
318</section>
319
320<section title="Other Range Units" anchor="range.units.other">
321  <x:anchor-alias value="other-range-unit"/>
322<t>
323  Range units are intended to be extensible.  New range units ought to be
324  registered with IANA, as defined in <xref target="range.unit.registry"/>.
325</t>
326<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="other-range-unit"/>
327  <x:ref>other-range-unit</x:ref> = <x:ref>token</x:ref>
328</artwork></figure>
329</section>
330
331<section title="Accept-Ranges" anchor="header.accept-ranges">
332  <iref primary="true" item="Accept-Ranges header field" x:for-anchor=""/>
333  <x:anchor-alias value="Accept-Ranges"/>
334  <x:anchor-alias value="acceptable-ranges"/>
335<t>
336   The "Accept-Ranges" header field allows a server to indicate that it
337   supports range requests for the target resource.
338</t>
339<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Ranges"/><iref primary="true" item="Grammar" subitem="acceptable-ranges"/>
340  <x:ref>Accept-Ranges</x:ref>     = <x:ref>acceptable-ranges</x:ref>
341  <x:ref>acceptable-ranges</x:ref> = 1#<x:ref>range-unit</x:ref> / "none"
342</artwork></figure>
343<t>
344   Origin servers that support byte-range requests &MAY; send
345</t>
346<figure><artwork type="example">
347  Accept-Ranges: bytes
348</artwork></figure>
349<t>
350   but are not required to do so. Clients &MAY; generate range
351   requests without having received this header field for the resource
352   involved. Range units are defined in <xref target="range.units"/>.
353</t>
354<t>
355   Servers that do not support any kind of range request for the target
356   resource resource &MAY; send
357</t>
358<figure><artwork type="example">
359  Accept-Ranges: none
360</artwork></figure>
361<t>
362   to advise the client not to attempt a range request.
363</t>
364</section>
365</section>
366
367
368<section title="Range Requests" anchor="range.requests">
369<section title="Range" anchor="header.range">
370  <iref primary="true" item="Range header field" x:for-anchor=""/>
371  <x:anchor-alias value="Range"/>
372  <x:anchor-alias value="other-ranges-specifier"/>
373  <x:anchor-alias value="other-range-set"/>
374<t>
375   The "Range" header field on a GET request modifies the method semantics to
376   request transfer of only one or more subranges of the selected
377   representation data, rather than the entire selected representation data.
378</t>
379<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Range"/>
380  <x:ref>Range</x:ref> = <x:ref>byte-ranges-specifier</x:ref> / <x:ref>other-ranges-specifier</x:ref>
381  <x:ref>other-ranges-specifier</x:ref> = <x:ref>other-range-unit</x:ref> "=" <x:ref>other-range-set</x:ref>
382  <x:ref>other-range-set</x:ref> = 1*<x:ref>CHAR</x:ref>
383</artwork></figure>
384<t>
385   A server &MAY; ignore the Range header field. However, origin servers and
386   intermediate caches ought to support byte ranges when possible, since Range
387   supports efficient recovery from partially failed transfers and partial
388   retrieval of large representations. A server &MUST; ignore a Range header
389   field received with a request method other than GET.
390</t>
391<t>
392   An origin server &MUST; ignore a Range header field that contains a range
393   unit it does not understand. A proxy &MAY; either discard a Range header
394   field that contains a range unit it does not understand or pass it to the
395   next inbound server when forwarding the request.
396</t>
397<t>
398   The Range header field is evaluated after evaluating the preconditions of
399   <xref target="Part4"/> and only if the result of their evaluation is
400   leading toward a <x:ref>200 (OK)</x:ref> response. In other words, Range
401   is ignored when a conditional GET would result in a
402   <x:ref>304 (Not Modified)</x:ref> response.
403</t>
404<t>
405   The If-Range header field (<xref target="header.if-range"/>) can be used as
406   a precondition to applying the Range header field.
407</t>
408<t>
409   If all of the preconditions are true, the server supports the Range header
410   field for the target resource, and the specified range(s) are valid and
411   satisfiable (as defined in <xref target="byte.ranges"/>), the
412   server &SHOULD; send a <x:ref>206 (Partial Content)</x:ref> response with a
413   payload containing one or more partial representations that correspond to
414   the satisfiable ranges requested, as defined in
415   <xref target="range.response"/>.
416</t>
417<t>
418   If all of the preconditions are true, the server supports the Range header
419   field for the target resource, and the specified range(s) are invalid or
420   unsatisfiable, the server &SHOULD; send a
421   <x:ref>416 (Range Not Satisfiable)</x:ref> response.
422</t>
423</section>
424
425<section title="If-Range" anchor="header.if-range">
426  <iref primary="true" item="If-Range header field" x:for-anchor=""/>
427  <x:anchor-alias value="If-Range"/>
428<t>
429   If a client has a partial copy of a representation and wishes
430   to have an up-to-date copy of the entire representation, it could use the
431   <x:ref>Range</x:ref> header field with a conditional GET (using
432   either or both of <x:ref>If-Unmodified-Since</x:ref> and
433   <x:ref>If-Match</x:ref>.) However, if the condition fails because the
434   representation has been modified, the client would then have to make a
435   second request to obtain the entire current representation.
436</t>
437<t>
438   The "If-Range" header field allows a client to "short-circuit" the second
439   request. Informally, its meaning is: if the representation is unchanged,
440   send me the part(s) that I am requesting in Range; otherwise, send me the
441   entire representation.
442</t>
443<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Range"/>
444  <x:ref>If-Range</x:ref> = <x:ref>entity-tag</x:ref> / <x:ref>HTTP-date</x:ref>
445</artwork></figure>
446<t>
447   Clients &MUST-NOT; use an entity-tag marked as weak in an If-Range
448   field value and &MUST-NOT; use a <x:ref>Last-Modified</x:ref> date in an
449   If-Range field value unless it has no entity-tag for the representation and
450   the Last-Modified date it does have for the representation is strong
451   in the sense defined by &lastmod-comparison;.
452</t>
453<t>
454   A server that evaluates a conditional range request that is applicable
455   to one of its representations &MUST; evaluate the condition as false if
456   the entity-tag used as a validator is marked as weak or, when an HTTP-date
457   is used as the validator, if the date value is not strong in the sense
458   defined by &lastmod-comparison;. (A server can distinguish between a
459   valid HTTP-date and any form of entity-tag by examining the first
460   two characters.)
461</t>
462<t>
463   A client &MUST-NOT; generate an If-Range header field in a request that
464   does not contain a <x:ref>Range</x:ref> header field.
465   A server &MUST; ignore an If-Range header field received in a request that
466   does not contain a <x:ref>Range</x:ref> header field.
467   An origin server &MUST; ignore an If-Range header field received in a
468   request for a target resource that does not support Range requests.
469</t>
470<t>
471   If the validator given in the If-Range header field matches the current
472   validator for the selected representation of the target resource, then
473   the server &SHOULD; process the Range header field as requested.
474   If the validator does not match, then the server &MUST; ignore the
475   <x:ref>Range</x:ref> header field.
476</t>
477</section>
478</section>
479
480
481<section title="Responses to a Range Request" anchor="range.response">
482
483<section title="206 Partial Content" anchor="status.206">
484  <iref primary="true" item="206 Partial Content (status code)" x:for-anchor=""/>
485  <x:anchor-alias value="206"/>
486  <x:anchor-alias value="206 (Partial Content)"/>
487<t>
488   The <x:dfn>206 (Partial Content)</x:dfn> status code indicates that the
489   server has fulfilled the partial GET request for the resource.
490   The request &MUST; have included a <x:ref>Range</x:ref> header field
491   (<xref target="header.range"/>) indicating the desired range, and &MAY; have
492   included an <x:ref>If-Range</x:ref> header field
493   (<xref target="header.if-range"/>) to make the request conditional.
494</t>
495<t>
496   When an HTTP message includes the content of a single range (for
497   example, a response to a request for a single range, or to a request
498   for a set of ranges that overlap without any holes), this content is
499   transmitted with a <x:ref>Content-Range</x:ref> header field, and a
500   <x:ref>Content-Length</x:ref> header field showing the number of bytes
501   actually transferred. For example,
502</t>
503<figure><artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with="  ">
504HTTP/1.1 206 Partial Content
505Date: Wed, 15 Nov 1995 06:25:24 GMT
506Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
507Content-Range: bytes 21010-47021/47022
508Content-Length: 26012
509Content-Type: image/gif
510</artwork></figure>
511<t>
512   When an HTTP message includes the content of multiple ranges (for
513   example, a response to a request for multiple non-overlapping
514   ranges), these are transmitted as a multipart message. The multipart
515   media type used for this purpose is "multipart/byteranges" as defined
516   in <xref target="internet.media.type.multipart.byteranges"/>.
517</t>
518<t>
519   A server &MAY; combine requested ranges when those ranges are overlapping
520   (see <xref target="overlapping.ranges"/>).
521</t>
522<t>
523   A response to a request for a single range &MUST-NOT; be sent using the
524   multipart/byteranges media type.  A response to a request for
525   multiple ranges, whose result is a single range, &MAY; be sent as a
526   multipart/byteranges media type with one part. A client that cannot
527   decode a multipart/byteranges message &MUST-NOT; ask for multiple
528   ranges in a single request.
529</t>
530<t>
531   When a client asks for multiple ranges in one request, the
532   server &SHOULD; send them in the order that they appeared in the
533   request.
534</t>
535<t>
536   When a 206 response is generated, the sender &MUST; generate the following
537   header fields:
538  <list style="symbols">
539    <t>
540        Either a <x:ref>Content-Range</x:ref> header field
541        (<xref target="header.content-range"/>) indicating the single range
542        included with this response, or a multipart/byteranges
543        <x:ref>Content-Type</x:ref> indicating that multiple ranges are
544        enclosed as multipart body-parts.
545    </t>
546    <t>
547        <x:ref>Date</x:ref>
548    </t>
549    <t>
550        <x:ref>Cache-Control</x:ref>, <x:ref>ETag</x:ref>,
551        <x:ref>Expires</x:ref>, <x:ref>Content-Location</x:ref> and/or
552        <x:ref>Vary</x:ref>, if the header field would have been sent in a
553        <x:ref>200 (OK)</x:ref> response to the same request
554    </t>
555  </list>
556</t>
557<t>
558   If a 206 is generated in response to a request with an <x:ref>If-Range</x:ref>
559   header field, the sender &SHOULD-NOT; generate other representation header
560   fields beyond those described above.
561   Otherwise, the sender &MUST; generate all of the same representation header
562   fields that would have been sent in a <x:ref>200 (OK)</x:ref> response
563   to the same request.
564</t>
565<t>
566   Caches &MAY; use a heuristic (see &p6-heuristic;) to determine
567   freshness for 206 responses.
568</t>
569</section>
570
571<section title="Content-Range" anchor="header.content-range">
572  <iref primary="true" item="Content-Range header field" x:for-anchor=""/>
573  <x:anchor-alias value="Content-Range"/>
574  <x:anchor-alias value="byte-content-range"/>
575  <x:anchor-alias value="byte-range-resp"/>
576  <x:anchor-alias value="byte-range"/>
577  <x:anchor-alias value="unsatisfied-range"/>
578  <x:anchor-alias value="complete-length"/>
579  <x:anchor-alias value="other-content-range"/>
580  <x:anchor-alias value="other-range-resp"/>
581<t>
582   The "Content-Range" header field is sent with a partial representation to
583   specify what range of the full representation is enclosed as payload.
584</t>
585<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Range"/><iref primary="true" item="Grammar" subitem="byte-content-range"/><iref primary="true" item="Grammar" subitem="byte-range-resp"/><iref primary="true" item="Grammar" subitem="byte-range"/><iref primary="true" item="Grammar" subitem="unsatisfied-range"/><iref primary="true" item="Grammar" subitem="other-content-range"/><iref primary="true" item="Grammar" subitem="other-range-resp"/><iref primary="true" item="Grammar" subitem="complete-length"/>
586  <x:ref>Content-Range</x:ref>       = <x:ref>byte-content-range</x:ref>
587                      / <x:ref>other-content-range</x:ref>
588                         
589  <x:ref>byte-content-range</x:ref>  = <x:ref>bytes-unit</x:ref> <x:ref>SP</x:ref>
590                        ( <x:ref>byte-range-resp</x:ref> / <x:ref>unsatisfied-range</x:ref> )
591
592  <x:ref>byte-range-resp</x:ref>     = <x:ref>byte-range</x:ref> "/" ( <x:ref>complete-length</x:ref> / "*" )
593  <x:ref>byte-range</x:ref>          = <x:ref>first-byte-pos</x:ref> "-" <x:ref>last-byte-pos</x:ref>
594  <x:ref>unsatisfied-range</x:ref>   = "*/" <x:ref>complete-length</x:ref>
595                         
596  <x:ref>complete-length</x:ref>     = 1*<x:ref>DIGIT</x:ref>
597 
598  <x:ref>other-content-range</x:ref> = <x:ref>other-range-unit</x:ref> <x:ref>SP</x:ref> <x:ref>other-range-resp</x:ref>
599  <x:ref>other-range-resp</x:ref>    = *<x:ref>CHAR</x:ref>
600</artwork></figure>
601<t>  
602   Range units are defined in <xref target="range.units"/>. A recipient of a
603   <x:ref>206 (Partial Content)</x:ref> response containing a
604   <x:ref>Content-Range</x:ref> header field with a <x:ref>range unit</x:ref>
605   that the recipient does not understand &MUST-NOT; attempt to recombine it
606   with a stored representation. A proxy that receives such a message
607   &SHOULD; forward it downstream.
608</t>
609<t>
610   For byte ranges, a sender &SHOULD; indicate the complete length of the
611   representation from which the range has been extracted unless the complete
612   length is unknown or difficult to determine. An asterisk character ("*") in
613   place of the complete-length indicates that the representation length was
614   unknown when the header field was generated.
615</t>
616<t>
617   A Content-Range field value with a <x:ref>byte-range-resp</x:ref> that has
618   a <x:ref>last-byte-pos</x:ref> value less than its
619   <x:ref>first-byte-pos</x:ref> value, or a <x:ref>complete-length</x:ref>
620   value less than or equal to its <x:ref>last-byte-pos</x:ref> value, is
621   invalid. The recipient of an invalid <x:ref>Content-Range</x:ref> &MUST-NOT;
622   attempt to recombine the received content with a stored representation.
623</t>
624<t>
625   A server generating a <x:ref>206 (Partial Content)</x:ref> response to a
626   byte range request &MUST; send, in each body-part of a multipart response
627   or in the header block of a single part response, a Content-Range header
628   field containing a <x:ref>byte-range-resp</x:ref> value that reflects the
629   corresponding range being sent. The following example would apply
630   when the complete length of the selected representation is known by the
631   sender to be 1234 bytes:
632</t>
633<figure><artwork type="example">
634  Content-Range: bytes 42-1233/1234
635</artwork></figure>
636<t>
637   or this second example would apply when the complete length is unknown:
638</t>
639<figure><artwork type="example">
640  Content-Range: bytes 42-1233/*
641</artwork></figure>
642<t>
643   A server generating a <x:ref>416 (Range Not Satisfiable)</x:ref> response
644   to a byte range request &SHOULD; send a Content-Range header field with an
645   <x:ref>unsatisfied-range</x:ref> value, as in the following example:
646</t>
647<figure><artwork type="example">
648  Content-Range: bytes */1234
649</artwork></figure>
650<t>
651   The complete-length in a 416 response indicates the current length of the
652   selected representation, which will be known by the server generating the
653   response because that is how it determined the range to be unsatisfiable.
654</t>
655<t>
656   The "Content-Range" header field has no meaning for status codes that do
657   not explicitly describe its semantic. For this specification, only the
658   <x:ref>206 (Partial Content)</x:ref> and
659   <x:ref>416 (Range Not Satisfiable)</x:ref> status codes describe a meaning
660   for Content-Range.
661</t>
662<t>
663   More examples of Content-Range values, assuming that the representation
664   contains a total of 1234 bytes:
665   <list style="symbols">
666      <t>
667        The first 500 bytes:
668<figure><artwork type="example" x:indent-with="   ">
669  Content-Range: bytes 0-499/1234
670</artwork></figure>
671      </t>   
672      <t>
673        The second 500 bytes:
674<figure><artwork type="example" x:indent-with="   ">
675  Content-Range: bytes 500-999/1234
676</artwork></figure>
677      </t>   
678      <t>
679        All except for the first 500 bytes:
680<figure><artwork type="example" x:indent-with="   ">
681  Content-Range: bytes 500-1233/1234
682</artwork></figure>
683      </t>   
684      <t>
685        The last 500 bytes:
686<figure><artwork type="example" x:indent-with="   ">
687  Content-Range: bytes 734-1233/1234
688</artwork></figure>
689      </t>   
690   </list>
691</t>
692</section>
693
694<section title="Combining Ranges" anchor="combining.byte.ranges">
695<t>
696   A response might transfer only a subrange of a representation if the
697   connection closed prematurely or if the request used one or more Range
698   specifications.  After several such transfers, a client might have
699   received several ranges of the same representation.  These ranges can only
700   be safely combined if they all have in common the same strong validator,
701   where "strong validator" is defined to be either an entity-tag that is
702   not marked as weak (&entity-tags;) or, if no entity-tag is provided, a
703   <x:ref>Last-Modified</x:ref> value that is strong in the sense defined by
704   &lastmod-comparison;.
705</t>
706<t>
707   When a client receives an incomplete <x:ref>200 (OK)</x:ref> response or a
708   <x:ref>206 (Partial Content)</x:ref> response, and already has one or more
709   partial responses for the same method and effective request URI that have
710   the same strong validator as present in the new response,
711   the recipient &MAY; combine some or all of those responses into a set of
712   continuous ranges. A client &MUST-NOT; combine responses that differ in the
713   strong validator or that do not have a strong validator.
714</t>
715<t>
716   If the new response is an incomplete <x:ref>200 (OK)</x:ref> response, then
717   the header fields of that new response are used for any combined response
718   and replace those of the matching stored responses.
719</t>
720<t>
721   If the new response is a <x:ref>206 (Partial Content)</x:ref> response and
722   at least one of the matching stored responses is a <x:ref>200 (OK)</x:ref>,
723   then the combined response header fields consist of the most recent 200
724   response's header fields. If all of the matching stored responses are 206
725   responses, then the stored response with the most recent header fields is
726   used as the source of header fields for the combined response, except that
727   the client &MUST; use other header fields provided in the new response,
728   aside from <x:ref>Content-Range</x:ref>, to replace all instances of the
729   corresponding header fields in the stored response.
730</t>
731<t>
732   The combined response message body consists of the union of partial
733   content ranges in the new response and each of the selected responses.
734   If the union consists of the entire range of the representation, then the
735   client &MUST; record the combined response as if it were a complete
736   <x:ref>200 (OK)</x:ref> response, including a <x:ref>Content-Length</x:ref>
737   header field that reflects the complete length.
738   Otherwise, the client &MUST; record the set of continuous ranges as one of
739   the following:
740   an incomplete <x:ref>200 (OK)</x:ref> response if the combined response is
741   a prefix of the representation,
742   a single <x:ref>206 (Partial Content)</x:ref> response containing a
743   multipart/byteranges body, or
744   multiple <x:ref>206 (Partial Content)</x:ref> responses, each with one
745   continuous range that is indicated by a <x:ref>Content-Range</x:ref> header
746   field.
747</t>
748</section>
749
750<section title="416 Range Not Satisfiable" anchor="status.416">
751  <iref primary="true" item="416 Range Not Satisfiable (status code)" x:for-anchor=""/>
752  <x:anchor-alias value="416 (Range Not Satisfiable)"/>
753<t>
754   The <x:dfn>416 (Range Not Satisfiable)</x:dfn> status code
755   indicates that none of the ranges-specifier values in the request's
756   <x:ref>Range</x:ref> header field (<xref target="header.range"/>)
757   overlap the current
758   extent of the selected resource and the request did not include an
759   <x:ref>If-Range</x:ref> header field (<xref target="header.if-range"/>).
760   (For byte-ranges, this means that the first-byte-pos of all of the
761   byte-range-spec values were greater than the current length of the selected
762   representation.)
763</t>
764<t>
765   When this status code is sent in response to a byte-range request, the
766   sender &SHOULD; generate a <x:ref>Content-Range</x:ref> header field
767   specifying the current length of the selected representation
768   (see <xref target="header.content-range"/>).
769</t>
770<figure>
771<preamble>For example:</preamble>
772<artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with="  ">
773HTTP/1.1 416 Range Not Satisfiable
774Date: Mon, 20 Jan 2012 15:41:54 GMT
775Content-Range: bytes */47022
776Content-Type: image/gif
777</artwork></figure>
778<x:note>
779  <t>
780    &Note; Clients cannot depend on servers to send a <x:ref>416 (Range Not
781    Satisfiable)</x:ref> response instead of a <x:ref>200 (OK)</x:ref>
782    response for an unsatisfiable <x:ref>Range</x:ref> header field, since not
783    all servers implement this header field.
784  </t>
785</x:note>
786</section>
787</section>
788
789<section title="IANA Considerations" anchor="IANA.considerations">
790
791<section title="Range Unit Registry" anchor="range.unit.registry">
792<t>
793   The HTTP Range Unit Registry defines the name space for the range
794   unit names and refers to their corresponding specifications.
795   The registry is maintained at
796   <eref target="http://www.iana.org/assignments/http-parameters"/>.
797</t>
798
799<section title="Procedure" anchor="range.unit.registry.procedure">
800<t>
801   Registration of an HTTP Range Unit &MUST; include the following fields:
802   <list style="symbols">
803     <t>Name</t>
804     <t>Description</t>
805     <t>Pointer to specification text</t>
806   </list>
807</t>
808<t>
809  Values to be added to this name space require IETF Review
810  (see <xref target="RFC5226" x:fmt="," x:sec="4.1"/>).
811</t>
812</section>
813
814<section title="Registrations" anchor="range.unit.registration">
815<t>
816   The initial HTTP Range Unit Registry shall contain the registrations
817   below:
818</t>
819<texttable align="left" suppress-title="true" anchor="iana.range.units.table">
820   <ttcol>Range Specifier Name</ttcol>
821   <ttcol>Description</ttcol>
822   <ttcol>Reference</ttcol>
823
824   <c>bytes</c>
825   <c>a range of octets</c>
826   <c><xref target="byte.ranges"/></c>
827
828   <c>none</c>
829   <c>reserved as keyword, indicating no ranges are supported</c>
830   <c><xref target="header.accept-ranges"/></c>
831</texttable>
832<t>
833   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
834</t>
835</section>
836</section>
837
838<section title="Status Code Registration" anchor="status.code.registration">
839<t>
840   The HTTP Status Code Registry located at <eref target="http://www.iana.org/assignments/http-status-codes"/>
841   shall be updated with the registrations below:
842</t>
843<?BEGININC p5-range.iana-status-codes ?>
844<!--AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually-->
845<texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table">
846   <ttcol>Value</ttcol>
847   <ttcol>Description</ttcol>
848   <ttcol>Reference</ttcol>
849   <c>206</c>
850   <c>Partial Content</c>
851   <c>
852      <xref target="status.206"/>
853   </c>
854   <c>416</c>
855   <c>Range Not Satisfiable</c>
856   <c>
857      <xref target="status.416"/>
858   </c>
859</texttable>
860<!--(END)-->
861<?ENDINC p5-range.iana-status-codes ?>
862</section>
863
864<section title="Header Field Registration" anchor="header.field.registration">
865<t>
866   The Message Header Field Registry located at <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/> shall be updated
867   with the permanent registrations below (see <xref target="BCP90"/>):
868</t>
869<?BEGININC p5-range.iana-headers ?>
870<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
871<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
872   <ttcol>Header Field Name</ttcol>
873   <ttcol>Protocol</ttcol>
874   <ttcol>Status</ttcol>
875   <ttcol>Reference</ttcol>
876
877   <c>Accept-Ranges</c>
878   <c>http</c>
879   <c>standard</c>
880   <c>
881      <xref target="header.accept-ranges"/>
882   </c>
883   <c>Content-Range</c>
884   <c>http</c>
885   <c>standard</c>
886   <c>
887      <xref target="header.content-range"/>
888   </c>
889   <c>If-Range</c>
890   <c>http</c>
891   <c>standard</c>
892   <c>
893      <xref target="header.if-range"/>
894   </c>
895   <c>Range</c>
896   <c>http</c>
897   <c>standard</c>
898   <c>
899      <xref target="header.range"/>
900   </c>
901</texttable>
902<!--(END)-->
903<?ENDINC p5-range.iana-headers ?>
904<t>
905   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
906</t>
907</section>
908
909</section>
910
911<section title="Security Considerations" anchor="security.considerations">
912<t>
913   This section is meant to inform developers, information providers, and
914   users of known security concerns specific to the HTTP/1.1 range
915   request mechanisms. More general security considerations are addressed
916   in HTTP messaging &messaging; and semantics &semantics;.
917</t>
918
919<section title="Overlapping Ranges" anchor="overlapping.ranges">
920<t>
921   Range requests containing overlapping ranges can lead to a situation
922   where the server is sending far more data than the size of the complete
923   resource representation.
924</t>
925</section>
926</section>
927
928<section title="Acknowledgments" anchor="acks">
929<t>
930  See &acks;.
931</t>
932</section>
933</middle>
934<back>
935
936<references title="Normative References">
937
938<reference anchor="Part1">
939  <front>
940    <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
941    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
942      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
943      <address><email>fielding@gbiv.com</email></address>
944    </author>
945    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
946      <organization abbrev="greenbytes">greenbytes GmbH</organization>
947      <address><email>julian.reschke@greenbytes.de</email></address>
948    </author>
949    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
950  </front>
951  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/>
952  <x:source href="p1-messaging.xml" basename="p1-messaging">
953    <x:defines>Content-Length</x:defines>
954  </x:source>
955</reference>
956
957<reference anchor="Part2">
958  <front>
959    <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
960    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
961      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
962      <address><email>fielding@gbiv.com</email></address>
963    </author>
964    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
965      <organization abbrev="greenbytes">greenbytes GmbH</organization>
966      <address><email>julian.reschke@greenbytes.de</email></address>
967    </author>
968    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
969  </front>
970  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;"/>
971  <x:source href="p2-semantics.xml" basename="p2-semantics">
972    <x:defines>200 (OK)</x:defines>
973    <x:defines>410 (Gone)</x:defines>
974    <x:defines>Content-Location</x:defines>
975    <x:defines>Content-Type</x:defines>
976    <x:defines>Date</x:defines>
977    <x:defines>Location</x:defines>
978    <x:defines>Vary</x:defines>
979  </x:source>
980</reference>
981
982<reference anchor="Part4">
983  <front>
984    <title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
985    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
986      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
987      <address><email>fielding@gbiv.com</email></address>
988    </author>
989    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
990      <organization abbrev="greenbytes">greenbytes GmbH</organization>
991      <address><email>julian.reschke@greenbytes.de</email></address>
992    </author>
993    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
994  </front>
995  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"/>
996  <x:source href="p4-conditional.xml" basename="p4-conditional">
997    <x:defines>304 (Not Modified)</x:defines>
998    <x:defines>ETag</x:defines>
999    <x:defines>If-Match</x:defines>
1000    <x:defines>If-Modified-Since</x:defines>
1001    <x:defines>If-None-Match</x:defines>
1002    <x:defines>If-Unmodified-Since</x:defines>
1003    <x:defines>Last-Modified</x:defines>
1004  </x:source>
1005</reference>
1006
1007<reference anchor="Part6">
1008  <front>
1009    <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
1010    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1011      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1012      <address><email>fielding@gbiv.com</email></address>
1013    </author>
1014    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
1015      <organization>Akamai</organization>
1016      <address><email>mnot@mnot.net</email></address>
1017    </author>
1018    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1019      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1020      <address><email>julian.reschke@greenbytes.de</email></address>
1021    </author>
1022    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1023  </front>
1024  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
1025  <x:source href="p6-cache.xml" basename="p6-cache">
1026    <x:defines>Cache-Control</x:defines>
1027    <x:defines>Expires</x:defines>
1028  </x:source>
1029</reference>
1030
1031<reference anchor="RFC2046">
1032  <front>
1033    <title abbrev="Media Types">Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title>
1034    <author initials="N." surname="Freed" fullname="Ned Freed">
1035      <organization>Innosoft International, Inc.</organization>
1036      <address><email>ned@innosoft.com</email></address>
1037    </author>
1038    <author initials="N." surname="Borenstein" fullname="Nathaniel S. Borenstein">
1039      <organization>First Virtual Holdings</organization>
1040      <address><email>nsb@nsb.fv.com</email></address>
1041    </author>
1042    <date month="November" year="1996"/>
1043  </front>
1044  <seriesInfo name="RFC" value="2046"/>
1045</reference>
1046
1047<reference anchor="RFC2119">
1048  <front>
1049    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1050    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1051      <organization>Harvard University</organization>
1052      <address><email>sob@harvard.edu</email></address>
1053    </author>
1054    <date month="March" year="1997"/>
1055  </front>
1056  <seriesInfo name="BCP" value="14"/>
1057  <seriesInfo name="RFC" value="2119"/>
1058</reference>
1059
1060<reference anchor="RFC5234">
1061  <front>
1062    <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
1063    <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
1064      <organization>Brandenburg InternetWorking</organization>
1065      <address>
1066        <email>dcrocker@bbiw.net</email>
1067      </address> 
1068    </author>
1069    <author initials="P." surname="Overell" fullname="Paul Overell">
1070      <organization>THUS plc.</organization>
1071      <address>
1072        <email>paul.overell@thus.net</email>
1073      </address>
1074    </author>
1075    <date month="January" year="2008"/>
1076  </front>
1077  <seriesInfo name="STD" value="68"/>
1078  <seriesInfo name="RFC" value="5234"/>
1079</reference>
1080
1081</references>
1082
1083<references title="Informative References">
1084
1085<reference anchor="RFC2616">
1086  <front>
1087    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1088    <author initials="R." surname="Fielding" fullname="R. Fielding">
1089      <organization>University of California, Irvine</organization>
1090      <address><email>fielding@ics.uci.edu</email></address>
1091    </author>
1092    <author initials="J." surname="Gettys" fullname="J. Gettys">
1093      <organization>W3C</organization>
1094      <address><email>jg@w3.org</email></address>
1095    </author>
1096    <author initials="J." surname="Mogul" fullname="J. Mogul">
1097      <organization>Compaq Computer Corporation</organization>
1098      <address><email>mogul@wrl.dec.com</email></address>
1099    </author>
1100    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1101      <organization>MIT Laboratory for Computer Science</organization>
1102      <address><email>frystyk@w3.org</email></address>
1103    </author>
1104    <author initials="L." surname="Masinter" fullname="L. Masinter">
1105      <organization>Xerox Corporation</organization>
1106      <address><email>masinter@parc.xerox.com</email></address>
1107    </author>
1108    <author initials="P." surname="Leach" fullname="P. Leach">
1109      <organization>Microsoft Corporation</organization>
1110      <address><email>paulle@microsoft.com</email></address>
1111    </author>
1112    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1113      <organization>W3C</organization>
1114      <address><email>timbl@w3.org</email></address>
1115    </author>
1116    <date month="June" year="1999"/>
1117  </front>
1118  <seriesInfo name="RFC" value="2616"/>
1119</reference>
1120
1121<reference anchor='BCP90'>
1122  <front>
1123    <title>Registration Procedures for Message Header Fields</title>
1124    <author initials='G.' surname='Klyne' fullname='G. Klyne'>
1125      <organization>Nine by Nine</organization>
1126      <address><email>GK-IETF@ninebynine.org</email></address>
1127    </author>
1128    <author initials='M.' surname='Nottingham' fullname='M. Nottingham'>
1129      <organization>BEA Systems</organization>
1130      <address><email>mnot@pobox.com</email></address>
1131    </author>
1132    <author initials='J.' surname='Mogul' fullname='J. Mogul'>
1133      <organization>HP Labs</organization>
1134      <address><email>JeffMogul@acm.org</email></address>
1135    </author>
1136    <date year='2004' month='September' />
1137  </front>
1138  <seriesInfo name='BCP' value='90' />
1139  <seriesInfo name='RFC' value='3864' />
1140</reference>
1141
1142<reference anchor="BCP13">
1143  <front>
1144    <title>Media Type Specifications and Registration Procedures</title>
1145    <author initials="N." surname="Freed" fullname="N. Freed">
1146      <organization>Sun Microsystems</organization>
1147      <address>
1148        <email>ned.freed@mrochek.com</email>
1149      </address>
1150    </author>
1151    <author initials="J." surname="Klensin" fullname="J. Klensin">
1152      <address>
1153        <email>klensin+ietf@jck.com</email>
1154      </address>
1155    </author>
1156    <date year="2005" month="December"/>
1157  </front>
1158  <seriesInfo name="BCP" value="13"/>
1159  <seriesInfo name="RFC" value="4288"/>
1160</reference>
1161
1162<reference anchor='RFC5226'>
1163  <front>
1164    <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
1165    <author initials='T.' surname='Narten' fullname='T. Narten'>
1166      <organization>IBM</organization>
1167      <address><email>narten@us.ibm.com</email></address>
1168    </author>
1169    <author initials='H.' surname='Alvestrand' fullname='H. Alvestrand'>
1170      <organization>Google</organization>
1171      <address><email>Harald@Alvestrand.no</email></address>
1172    </author>
1173    <date year='2008' month='May' />
1174  </front>
1175  <seriesInfo name='BCP' value='26' />
1176  <seriesInfo name='RFC' value='5226' />
1177</reference>
1178
1179</references>
1180
1181<section title="Internet Media Type multipart/byteranges" anchor="internet.media.type.multipart.byteranges">
1182<iref item="Media Type" subitem="multipart/byteranges" primary="true"/>
1183<iref item="multipart/byteranges Media Type" primary="true"/>
1184<t>
1185   When an HTTP <x:ref>206 (Partial Content)</x:ref> response message includes the
1186   content of multiple ranges (a response to a request for multiple
1187   non-overlapping ranges), these are transmitted as a multipart
1188   message body (<xref target="RFC2046" x:fmt="," x:sec="5.1"/>). The media type for this purpose is called
1189   "multipart/byteranges".  The following is to be registered with IANA <xref target="BCP13"/>.
1190</t>
1191<t>
1192   The multipart/byteranges media type includes one or more parts, each
1193   with its own <x:ref>Content-Type</x:ref> and <x:ref>Content-Range</x:ref>
1194   fields. The required boundary parameter specifies the boundary string used
1195   to separate each body-part.
1196</t>
1197<t>
1198  <list style="hanging" x:indent="12em">
1199    <t hangText="Type name:">
1200      multipart
1201    </t>
1202    <t hangText="Subtype name:">
1203      byteranges
1204    </t>
1205    <t hangText="Required parameters:">
1206      boundary
1207    </t>
1208    <t hangText="Optional parameters:">
1209      none
1210    </t>
1211    <t hangText="Encoding considerations:">
1212      only "7bit", "8bit", or "binary" are permitted
1213    </t>
1214    <t hangText="Security considerations:">
1215      none
1216    </t>
1217    <t hangText="Interoperability considerations:">
1218      none
1219    </t>
1220    <t hangText="Published specification:">
1221      This specification (see <xref target="internet.media.type.multipart.byteranges"/>).
1222    </t>
1223    <t hangText="Applications that use this media type:">
1224      HTTP components supporting multiple ranges in a single request.
1225    </t>
1226    <t hangText="Additional information:">
1227      <list style="hanging">
1228        <t hangText="Magic number(s):">none</t>
1229        <t hangText="File extension(s):">none</t>
1230        <t hangText="Macintosh file type code(s):">none</t>
1231      </list>
1232    </t>
1233    <t hangText="Person and email address to contact for further information:">
1234      See Authors Section.
1235    </t>
1236    <t hangText="Intended usage:">
1237      COMMON
1238    </t>
1239    <t hangText="Restrictions on usage:">
1240      none
1241    </t>
1242    <t hangText="Author/Change controller:">
1243      IESG
1244    </t>
1245  </list>
1246</t>
1247<x:note>
1248  <t>
1249    &Note; Despite the name "multipart/byteranges" is not limited to the byte ranges only.
1250  </t>
1251</x:note>
1252<figure><preamble>
1253   For example:
1254</preamble><artwork type="example">
1255  HTTP/1.1 206 Partial Content
1256  Date: Wed, 15 Nov 1995 06:25:24 GMT
1257  Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
1258  Content-Length: 1741
1259  Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
1260 
1261  --THIS_STRING_SEPARATES
1262  Content-Type: application/pdf
1263  Content-Range: bytes 500-999/8000
1264 
1265  ...the first range...
1266  --THIS_STRING_SEPARATES
1267  Content-Type: application/pdf
1268  Content-Range: bytes 7000-7999/8000
1269 
1270  ...the second range
1271  --THIS_STRING_SEPARATES--
1272</artwork></figure>
1273<figure><preamble>
1274   Another example, using the "exampleunit" range unit:
1275</preamble>
1276<artwork type="example">
1277  HTTP/1.1 206 Partial Content
1278  Date: Tue, 14 Nov 1995 06:25:24 GMT
1279  Last-Modified: Tue, 14 July 04:58:08 GMT
1280  Content-Length: 2331785
1281  Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
1282 
1283  --THIS_STRING_SEPARATES
1284  Content-Type: video/example
1285  Content-Range: exampleunit 1.2-4.3/25
1286 
1287  ...the first range...
1288  --THIS_STRING_SEPARATES
1289  Content-Type: video/example
1290  Content-Range: exampleunit 11.2-14.3/25
1291 
1292  ...the second range
1293  --THIS_STRING_SEPARATES--
1294</artwork>
1295</figure>
1296<t>
1297  Notes:
1298  <list style="numbers">
1299      <t>Additional CRLFs &MAY; precede the first boundary string in the body.</t>
1300
1301      <t>Although <xref target="RFC2046"/> permits the boundary string to be
1302         quoted, some existing implementations handle a quoted boundary
1303         string incorrectly.</t>
1304
1305      <t>A number of clients and servers were coded to an early draft
1306         of the byteranges specification to use a media type of
1307         multipart/x-byteranges<iref item="multipart/x-byteranges Media Type"/><iref item="Media Type" subitem="multipart/x-byteranges"/>, which is almost, but not quite
1308         compatible with the version documented in HTTP/1.1.</t>
1309  </list>
1310</t>
1311</section>
1312
1313<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
1314
1315<t>
1316  A weak validator cannot be used in a <x:ref>206</x:ref> response.
1317  (<xref target="status.206"/>)
1318</t>
1319<t>
1320  The Content-Range header field only has meaning when the status code
1321  explicitly defines its use.
1322  (<xref target="header.content-range" />)
1323</t>
1324<t>
1325  Servers are given more leeway in how they respond to a range request,
1326  in order to mitigate abuse by malicious (or just greedy) clients.
1327</t>
1328<t>
1329  multipart/byteranges can consist of a single part.
1330  (<xref target="internet.media.type.multipart.byteranges"/>)
1331</t>
1332<t>
1333  This specification introduces a Range Specifier Registry.
1334  (<xref target="range.unit.registry"/>)
1335</t>
1336</section>
1337
1338<section title="Imported ABNF" anchor="imported.abnf">
1339  <x:anchor-alias value="ALPHA"/>
1340  <x:anchor-alias value="CHAR"/>
1341  <x:anchor-alias value="CR"/>
1342  <x:anchor-alias value="DIGIT"/>
1343  <x:anchor-alias value="LF"/>
1344  <x:anchor-alias value="OCTET"/>
1345  <x:anchor-alias value="SP"/>
1346  <x:anchor-alias value="VCHAR"/>
1347  <x:anchor-alias value="token"/>
1348  <x:anchor-alias value="OWS"/>
1349  <x:anchor-alias value="HTTP-date"/>
1350  <x:anchor-alias value="entity-tag"/>
1351<t>
1352  The following core rules are included by
1353  reference, as defined in <xref target="RFC5234" x:fmt="of" x:sec="B.1"/>:
1354  ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls),
1355  DIGIT (decimal 0-9), DQUOTE (double quote),
1356  HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed),
1357  OCTET (any 8-bit sequence of data), SP (space), and
1358  VCHAR (any visible US-ASCII character).
1359</t>
1360<t>
1361  Note that all rules derived from <x:ref>token</x:ref> are to
1362  be compared case-insensitively, like <x:ref>range-unit</x:ref> and
1363  <x:ref>acceptable-ranges</x:ref>.
1364</t>
1365<t>
1366  The rules below are defined in <xref target="Part1"/>:
1367</t>
1368<figure><artwork type="abnf2616">
1369  <x:ref>OWS</x:ref>        = &lt;OWS, defined in &whitespace;&gt;
1370  <x:ref>token</x:ref>      = &lt;token, defined in &field-components;&gt;
1371</artwork></figure>
1372<t>
1373  The rules below are defined in other parts:
1374</t>
1375<figure><artwork type="abnf2616">
1376  <x:ref>HTTP-date</x:ref>  = &lt;HTTP-date, defined in &http-date;&gt;
1377  <x:ref>entity-tag</x:ref> = &lt;entity-tag, defined in &entity-tags;&gt;
1378</artwork></figure>
1379</section>
1380
1381<?BEGININC p5-range.abnf-appendix ?>
1382<section xmlns:x="http://purl.org/net/xml2rfc/ext" title="Collected ABNF" anchor="collected.abnf">
1383<figure>
1384<artwork type="abnf" name="p5-range.parsed-abnf">
1385<x:ref>Accept-Ranges</x:ref> = acceptable-ranges
1386
1387<x:ref>Content-Range</x:ref> = byte-content-range / other-content-range
1388
1389<x:ref>HTTP-date</x:ref> = &lt;HTTP-date, defined in [Part2], Section 7.1.1.1&gt;
1390
1391<x:ref>If-Range</x:ref> = entity-tag / HTTP-date
1392
1393<x:ref>OWS</x:ref> = &lt;OWS, defined in [Part1], Section 3.2.3&gt;
1394
1395<x:ref>Range</x:ref> = byte-ranges-specifier / other-ranges-specifier
1396
1397<x:ref>acceptable-ranges</x:ref> = ( *( "," OWS ) range-unit *( OWS "," [ OWS
1398 range-unit ] ) ) / "none"
1399
1400<x:ref>byte-content-range</x:ref> = bytes-unit SP ( byte-range-resp /
1401 unsatisfied-range )
1402<x:ref>byte-range</x:ref> = first-byte-pos "-" last-byte-pos
1403<x:ref>byte-range-resp</x:ref> = byte-range "/" ( complete-length / "*" )
1404<x:ref>byte-range-set</x:ref> = *( "," OWS ) ( byte-range-spec /
1405 suffix-byte-range-spec ) *( OWS "," [ OWS ( byte-range-spec /
1406 suffix-byte-range-spec ) ] )
1407<x:ref>byte-range-spec</x:ref> = first-byte-pos "-" [ last-byte-pos ]
1408<x:ref>byte-ranges-specifier</x:ref> = bytes-unit "=" byte-range-set
1409<x:ref>bytes-unit</x:ref> = "bytes"
1410
1411<x:ref>complete-length</x:ref> = 1*DIGIT
1412
1413<x:ref>entity-tag</x:ref> = &lt;entity-tag, defined in [Part4], Section 2.3&gt;
1414
1415<x:ref>first-byte-pos</x:ref> = 1*DIGIT
1416
1417<x:ref>last-byte-pos</x:ref> = 1*DIGIT
1418
1419<x:ref>other-content-range</x:ref> = other-range-unit SP other-range-resp
1420<x:ref>other-range-resp</x:ref> = *CHAR
1421<x:ref>other-range-set</x:ref> = 1*CHAR
1422<x:ref>other-range-unit</x:ref> = token
1423<x:ref>other-ranges-specifier</x:ref> = other-range-unit "=" other-range-set
1424
1425<x:ref>range-unit</x:ref> = bytes-unit / other-range-unit
1426
1427<x:ref>suffix-byte-range-spec</x:ref> = "-" suffix-length
1428<x:ref>suffix-length</x:ref> = 1*DIGIT
1429
1430<x:ref>token</x:ref> = &lt;token, defined in [Part1], Section 3.2.6&gt;
1431
1432<x:ref>unsatisfied-range</x:ref> = "*/" complete-length
1433</artwork>
1434</figure>
1435</section>
1436<?ENDINC p5-range.abnf-appendix ?>
1437
1438
1439<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
1440<t>
1441  Changes up to the first Working Group Last Call draft are summarized
1442  in <eref target="http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-19#appendix-D"/>.
1443</t>
1444
1445<section title="Since draft-ietf-httpbis-p5-range-19" anchor="changes.since.19">
1446<t>
1447  Closed issues:
1448  <list style="symbols">
1449    <t>
1450      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/358"/>:
1451      "ABNF list expansion code problem"
1452    </t>
1453    <t>
1454      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/361"/>:
1455      "ABNF requirements for recipients"
1456    </t>
1457    <t>
1458      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/367"/>:
1459      "reserve 'none' as byte range unit"
1460    </t>
1461    <t>
1462      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/368"/>:
1463      "note introduction of new IANA registries as normative changes"
1464    </t>
1465    <t>
1466      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/369"/>:
1467      "range units vs leading zeroes vs size"
1468    </t>
1469  </list>
1470</t>
1471</section>
1472
1473<section title="Since draft-ietf-httpbis-p5-range-20" anchor="changes.since.20">
1474<t>
1475  <list style="symbols">
1476    <t>
1477      Conformance criteria and considerations regarding error handling are
1478      now defined in Part 1.
1479    </t>
1480  </list>
1481</t>
1482</section>
1483
1484<section title="Since draft-ietf-httpbis-p5-range-21" anchor="changes.since.21">
1485<t>
1486  None yet.
1487</t>
1488</section>
1489
1490</section>
1491
1492</back>
1493</rfc>
Note: See TracBrowser for help on using the repository browser.