Ignore:
Timestamp:
20/01/13 14:20:32 (8 years ago)
Author:
fielding@…
Message:

(editorial) move byte ranges definition into range unit section near start of document; no text changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • draft-ietf-httpbis/latest/p5-range.xml

    r2139 r2140  
    176176</t>
    177177</section>
    178 
    179178</section>
    180179
     
    199198  <x:ref>other-range-unit</x:ref> = <x:ref>token</x:ref>
    200199</artwork></figure>
     200
     201<section title="Byte Ranges" anchor="byte.ranges">
     202<t>
     203   Since all HTTP representations are transferred as sequences
     204   of bytes, the concept of a byte range is meaningful for any HTTP
     205   representation. (However, not all clients and servers need to support byte-range
     206   operations.)
     207</t>
     208<t>
     209   Byte range specifications in HTTP apply to the sequence of bytes in
     210   the representation data (not necessarily the same as the message body).
     211</t>
     212<t anchor="rule.ranges-specifier">
     213  <x:anchor-alias value="byte-range-set"/>
     214  <x:anchor-alias value="byte-range-spec"/>
     215  <x:anchor-alias value="byte-ranges-specifier"/>
     216  <x:anchor-alias value="first-byte-pos"/>
     217  <x:anchor-alias value="last-byte-pos"/>
     218  <x:anchor-alias value="ranges-specifier"/>
     219  <x:anchor-alias value="suffix-byte-range-spec"/>
     220  <x:anchor-alias value="suffix-length"/>
     221   A byte range operation &MAY; specify a single range of bytes, or a set
     222   of ranges within a single representation.
     223</t>
     224<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"/>
     225  <x:ref>byte-ranges-specifier</x:ref> = <x:ref>bytes-unit</x:ref> "=" <x:ref>byte-range-set</x:ref>
     226  <x:ref>byte-range-set</x:ref>  = 1#( <x:ref>byte-range-spec</x:ref> / <x:ref>suffix-byte-range-spec</x:ref> )
     227  <x:ref>byte-range-spec</x:ref> = <x:ref>first-byte-pos</x:ref> "-" [ <x:ref>last-byte-pos</x:ref> ]
     228  <x:ref>first-byte-pos</x:ref>  = 1*<x:ref>DIGIT</x:ref>
     229  <x:ref>last-byte-pos</x:ref>   = 1*<x:ref>DIGIT</x:ref>
     230</artwork></figure>
     231<t>
     232   The first-byte-pos value in a byte-range-spec gives the byte-offset
     233   of the first byte in a range. The last-byte-pos value gives the
     234   byte-offset of the last byte in the range; that is, the byte
     235   positions specified are inclusive. Byte offsets start at zero.
     236</t>
     237<t>
     238   If the last-byte-pos value is present, it &MUST; be greater than or
     239   equal to the first-byte-pos in that byte-range-spec, or the byte-range-spec
     240   is syntactically invalid. The recipient of a byte-range-set
     241   that includes one or more syntactically invalid byte-range-spec
     242   values &MUST; ignore the header field that includes that byte-range-set.
     243</t>
     244<t>
     245   If the last-byte-pos value is absent, or if the value is greater than
     246   or equal to the current length of the representation data, last-byte-pos is
     247   taken to be equal to one less than the current length of the representation
     248   in bytes.
     249</t>
     250<t>
     251   By its choice of last-byte-pos, a client can limit the number of
     252   bytes retrieved without knowing the size of the representation.
     253</t>
     254<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="suffix-byte-range-spec"/><iref primary="true" item="Grammar" subitem="suffix-length"/>
     255  <x:ref>suffix-byte-range-spec</x:ref> = "-" <x:ref>suffix-length</x:ref>
     256  <x:ref>suffix-length</x:ref> = 1*<x:ref>DIGIT</x:ref>
     257</artwork></figure>
     258<t>
     259   A suffix-byte-range-spec is used to specify the suffix of the
     260   representation data, of a length given by the suffix-length value. (That is,
     261   this form specifies the last N bytes of a representation.) If the
     262   representation is shorter than the specified suffix-length, the entire
     263   representation is used.
     264</t>
     265<t>
     266   If a syntactically valid byte-range-set includes at least one byte-range-spec
     267   whose first-byte-pos is less than the current length of
     268   the representation, or at least one suffix-byte-range-spec with a non-zero
     269   suffix-length, then the byte-range-set is satisfiable.
     270   Otherwise, the byte-range-set is unsatisfiable. If the byte-range-set
     271   is unsatisfiable, the server &SHOULD; send a response with a
     272   <x:ref>416 (Range Not Satisfiable)</x:ref> status code. Otherwise, the server
     273   &SHOULD; send a response with a <x:ref>206 (Partial Content)</x:ref> status code
     274   containing the satisfiable ranges of the representation.
     275</t>
     276<t>
     277   In the byte range syntax, <x:ref>first-byte-pos</x:ref>,
     278   <x:ref>last-byte-pos</x:ref>, and <x:ref>suffix-length</x:ref> are
     279   expressed as decimal number of octets.  Since there is no predefined limit
     280   to the length of an HTTP payload, recipients &SHOULD; anticipate
     281   potentially large decimal numerals and prevent parsing errors due to integer
     282   conversion overflows.
     283</t>
     284<t>
     285   Examples of byte-ranges-specifier values (assuming a representation of
     286   length 10000):
     287  <list style="symbols">
     288     <t>The first 500 bytes (byte offsets 0-499, inclusive):
     289<figure><artwork type="example" x:indent-with="   ">
     290  bytes=0-499
     291</artwork></figure>
     292    </t>
     293     <t>The second 500 bytes (byte offsets 500-999, inclusive):
     294<figure><artwork type="example" x:indent-with="   ">
     295  bytes=500-999
     296</artwork></figure>
     297    </t>
     298     <t>The final 500 bytes (byte offsets 9500-9999, inclusive):
     299<figure><artwork type="example" x:indent-with="   ">
     300  bytes=-500
     301</artwork></figure>
     302    Or:
     303<figure><artwork type="example" x:indent-with="   ">
     304  bytes=9500-
     305</artwork></figure>
     306    </t>
     307     <t>The first and last bytes only (bytes 0 and 9999):
     308<figure><artwork type="example" x:indent-with="   ">
     309  bytes=0-0,-1
     310</artwork></figure>
     311     </t>
     312     <t>Several legal but not canonical specifications of the second 500
     313        bytes (byte offsets 500-999, inclusive):
     314<figure><artwork type="example" x:indent-with="   ">
     315  bytes=500-600,601-999
     316  bytes=500-700,601-999
     317</artwork></figure>
     318     </t>
     319  </list>
     320</t>
     321</section>
     322
     323<section title="Other Range Units" anchor="range.units.other">
    201324<t>
    202325  The only range unit defined by HTTP/1.1 is "bytes"
     
    204327  in <xref target="range.unit.registry"/>.
    205328</t>
    206 
     329</section>
    207330</section>
    208331
     
    619742<section title="Range" anchor="header.range">
    620743  <iref primary="true" item="Range header field" x:for-anchor=""/>
    621 
    622 <section title="Byte Ranges" anchor="byte.ranges">
    623 <t>
    624    Since all HTTP representations are transferred as sequences
    625    of bytes, the concept of a byte range is meaningful for any HTTP
    626    representation. (However, not all clients and servers need to support byte-range
    627    operations.)
    628 </t>
    629 <t>
    630    Byte range specifications in HTTP apply to the sequence of bytes in
    631    the representation data (not necessarily the same as the message body).
    632 </t>
    633 <t anchor="rule.ranges-specifier">
    634   <x:anchor-alias value="byte-range-set"/>
    635   <x:anchor-alias value="byte-range-spec"/>
    636   <x:anchor-alias value="byte-ranges-specifier"/>
    637   <x:anchor-alias value="first-byte-pos"/>
    638   <x:anchor-alias value="last-byte-pos"/>
    639   <x:anchor-alias value="ranges-specifier"/>
    640   <x:anchor-alias value="suffix-byte-range-spec"/>
    641   <x:anchor-alias value="suffix-length"/>
    642    A byte range operation &MAY; specify a single range of bytes, or a set
    643    of ranges within a single representation.
    644 </t>
    645 <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"/>
    646   <x:ref>byte-ranges-specifier</x:ref> = <x:ref>bytes-unit</x:ref> "=" <x:ref>byte-range-set</x:ref>
    647   <x:ref>byte-range-set</x:ref>  = 1#( <x:ref>byte-range-spec</x:ref> / <x:ref>suffix-byte-range-spec</x:ref> )
    648   <x:ref>byte-range-spec</x:ref> = <x:ref>first-byte-pos</x:ref> "-" [ <x:ref>last-byte-pos</x:ref> ]
    649   <x:ref>first-byte-pos</x:ref>  = 1*<x:ref>DIGIT</x:ref>
    650   <x:ref>last-byte-pos</x:ref>   = 1*<x:ref>DIGIT</x:ref>
    651 </artwork></figure>
    652 <t>
    653    The first-byte-pos value in a byte-range-spec gives the byte-offset
    654    of the first byte in a range. The last-byte-pos value gives the
    655    byte-offset of the last byte in the range; that is, the byte
    656    positions specified are inclusive. Byte offsets start at zero.
    657 </t>
    658 <t>
    659    If the last-byte-pos value is present, it &MUST; be greater than or
    660    equal to the first-byte-pos in that byte-range-spec, or the byte-range-spec
    661    is syntactically invalid. The recipient of a byte-range-set
    662    that includes one or more syntactically invalid byte-range-spec
    663    values &MUST; ignore the header field that includes that byte-range-set.
    664 </t>
    665 <t>
    666    If the last-byte-pos value is absent, or if the value is greater than
    667    or equal to the current length of the representation data, last-byte-pos is
    668    taken to be equal to one less than the current length of the representation
    669    in bytes.
    670 </t>
    671 <t>
    672    By its choice of last-byte-pos, a client can limit the number of
    673    bytes retrieved without knowing the size of the representation.
    674 </t>
    675 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="suffix-byte-range-spec"/><iref primary="true" item="Grammar" subitem="suffix-length"/>
    676   <x:ref>suffix-byte-range-spec</x:ref> = "-" <x:ref>suffix-length</x:ref>
    677   <x:ref>suffix-length</x:ref> = 1*<x:ref>DIGIT</x:ref>
    678 </artwork></figure>
    679 <t>
    680    A suffix-byte-range-spec is used to specify the suffix of the
    681    representation data, of a length given by the suffix-length value. (That is,
    682    this form specifies the last N bytes of a representation.) If the
    683    representation is shorter than the specified suffix-length, the entire
    684    representation is used.
    685 </t>
    686 <t>
    687    If a syntactically valid byte-range-set includes at least one byte-range-spec
    688    whose first-byte-pos is less than the current length of
    689    the representation, or at least one suffix-byte-range-spec with a non-zero
    690    suffix-length, then the byte-range-set is satisfiable.
    691    Otherwise, the byte-range-set is unsatisfiable. If the byte-range-set
    692    is unsatisfiable, the server &SHOULD; send a response with a
    693    <x:ref>416 (Range Not Satisfiable)</x:ref> status code. Otherwise, the server
    694    &SHOULD; send a response with a <x:ref>206 (Partial Content)</x:ref> status code
    695    containing the satisfiable ranges of the representation.
    696 </t>
    697 <t>
    698    In the byte range syntax, <x:ref>first-byte-pos</x:ref>,
    699    <x:ref>last-byte-pos</x:ref>, and <x:ref>suffix-length</x:ref> are
    700    expressed as decimal number of octets.  Since there is no predefined limit
    701    to the length of an HTTP payload, recipients &SHOULD; anticipate
    702    potentially large decimal numerals and prevent parsing errors due to integer
    703    conversion overflows.
    704 </t>
    705 <t>
    706    Examples of byte-ranges-specifier values (assuming a representation of
    707    length 10000):
    708   <list style="symbols">
    709      <t>The first 500 bytes (byte offsets 0-499, inclusive):
    710 <figure><artwork type="example" x:indent-with="   ">
    711   bytes=0-499
    712 </artwork></figure>
    713     </t>
    714      <t>The second 500 bytes (byte offsets 500-999, inclusive):
    715 <figure><artwork type="example" x:indent-with="   ">
    716   bytes=500-999
    717 </artwork></figure>
    718     </t>
    719      <t>The final 500 bytes (byte offsets 9500-9999, inclusive):
    720 <figure><artwork type="example" x:indent-with="   ">
    721   bytes=-500
    722 </artwork></figure>
    723     Or:
    724 <figure><artwork type="example" x:indent-with="   ">
    725   bytes=9500-
    726 </artwork></figure>
    727     </t>
    728      <t>The first and last bytes only (bytes 0 and 9999):
    729 <figure><artwork type="example" x:indent-with="   ">
    730   bytes=0-0,-1
    731 </artwork></figure>
    732      </t>
    733      <t>Several legal but not canonical specifications of the second 500
    734         bytes (byte offsets 500-999, inclusive):
    735 <figure><artwork type="example" x:indent-with="   ">
    736   bytes=500-600,601-999
    737   bytes=500-700,601-999
    738 </artwork></figure>
    739      </t>
    740   </list>
    741 </t>
    742 </section>
    743744
    744745<section title="Range Retrieval Requests" anchor="range.retrieval.requests">
Note: See TracChangeset for help on using the changeset viewer.