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

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

(editorial) move byte range examples closer to defs

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