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

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

bump up document dates, update to latest version of rfc2629.xslt

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