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

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

bump up document dates

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