Ignore:
Timestamp:
Aug 19, 2012, 2:59:58 PM (7 years ago)
Author:
fielding@…
Message:

move Trailer and trailer requirements to one location, inside chunked

File:
1 edited

Legend:

Unmodified
Added
Removed
  • draft-ietf-httpbis/latest/p1-messaging.html

    r1831 r1832  
    619619         </li>
    620620         <li><a href="#rfc.section.4">4.</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.codings">Transfer Codings</a><ul>
    621                <li><a href="#rfc.section.4.1">4.1</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.encoding">Chunked Transfer Coding</a></li>
     621               <li><a href="#rfc.section.4.1">4.1</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.encoding">Chunked Transfer Coding</a><ul>
     622                     <li><a href="#rfc.section.4.1.1">4.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.trailer">Trailer</a></li>
     623                     <li><a href="#rfc.section.4.1.2">4.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#decoding.chunked">Decoding chunked</a></li>
     624                  </ul>
     625               </li>
    622626               <li><a href="#rfc.section.4.2">4.2</a>&nbsp;&nbsp;&nbsp;<a href="#compression.codings">Compression Codings</a><ul>
    623627                     <li><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#compress.coding">Compress Coding</a></li>
     
    627631               </li>
    628632               <li><a href="#rfc.section.4.3">4.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.te">TE</a></li>
    629                <li><a href="#rfc.section.4.4">4.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.trailer">Trailer</a></li>
    630633            </ul>
    631634         </li>
     
    15771580                 ; like <a href="#rule.quoted-string" class="smpl">quoted-string</a>, but disallowing line folding
    15781581  <a href="#chunked.encoding" class="smpl">qdtext-nf</a>      = <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / %x21 / %x23-5B / %x5D-7E / <a href="#rule.quoted-string" class="smpl">obs-text</a>
    1579 </pre><p id="rfc.section.4.1.p.3">The chunk-size field is a string of hex digits indicating the size of the chunk-data in octets. The chunked encoding is ended
     1582</pre><p id="rfc.section.4.1.p.3">Chunk extensions within the chucked encoding are deprecated. Senders <em class="bcp14">SHOULD NOT</em> send chunk-ext. Definition of new chunk extensions is discouraged.
     1583      </p>
     1584      <p id="rfc.section.4.1.p.4">The chunk-size field is a string of hex digits indicating the size of the chunk-data in octets. The chunked encoding is ended
    15801585         by any chunk whose size is zero, followed by the trailer, which is terminated by an empty line.
    15811586      </p>
    1582       <p id="rfc.section.4.1.p.4">The trailer allows the sender to include additional HTTP header fields at the end of the message. The <a href="#header.trailer" class="smpl">Trailer</a> header field can be used to indicate which header fields are included in a trailer (see <a href="#header.trailer" id="rfc.xref.header.trailer.1" title="Trailer">Section&nbsp;4.4</a>).
    1583       </p>
    1584       <p id="rfc.section.4.1.p.5">A server using chunked transfer-coding in a response <em class="bcp14">MUST NOT</em> use the trailer for any header fields unless at least one of the following is true:
     1587      <div id="rfc.iref.t.5"></div>
     1588      <div id="rfc.iref.h.8"></div>
     1589      <h3 id="rfc.section.4.1.1"><a href="#rfc.section.4.1.1">4.1.1</a>&nbsp;<a id="header.trailer" href="#header.trailer">Trailer</a></h3>
     1590      <p id="rfc.section.4.1.1.p.1">A trailer allows the sender to include additional fields at the end of a chunked message in order to supply metadata that
     1591         might be dynamically generated while the message body is sent, such as a message integrity check, digital signature, or post-processing
     1592         status. The trailer <em class="bcp14">MUST NOT</em> contain fields that need to be known before a recipient processes the body, such as <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a>, <a href="#header.content-length" class="smpl">Content-Length</a>, and <a href="#header.trailer" class="smpl">Trailer</a>.
     1593      </p>
     1594      <p id="rfc.section.4.1.1.p.2">When a message includes a message body encoded with the chunked transfer-coding and the sender desires to send metadata in
     1595         the form of trailer fields at the end of the message, the sender <em class="bcp14">SHOULD</em> send a <a href="#header.trailer" class="smpl">Trailer</a> header field before the message body to indicate which fields will be present in the trailers. This allows the recipient to
     1596         prepare for receipt of that metadata before it starts processing the body, which is useful if the message is being streamed
     1597         and the recipient wishes to confirm an integrity check on the fly.
     1598      </p>
     1599      <div id="rfc.figure.u.33"></div><pre class="inline"><span id="rfc.iref.g.73"></span>  <a href="#header.trailer" class="smpl">Trailer</a> = 1#<a href="#header.fields" class="smpl">field-name</a>
     1600</pre><p id="rfc.section.4.1.1.p.4">If no <a href="#header.trailer" class="smpl">Trailer</a> header field is present, the sender of a chunked message body <em class="bcp14">SHOULD</em> send an empty trailer.
     1601      </p>
     1602      <p id="rfc.section.4.1.1.p.5">A server <em class="bcp14">MUST</em> send an empty trailer with the chunked transfer-coding unless at least one of the following is true:
    15851603      </p>
    15861604      <ol>
    15871605         <li>the request included a <a href="#header.te" class="smpl">TE</a> header field that indicates "trailers" is acceptable in the transfer-coding of the response, as described in <a href="#header.te" id="rfc.xref.header.te.2" title="TE">Section&nbsp;4.3</a>; or,
    15881606         </li>
    1589          <li>the trailer fields consist entirely of optional metadata, and the recipient could use the message (in a manner acceptable
    1590             to the server where the field originated) without receiving it. In other words, the server that generated the header field
    1591             (often but not always the origin server) is willing to accept the possibility that the trailer fields might be silently discarded
    1592             along the path to the client.
     1607         <li>the trailer fields consist entirely of optional metadata and the recipient could use the message (in a manner acceptable to
     1608            the server where the field originated) without receiving that metadata. In other words, the server that generated the header
     1609            field is willing to accept the possibility that the trailer fields might be silently discarded along the path to the client.
    15931610         </li>
    15941611      </ol>
    1595       <p id="rfc.section.4.1.p.6">This requirement prevents an interoperability failure when the message is being received by an HTTP/1.1 (or later) proxy and
    1596          forwarded to an HTTP/1.0 recipient. It avoids a situation where conformance with the protocol would have necessitated a possibly
    1597          infinite buffer on the proxy.
    1598       </p>
    1599       <p id="rfc.section.4.1.p.7">A process for decoding the "chunked" transfer-coding can be represented in pseudo-code as:</p>
    1600       <div id="rfc.figure.u.33"></div><pre class="text">  length := 0
     1612      <p id="rfc.section.4.1.1.p.6">The above requirement prevents the need for an infinite buffer when a message is being received by an HTTP/1.1 (or later)
     1613         proxy and forwarded to an HTTP/1.0 recipient.
     1614      </p>
     1615      <h3 id="rfc.section.4.1.2"><a href="#rfc.section.4.1.2">4.1.2</a>&nbsp;<a id="decoding.chunked" href="#decoding.chunked">Decoding chunked</a></h3>
     1616      <p id="rfc.section.4.1.2.p.1">A process for decoding the "chunked" transfer-coding can be represented in pseudo-code as:</p>
     1617      <div id="rfc.figure.u.34"></div><pre class="text">  length := 0
    16011618  read chunk-size, chunk-ext (if any) and CRLF
    16021619  while (chunk-size &gt; 0) {
     
    16131630  Content-Length := length
    16141631  Remove "chunked" from Transfer-Encoding
    1615 </pre><p id="rfc.section.4.1.p.9">All HTTP/1.1 applications <em class="bcp14">MUST</em> be able to receive and decode the "chunked" transfer-coding and <em class="bcp14">MUST</em> ignore chunk-ext extensions they do not understand.
    1616       </p>
    1617       <p id="rfc.section.4.1.p.10">Use of chunk-ext extensions by senders is deprecated; they <em class="bcp14">SHOULD NOT</em> be sent and definition of new chunk-extensions is discouraged.
     1632  Remove Trailer from existing header fields
     1633</pre><p id="rfc.section.4.1.2.p.3">All HTTP/1.1 applications <em class="bcp14">MUST</em> be able to receive and decode the "chunked" transfer-coding and <em class="bcp14">MUST</em> ignore chunk-ext extensions they do not understand.
    16181634      </p>
    16191635      <h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a>&nbsp;<a id="compression.codings" href="#compression.codings">Compression Codings</a></h2>
     
    16341650         </p>
    16351651      </div>
    1636       <div id="rfc.iref.g.73"></div>
     1652      <div id="rfc.iref.g.74"></div>
    16371653      <div id="rfc.iref.c.12"></div>
    16381654      <h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;<a id="gzip.coding" href="#gzip.coding">Gzip Coding</a></h3>
    16391655      <p id="rfc.section.4.2.3.p.1">The "gzip" format is produced by the file compression program "gzip" (GNU zip), as described in <a href="#RFC1952" id="rfc.xref.RFC1952.1"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a>. This format is a Lempel-Ziv coding (LZ77) with a 32 bit CRC. Recipients <em class="bcp14">SHOULD</em> consider "x-gzip" to be equivalent to "gzip".
    16401656      </p>
    1641       <div id="rfc.iref.t.5"></div>
    1642       <div id="rfc.iref.h.8"></div>
     1657      <div id="rfc.iref.t.6"></div>
     1658      <div id="rfc.iref.h.9"></div>
    16431659      <h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a>&nbsp;<a id="header.te" href="#header.te">TE</a></h2>
    16441660      <p id="rfc.section.4.3.p.1">The "TE" header field in a request indicates what transfer-codings, besides "chunked", the client is willing to accept in
     
    16481664         described in <a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>), and/or the keyword "trailers". Clients <em class="bcp14">MUST NOT</em> send the chunked transfer-coding name in TE; chunked is always acceptable for HTTP/1.1 recipients.
    16491665      </p>
    1650       <div id="rfc.figure.u.34"></div><pre class="inline"><span id="rfc.iref.g.74"></span><span id="rfc.iref.g.75"></span><span id="rfc.iref.g.76"></span><span id="rfc.iref.g.77"></span>  <a href="#header.te" class="smpl">TE</a>        = #<a href="#header.te" class="smpl">t-codings</a>
     1666      <div id="rfc.figure.u.35"></div><pre class="inline"><span id="rfc.iref.g.75"></span><span id="rfc.iref.g.76"></span><span id="rfc.iref.g.77"></span><span id="rfc.iref.g.78"></span>  <a href="#header.te" class="smpl">TE</a>        = #<a href="#header.te" class="smpl">t-codings</a>
    16511667  <a href="#header.te" class="smpl">t-codings</a> = "trailers" / ( <a href="#transfer.codings" class="smpl">transfer-coding</a> [ <a href="#header.te" class="smpl">t-ranking</a> ] )
    16521668  <a href="#header.te" class="smpl">t-ranking</a> = <a href="#rule.whitespace" class="smpl">OWS</a> ";" <a href="#rule.whitespace" class="smpl">OWS</a> "q=" <a href="#header.te" class="smpl">rank</a>
     
    16541670             / ( "1" [ "." 0*3("0") ] )
    16551671</pre><p id="rfc.section.4.3.p.4">Three examples of TE use are below.</p>
    1656       <div id="rfc.figure.u.35"></div><pre class="text">  TE: deflate
     1672      <div id="rfc.figure.u.36"></div><pre class="text">  TE: deflate
    16571673  TE:
    16581674  TE: trailers, deflate;q=0.5
     
    16711687      <p id="rfc.section.4.3.p.9">Since the TE header field only applies to the immediate connection, a sender of TE <em class="bcp14">MUST</em> also send a "TE" connection option within the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.4" title="Connection">Section&nbsp;6.1</a>) in order to prevent the TE field from being forwarded by intermediaries that do not support its semantics.
    16721688      </p>
    1673       <div id="rfc.iref.t.6"></div>
    1674       <div id="rfc.iref.h.9"></div>
    1675       <h2 id="rfc.section.4.4"><a href="#rfc.section.4.4">4.4</a>&nbsp;<a id="header.trailer" href="#header.trailer">Trailer</a></h2>
    1676       <p id="rfc.section.4.4.p.1">The "Trailer" header field indicates that the given set of header fields is present in the trailer of a message encoded with
    1677          chunked transfer-coding.
    1678       </p>
    1679       <div id="rfc.figure.u.36"></div><pre class="inline"><span id="rfc.iref.g.78"></span>  <a href="#header.trailer" class="smpl">Trailer</a> = 1#<a href="#header.fields" class="smpl">field-name</a>
    1680 </pre><p id="rfc.section.4.4.p.3">An HTTP/1.1 message <em class="bcp14">SHOULD</em> include a Trailer header field in a message using chunked transfer-coding with a non-empty trailer. Doing so allows the recipient
    1681          to know which header fields to expect in the trailer.
    1682       </p>
    1683       <p id="rfc.section.4.4.p.4">If no Trailer header field is present, the trailer <em class="bcp14">SHOULD NOT</em> include any header fields. See <a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a> for restrictions on the use of trailer fields in a "chunked" transfer-coding.
    1684       </p>
    1685       <p id="rfc.section.4.4.p.5">Message header fields listed in the Trailer header field <em class="bcp14">MUST NOT</em> include the following header fields:
    1686       </p>
    1687       <ul>
    1688          <li><a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a></li>
    1689          <li><a href="#header.content-length" class="smpl">Content-Length</a></li>
    1690          <li><a href="#header.trailer" class="smpl">Trailer</a></li>
    1691       </ul>
    16921689      <h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a>&nbsp;<a id="message.routing" href="#message.routing">Message Routing</a></h1>
    16931690      <p id="rfc.section.5.p.1">HTTP request message routing is determined by each client based on the target resource, the client's proxy configuration,
     
    22692266                  <td class="left">http</td>
    22702267                  <td class="left">standard</td>
    2271                   <td class="left"> <a href="#header.trailer" id="rfc.xref.header.trailer.2" title="Trailer">Section&nbsp;4.4</a>
     2268                  <td class="left"> <a href="#header.trailer" id="rfc.xref.header.trailer.1" title="Trailer">Section&nbsp;4.1.1</a>
    22722269                  </td>
    22732270               </tr>
     
    36353632                        <li><tt>quoted-str-nf</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.71"><b>4.1</b></a></li>
    36363633                        <li><tt>quoted-string</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.45"><b>3.2.4</b></a></li>
    3637                         <li><tt>rank</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.77"><b>4.3</b></a></li>
     3634                        <li><tt>rank</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.78"><b>4.3</b></a></li>
    36383635                        <li><tt>reason-phrase</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.32"><b>3.1.2</b></a></li>
    36393636                        <li><tt>received-by</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.91"><b>6.2</b></a></li>
     
    36473644                        <li><tt>status-code</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.31"><b>3.1.2</b></a></li>
    36483645                        <li><tt>status-line</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.30"><b>3.1.2</b></a></li>
    3649                         <li><tt>t-codings</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.75"><b>4.3</b></a></li>
    3650                         <li><tt>t-ranking</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.76"><b>4.3</b></a></li>
     3646                        <li><tt>t-codings</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.76"><b>4.3</b></a></li>
     3647                        <li><tt>t-ranking</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.77"><b>4.3</b></a></li>
    36513648                        <li><tt>tchar</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.43"><b>3.2.4</b></a></li>
    3652                         <li><tt>TE</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.74"><b>4.3</b></a></li>
     3649                        <li><tt>TE</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.75"><b>4.3</b></a></li>
    36533650                        <li><tt>token</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.42"><b>3.2.4</b></a></li>
    3654                         <li><tt>Trailer</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.78"><b>4.4</b></a></li>
     3651                        <li><tt>Trailer</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.73"><b>4.1.1</b></a></li>
    36553652                        <li><tt>trailer-part</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.70"><b>4.1</b></a></li>
    36563653                        <li><tt>transfer-coding</tt>&nbsp;&nbsp;<a href="#rfc.iref.g.55"><b>4</b></a></li>
     
    36673664                     </ul>
    36683665                  </li>
    3669                   <li>gzip (Coding Format)&nbsp;&nbsp;<a href="#rfc.iref.g.73">4.2.3</a></li>
     3666                  <li>gzip (Coding Format)&nbsp;&nbsp;<a href="#rfc.iref.g.74">4.2.3</a></li>
    36703667               </ul>
    36713668            </li>
     
    36773674                        <li>Content-Length&nbsp;&nbsp;<a href="#rfc.iref.h.7"><b>3.3.2</b></a>, <a href="#rfc.xref.header.content-length.1">7.1</a></li>
    36783675                        <li>Host&nbsp;&nbsp;<a href="#rfc.xref.header.host.1">5.3</a>, <a href="#rfc.iref.h.11"><b>5.4</b></a>, <a href="#rfc.xref.header.host.2">7.1</a>, <a href="#rfc.xref.header.host.3">A.1.1</a></li>
    3679                         <li>TE&nbsp;&nbsp;<a href="#rfc.xref.header.te.1">4</a>, <a href="#rfc.xref.header.te.2">4.1</a>, <a href="#rfc.iref.h.8"><b>4.3</b></a>, <a href="#rfc.xref.header.te.3">7.1</a></li>
    3680                         <li>Trailer&nbsp;&nbsp;<a href="#rfc.xref.header.trailer.1">4.1</a>, <a href="#rfc.iref.h.9"><b>4.4</b></a>, <a href="#rfc.xref.header.trailer.2">7.1</a></li>
     3676                        <li>TE&nbsp;&nbsp;<a href="#rfc.xref.header.te.1">4</a>, <a href="#rfc.xref.header.te.2">4.1.1</a>, <a href="#rfc.iref.h.9"><b>4.3</b></a>, <a href="#rfc.xref.header.te.3">7.1</a></li>
     3677                        <li>Trailer&nbsp;&nbsp;<a href="#rfc.iref.h.8"><b>4.1.1</b></a>, <a href="#rfc.xref.header.trailer.1">7.1</a></li>
    36813678                        <li>Transfer-Encoding&nbsp;&nbsp;<a href="#rfc.xref.header.transfer-encoding.1">3.3</a>, <a href="#rfc.iref.h.6"><b>3.3.1</b></a>, <a href="#rfc.xref.header.transfer-encoding.2">4</a>, <a href="#rfc.xref.header.transfer-encoding.3">7.1</a>, <a href="#rfc.xref.header.transfer-encoding.4">A.1.3</a></li>
    36823679                        <li>Upgrade&nbsp;&nbsp;<a href="#rfc.iref.h.14"><b>6.5</b></a>, <a href="#rfc.xref.header.upgrade.1">7.1</a>, <a href="#rfc.xref.header.upgrade.2">A.2</a></li>
     
    38593856                  <li>target resource&nbsp;&nbsp;<a href="#rfc.iref.t.7"><b>5.1</b></a></li>
    38603857                  <li>target URI&nbsp;&nbsp;<a href="#rfc.iref.t.8"><b>5.1</b></a></li>
    3861                   <li>TE header field&nbsp;&nbsp;<a href="#rfc.xref.header.te.1">4</a>, <a href="#rfc.xref.header.te.2">4.1</a>, <a href="#rfc.iref.t.5"><b>4.3</b></a>, <a href="#rfc.xref.header.te.3">7.1</a></li>
     3858                  <li>TE header field&nbsp;&nbsp;<a href="#rfc.xref.header.te.1">4</a>, <a href="#rfc.xref.header.te.2">4.1.1</a>, <a href="#rfc.iref.t.6"><b>4.3</b></a>, <a href="#rfc.xref.header.te.3">7.1</a></li>
    38623859                  <li><em>Tou1998</em>&nbsp;&nbsp;<a href="#rfc.xref.Tou1998.1">6.3.1</a>, <a href="#Tou1998"><b>10.2</b></a></li>
    3863                   <li>Trailer header field&nbsp;&nbsp;<a href="#rfc.xref.header.trailer.1">4.1</a>, <a href="#rfc.iref.t.6"><b>4.4</b></a>, <a href="#rfc.xref.header.trailer.2">7.1</a></li>
     3860                  <li>Trailer header field&nbsp;&nbsp;<a href="#rfc.iref.t.5"><b>4.1.1</b></a>, <a href="#rfc.xref.header.trailer.1">7.1</a></li>
    38643861                  <li>Transfer-Encoding header field&nbsp;&nbsp;<a href="#rfc.xref.header.transfer-encoding.1">3.3</a>, <a href="#rfc.iref.t.4"><b>3.3.1</b></a>, <a href="#rfc.xref.header.transfer-encoding.2">4</a>, <a href="#rfc.xref.header.transfer-encoding.3">7.1</a>, <a href="#rfc.xref.header.transfer-encoding.4">A.1.3</a></li>
    38653862                  <li>transforming proxy&nbsp;&nbsp;<a href="#rfc.iref.t.1"><b>2.4</b></a></li>
Note: See TracChangeset for help on using the changeset viewer.