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

Last change on this file since 2582 was 2569, checked in by fielding@…, 7 years ago

(editorial) OWASP only provides useful additional info for web application semantics and authentication; see #520 and #549

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