Ignore:
Timestamp:
Feb 20, 2012, 1:10:22 AM (8 years ago)
Author:
fielding@…
Message:

Consolidate and clean the description and requirements for Transfer-Encoding

File:
1 edited

Legend:

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

    r1538 r1540  
    15501550  <x:anchor-alias value="message-body"/>
    15511551<t>
    1552    The message-body (if any) of an HTTP message is used to carry the
    1553    payload body associated with the request or response.
     1552   The message body (if any) of an HTTP message is used to carry the
     1553   payload body of that request or response.  The message body is
     1554   identical to the payload body unless a transfer coding has been
     1555   applied, as described in <xref target="header.transfer-encoding"/>.
    15541556</t>
    15551557<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="message-body"/>
     
    15571559</artwork></figure>
    15581560<t>
    1559    The message-body differs from the payload body only when a transfer-coding
    1560    has been applied, as indicated by the Transfer-Encoding header field
    1561    (<xref target="header.transfer-encoding"/>).
    1562 </t>
    1563 <t>
    1564    The rules for when a message-body is allowed in a message differ for
     1561   The rules for when a message body is allowed in a message differ for
    15651562   requests and responses.
    15661563</t>
    15671564<t>
    1568    The presence of a message-body in a request is signaled by the
    1569    inclusion of a Content-Length or Transfer-Encoding header field in
    1570    the request's header fields, even if the request method does not
    1571    define any use for a message-body.  This allows the request
    1572    message framing algorithm to be independent of method semantics.
    1573 </t>
    1574 <t>
    1575    For response messages, whether or not a message-body is included with
    1576    a message is dependent on both the request method and the response
     1565   The presence of a message body in a request is signaled by a
     1566   a Content-Length or Transfer-Encoding header field.
     1567   Request message framing is independent of method semantics,
     1568   even if the method does not define any use for a message body.
     1569</t>
     1570<t>
     1571   The presence of a message body in a response depends on both
     1572   the request method to which it is responding and the response
    15771573   status code (<xref target="status.code"/>).
    1578    Responses to the HEAD request method never include a message-body
     1574   Responses to the HEAD request method never include a message body
    15791575   because the associated response header fields (e.g., Transfer-Encoding,
    15801576   Content-Length, etc.) only indicate what their values would have been
    1581    if the request method had been GET.  All 1xx (Informational), 204 (No Content),
    1582    and 304 (Not Modified) responses &MUST-NOT; include a message-body.
     1577   if the request method had been GET.
     1578   All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
     1579   responses &MUST-NOT; include a message body.
    15831580   All other responses do include a message-body, although the body
    15841581   &MAY; be of zero length.
     
    15901587  <x:anchor-alias value="Transfer-Encoding"/>
    15911588<t>
    1592    The "Transfer-Encoding" header field indicates what transfer-codings
    1593    (if any) have been applied to the message body. It differs from
    1594    Content-Encoding (&content-codings;) in that transfer-codings are a property
    1595    of the message (and therefore are removed by intermediaries), whereas
    1596    content-codings are not.
     1589   When one or more transfer encodings are applied to a payload body in order
     1590   to form the message-body, a Transfer-Encoding header field &MUST; be sent
     1591   in the message and &MUST; contain the list of corresponding
     1592   transfer-coding names in the same order that they were applied.
     1593   Transfer encodings are defined in <xref target="transfer.codings"/>.
    15971594</t>
    15981595<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Transfer-Encoding"/>
     
    16001597</artwork></figure>
    16011598<t>
    1602    Transfer-codings are defined in <xref target="transfer.codings"/>. An example is:
     1599   Transfer-Encoding is analogous to the Content-Transfer-Encoding field of
     1600   MIME, which was designed to enable safe transport of binary data over a
     1601   7-bit transport service (<xref target="RFC2045" x:fmt="," x:sec="6"/>).
     1602   However, safe transport has a different focus for an 8bit-clean transfer
     1603   protocol. In HTTP's case, Transfer-Encoding is primarily intended to
     1604   accurately delimit a dynamically generated payload and to distinguish
     1605   payload encodings that are only applied for transport efficiency or
     1606   security from those that are characteristics of the target resource.
     1607</t>
     1608<t>
     1609   The "chunked" transfer-coding (<xref target="chunked.encoding"/>)
     1610   &MUST; be implemented by all HTTP/1.1 recipients because it plays a
     1611   crucial role in delimiting messages when the payload body size is not
     1612   known in advance.
     1613   When the "chunked" transfer-coding is used, it &MUST; be the last
     1614   transfer-coding applied to form the message body and &MUST-NOT;
     1615   be applied more than once in a message-body.
     1616   If any transfer-coding is applied to a request payload body,
     1617   the final transfer-coding applied &MUST; be "chunked".
     1618   If any transfer-coding is applied to a response payload body, then either
     1619   the final transfer-coding applied &MUST; be "chunked" or
     1620   the message &MUST; be terminated by closing the connection.
     1621</t>
     1622<t>
     1623   For example,
    16031624</t>
    16041625<figure><artwork type="example">
     
    16061627</artwork></figure>
    16071628<t>
    1608    If multiple encodings have been applied to a representation, the transfer-codings
    1609    &MUST; be listed in the order in which they were applied.
     1629   If more than one Transfer-Encoding header field is present in a message,
     1630   the multiple field-values &MUST; be combined into one field-value,
     1631   according to the algorithm defined in <xref target="header.fields"/>,
     1632   before determining the message-body length.
     1633</t>
     1634<t>
     1635   Unlike Content-Encoding (&content-codings;), Transfer-Encoding is a
     1636   property of the message, not of the payload, and thus &MAY; be added or
     1637   removed by any implementation along the request/response chain.
    16101638   Additional information about the encoding parameters &MAY; be provided
    16111639   by other header fields not defined by this specification.
    16121640</t>
    16131641<t>
    1614    Many older HTTP/1.0 applications do not understand the Transfer-Encoding
    1615    header field.
    1616 </t>
    1617 <t>
    1618    If more than one
    1619    Transfer-Encoding header field is present in a message, the multiple
    1620    field-values &MUST; be combined into one field-value, according to the
    1621    algorithm defined in <xref target="header.fields"/>, before determining
    1622    the message-body length.
    1623 </t>
    1624 <t>
    1625    When one or more transfer-codings are applied to a payload in order to
    1626    form the message-body, the Transfer-Encoding header field &MUST; contain
    1627    the list of transfer-codings applied. Transfer-Encoding is a property of
    1628    the message, not of the payload, and thus &MAY; be added or removed by
    1629    any implementation along the request/response chain under the constraints
    1630    found in <xref target="transfer.codings"/>.
     1642   Transfer-Encoding was added in HTTP/1.1.  It is generally assumed that
     1643   implementations advertising only HTTP/1.0 support will not understand
     1644   how to process a transfer-encoded payload.
     1645   A client &MUST-NOT; send a request containing Transfer-Encoding unless it
     1646   knows the server will handle HTTP/1.1 (or later) requests; such knowledge
     1647   might be in the form of specific user configuration or by remembering the
     1648   version of a prior received response.
     1649   A server &MUST-NOT; send a response containing Transfer-Encoding unless
     1650   the corresponding request indicates HTTP/1.1 (or later).
     1651</t>
     1652<t>
     1653   A server that receives a request message with a transfer-coding it does
     1654   not understand &SHOULD; respond with 501 (Not Implemented) and then
     1655   close the connection.
    16311656</t>
    16321657</section>
     
    16881713<section title="Message Body Length" anchor="message.body.length">
    16891714<t>
    1690    The length of the message-body is determined by one of the following
     1715   The length of a message-body is determined by one of the following
    16911716   (in order of precedence):
    16921717</t>
     
    17011726    <x:lt><t>
    17021727     If a Transfer-Encoding header field is present
    1703      and the "chunked" transfer-coding (<xref target="transfer.codings"/>)
     1728     and the "chunked" transfer-coding (<xref target="chunked.encoding"/>)
    17041729     is the final encoding, the message-body length is determined by reading
    17051730     and decoding the chunked data until the transfer-coding indicates the
     
    21112136</section>
    21122137
    2113 <section title="Associating Response to Request" anchor="associating.request.response">
     2138<section title="Associating a Response to a Request" anchor="associating.response.to.request">
    21142139<t>
    21152140   HTTP does not include a request identifier for associating a given
     
    21652190   transfer-coding values in the TE header field (<xref target="header.te"/>) and in
    21662191   the Transfer-Encoding header field (<xref target="header.transfer-encoding"/>).
    2167 </t>
    2168 <t>
    2169    Transfer-codings are analogous to the Content-Transfer-Encoding values of
    2170    MIME, which were designed to enable safe transport of binary data over a
    2171    7-bit transport service (<xref target="RFC2045" x:fmt="," x:sec="6"/>).
    2172    However, safe transport
    2173    has a different focus for an 8bit-clean transfer protocol. In HTTP,
    2174    the only unsafe characteristic of message-bodies is the difficulty in
    2175    determining the exact message body length (<xref target="message.body"/>),
    2176    or the desire to encrypt data over a shared transport.
    2177 </t>
    2178 <t>
    2179    A server that receives a request message with a transfer-coding it does
    2180    not understand &SHOULD; respond with 501 (Not Implemented) and then
    2181    close the connection. A server &MUST-NOT; send transfer-codings to an HTTP/1.0
    2182    client.
    21832192</t>
    21842193
     
    22912300   Use of chunk-ext extensions by senders is deprecated; they &SHOULD-NOT; be
    22922301   sent and definition of new chunk-extensions is discouraged.
    2293 </t>
    2294 <t>
    2295    Since "chunked" is the only transfer-coding required to be understood
    2296    by HTTP/1.1 recipients, it plays a crucial role in delimiting messages
    2297    on a persistent connection.  Whenever a transfer-coding is applied to
    2298    a payload body in a request, the final transfer-coding applied &MUST;
    2299    be "chunked".  If a transfer-coding is applied to a response payload
    2300    body, then either the final transfer-coding applied &MUST; be "chunked"
    2301    or the message &MUST; be terminated by closing the connection. When the
    2302    "chunked" transfer-coding is used, it &MUST; be the last transfer-coding
    2303    applied to form the message-body. The "chunked" transfer-coding &MUST-NOT;
    2304    be applied more than once in a message-body.
    23052302</t>
    23062303</section>
Note: See TracChangeset for help on using the changeset viewer.