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

Last change on this file was 2724, checked in by julian.reschke@…, 5 years ago

revert changes for auth48 boilerplate checks (#553)

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