Ignore:
Timestamp:
Dec 11, 2007, 1:53:42 AM (12 years ago)
Author:
fielding@…
Message:

Partition RFC 2616 into seven (mostly) independent documents.
No semantic changes. Some meaningless crossreferences to prior
editorial decisions have been removed from appendices.

Structural changes minimized to simplify diff versus rfc2616.
This was a lot harder than it looks.

Part 8 (Cookies) is for future specification based on RFC 2965.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • draft-ietf-httpbis/latest/p6-cache.xml

    r23 r29  
    1 <?xml version="1.0" encoding="UTF-8"?>
     1<?xml version="1.0" encoding="utf-8"?>
    22<!DOCTYPE rfc [
    33  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
     
    1111  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
    1212  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
     13  <!ENTITY ID-VERSION "latest">
     14  <!ENTITY messaging                   "[Part 1]">
     15  <!ENTITY combining-byte-ranges       "[Part 5]">
     16  <!ENTITY entity-length               "[Part 3]">
     17  <!ENTITY entity-tags                 "[Part 4]">
     18  <!ENTITY full-date                   "[Part 1]">
     19  <!ENTITY header-authorization        "[Part 7]">
     20  <!ENTITY header-connection           "[Part 1]">
     21  <!ENTITY header-date                 "[Part 1]">
     22  <!ENTITY weak-and-strong-validators  "[Part 4]">
     23  <!ENTITY message-headers             "[Part 1]">
     24  <!ENTITY message-length              "[Part 1]">
     25  <!ENTITY safe-methods                "[Part 2]">
     26  <!ENTITY server-driven-negotiation   "[Part 3]">
    1327]>
    1428<?rfc toc="yes" ?>
    15 <?rfc symrefs="no" ?>
     29<?rfc symrefs="yes" ?>
     30<?rfc sortrefs="yes" ?>
    1631<?rfc compact="yes"?>
    1732<?rfc subcompact="no" ?>
     
    2035<?rfc-ext allow-markup-in-artwork="yes" ?>
    2136<?rfc-ext include-references-in-index="yes" ?>
    22 <rfc number="2616" category="std" obsoletes="2068" xmlns:x='http://purl.org/net/xml2rfc/ext' xmlns:ed="http://greenbytes.de/2002/rfcedit" >
    23 <x:assign-section-number number="18" builtin-target="authors"/>
     37<rfc obsoletes="2068, 2616, 2617" category="std"
     38     ipr="full3978" docName="draft-ietf-httpbis-p6-cache-&ID-VERSION;"
     39     xmlns:x='http://purl.org/net/xml2rfc/ext' xmlns:ed="http://greenbytes.de/2002/rfcedit">
    2440<front>
    2541
    26   <title abbrev="HTTP/1.1">Hypertext Transfer Protocol -- HTTP/1.1</title>
    27 
    28   <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
    29     <organization abbrev="UC Irvine">Department of Information and Computer Science</organization>
     42  <title abbrev="HTTP/1.1, part 6">HTTP/1.1, part 6: Caching</title>
     43
     44  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
     45    <organization abbrev="Day Software">Day Software</organization>
    3046    <address>
    3147      <postal>
    32         <street>University of California, Irvine</street>
    33         <city>Irvine</city>
     48        <street>23 Corporate Plaza DR, Suite 280</street>
     49        <city>Newport Beach</city>
    3450        <region>CA</region>
    35         <code>92697-3425</code>
     51        <code>92660</code>
     52        <country>USA</country>
    3653      </postal>
    37       <facsimile>+1(949)824-1715</facsimile>
    38       <email>fielding@ics.uci.edu</email>
     54      <phone>+1-949-706-5300</phone>
     55      <facsimile>+1-949-706-5305</facsimile>
     56      <email>fielding@gbiv.com</email>
     57      <uri>http://roy.gbiv.com/</uri>
    3958    </address>
    4059  </author>
    4160
    42   <author initials="J." surname="Gettys" fullname="James Gettys">
    43     <organization abbrev="Compaq/W3C">World Wide Web Consortium</organization>
     61  <author initials="J." surname="Gettys" fullname="Jim Gettys">
     62    <organization>One Laptop per Child</organization>
    4463    <address>
    4564      <postal>
    46         <street>MIT Laboratory for Computer Science, NE43-356</street>
    47         <street>545 Technology Square</street>
    48         <city>Cambridge</city>
     65        <street>21 Oak Knoll Road</street>
     66        <city>Carlisle</city>
    4967        <region>MA</region>
    50         <code>02139</code>
     68        <code>01741</code>
     69        <country>USA</country>
    5170      </postal>
    52       <facsimile>+1(617)258-8682</facsimile>
    53       <email>jg@w3.org</email>
     71      <email>jg@laptop.org</email>
     72      <uri>http://www.laptop.org/</uri>
    5473    </address>
    5574  </author>
    5675 
    5776  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
    58     <organization abbrev="Compaq">Compaq Computer Corporation</organization>
     77    <organization abbrev="HP">Hewlett-Packard Company</organization>
    5978    <address>
    6079      <postal>
    61         <street>Western Research Laboratory</street>
    62         <street>250 University Avenue</street>
     80        <street>HP Labs, Large Scale Systems Group</street>
     81        <street>1501 Page Mill Road, MS 1177</street>
    6382        <city>Palo Alto</city>
    6483        <region>CA</region>
    65         <code>94305</code>
     84        <code>94304</code>
     85        <country>USA</country>
    6686      </postal>
    67       <email>mogul@wrl.dec.com</email>
     87      <email>JeffMogul@acm.org</email>
    6888    </address>
    6989  </author>
    7090
    7191  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
    72     <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
     92    <organization abbrev="Microsoft">Microsoft Corporation</organization>
    7393    <address>
    7494      <postal>
    75         <street>MIT Laboratory for Computer Science, NE43-356</street>
    76         <street>545 Technology Square</street>
    77         <city>Cambridge</city>
    78         <region>MA</region>
    79         <code>02139</code>
     95        <street>1 Microsoft Way</street>
     96        <city>Redmond</city>
     97        <region>WA</region>
     98        <code>98052</code>
     99        <country>USA</country>
    80100      </postal>
    81       <facsimile>+1(617)258-8682</facsimile>
    82       <email>frystyk@w3.org</email>
     101      <email>henrikn@microsoft.com</email>
    83102    </address>
    84103  </author>
    85104
    86105  <author initials="L." surname="Masinter" fullname="Larry Masinter">
    87     <organization abbrev="Xerox">Xerox Corporation</organization>
     106    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
    88107    <address>
    89108      <postal>
    90         <street>MIT Laboratory for Computer Science, NE43-356</street>
    91         <street>3333 Coyote Hill Road</street>
    92         <city>Palo Alto</city>
     109        <street>345 Park Ave</street>
     110        <city>San Jose</city>
    93111        <region>CA</region>
    94         <code>94034</code>
     112        <code>95110</code>
     113        <country>USA</country>
    95114      </postal>
    96       <email>masinter@parc.xerox.com</email>
     115      <email>LMM@acm.org</email>
     116      <uri>http://larry.masinter.net/</uri>
    97117    </address>
    98118  </author>
     
    115135    <address>
    116136      <postal>
    117         <street>MIT Laboratory for Computer Science, NE43-356</street>
     137        <street>MIT Laboratory for Computer Science</street>
    118138        <street>545 Technology Square</street>
    119139        <city>Cambridge</city>
    120140        <region>MA</region>
    121141        <code>02139</code>
     142        <country>USA</country>
    122143      </postal>
    123       <facsimile>+1(617)258-8682</facsimile>
     144      <facsimile>+1 (617) 258 8682</facsimile>
    124145      <email>timbl@w3.org</email>
    125146    </address>
    126147  </author>
    127148
    128   <date month="June" year="1999"/>
     149  <date month="December" year="2007"/>
    129150
    130151<abstract>
     
    132153   The Hypertext Transfer Protocol (HTTP) is an application-level
    133154   protocol for distributed, collaborative, hypermedia information
    134    systems. It is a generic, stateless, protocol which can be used for
    135    many tasks beyond its use for hypertext, such as name servers and
    136    distributed object management systems, through extension of its
    137    request methods, error codes and headers <xref target="RFC2324"/>. A feature of HTTP is
    138    the typing and negotiation of data representation, allowing systems
    139    to be built independently of the data being transferred.
    140 </t>
    141 <t>
    142    HTTP has been in use by the World-Wide Web global information
    143    initiative since 1990. This specification defines the protocol
    144    referred to as "HTTP/1.1", and is an update to RFC 2068 <xref target="RFC2068"/>.
     155   systems. HTTP has been in use by the World Wide Web global information
     156   initiative since 1990. This document is Part 6 of the eight-part specification
     157   that defines the protocol referred to as "HTTP/1.1" and, taken together,
     158   updates RFC 2616 and RFC 2617.  Part 6 defines requirements on HTTP caches
     159   and the associated header fields that control cache behavior or indicate
     160   cacheable response messages.
    145161</t>
    146162</abstract>
     
    148164<middle>
    149165<section title="Introduction" anchor="introduction">
    150 
    151 <section title="Purpose" anchor="intro.purpose">
    152 <t>
    153    The Hypertext Transfer Protocol (HTTP) is an application-level
    154    protocol for distributed, collaborative, hypermedia information
    155    systems. HTTP has been in use by the World-Wide Web global
    156    information initiative since 1990. The first version of HTTP,
    157    referred to as HTTP/0.9, was a simple protocol for raw data transfer
    158    across the Internet. HTTP/1.0, as defined by RFC 1945 <xref target="RFC1945"/>, improved
    159    the protocol by allowing messages to be in the format of MIME-like
    160    messages, containing metainformation about the data transferred and
    161    modifiers on the request/response semantics. However, HTTP/1.0 does
    162    not sufficiently take into consideration the effects of hierarchical
    163    proxies, caching, the need for persistent connections, or virtual
    164    hosts. In addition, the proliferation of incompletely-implemented
    165    applications calling themselves "HTTP/1.0" has necessitated a
    166    protocol version change in order for two communicating applications
    167    to determine each other's true capabilities.
    168 </t>
    169 <t>
    170    This specification defines the protocol referred to as "HTTP/1.1".
    171    This protocol includes more stringent requirements than HTTP/1.0 in
    172    order to ensure reliable implementation of its features.
    173 </t>
    174 <t>
    175    Practical information systems require more functionality than simple
    176    retrieval, including search, front-end update, and annotation. HTTP
    177    allows an open-ended set of methods and headers that indicate the
    178    purpose of a request <xref target="RFC2324"/>. It builds on the discipline of reference
    179    provided by the Uniform Resource Identifier (URI) <xref target="RFC1630"/>, as a location
    180    (URL) <xref target="RFC1738"/> or name (URN) <xref target="RFC1737"/>, for indicating the resource to which a
    181    method is to be applied. Messages are passed in a format similar to
    182    that used by Internet mail <xref target="RFC822"/> as defined by the Multipurpose
    183    Internet Mail Extensions (MIME) <xref target="RFC2045"/>.
    184 </t>
    185 <t>
    186    HTTP is also used as a generic protocol for communication between
    187    user agents and proxies/gateways to other Internet systems, including
    188    those supported by the SMTP <xref target="RFC821"/>, NNTP <xref target="RFC977"/>, FTP <xref target="RFC959"/>, Gopher <xref target="RFC1436"/>,
    189    and WAIS <xref target="WAIS"/> protocols. In this way, HTTP allows basic hypermedia
    190    access to resources available from diverse applications.
    191 </t>
    192 </section>
    193 
    194 <section title="Requirements" anchor="intro.requirements">
    195 <t>
    196    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
    197    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
    198    document are to be interpreted as described in RFC 2119 <xref target="RFC2119"/>.
    199 </t>
    200 <t>
    201    An implementation is not compliant if it fails to satisfy one or more
    202    of the &MUST; or &REQUIRED; level requirements for the protocols it
    203    implements. An implementation that satisfies all the &MUST; or &REQUIRED;
    204    level and all the &SHOULD; level requirements for its protocols is said
    205    to be "unconditionally compliant"; one that satisfies all the &MUST;
    206    level requirements but not all the &SHOULD; level requirements for its
    207    protocols is said to be "conditionally compliant."
    208 </t>
    209 </section>
     166<t>
     167   This document will define aspects of HTTP related to caching response
     168   messages.  Right now it only includes the extracted relevant sections
     169   of <xref target="RFC2616">RFC 2616</xref> without edit.
     170</t>
    210171
    211172<section title="Terminology" anchor="intro.terminology">
     
    213174   This specification uses a number of terms to refer to the roles
    214175   played by participants in, and objects of, the HTTP communication.
    215 </t>
    216 <t>
    217   <iref item="connection"/>
    218   <x:dfn>connection</x:dfn>
    219   <list>
    220     <t>
    221       A transport layer virtual circuit established between two programs
    222       for the purpose of communication.
    223     </t>
    224   </list>
    225 </t>
    226 <t>
    227   <iref item="message"/>
    228   <x:dfn>message</x:dfn>
    229   <list>
    230     <t>
    231       The basic unit of HTTP communication, consisting of a structured
    232       sequence of octets matching the syntax defined in <xref target="http.message"/> and
    233       transmitted via the connection.
    234     </t>
    235   </list>
    236 </t>
    237 <t>
    238   <iref item="request"/>
    239   <x:dfn>request</x:dfn>
    240   <list>
    241     <t>
    242       An HTTP request message, as defined in <xref target="request"/>.
    243     </t>
    244   </list>
    245 </t>
    246 <t>
    247   <iref item="response"/>
    248   <x:dfn>response</x:dfn>
    249   <list>
    250     <t>
    251       An HTTP response message, as defined in <xref target="response"/>.
    252     </t>
    253   </list>
    254 </t>
    255 <t>
    256   <iref item="resource"/>
    257   <x:dfn>resource</x:dfn>
    258   <list>
    259     <t>
    260       A network data object or service that can be identified by a URI,
    261       as defined in <xref target="uri"/>. Resources may be available in multiple
    262       representations (e.g. multiple languages, data formats, size, and
    263       resolutions) or vary in other ways.
    264     </t>
    265   </list>
    266 </t>
    267 <t>
    268   <iref item="entity"/>
    269   <x:dfn>entity</x:dfn>
    270   <list>
    271     <t>
    272       The information transferred as the payload of a request or
    273       response. An entity consists of metainformation in the form of
    274       entity-header fields and content in the form of an entity-body, as
    275       described in <xref target="entity"/>.
    276     </t>
    277   </list>
    278 </t>
    279 <t>
    280   <iref item="representation"/>
    281   <x:dfn>representation</x:dfn>
    282   <list>
    283     <t>
    284       An entity included with a response that is subject to content
    285       negotiation, as described in <xref target="content.negotiation"/>. There may exist multiple
    286       representations associated with a particular response status.
    287     </t>
    288   </list>
    289 </t>
    290 <t>
    291   <iref item="content negotiation"/>
    292   <x:dfn>content negotiation</x:dfn>
    293   <list>
    294     <t>
    295       The mechanism for selecting the appropriate representation when
    296       servicing a request, as described in <xref target="content.negotiation"/>. The
    297       representation of entities in any response can be negotiated
    298       (including error responses).
    299     </t>
    300   </list>
    301 </t>
    302 <t>
    303   <iref item="variant"/>
    304   <x:dfn>variant</x:dfn>
    305   <list>
    306     <t>
    307       A resource may have one, or more than one, representation(s)
    308       associated with it at any given instant. Each of these
    309       representations is termed a `varriant'.  Use of the term `variant'
    310       does not necessarily imply that the resource is subject to content
    311       negotiation.
    312     </t>
    313   </list>
    314 </t>
    315 <t>
    316   <iref item="client"/>
    317   <x:dfn>client</x:dfn>
    318   <list>
    319     <t>
    320       A program that establishes connections for the purpose of sending
    321       requests.
    322     </t>
    323   </list>
    324 </t>
    325 <t>
    326   <iref item="user agent"/>
    327   <x:dfn>user agent</x:dfn>
    328   <list>
    329     <t>
    330       The client which initiates a request. These are often browsers,
    331       editors, spiders (web-traversing robots), or other end user tools.
    332     </t>
    333   </list>
    334 </t>
    335 <t>
    336   <iref item="server"/>
    337   <x:dfn>server</x:dfn>
    338   <list>
    339     <t>
    340       An application program that accepts connections in order to
    341       service requests by sending back responses. Any given program may
    342       be capable of being both a client and a server; our use of these
    343       terms refers only to the role being performed by the program for a
    344       particular connection, rather than to the program's capabilities
    345       in general. Likewise, any server may act as an origin server,
    346       proxy, gateway, or tunnel, switching behavior based on the nature
    347       of each request.
    348     </t>
    349   </list>
    350 </t>
    351 <t>
    352   <iref item="origin server"/>
    353   <x:dfn>origin server</x:dfn>
    354   <list>
    355     <t>
    356       The server on which a given resource resides or is to be created.
    357     </t>
    358   </list>
    359 </t>
    360 <t>
    361   <iref item="proxy"/>
    362   <x:dfn>proxy</x:dfn>
    363   <list>
    364     <t>
    365       An intermediary program which acts as both a server and a client
    366       for the purpose of making requests on behalf of other clients.
    367       Requests are serviced internally or by passing them on, with
    368       possible translation, to other servers. A proxy &MUST; implement
    369       both the client and server requirements of this specification. A
    370       "transparent proxy" is a proxy that does not modify the request or
    371       response beyond what is required for proxy authentication and
    372       identification. A "non-transparent proxy" is a proxy that modifies
    373       the request or response in order to provide some added service to
    374       the user agent, such as group annotation services, media type
    375       transformation, protocol reduction, or anonymity filtering. Except
    376       where either transparent or non-transparent behavior is explicitly
    377       stated, the HTTP proxy requirements apply to both types of
    378       proxies.
    379     </t>
    380   </list>
    381 </t>
    382 <t>
    383   <iref item="gateway"/>
    384   <x:dfn>gateway</x:dfn>
    385   <list>
    386     <t>
    387       A server which acts as an intermediary for some other server.
    388       Unlike a proxy, a gateway receives requests as if it were the
    389       origin server for the requested resource; the requesting client
    390       may not be aware that it is communicating with a gateway.
    391     </t>
    392   </list>
    393 </t>
    394 <t>
    395   <iref item="tunnel"/>
    396   <x:dfn>tunnel</x:dfn>
    397   <list>
    398     <t>
    399       An intermediary program which is acting as a blind relay between
    400       two connections. Once active, a tunnel is not considered a party
    401       to the HTTP communication, though the tunnel may have been
    402       initiated by an HTTP request. The tunnel ceases to exist when both
    403       ends of the relayed connections are closed.
    404     </t>
    405   </list>
    406176</t>
    407177<t>
     
    530300  </list>
    531301</t>
    532 <t>
    533   <iref item="upstream"/>
    534   <iref item="downstream"/>
    535   <x:dfn>upstream</x:dfn>/<x:dfn>downstream</x:dfn>
    536   <list>
    537     <t>
    538       Upstream and downstream describe the flow of a message: all
    539       messages flow from upstream to downstream.
    540     </t>
    541   </list>
    542 </t>
    543 <t>
    544   <iref item="inbound"/>
    545   <iref item="outbound"/>
    546   <x:dfn>inbound</x:dfn>/<x:dfn>outbound</x:dfn>
    547   <list>
    548     <t>
    549       Inbound and outbound refer to the request and response paths for
    550       messages: "inbound" means "traveling toward the origin server",
    551       and "outbound" means "traveling toward the user agent"
    552     </t>
    553   </list>
    554 </t>
    555 </section>
    556 
    557 <section title="Overall Operation" anchor="intro.overall.operation">
    558 <t>
    559    The HTTP protocol is a request/response protocol. A client sends a
    560    request to the server in the form of a request method, URI, and
    561    protocol version, followed by a MIME-like message containing request
    562    modifiers, client information, and possible body content over a
    563    connection with a server. The server responds with a status line,
    564    including the message's protocol version and a success or error code,
    565    followed by a MIME-like message containing server information, entity
    566    metainformation, and possible entity-body content. The relationship
    567    between HTTP and MIME is described in <xref target="differences.between.http.entities.and.rfc.2045.entities"/>.
    568 </t>
    569 <t>
    570    Most HTTP communication is initiated by a user agent and consists of
    571    a request to be applied to a resource on some origin server. In the
    572    simplest case, this may be accomplished via a single connection (v)
    573    between the user agent (UA) and the origin server (O).
    574 </t>
    575 <figure><artwork type="drawing">
    576        request chain ------------------------&gt;
    577     UA -------------------v------------------- O
    578        &lt;----------------------- response chain
    579 </artwork></figure>
    580 <t>
    581    A more complicated situation occurs when one or more intermediaries
    582    are present in the request/response chain. There are three common
    583    forms of intermediary: proxy, gateway, and tunnel. A proxy is a
    584    forwarding agent, receiving requests for a URI in its absolute form,
    585    rewriting all or part of the message, and forwarding the reformatted
    586    request toward the server identified by the URI. A gateway is a
    587    receiving agent, acting as a layer above some other server(s) and, if
    588    necessary, translating the requests to the underlying server's
    589    protocol. A tunnel acts as a relay point between two connections
    590    without changing the messages; tunnels are used when the
    591    communication needs to pass through an intermediary (such as a
    592    firewall) even when the intermediary cannot understand the contents
    593    of the messages.
    594 </t>
    595 <figure><artwork type="drawing">
    596        request chain --------------------------------------&gt;
    597     UA -----v----- A -----v----- B -----v----- C -----v----- O
    598        &lt;------------------------------------- response chain
    599 </artwork></figure>
    600 <t>
    601    The figure above shows three intermediaries (A, B, and C) between the
    602    user agent and origin server. A request or response message that
    603    travels the whole chain will pass through four separate connections.
    604    This distinction is important because some HTTP communication options
    605    may apply only to the connection with the nearest, non-tunnel
    606    neighbor, only to the end-points of the chain, or to all connections
    607    along the chain. Although the diagram is linear, each participant may
    608    be engaged in multiple, simultaneous communications. For example, B
    609    may be receiving requests from many clients other than A, and/or
    610    forwarding requests to servers other than C, at the same time that it
    611    is handling A's request.
    612 </t>
    613 <t>
    614    Any party to the communication which is not acting as a tunnel may
    615    employ an internal cache for handling requests. The effect of a cache
    616    is that the request/response chain is shortened if one of the
    617    participants along the chain has a cached response applicable to that
    618    request. The following illustrates the resulting chain if B has a
    619    cached copy of an earlier response from O (via C) for a request which
    620    has not been cached by UA or A.
    621 </t>
    622 <figure><artwork type="drawing">
    623           request chain ----------&gt;
    624        UA -----v----- A -----v----- B - - - - - - C - - - - - - O
    625           &lt;--------- response chain
    626 </artwork></figure>
    627 <t>
    628    Not all responses are usefully cacheable, and some requests may
    629    contain modifiers which place special requirements on cache behavior.
    630    HTTP requirements for cache behavior and cacheable responses are
    631    defined in <xref target="caching"/>.
    632 </t>
    633 <t>
    634    In fact, there are a wide variety of architectures and configurations
    635    of caches and proxies currently being experimented with or deployed
    636    across the World Wide Web. These systems include national hierarchies
    637    of proxy caches to save transoceanic bandwidth, systems that
    638    broadcast or multicast cache entries, organizations that distribute
    639    subsets of cached data via CD-ROM, and so on. HTTP systems are used
    640    in corporate intranets over high-bandwidth links, and for access via
    641    PDAs with low-power radio links and intermittent connectivity. The
    642    goal of HTTP/1.1 is to support the wide diversity of configurations
    643    already deployed while introducing protocol constructs that meet the
    644    needs of those who build web applications that require high
    645    reliability and, failing that, at least reliable indications of
    646    failure.
    647 </t>
    648 <t>
    649    HTTP communication usually takes place over TCP/IP connections. The
    650    default port is TCP 80 <xref target="RFC1700"/>, but other ports can be used. This does
    651    not preclude HTTP from being implemented on top of any other protocol
    652    on the Internet, or on other networks. HTTP only presumes a reliable
    653    transport; any protocol that provides such guarantees can be used;
    654    the mapping of the HTTP/1.1 request and response structures onto the
    655    transport data units of the protocol in question is outside the scope
    656    of this specification.
    657 </t>
    658 <t>
    659    In HTTP/1.0, most implementations used a new connection for each
    660    request/response exchange. In HTTP/1.1, a connection may be used for
    661    one or more request/response exchanges, although connections may be
    662    closed for a variety of reasons (see <xref target="persistent.connections"/>).
    663 </t>
    664 </section>
    665 </section>
    666 
    667 <section title="Notational Conventions and Generic Grammar" anchor="notation">
    668 
    669 <section title="Augmented BNF" anchor="notation.abnf">
    670 <t>
    671    All of the mechanisms specified in this document are described in
    672    both prose and an augmented Backus-Naur Form (BNF) similar to that
    673    used by RFC 822 <xref target="RFC822"/>. Implementors will need to be familiar with the
    674    notation in order to understand this specification. The augmented BNF
    675    includes the following constructs:
    676 </t>
    677 <t>
    678    name = definition
    679   <list>
    680     <t>
    681       The name of a rule is simply the name itself (without any
    682       enclosing "&lt;" and "&gt;") and is separated from its definition by the
    683       equal "=" character. White space is only significant in that
    684       indentation of continuation lines is used to indicate a rule
    685       definition that spans more than one line. Certain basic rules are
    686       in uppercase, such as SP, LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle
    687       brackets are used within definitions whenever their presence will
    688       facilitate discerning the use of rule names.
    689     </t>
    690   </list>
    691 </t>
    692 <t>
    693    "literal"
    694   <list>
    695     <t>
    696       Quotation marks surround literal text. Unless stated otherwise,
    697       the text is case-insensitive.
    698     </t>
    699   </list>
    700 </t>
    701 <t>
    702    rule1 | rule2
    703   <list>
    704     <t>
    705       Elements separated by a bar ("|") are alternatives, e.g., "yes |
    706       no" will accept yes or no.
    707     </t>
    708   </list>
    709 </t>
    710 <t>
    711    (rule1 rule2)
    712   <list>
    713     <t>
    714       Elements enclosed in parentheses are treated as a single element.
    715       Thus, "(elem (foo | bar) elem)" allows the token sequences "elem
    716       foo elem" and "elem bar elem".
    717     </t>
    718   </list>
    719 </t>
    720 <t>
    721    *rule
    722   <list>
    723     <t>
    724       The character "*" preceding an element indicates repetition. The
    725       full form is "&lt;n&gt;*&lt;m&gt;element" indicating at least &lt;n&gt; and at most
    726       &lt;m&gt; occurrences of element. Default values are 0 and infinity so
    727       that "*(element)" allows any number, including zero; "1*element"
    728       requires at least one; and "1*2element" allows one or two.
    729     </t>
    730   </list>
    731 </t>
    732 <t>
    733    [rule]
    734   <list>
    735     <t>
    736       Square brackets enclose optional elements; "[foo bar]" is
    737       equivalent to "*1(foo bar)".
    738     </t>
    739   </list>
    740 </t>
    741 <t>
    742    N rule
    743   <list>
    744     <t>
    745       Specific repetition: "&lt;n&gt;(element)" is equivalent to
    746       "&lt;n&gt;*&lt;n&gt;(element)"; that is, exactly &lt;n&gt; occurrences of (element).
    747       Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three
    748       alphabetic characters.
    749     </t>
    750   </list>
    751 </t>
    752 <t>
    753    #rule
    754   <list>
    755     <t>
    756       A construct "#" is defined, similar to "*", for defining lists of
    757       elements. The full form is "&lt;n&gt;#&lt;m&gt;element" indicating at least
    758       &lt;n&gt; and at most &lt;m&gt; elements, each separated by one or more commas
    759       (",") and &OPTIONAL; linear white space (LWS). This makes the usual
    760       form of lists very easy; a rule such as
    761     </t>
    762     <t>
    763          ( *LWS element *( *LWS "," *LWS element ))
    764     </t>
    765     <t>
    766       can be shown as
    767     </t>
    768     <t>
    769          1#element
    770     </t>
    771     <t>
    772       Wherever this construct is used, null elements are allowed, but do
    773       not contribute to the count of elements present. That is,
    774       "(element), , (element) " is permitted, but counts as only two
    775       elements. Therefore, where at least one element is required, at
    776       least one non-null element &MUST; be present. Default values are 0
    777       and infinity so that "#element" allows any number, including zero;
    778       "1#element" requires at least one; and "1#2element" allows one or
    779       two.
    780     </t>
    781   </list>
    782 </t>
    783 <t>
    784    ; comment
    785   <list>
    786     <t>
    787       A semi-colon, set off some distance to the right of rule text,
    788       starts a comment that continues to the end of line. This is a
    789       simple way of including useful notes in parallel with the
    790       specifications.
    791     </t>
    792   </list>
    793 </t>
    794 <t>
    795    implied *LWS
    796   <list>
    797     <t>
    798       The grammar described by this specification is word-based. Except
    799       where noted otherwise, linear white space (LWS) can be included
    800       between any two adjacent words (token or quoted-string), and
    801       between adjacent words and separators, without changing the
    802       interpretation of a field. At least one delimiter (LWS and/or
    803       separators) &MUST; exist between any two tokens (for the definition
    804       of "token" below), since they would otherwise be interpreted as a
    805       single token.
    806     </t>
    807   </list>
    808 </t>
    809 </section>
    810 
    811 <section title="Basic Rules" anchor="basic.rules">
    812 <x:anchor-alias value="OCTET"/>
    813 <x:anchor-alias value="CHAR"/>
    814 <x:anchor-alias value="UPALPHA"/>
    815 <x:anchor-alias value="LOALPHA"/>
    816 <x:anchor-alias value="ALPHA"/>
    817 <x:anchor-alias value="DIGIT"/>
    818 <x:anchor-alias value="CTL"/>
    819 <x:anchor-alias value="CR"/>
    820 <x:anchor-alias value="LF"/>
    821 <x:anchor-alias value="SP"/>
    822 <x:anchor-alias value="HT"/>
    823 <x:anchor-alias value="CRLF"/>
    824 <x:anchor-alias value="LWS"/>
    825 <x:anchor-alias value="TEXT"/>
    826 <x:anchor-alias value="HEX"/>
    827 <x:anchor-alias value="token"/>
    828 <x:anchor-alias value="separators"/>
    829 <x:anchor-alias value="comment"/>
    830 <x:anchor-alias value="ctext"/>
    831 <x:anchor-alias value="quoted-string"/>
    832 <x:anchor-alias value="qdtext"/>
    833 <x:anchor-alias value="quoted-pair"/>
    834 <t>
    835    The following rules are used throughout this specification to
    836    describe basic parsing constructs. The US-ASCII coded character set
    837    is defined by ANSI X3.4-1986 <xref target="USASCII"/>.
    838 </t>
    839 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="OCTET"/><iref primary="true" item="Grammar" subitem="CHAR"/><iref primary="true" item="Grammar" subitem="UPALPHA"/><iref primary="true" item="Grammar" subitem="LOALPHA"/><iref primary="true" item="Grammar" subitem="ALPHA"/><iref primary="true" item="Grammar" subitem="DIGIT"/><iref primary="true" item="Grammar" subitem="CTL"/><iref primary="true" item="Grammar" subitem="CR"/><iref primary="true" item="Grammar" subitem="LF"/><iref primary="true" item="Grammar" subitem="SP"/><iref primary="true" item="Grammar" subitem="HT"/>
    840     OCTET          = &lt;any 8-bit sequence of data&gt;
    841     CHAR           = &lt;any US-ASCII character (octets 0 - 127)&gt;
    842     UPALPHA        = &lt;any US-ASCII uppercase letter "A".."Z"&gt;
    843     LOALPHA        = &lt;any US-ASCII lowercase letter "a".."z"&gt;
    844     ALPHA          = UPALPHA | LOALPHA
    845     DIGIT          = &lt;any US-ASCII digit "0".."9"&gt;
    846     CTL            = &lt;any US-ASCII control character
    847                      (octets 0 - 31) and DEL (127)&gt;
    848     CR             = &lt;US-ASCII CR, carriage return (13)&gt;
    849     LF             = &lt;US-ASCII LF, linefeed (10)&gt;
    850     SP             = &lt;US-ASCII SP, space (32)&gt;
    851     HT             = &lt;US-ASCII HT, horizontal-tab (9)&gt;
    852     &lt;"&gt;            = &lt;US-ASCII double-quote mark (34)&gt;
    853 </artwork></figure>
    854 <t>
    855    HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
    856    protocol elements except the entity-body (see <xref target="tolerant.applications"/> for
    857    tolerant applications). The end-of-line marker within an entity-body
    858    is defined by its associated media type, as described in <xref target="media.types"/>.
    859 </t>
    860 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="CRLF"/>
    861     CRLF           = CR LF
    862 </artwork></figure>
    863 <t>
    864    HTTP/1.1 header field values can be folded onto multiple lines if the
    865    continuation line begins with a space or horizontal tab. All linear
    866    white space, including folding, has the same semantics as SP. A
    867    recipient &MAY; replace any linear white space with a single SP before
    868    interpreting the field value or forwarding the message downstream.
    869 </t>
    870 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="LWS"/>
    871     LWS            = [CRLF] 1*( SP | HT )
    872 </artwork></figure>
    873 <t>
    874    The TEXT rule is only used for descriptive field contents and values
    875    that are not intended to be interpreted by the message parser. Words
    876    of *TEXT &MAY; contain characters from character sets other than ISO-8859-1
    877    <xref target="ISO-8859"/> only when encoded according to the rules of RFC 2047
    878    <xref target="RFC2047"/>.
    879 </t>
    880 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="TEXT"/>
    881     TEXT           = &lt;any OCTET except CTLs,
    882                      but including LWS&gt;
    883 </artwork></figure>
    884 <t>
    885    A CRLF is allowed in the definition of TEXT only as part of a header
    886    field continuation. It is expected that the folding LWS will be
    887    replaced with a single SP before interpretation of the TEXT value.
    888 </t>
    889 <t>
    890    Hexadecimal numeric characters are used in several protocol elements.
    891 </t>
    892 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HEX"/>
    893     HEX            = "A" | "B" | "C" | "D" | "E" | "F"
    894                    | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT
    895 </artwork></figure>
    896 <t>
    897    Many HTTP/1.1 header field values consist of words separated by LWS
    898    or special characters. These special characters &MUST; be in a quoted
    899    string to be used within a parameter value (as defined in
    900    <xref target="transfer.codings"/>).
    901 </t>
    902 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="token"/><iref primary="true" item="Grammar" subitem="separators"/>
    903     token          = 1*&lt;any CHAR except CTLs or separators&gt;
    904     separators     = "(" | ")" | "&lt;" | "&gt;" | "@"
    905                    | "," | ";" | ":" | "\" | &lt;"&gt;
    906                    | "/" | "[" | "]" | "?" | "="
    907                    | "{" | "}" | SP | HT
    908 </artwork></figure>
    909 <t>
    910    Comments can be included in some HTTP header fields by surrounding
    911    the comment text with parentheses. Comments are only allowed in
    912    fields containing "comment" as part of their field value definition.
    913    In all other fields, parentheses are considered part of the field
    914    value.
    915 </t>
    916 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="comment"/><iref primary="true" item="Grammar" subitem="ctext"/>
    917     comment        = "(" *( ctext | quoted-pair | comment ) ")"
    918     ctext          = &lt;any TEXT excluding "(" and ")"&gt;
    919 </artwork></figure>
    920 <t>
    921    A string of text is parsed as a single word if it is quoted using
    922    double-quote marks.
    923 </t>
    924 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-string"/><iref primary="true" item="Grammar" subitem="qdtext"/>
    925     quoted-string  = ( &lt;"&gt; *(qdtext | quoted-pair ) &lt;"&gt; )
    926     qdtext         = &lt;any TEXT except &lt;"&gt;&gt;
    927 </artwork></figure>
    928 <t>
    929    The backslash character ("\") &MAY; be used as a single-character
    930    quoting mechanism only within quoted-string and comment constructs.
    931 </t>
    932 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-pair"/>
    933     quoted-pair    = "\" CHAR
    934 </artwork></figure>
    935 </section>
    936 </section>
    937 
    938 <section title="Protocol Parameters" anchor="protocol.parameters">
    939 
    940 <section title="HTTP Version" anchor="http.version">
    941 <t>
    942    HTTP uses a "&lt;major&gt;.&lt;minor&gt;" numbering scheme to indicate versions
    943    of the protocol. The protocol versioning policy is intended to allow
    944    the sender to indicate the format of a message and its capacity for
    945    understanding further HTTP communication, rather than the features
    946    obtained via that communication. No change is made to the version
    947    number for the addition of message components which do not affect
    948    communication behavior or which only add to extensible field values.
    949    The &lt;minor&gt; number is incremented when the changes made to the
    950    protocol add features which do not change the general message parsing
    951    algorithm, but which may add to the message semantics and imply
    952    additional capabilities of the sender. The &lt;major&gt; number is
    953    incremented when the format of a message within the protocol is
    954    changed. See RFC 2145 <xref target="RFC2145"/> for a fuller explanation.
    955 </t>
    956 <t>
    957    The version of an HTTP message is indicated by an HTTP-Version field
    958    in the first line of the message.
    959 </t>
    960 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-Version"/>
    961        HTTP-Version   = "HTTP" "/" 1*DIGIT "." 1*DIGIT
    962 </artwork></figure>
    963 <t>
    964    Note that the major and minor numbers &MUST; be treated as separate
    965    integers and that each &MAY; be incremented higher than a single digit.
    966    Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is
    967    lower than HTTP/12.3. Leading zeros &MUST; be ignored by recipients and
    968    &MUST-NOT; be sent.
    969 </t>
    970 <t>
    971    An application that sends a request or response message that includes
    972    HTTP-Version of "HTTP/1.1" &MUST; be at least conditionally compliant
    973    with this specification. Applications that are at least conditionally
    974    compliant with this specification &SHOULD; use an HTTP-Version of
    975    "HTTP/1.1" in their messages, and &MUST; do so for any message that is
    976    not compatible with HTTP/1.0. For more details on when to send
    977    specific HTTP-Version values, see RFC 2145 <xref target="RFC2145"/>.
    978 </t>
    979 <t>
    980    The HTTP version of an application is the highest HTTP version for
    981    which the application is at least conditionally compliant.
    982 </t>
    983 <t>
    984    Proxy and gateway applications need to be careful when forwarding
    985    messages in protocol versions different from that of the application.
    986    Since the protocol version indicates the protocol capability of the
    987    sender, a proxy/gateway &MUST-NOT; send a message with a version
    988    indicator which is greater than its actual version. If a higher
    989    version request is received, the proxy/gateway &MUST; either downgrade
    990    the request version, or respond with an error, or switch to tunnel
    991    behavior.
    992 </t>
    993 <t>
    994    Due to interoperability problems with HTTP/1.0 proxies discovered
    995    since the publication of RFC 2068 <xref target="RFC2068"/>, caching proxies MUST, gateways
    996    &MAY;, and tunnels &MUST-NOT; upgrade the request to the highest version
    997    they support. The proxy/gateway's response to that request &MUST; be in
    998    the same major version as the request.
    999 </t>
    1000 <t>
    1001   <list>
    1002     <t>
    1003       <x:h>Note:</x:h> Converting between versions of HTTP may involve modification
    1004       of header fields required or forbidden by the versions involved.
    1005     </t>
    1006   </list>
    1007 </t>
    1008 </section>
    1009 
    1010 <section title="Uniform Resource Identifiers" anchor="uri">
    1011 <t>
    1012    URIs have been known by many names: WWW addresses, Universal Document
    1013    Identifiers, Universal Resource Identifiers <xref target="RFC1630"/>, and finally the
    1014    combination of Uniform Resource Locators (URL) <xref target="RFC1738"/> and Names (URN)
    1015    <xref target="RFC1737"/>. As far as HTTP is concerned, Uniform Resource Identifiers are
    1016    simply formatted strings which identify--via name, location, or any
    1017    other characteristic--a resource.
    1018 </t>
    1019 
    1020 <section title="General Syntax" anchor="general.syntax">
    1021 <t>
    1022    URIs in HTTP can be represented in absolute form or relative to some
    1023    known base URI <xref target="RFC1808"/>, depending upon the context of their use. The two
    1024    forms are differentiated by the fact that absolute URIs always begin
    1025    with a scheme name followed by a colon. For definitive information on
    1026    URL syntax and semantics, see "Uniform Resource Identifiers (URI):
    1027    Generic Syntax and Semantics," RFC 2396 <xref target="RFC2396"/> (which replaces RFCs
    1028    1738 <xref target="RFC1738"/> and RFC 1808 <xref target="RFC1808"/>). This specification adopts the
    1029    definitions of "URI-reference", "absoluteURI", "relativeURI", "port",
    1030    "host","abs_path", "rel_path", and "authority" from that
    1031    specification.
    1032 </t>
    1033 <t>
    1034    The HTTP protocol does not place any a priori limit on the length of
    1035    a URI. Servers &MUST; be able to handle the URI of any resource they
    1036    serve, and &SHOULD; be able to handle URIs of unbounded length if they
    1037    provide GET-based forms that could generate such URIs. A server
    1038    &SHOULD; return 414 (Request-URI Too Long) status if a URI is longer
    1039    than the server can handle (see <xref target="status.414"/>).
    1040 </t>
    1041 <t>
    1042   <list>
    1043     <t>
    1044       <x:h>Note:</x:h> Servers ought to be cautious about depending on URI lengths
    1045       above 255 bytes, because some older client or proxy
    1046       implementations might not properly support these lengths.
    1047     </t>
    1048   </list>
    1049 </t>
    1050 </section>
    1051 
    1052 <section title="http URL" anchor="http.url">
    1053 <t>
    1054    The "http" scheme is used to locate network resources via the HTTP
    1055    protocol. This section defines the scheme-specific syntax and
    1056    semantics for http URLs.
    1057 </t>
    1058 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="http_URL"/>
    1059 http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
    1060 </artwork></figure>
    1061 <t>
    1062    If the port is empty or not given, port 80 is assumed. The semantics
    1063    are that the identified resource is located at the server listening
    1064    for TCP connections on that port of that host, and the Request-URI
    1065    for the resource is abs_path (<xref target="request-uri"/>). The use of IP addresses
    1066    in URLs &SHOULD; be avoided whenever possible (see RFC 1900 <xref target="RFC1900"/>). If
    1067    the abs_path is not present in the URL, it &MUST; be given as "/" when
    1068    used as a Request-URI for a resource (<xref target="request-uri"/>). If a proxy
    1069 
    1070    receives a host name which is not a fully qualified domain name, it
    1071    &MAY; add its domain to the host name it received. If a proxy receives
    1072    a fully qualified domain name, the proxy &MUST-NOT; change the host
    1073    name.
    1074 </t>
    1075 </section>
    1076 
    1077 <section title="URI Comparison" anchor="uri.comparison">
    1078 <t>
    1079    When comparing two URIs to decide if they match or not, a client
    1080    &SHOULD; use a case-sensitive octet-by-octet comparison of the entire
    1081    URIs, with these exceptions:
    1082   <list style="symbols">
    1083     <t>A port that is empty or not given is equivalent to the default
    1084         port for that URI-reference;</t>
    1085     <t>Comparisons of host names &MUST; be case-insensitive;</t>
    1086     <t>Comparisons of scheme names &MUST; be case-insensitive;</t>
    1087     <t>An empty abs_path is equivalent to an abs_path of "/".</t>
    1088   </list>
    1089 </t>
    1090 <t>
    1091    Characters other than those in the "reserved" and "unsafe" sets (see
    1092    RFC 2396 <xref target="RFC2396"/>) are equivalent to their ""%" HEX HEX" encoding.
    1093 </t>
    1094 <t>
    1095    For example, the following three URIs are equivalent:
    1096 </t>
    1097 <figure><artwork type="example">
    1098    http://abc.com:80/~smith/home.html
    1099    http://ABC.com/%7Esmith/home.html
    1100    http://ABC.com:/%7esmith/home.html
    1101 </artwork></figure>
    1102 </section>
    1103 </section>
    1104 
    1105 <section title="Date/Time Formats" anchor="date.time.formats">
    1106 
    1107 <section title="Full Date" anchor="full.date">
    1108 <t>
    1109    HTTP applications have historically allowed three different formats
    1110    for the representation of date/time stamps:
    1111 </t>
    1112 <figure><artwork type="example">
    1113    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
    1114    Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
    1115    Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
    1116 </artwork></figure>
    1117 <t>
    1118    The first format is preferred as an Internet standard and represents
    1119    a fixed-length subset of that defined by RFC 1123 <xref target="RFC1123"/> (an update to
    1120    RFC 822 <xref target="RFC822"/>). The second format is in common use, but is based on the
    1121    obsolete RFC 850 <xref target="RFC1036"/> date format and lacks a four-digit year.
    1122    HTTP/1.1 clients and servers that parse the date value &MUST; accept
    1123    all three formats (for compatibility with HTTP/1.0), though they &MUST;
    1124    only generate the RFC 1123 format for representing HTTP-date values
    1125    in header fields. See <xref target="tolerant.applications"/> for further information.
    1126 </t>
    1127 <t><list><t>
    1128       <x:h>Note:</x:h> Recipients of date values are encouraged to be robust in
    1129       accepting date values that may have been sent by non-HTTP
    1130       applications, as is sometimes the case when retrieving or posting
    1131       messages via proxies/gateways to SMTP or NNTP.
    1132 </t></list></t>
    1133 <t>
    1134    All HTTP date/time stamps &MUST; be represented in Greenwich Mean Time
    1135    (GMT), without exception. For the purposes of HTTP, GMT is exactly
    1136    equal to UTC (Coordinated Universal Time). This is indicated in the
    1137    first two formats by the inclusion of "GMT" as the three-letter
    1138    abbreviation for time zone, and &MUST; be assumed when reading the
    1139    asctime format. HTTP-date is case sensitive and &MUST-NOT; include
    1140    additional LWS beyond that specifically included as SP in the
    1141    grammar.
    1142 </t>
    1143 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-date"/><iref primary="true" item="Grammar" subitem="rfc1123-date"/><iref primary="true" item="Grammar" subitem="rfc850-date"/><iref primary="true" item="Grammar" subitem="asctime-date"/><iref primary="true" item="Grammar" subitem="date1"/><iref primary="true" item="Grammar" subitem="date2"/><iref primary="true" item="Grammar" subitem="date3"/><iref primary="true" item="Grammar" subitem="time"/><iref primary="true" item="Grammar" subitem="wkday"/><iref primary="true" item="Grammar" subitem="weekday"/><iref primary="true" item="Grammar" subitem="month"/>
    1144     HTTP-date    = rfc1123-date | rfc850-date | asctime-date
    1145     rfc1123-date = wkday "," SP date1 SP time SP "GMT"
    1146     rfc850-date  = weekday "," SP date2 SP time SP "GMT"
    1147     asctime-date = wkday SP date3 SP time SP 4DIGIT
    1148     date1        = 2DIGIT SP month SP 4DIGIT
    1149                    ; day month year (e.g., 02 Jun 1982)
    1150     date2        = 2DIGIT "-" month "-" 2DIGIT
    1151                    ; day-month-year (e.g., 02-Jun-82)
    1152     date3        = month SP ( 2DIGIT | ( SP 1DIGIT ))
    1153                    ; month day (e.g., Jun  2)
    1154     time         = 2DIGIT ":" 2DIGIT ":" 2DIGIT
    1155                    ; 00:00:00 - 23:59:59
    1156     wkday        = "Mon" | "Tue" | "Wed"
    1157                  | "Thu" | "Fri" | "Sat" | "Sun"
    1158     weekday      = "Monday" | "Tuesday" | "Wednesday"
    1159                  | "Thursday" | "Friday" | "Saturday" | "Sunday"
    1160     month        = "Jan" | "Feb" | "Mar" | "Apr"
    1161                  | "May" | "Jun" | "Jul" | "Aug"
    1162                  | "Sep" | "Oct" | "Nov" | "Dec"
    1163 </artwork></figure>
    1164 <t>
    1165       <x:h>Note:</x:h> HTTP requirements for the date/time stamp format apply only
    1166       to their usage within the protocol stream. Clients and servers are
    1167       not required to use these formats for user presentation, request
    1168       logging, etc.
    1169 </t>
    1170302</section>
    1171303
     
    1182314</section>
    1183315
    1184 <section title="Character Sets" anchor="character.sets">
    1185 <t>
    1186    HTTP uses the same definition of the term "character set" as that
    1187    described for MIME:
    1188 </t>
    1189 <t>
    1190    The term "character set" is used in this document to refer to a
    1191    method used with one or more tables to convert a sequence of octets
    1192    into a sequence of characters. Note that unconditional conversion in
    1193    the other direction is not required, in that not all characters may
    1194    be available in a given character set and a character set may provide
    1195    more than one sequence of octets to represent a particular character.
    1196    This definition is intended to allow various kinds of character
    1197    encoding, from simple single-table mappings such as US-ASCII to
    1198    complex table switching methods such as those that use ISO-2022's
    1199    techniques. However, the definition associated with a MIME character
    1200    set name &MUST; fully specify the mapping to be performed from octets
    1201    to characters. In particular, use of external profiling information
    1202    to determine the exact mapping is not permitted.
    1203 </t>
    1204 <t><list><t>
    1205       <x:h>Note:</x:h> This use of the term "character set" is more commonly
    1206       referred to as a "character encoding." However, since HTTP and
    1207       MIME share the same registry, it is important that the terminology
    1208       also be shared.
    1209 </t></list></t>
    1210 <t>
    1211    HTTP character sets are identified by case-insensitive tokens. The
    1212    complete set of tokens is defined by the IANA Character Set registry
    1213    <xref target="RFC1700"/>.
    1214 </t>
    1215 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="charset"/>
    1216     charset = token
    1217 </artwork></figure>
    1218 <t>
    1219    Although HTTP allows an arbitrary token to be used as a charset
    1220    value, any token that has a predefined value within the IANA
    1221    Character Set registry <xref target="RFC1700"/> &MUST; represent the character set defined
    1222    by that registry. Applications &SHOULD; limit their use of character
    1223    sets to those defined by the IANA registry.
    1224 </t>
    1225 <t>
    1226    Implementors should be aware of IETF character set requirements <xref target="RFC2279"/>
    1227    <xref target="RFC2277"/>.
    1228 </t>
    1229 
    1230 <section title="Missing Charset" anchor="missing.charset">
    1231 <t>
    1232    Some HTTP/1.0 software has interpreted a Content-Type header without
    1233    charset parameter incorrectly to mean "recipient should guess."
    1234    Senders wishing to defeat this behavior &MAY; include a charset
    1235    parameter even when the charset is ISO-8859-1 and &SHOULD; do so when
    1236    it is known that it will not confuse the recipient.
    1237 </t>
    1238 <t>
    1239    Unfortunately, some older HTTP/1.0 clients did not deal properly with
    1240    an explicit charset parameter. HTTP/1.1 recipients &MUST; respect the
    1241    charset label provided by the sender; and those user agents that have
    1242    a provision to "guess" a charset &MUST; use the charset from the
    1243    content-type field if they support that charset, rather than the
    1244    recipient's preference, when initially displaying a document. See
    1245    <xref target="canonicalization.and.text.defaults"/>.
    1246 </t>
    1247 </section>
    1248 </section>
    1249 
    1250 <section title="Content Codings" anchor="content.codings">
    1251 <t>
    1252    Content coding values indicate an encoding transformation that has
    1253    been or can be applied to an entity. Content codings are primarily
    1254    used to allow a document to be compressed or otherwise usefully
    1255    transformed without losing the identity of its underlying media type
    1256    and without loss of information. Frequently, the entity is stored in
    1257    coded form, transmitted directly, and only decoded by the recipient.
    1258 </t>
    1259 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="content-coding"/>
    1260     content-coding   = token
    1261 </artwork></figure>
    1262 <t>
    1263    All content-coding values are case-insensitive. HTTP/1.1 uses
    1264    content-coding values in the Accept-Encoding (<xref target="header.accept-encoding"/>) and
    1265    Content-Encoding (<xref target="header.content-encoding"/>) header fields. Although the value
    1266    describes the content-coding, what is more important is that it
    1267    indicates what decoding mechanism will be required to remove the
    1268    encoding.
    1269 </t>
    1270 <t>
    1271    The Internet Assigned Numbers Authority (IANA) acts as a registry for
    1272    content-coding value tokens. Initially, the registry contains the
    1273    following tokens:
    1274 </t>
    1275 <t>
    1276    gzip<iref item="gzip"/>
    1277   <list>
    1278     <t>
    1279         An encoding format produced by the file compression program
    1280         "gzip" (GNU zip) as described in RFC 1952 <xref target="RFC1952"/>. This format is a
    1281         Lempel-Ziv coding (LZ77) with a 32 bit CRC.
    1282     </t>
    1283   </list>
    1284 </t>
    1285 <t>
    1286    compress<iref item="compress"/>
    1287   <list><t>
    1288         The encoding format produced by the common UNIX file compression
    1289         program "compress". This format is an adaptive Lempel-Ziv-Welch
    1290         coding (LZW).
    1291 </t><t>
    1292         Use of program names for the identification of encoding formats
    1293         is not desirable and is discouraged for future encodings. Their
    1294         use here is representative of historical practice, not good
    1295         design. For compatibility with previous implementations of HTTP,
    1296         applications &SHOULD; consider "x-gzip" and "x-compress" to be
    1297         equivalent to "gzip" and "compress" respectively.
    1298   </t></list>
    1299 </t>
    1300 <t>
    1301    deflate<iref item="deflate"/>
    1302   <list><t>
    1303         The "zlib" format defined in RFC 1950 <xref target="RFC1950"/> in combination with
    1304         the "deflate" compression mechanism described in RFC 1951 <xref target="RFC1951"/>.
    1305   </t></list>
    1306 </t>
    1307 <t>
    1308    identity<iref item="identity"/>
    1309   <list><t>
    1310         The default (identity) encoding; the use of no transformation
    1311         whatsoever. This content-coding is used only in the Accept-Encoding
    1312         header, and &SHOULD-NOT;  be used in the Content-Encoding
    1313         header.
    1314   </t></list>
    1315 </t>
    1316 <t>
    1317    New content-coding value tokens &SHOULD; be registered; to allow
    1318    interoperability between clients and servers, specifications of the
    1319    content coding algorithms needed to implement a new value &SHOULD; be
    1320    publicly available and adequate for independent implementation, and
    1321    conform to the purpose of content coding defined in this section.
    1322 </t>
    1323 </section>
    1324 
    1325 <section title="Transfer Codings" anchor="transfer.codings">
    1326 <t>
    1327    Transfer-coding values are used to indicate an encoding
    1328    transformation that has been, can be, or may need to be applied to an
    1329    entity-body in order to ensure "safe transport" through the network.
    1330    This differs from a content coding in that the transfer-coding is a
    1331    property of the message, not of the original entity.
    1332 </t>
    1333 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="transfer-coding"/><iref primary="true" item="Grammar" subitem="transfer-extension"/>
    1334     transfer-coding         = "chunked" | transfer-extension
    1335     transfer-extension      = token *( ";" parameter )
    1336 </artwork></figure>
    1337 <t>
    1338    Parameters are in  the form of attribute/value pairs.
    1339 </t>
    1340 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="parameter"/><iref primary="true" item="Grammar" subitem="attribute"/><iref primary="true" item="Grammar" subitem="value"/>
    1341     parameter               = attribute "=" value
    1342     attribute               = token
    1343     value                   = token | quoted-string
    1344 </artwork></figure>
    1345 <t>
    1346    All transfer-coding values are case-insensitive. HTTP/1.1 uses
    1347    transfer-coding values in the TE header field (<xref target="header.te"/>) and in
    1348    the Transfer-Encoding header field (<xref target="header.transfer-encoding"/>).
    1349 </t>
    1350 <t>
    1351    Whenever a transfer-coding is applied to a message-body, the set of
    1352    transfer-codings &MUST; include "chunked", unless the message is
    1353    terminated by closing the connection. When the "chunked" transfer-coding
    1354    is used, it &MUST; be the last transfer-coding applied to the
    1355    message-body. The "chunked" transfer-coding &MUST-NOT; be applied more
    1356    than once to a message-body. These rules allow the recipient to
    1357    determine the transfer-length of the message (<xref target="message.length"/>).
    1358 </t>
    1359 <t>
    1360    Transfer-codings are analogous to the Content-Transfer-Encoding
    1361    values of MIME <xref target="RFC2045"/>, which were designed to enable safe transport of
    1362    binary data over a 7-bit transport service. However, safe transport
    1363    has a different focus for an 8bit-clean transfer protocol. In HTTP,
    1364    the only unsafe characteristic of message-bodies is the difficulty in
    1365    determining the exact body length (<xref target="entity.length"/>), or the desire to
    1366    encrypt data over a shared transport.
    1367 </t>
    1368 <t>
    1369    The Internet Assigned Numbers Authority (IANA) acts as a registry for
    1370    transfer-coding value tokens. Initially, the registry contains the
    1371    following tokens: "chunked" (<xref target="chunked.transfer.encoding"/>), "identity" (section
    1372    3.6.2), "gzip" (<xref target="content.codings"/>), "compress" (<xref target="content.codings"/>), and "deflate"
    1373    (<xref target="content.codings"/>).
    1374 </t>
    1375 <t>
    1376    New transfer-coding value tokens &SHOULD; be registered in the same way
    1377    as new content-coding value tokens (<xref target="content.codings"/>).
    1378 </t>
    1379 <t>
    1380    A server which receives an entity-body with a transfer-coding it does
    1381    not understand &SHOULD; return 501 (Unimplemented), and close the
    1382    connection. A server &MUST-NOT; send transfer-codings to an HTTP/1.0
    1383    client.
    1384 </t>
    1385 
    1386 <section title="Chunked Transfer Coding" anchor="chunked.transfer.encoding">
    1387 <t>
    1388    The chunked encoding modifies the body of a message in order to
    1389    transfer it as a series of chunks, each with its own size indicator,
    1390    followed by an &OPTIONAL; trailer containing entity-header fields. This
    1391    allows dynamically produced content to be transferred along with the
    1392    information necessary for the recipient to verify that it has
    1393    received the full message.
    1394 </t>
    1395 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Chunked-Body"/><iref primary="true" item="Grammar" subitem="chunk"/><iref primary="true" item="Grammar" subitem="chunk-size"/><iref primary="true" item="Grammar" subitem="last-chunk"/><iref primary="true" item="Grammar" subitem="chunk-extension"/><iref primary="true" item="Grammar" subitem="chunk-ext-name"/><iref primary="true" item="Grammar" subitem="chunk-ext-val"/><iref primary="true" item="Grammar" subitem="chunk-data"/><iref primary="true" item="Grammar" subitem="trailer"/>
    1396     Chunked-Body   = *chunk
    1397                      last-chunk
    1398                      trailer
    1399                      CRLF
    1400 
    1401     chunk          = chunk-size [ chunk-extension ] CRLF
    1402                      chunk-data CRLF
    1403     chunk-size     = 1*HEX
    1404     last-chunk     = 1*("0") [ chunk-extension ] CRLF
    1405 
    1406     chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
    1407     chunk-ext-name = token
    1408     chunk-ext-val  = token | quoted-string
    1409     chunk-data     = chunk-size(OCTET)
    1410     trailer        = *(entity-header CRLF)
    1411 </artwork></figure>
    1412 <t>
    1413    The chunk-size field is a string of hex digits indicating the size of
    1414    the chunk. The chunked encoding is ended by any chunk whose size is
    1415    zero, followed by the trailer, which is terminated by an empty line.
    1416 </t>
    1417 <t>
    1418    The trailer allows the sender to include additional HTTP header
    1419    fields at the end of the message. The Trailer header field can be
    1420    used to indicate which header fields are included in a trailer (see
    1421    <xref target="header.trailer"/>).
    1422 </t>
    1423 <t>
    1424    A server using chunked transfer-coding in a response &MUST-NOT; use the
    1425    trailer for any header fields unless at least one of the following is
    1426    true:
    1427   <list style="numbers">
    1428     <t>the request included a TE header field that indicates "trailers" is
    1429      acceptable in the transfer-coding of the  response, as described in
    1430      <xref target="header.te"/>; or,</t>
    1431 
    1432     <t>the server is the origin server for the response, the trailer
    1433      fields consist entirely of optional metadata, and the recipient
    1434      could use the message (in a manner acceptable to the origin server)
    1435      without receiving this metadata.  In other words, the origin server
    1436      is willing to accept the possibility that the trailer fields might
    1437      be silently discarded along the path to the client.</t>
    1438   </list>
    1439 </t>
    1440 <t>
    1441    This requirement prevents an interoperability failure when the
    1442    message is being received by an HTTP/1.1 (or later) proxy and
    1443    forwarded to an HTTP/1.0 recipient. It avoids a situation where
    1444    compliance with the protocol would have necessitated a possibly
    1445    infinite buffer on the proxy.
    1446 </t>
    1447 <t>
    1448    An example process for decoding a Chunked-Body is presented in
    1449    <xref target="introduction.of.transfer-encoding"/>.
    1450 </t>
    1451 <t>
    1452    All HTTP/1.1 applications &MUST; be able to receive and decode the
    1453    "chunked" transfer-coding, and &MUST; ignore chunk-extension extensions
    1454    they do not understand.
    1455 </t>
    1456 </section>
    1457 </section>
    1458 
    1459 <section title="Media Types" anchor="media.types">
    1460 <t>
    1461    HTTP uses Internet Media Types <xref target="RFC1590"/> in the Content-Type (<xref target="header.content-type"/>)
    1462    and Accept (<xref target="header.accept"/>) header fields in order to provide
    1463    open and extensible data typing and type negotiation.
    1464 </t>
    1465 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="media-type"/><iref primary="true" item="Grammar" subitem="type"/><iref primary="true" item="Grammar" subitem="subtype"/>
    1466     media-type     = type "/" subtype *( ";" parameter )
    1467     type           = token
    1468     subtype        = token
    1469 </artwork></figure>
    1470 <t>
    1471    Parameters &MAY; follow the type/subtype in the form of attribute/value
    1472    pairs (as defined in <xref target="transfer.codings"/>).
    1473 </t>
    1474 <t>
    1475    The type, subtype, and parameter attribute names are case-insensitive.
    1476    Parameter values might or might not be case-sensitive,
    1477    depending on the semantics of the parameter name. Linear white space
    1478    (LWS) &MUST-NOT; be used between the type and subtype, nor between an
    1479    attribute and its value. The presence or absence of a parameter might
    1480    be significant to the processing of a media-type, depending on its
    1481    definition within the media type registry.
    1482 </t>
    1483 <t>
    1484    Note that some older HTTP applications do not recognize media type
    1485    parameters. When sending data to older HTTP applications,
    1486    implementations &SHOULD; only use media type parameters when they are
    1487    required by that type/subtype definition.
    1488 </t>
    1489 <t>
    1490    Media-type values are registered with the Internet Assigned Number
    1491    Authority (IANA <xref target="RFC1700"/>). The media type registration process is
    1492    outlined in RFC 1590 <xref target="RFC1590"/>. Use of non-registered media types is
    1493    discouraged.
    1494 </t>
    1495 
    1496 <section title="Canonicalization and Text Defaults" anchor="canonicalization.and.text.defaults">
    1497 <t>
    1498    Internet media types are registered with a canonical form. An
    1499    entity-body transferred via HTTP messages &MUST; be represented in the
    1500    appropriate canonical form prior to its transmission except for
    1501    "text" types, as defined in the next paragraph.
    1502 </t>
    1503 <t>
    1504    When in canonical form, media subtypes of the "text" type use CRLF as
    1505    the text line break. HTTP relaxes this requirement and allows the
    1506    transport of text media with plain CR or LF alone representing a line
    1507    break when it is done consistently for an entire entity-body. HTTP
    1508    applications &MUST; accept CRLF, bare CR, and bare LF as being
    1509    representative of a line break in text media received via HTTP. In
    1510    addition, if the text is represented in a character set that does not
    1511    use octets 13 and 10 for CR and LF respectively, as is the case for
    1512    some multi-byte character sets, HTTP allows the use of whatever octet
    1513    sequences are defined by that character set to represent the
    1514    equivalent of CR and LF for line breaks. This flexibility regarding
    1515    line breaks applies only to text media in the entity-body; a bare CR
    1516    or LF &MUST-NOT; be substituted for CRLF within any of the HTTP control
    1517    structures (such as header fields and multipart boundaries).
    1518 </t>
    1519 <t>
    1520    If an entity-body is encoded with a content-coding, the underlying
    1521    data &MUST; be in a form defined above prior to being encoded.
    1522 </t>
    1523 <t>
    1524    The "charset" parameter is used with some media types to define the
    1525    character set (<xref target="character.sets"/>) of the data. When no explicit charset
    1526    parameter is provided by the sender, media subtypes of the "text"
    1527    type are defined to have a default charset value of "ISO-8859-1" when
    1528    received via HTTP. Data in character sets other than "ISO-8859-1" or
    1529    its subsets &MUST; be labeled with an appropriate charset value. See
    1530    <xref target="missing.charset"/> for compatibility problems.
    1531 </t>
    1532 </section>
    1533 
    1534 <section title="Multipart Types" anchor="multipart.types">
    1535 <t>
    1536    MIME provides for a number of "multipart" types -- encapsulations of
    1537    one or more entities within a single message-body. All multipart
    1538    types share a common syntax, as defined in section <xref target="RFC2046" x:sec="5.1.1" x:fmt="number"/> of RFC 2046
    1539    <xref target="RFC2046"/>, and &MUST; include a boundary parameter as part of the media type
    1540    value. The message body is itself a protocol element and &MUST;
    1541    therefore use only CRLF to represent line breaks between body-parts.
    1542    Unlike in RFC 2046, the epilogue of any multipart message &MUST; be
    1543    empty; HTTP applications &MUST-NOT; transmit the epilogue (even if the
    1544    original multipart contains an epilogue). These restrictions exist in
    1545    order to preserve the self-delimiting nature of a multipart message-body,
    1546    wherein the "end" of the message-body is indicated by the
    1547    ending multipart boundary.
    1548 </t>
    1549 <t>
    1550    In general, HTTP treats a multipart message-body no differently than
    1551    any other media type: strictly as payload. The one exception is the
    1552    "multipart/byteranges" type (<xref target="internet.media.type.multipart.byteranges"/>) when it appears in a 206
    1553    (Partial Content) response, which will be interpreted by some HTTP
    1554    caching mechanisms as described in sections <xref target="combining.byte.ranges" format="counter"/>
    1555    and <xref target="header.content-range" format="counter"/>. In all
    1556    other cases, an HTTP user agent &SHOULD; follow the same or similar
    1557    behavior as a MIME user agent would upon receipt of a multipart type.
    1558    The MIME header fields within each body-part of a multipart message-body
    1559    do not have any significance to HTTP beyond that defined by
    1560    their MIME semantics.
    1561 </t>
    1562 <t>
    1563    In general, an HTTP user agent &SHOULD; follow the same or similar
    1564    behavior as a MIME user agent would upon receipt of a multipart type.
    1565    If an application receives an unrecognized multipart subtype, the
    1566    application &MUST; treat it as being equivalent to "multipart/mixed".
    1567 </t>
    1568 <t><list><t>
    1569       <x:h>Note:</x:h> The "multipart/form-data" type has been specifically defined
    1570       for carrying form data suitable for processing via the POST
    1571       request method, as described in RFC 1867 <xref target="RFC1867"/>.
    1572 </t></list></t>
    1573 </section>
    1574 </section>
    1575 
    1576 <section title="Product Tokens" anchor="product.tokens">
    1577 <t>
    1578    Product tokens are used to allow communicating applications to
    1579    identify themselves by software name and version. Most fields using
    1580    product tokens also allow sub-products which form a significant part
    1581    of the application to be listed, separated by white space. By
    1582    convention, the products are listed in order of their significance
    1583    for identifying the application.
    1584 </t>
    1585 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="product"/><iref primary="true" item="Grammar" subitem="product-version"/>
    1586     product         = token ["/" product-version]
    1587     product-version = token
    1588 </artwork></figure>
    1589 <t>
    1590    Examples:
    1591 </t>
    1592 <figure><artwork type="example">
    1593     User-Agent: CERN-LineMode/2.15 libwww/2.17b3
    1594     Server: Apache/0.8.4
    1595 </artwork></figure>
    1596 <t>
    1597    Product tokens &SHOULD; be short and to the point. They &MUST-NOT; be
    1598    used for advertising or other non-essential information. Although any
    1599    token character &MAY; appear in a product-version, this token &SHOULD;
    1600    only be used for a version identifier (i.e., successive versions of
    1601    the same product &SHOULD; only differ in the product-version portion of
    1602    the product value).
    1603 </t>
    1604 </section>
    1605 
    1606 <section title="Quality Values" anchor="quality.values">
    1607 <t>
    1608    HTTP content negotiation (<xref target="content.negotiation"/>) uses short "floating point"
    1609    numbers to indicate the relative importance ("weight") of various
    1610    negotiable parameters.  A weight is normalized to a real number in
    1611    the range 0 through 1, where 0 is the minimum and 1 the maximum
    1612    value. If a parameter has a quality value of 0, then content with
    1613    this parameter is `not acceptable' for the client. HTTP/1.1
    1614    applications &MUST-NOT; generate more than three digits after the
    1615    decimal point. User configuration of these values &SHOULD; also be
    1616    limited in this fashion.
    1617 </t>
    1618 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="qvalue"/>
    1619     qvalue         = ( "0" [ "." 0*3DIGIT ] )
    1620                    | ( "1" [ "." 0*3("0") ] )
    1621 </artwork></figure>
    1622 <t>
    1623    "Quality values" is a misnomer, since these values merely represent
    1624    relative degradation in desired quality.
    1625 </t>
    1626 </section>
    1627 
    1628 <section title="Language Tags" anchor="language.tags">
    1629 <t>
    1630    A language tag identifies a natural language spoken, written, or
    1631    otherwise conveyed by human beings for communication of information
    1632    to other human beings. Computer languages are explicitly excluded.
    1633    HTTP uses language tags within the Accept-Language and Content-Language
    1634    fields.
    1635 </t>
    1636 <t>
    1637    The syntax and registry of HTTP language tags is the same as that
    1638    defined by RFC 1766 <xref target="RFC1766"/>. In summary, a language tag is composed of 1
    1639    or more parts: A primary language tag and a possibly empty series of
    1640    subtags:
    1641 </t>
    1642 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="language-tag"/><iref primary="true" item="Grammar" subitem="primary-tag"/><iref primary="true" item="Grammar" subitem="subtag"/>
    1643      language-tag  = primary-tag *( "-" subtag )
    1644      primary-tag   = 1*8ALPHA
    1645      subtag        = 1*8ALPHA
    1646 </artwork></figure>
    1647 <t>
    1648    White space is not allowed within the tag and all tags are case-insensitive.
    1649    The name space of language tags is administered by the
    1650    IANA. Example tags include:
    1651 </t>
    1652 <figure><artwork type="example">
    1653     en, en-US, en-cockney, i-cherokee, x-pig-latin
    1654 </artwork></figure>
    1655 <t>
    1656    where any two-letter primary-tag is an ISO-639 language abbreviation
    1657    and any two-letter initial subtag is an ISO-3166 country code. (The
    1658    last three tags above are not registered tags; all but the last are
    1659    examples of tags which could be registered in future.)
    1660 </t>
    1661 </section>
    1662 
    1663 <section title="Entity Tags" anchor="entity.tags">
    1664 <t>
    1665    Entity tags are used for comparing two or more entities from the same
    1666    requested resource. HTTP/1.1 uses entity tags in the ETag (<xref target="header.etag"/>),
    1667    If-Match (<xref target="header.if-match"/>), If-None-Match (<xref target="header.if-none-match"/>), and
    1668    If-Range (<xref target="header.if-range"/>) header fields. The definition of how they
    1669    are used and compared as cache validators is in <xref target="weak.and.strong.validators"/>. An
    1670    entity tag consists of an opaque quoted string, possibly prefixed by
    1671    a weakness indicator.
    1672 </t>
    1673 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="entity-tag"/><iref primary="true" item="Grammar" subitem="weak"/><iref primary="true" item="Grammar" subitem="opaque-tag"/>
    1674    entity-tag = [ weak ] opaque-tag
    1675    weak       = "W/"
    1676    opaque-tag = quoted-string
    1677 </artwork></figure>
    1678 <t>
    1679    A "strong entity tag" &MAY; be shared by two entities of a resource
    1680    only if they are equivalent by octet equality.
    1681 </t>
    1682 <t>
    1683    A "weak entity tag," indicated by the "W/" prefix, &MAY; be shared by
    1684    two entities of a resource only if the entities are equivalent and
    1685    could be substituted for each other with no significant change in
    1686    semantics. A weak entity tag can only be used for weak comparison.
    1687 </t>
    1688 <t>
    1689    An entity tag &MUST; be unique across all versions of all entities
    1690    associated with a particular resource. A given entity tag value &MAY;
    1691    be used for entities obtained by requests on different URIs. The use
    1692    of the same entity tag value in conjunction with entities obtained by
    1693    requests on different URIs does not imply the equivalence of those
    1694    entities.
    1695 </t>
    1696 </section>
    1697 
    1698 <section title="Range Units" anchor="range.units">
    1699 <t>
    1700    HTTP/1.1 allows a client to request that only part (a range of) the
    1701    response entity be included within the response. HTTP/1.1 uses range
    1702    units in the Range (<xref target="header.range"/>) and Content-Range (<xref target="header.content-range"/>)
    1703    header fields. An entity can be broken down into subranges according
    1704    to various structural units.
    1705 </t>
    1706 <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"/>
    1707    range-unit       = bytes-unit | other-range-unit
    1708    bytes-unit       = "bytes"
    1709    other-range-unit = token
    1710 </artwork></figure>
    1711 <t>
    1712    The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
    1713    implementations &MAY; ignore ranges specified using other units.
    1714 </t>
    1715 <t>
    1716    HTTP/1.1 has been designed to allow implementations of applications
    1717    that do not depend on knowledge of ranges.
    1718 </t>
    1719 </section>
    1720 </section>
    1721 
    1722 
    1723 
    1724 
    1725 <section title="HTTP Message" anchor="http.message">
    1726 
    1727 <section title="Message Types" anchor="message.types">
    1728 <t>
    1729    HTTP messages consist of requests from client to server and responses
    1730    from server to client.
    1731 </t>
    1732 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-message"/>
    1733     HTTP-message   = Request | Response     ; HTTP/1.1 messages
    1734 </artwork></figure>
    1735 <t>
    1736    Request (<xref target="request"/>) and Response (<xref target="response"/>) messages use the generic
    1737    message format of RFC 822 <xref target="RFC822"/> for transferring entities (the payload
    1738    of the message). Both types of message consist of a start-line, zero
    1739    or more header fields (also known as "headers"), an empty line (i.e.,
    1740    a line with nothing preceding the CRLF) indicating the end of the
    1741    header fields, and possibly a message-body.
    1742 </t>
    1743 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="generic-message"/><iref primary="true" item="Grammar" subitem="start-line"/>
    1744      generic-message = start-line
    1745                        *(message-header CRLF)
    1746                        CRLF
    1747                        [ message-body ]
    1748      start-line      = Request-Line | Status-Line
    1749 </artwork></figure>
    1750 <t>
    1751    In the interest of robustness, servers &SHOULD; ignore any empty
    1752    line(s) received where a Request-Line is expected. In other words, if
    1753    the server is reading the protocol stream at the beginning of a
    1754    message and receives a CRLF first, it should ignore the CRLF.
    1755 </t>
    1756 <t>
    1757    Certain buggy HTTP/1.0 client implementations generate extra CRLF's
    1758    after a POST request. To restate what is explicitly forbidden by the
    1759    BNF, an HTTP/1.1 client &MUST-NOT; preface or follow a request with an
    1760    extra CRLF.
    1761 </t>
    1762 </section>
    1763 
    1764 <section title="Message Headers" anchor="message.headers">
    1765 <t>
    1766    HTTP header fields, which include general-header (<xref target="general.header.fields"/>),
    1767    request-header (<xref target="request.header.fields"/>), response-header (<xref target="response.header.fields"/>), and
    1768    entity-header (<xref target="entity.header.fields"/>) fields, follow the same generic format as
    1769    that given in <xref target="RFC822" x:fmt="sec" x:sec="3.1"/> of RFC 822 <xref target="RFC822"/>. Each header field consists
    1770    of a name followed by a colon (":") and the field value. Field names
    1771    are case-insensitive. The field value &MAY; be preceded by any amount
    1772    of LWS, though a single SP is preferred. Header fields can be
    1773    extended over multiple lines by preceding each extra line with at
    1774    least one SP or HT. Applications ought to follow "common form", where
    1775    one is known or indicated, when generating HTTP constructs, since
    1776    there might exist some implementations that fail to accept anything
    1777    beyond the common forms.
    1778 </t>
    1779 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="message-header"/><iref primary="true" item="Grammar" subitem="field-name"/><iref primary="true" item="Grammar" subitem="field-value"/><iref primary="true" item="Grammar" subitem="field-content"/>
    1780     message-header = field-name ":" [ field-value ]
    1781     field-name     = token
    1782     field-value    = *( field-content | LWS )
    1783     field-content  = &lt;the OCTETs making up the field-value
    1784                      and consisting of either *TEXT or combinations
    1785                      of token, separators, and quoted-string&gt;
    1786 </artwork></figure>
    1787 <t>
    1788    The field-content does not include any leading or trailing LWS:
    1789    linear white space occurring before the first non-whitespace
    1790    character of the field-value or after the last non-whitespace
    1791    character of the field-value. Such leading or trailing LWS &MAY; be
    1792    removed without changing the semantics of the field value. Any LWS
    1793    that occurs between field-content &MAY; be replaced with a single SP
    1794    before interpreting the field value or forwarding the message
    1795    downstream.
    1796 </t>
    1797 <t>
    1798    The order in which header fields with differing field names are
    1799    received is not significant. However, it is "good practice" to send
    1800    general-header fields first, followed by request-header or response-header
    1801    fields, and ending with the entity-header fields.
    1802 </t>
    1803 <t>
    1804    Multiple message-header fields with the same field-name &MAY; be
    1805    present in a message if and only if the entire field-value for that
    1806    header field is defined as a comma-separated list [i.e., #(values)].
    1807    It &MUST; be possible to combine the multiple header fields into one
    1808    "field-name: field-value" pair, without changing the semantics of the
    1809    message, by appending each subsequent field-value to the first, each
    1810    separated by a comma. The order in which header fields with the same
    1811    field-name are received is therefore significant to the
    1812    interpretation of the combined field value, and thus a proxy &MUST-NOT;
    1813    change the order of these field values when a message is forwarded.
    1814 </t>
    1815 </section>
    1816 
    1817 <section title="Message Body" anchor="message.body">
    1818 <t>
    1819    The message-body (if any) of an HTTP message is used to carry the
    1820    entity-body associated with the request or response. The message-body
    1821    differs from the entity-body only when a transfer-coding has been
    1822    applied, as indicated by the Transfer-Encoding header field (<xref target="header.transfer-encoding"/>).
    1823 </t>
    1824 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="message-body"/>
    1825     message-body = entity-body
    1826                  | &lt;entity-body encoded as per Transfer-Encoding&gt;
    1827 </artwork></figure>
    1828 <t>
    1829    Transfer-Encoding &MUST; be used to indicate any transfer-codings
    1830    applied by an application to ensure safe and proper transfer of the
    1831    message. Transfer-Encoding is a property of the message, not of the
    1832    entity, and thus &MAY; be added or removed by any application along the
    1833    request/response chain. (However, <xref target="transfer.codings"/> places restrictions on
    1834    when certain transfer-codings may be used.)
    1835 </t>
    1836 <t>
    1837    The rules for when a message-body is allowed in a message differ for
    1838    requests and responses.
    1839 </t>
    1840 <t>
    1841    The presence of a message-body in a request is signaled by the
    1842    inclusion of a Content-Length or Transfer-Encoding header field in
    1843    the request's message-headers. A message-body &MUST-NOT; be included in
    1844    a request if the specification of the request method (<xref target="method"/>)
    1845    does not allow sending an entity-body in requests. A server &SHOULD;
    1846    read and forward a message-body on any request; if the request method
    1847    does not include defined semantics for an entity-body, then the
    1848    message-body &SHOULD; be ignored when handling the request.
    1849 </t>
    1850 <t>
    1851    For response messages, whether or not a message-body is included with
    1852    a message is dependent on both the request method and the response
    1853    status code (<xref target="status.code.and.reason.phrase"/>). All responses to the HEAD request method
    1854    &MUST-NOT; include a message-body, even though the presence of entity-header
    1855    fields might lead one to believe they do. All 1xx
    1856    (informational), 204 (no content), and 304 (not modified) responses
    1857    &MUST-NOT; include a message-body. All other responses do include a
    1858    message-body, although it &MAY; be of zero length.
    1859 </t>
    1860 </section>
    1861 
    1862 <section title="Message Length" anchor="message.length">
    1863 <t>
    1864    The transfer-length of a message is the length of the message-body as
    1865    it appears in the message; that is, after any transfer-codings have
    1866    been applied. When a message-body is included with a message, the
    1867    transfer-length of that body is determined by one of the following
    1868    (in order of precedence):
    1869 </t>
    1870 <t>
    1871   <list style="numbers">
    1872     <x:lt><t>
    1873      Any response message which "&MUST-NOT;" include a message-body (such
    1874      as the 1xx, 204, and 304 responses and any response to a HEAD
    1875      request) is always terminated by the first empty line after the
    1876      header fields, regardless of the entity-header fields present in
    1877      the message.
    1878     </t></x:lt>
    1879     <x:lt><t>
    1880      If a Transfer-Encoding header field (<xref target="header.transfer-encoding"/>) is present and
    1881      has any value other than "identity", then the transfer-length is
    1882      defined by use of the "chunked" transfer-coding (<xref target="transfer.codings"/>),
    1883      unless the message is terminated by closing the connection.
    1884     </t></x:lt>
    1885     <x:lt><t>
    1886      If a Content-Length header field (<xref target="header.content-length"/>) is present, its
    1887      decimal value in OCTETs represents both the entity-length and the
    1888      transfer-length. The Content-Length header field &MUST-NOT; be sent
    1889      if these two lengths are different (i.e., if a Transfer-Encoding
    1890      header field is present). If a message is received with both a
    1891      Transfer-Encoding header field and a Content-Length header field,
    1892      the latter &MUST; be ignored.
    1893     </t></x:lt>
    1894     <x:lt><t>
    1895      If the message uses the media type "multipart/byteranges", and the
    1896      ransfer-length is not otherwise specified, then this self-elimiting
    1897      media type defines the transfer-length. This media type
    1898      UST NOT be used unless the sender knows that the recipient can arse
    1899      it; the presence in a request of a Range header with ultiple byte-range
    1900      specifiers from a 1.1 client implies that the lient can parse
    1901      multipart/byteranges responses.
    1902     <list style="empty"><t>
    1903        A range header might be forwarded by a 1.0 proxy that does not
    1904        understand multipart/byteranges; in this case the server &MUST;
    1905        delimit the message using methods defined in items 1, 3 or 5 of
    1906        this section.
    1907     </t></list>
    1908     </t></x:lt>
    1909     <x:lt><t>
    1910      By the server closing the connection. (Closing the connection
    1911      cannot be used to indicate the end of a request body, since that
    1912      would leave no possibility for the server to send back a response.)
    1913     </t></x:lt>
    1914   </list>
    1915 </t>
    1916 <t>
    1917    For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
    1918    containing a message-body &MUST; include a valid Content-Length header
    1919    field unless the server is known to be HTTP/1.1 compliant. If a
    1920    request contains a message-body and a Content-Length is not given,
    1921    the server &SHOULD; respond with 400 (bad request) if it cannot
    1922    determine the length of the message, or with 411 (length required) if
    1923    it wishes to insist on receiving a valid Content-Length.
    1924 </t>
    1925 <t>
    1926    All HTTP/1.1 applications that receive entities &MUST; accept the
    1927    "chunked" transfer-coding (<xref target="transfer.codings"/>), thus allowing this mechanism
    1928    to be used for messages when the message length cannot be determined
    1929    in advance.
    1930 </t>
    1931 <t>
    1932    Messages &MUST-NOT; include both a Content-Length header field and a
    1933    non-identity transfer-coding. If the message does include a non-identity
    1934    transfer-coding, the Content-Length &MUST; be ignored.
    1935 </t>
    1936 <t>
    1937    When a Content-Length is given in a message where a message-body is
    1938    allowed, its field value &MUST; exactly match the number of OCTETs in
    1939    the message-body. HTTP/1.1 user agents &MUST; notify the user when an
    1940    invalid length is received and detected.
    1941 </t>
    1942 </section>
    1943 
    1944 <section title="General Header Fields" anchor="general.header.fields">
    1945 <t>
    1946    There are a few header fields which have general applicability for
    1947    both request and response messages, but which do not apply to the
    1948    entity being transferred. These header fields apply only to the
    1949    message being transmitted.
    1950 </t>
    1951 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="general-header"/>
    1952     general-header = Cache-Control            ; <xref target="header.cache-control"/>
    1953                    | Connection               ; <xref target="header.connection"/>
    1954                    | Date                     ; <xref target="header.date"/>
    1955                    | Pragma                   ; <xref target="header.pragma"/>
    1956                    | Trailer                  ; <xref target="header.trailer"/>
    1957                    | Transfer-Encoding        ; <xref target="header.transfer-encoding"/>
    1958                    | Upgrade                  ; <xref target="header.upgrade"/>
    1959                    | Via                      ; <xref target="header.via"/>
    1960                    | Warning                  ; <xref target="header.warning"/>
    1961 </artwork></figure>
    1962 <t>
    1963    General-header field names can be extended reliably only in
    1964    combination with a change in the protocol version. However, new or
    1965    experimental header fields may be given the semantics of general
    1966    header fields if all parties in the communication recognize them to
    1967    be general-header fields. Unrecognized header fields are treated as
    1968    entity-header fields.
    1969 </t>
    1970 </section>
    1971 </section>
    1972 
    1973 <section title="Request" anchor="request">
    1974 <t>
    1975    A request message from a client to a server includes, within the
    1976    first line of that message, the method to be applied to the resource,
    1977    the identifier of the resource, and the protocol version in use.
    1978 </t>
    1979 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Request"/>
    1980      Request       = Request-Line              ; <xref target="request-line"/>
    1981                      *(( general-header        ; <xref target="general.header.fields"/>
    1982                       | request-header         ; <xref target="request.header.fields"/>
    1983                       | entity-header ) CRLF)  ; <xref target="entity.header.fields"/>
    1984                      CRLF
    1985                      [ message-body ]          ; <xref target="message.body"/>
    1986 </artwork></figure>
    1987 
    1988 <section title="Request-Line" anchor="request-line">
    1989 <t>
    1990    The Request-Line begins with a method token, followed by the
    1991    Request-URI and the protocol version, and ending with CRLF. The
    1992    elements are separated by SP characters. No CR or LF is allowed
    1993    except in the final CRLF sequence.
    1994 </t>
    1995 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Request-Line"/>
    1996      Request-Line   = Method SP Request-URI SP HTTP-Version CRLF
    1997 </artwork></figure>
    1998 
    1999 <section title="Method" anchor="method">
    2000 <t>
    2001    The Method  token indicates the method to be performed on the
    2002    resource identified by the Request-URI. The method is case-sensitive.
    2003 </t>
    2004 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Method"/><iref primary="true" item="Grammar" subitem="extension-method"/>
    2005     Method         = "OPTIONS"                ; <xref target="OPTIONS"/>
    2006                    | "GET"                    ; <xref target="GET"/>
    2007                    | "HEAD"                   ; <xref target="HEAD"/>
    2008                    | "POST"                   ; <xref target="POST"/>
    2009                    | "PUT"                    ; <xref target="PUT"/>
    2010                    | "DELETE"                 ; <xref target="DELETE"/>
    2011                    | "TRACE"                  ; <xref target="TRACE"/>
    2012                    | "CONNECT"                ; <xref target="CONNECT"/>
    2013                    | extension-method
    2014     extension-method = token
    2015 </artwork></figure>
    2016 <t>
    2017    The list of methods allowed by a resource can be specified in an
    2018    Allow header field (<xref target="header.allow"/>). The return code of the response
    2019    always notifies the client whether a method is currently allowed on a
    2020    resource, since the set of allowed methods can change dynamically. An
    2021    origin server &SHOULD; return the status code 405 (Method Not Allowed)
    2022    if the method is known by the origin server but not allowed for the
    2023    requested resource, and 501 (Not Implemented) if the method is
    2024    unrecognized or not implemented by the origin server. The methods GET
    2025    and HEAD &MUST; be supported by all general-purpose servers. All other
    2026    methods are &OPTIONAL;; however, if the above methods are implemented,
    2027    they &MUST; be implemented with the same semantics as those specified
    2028    in <xref target="method.definitions"/>.
    2029 </t>
    2030 </section>
    2031 
    2032 <section title="Request-URI" anchor="request-uri">
    2033 <t>
    2034    The Request-URI is a Uniform Resource Identifier (<xref target="uri"/>) and
    2035    identifies the resource upon which to apply the request.
    2036 </t>
    2037 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Request-URI"/>
    2038     Request-URI    = "*" | absoluteURI | abs_path | authority
    2039 </artwork></figure>
    2040 <t>
    2041    The four options for Request-URI are dependent on the nature of the
    2042    request. The asterisk "*" means that the request does not apply to a
    2043    particular resource, but to the server itself, and is only allowed
    2044    when the method used does not necessarily apply to a resource. One
    2045    example would be
    2046 </t>
    2047 <figure><artwork type="example">
    2048     OPTIONS * HTTP/1.1
    2049 </artwork></figure>
    2050 <t>
    2051    The absoluteURI form is &REQUIRED; when the request is being made to a
    2052    proxy. The proxy is requested to forward the request or service it
    2053    from a valid cache, and return the response. Note that the proxy &MAY;
    2054    forward the request on to another proxy or directly to the server
    2055    specified by the absoluteURI. In order to avoid request loops, a
    2056    proxy &MUST; be able to recognize all of its server names, including
    2057    any aliases, local variations, and the numeric IP address. An example
    2058    Request-Line would be:
    2059 </t>
    2060 <figure><artwork type="example">
    2061     GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
    2062 </artwork></figure>
    2063 <t>
    2064    To allow for transition to absoluteURIs in all requests in future
    2065    versions of HTTP, all HTTP/1.1 servers &MUST; accept the absoluteURI
    2066    form in requests, even though HTTP/1.1 clients will only generate
    2067    them in requests to proxies.
    2068 </t>
    2069 <t>
    2070    The authority form is only used by the CONNECT method (<xref target="CONNECT"/>).
    2071 </t>
    2072 <t>
    2073    The most common form of Request-URI is that used to identify a
    2074    resource on an origin server or gateway. In this case the absolute
    2075    path of the URI &MUST; be transmitted (see <xref target="general.syntax"/>, abs_path) as
    2076    the Request-URI, and the network location of the URI (authority) &MUST;
    2077    be transmitted in a Host header field. For example, a client wishing
    2078    to retrieve the resource above directly from the origin server would
    2079    create a TCP connection to port 80 of the host "www.w3.org" and send
    2080    the lines:
    2081 </t>
    2082 <figure><artwork type="example">
    2083     GET /pub/WWW/TheProject.html HTTP/1.1
    2084     Host: www.w3.org
    2085 </artwork></figure>
    2086 <t>
    2087    followed by the remainder of the Request. Note that the absolute path
    2088    cannot be empty; if none is present in the original URI, it &MUST; be
    2089    given as "/" (the server root).
    2090 </t>
    2091 <t>
    2092    The Request-URI is transmitted in the format specified in
    2093    <xref target="general.syntax"/>. If the Request-URI is encoded using the "% HEX HEX" encoding
    2094    <xref target="RFC2396"/>, the origin server &MUST; decode the Request-URI in order to
    2095    properly interpret the request. Servers &SHOULD; respond to invalid
    2096    Request-URIs with an appropriate status code.
    2097 </t>
    2098 <t>
    2099    A transparent proxy &MUST-NOT; rewrite the "abs_path" part of the
    2100    received Request-URI when forwarding it to the next inbound server,
    2101    except as noted above to replace a null abs_path with "/".
    2102 </t>
    2103 <t>
    2104   <list><t>
    2105       <x:h>Note:</x:h> The "no rewrite" rule prevents the proxy from changing the
    2106       meaning of the request when the origin server is improperly using
    2107       a non-reserved URI character for a reserved purpose.  Implementors
    2108       should be aware that some pre-HTTP/1.1 proxies have been known to
    2109       rewrite the Request-URI.
    2110   </t></list>
    2111 </t>
    2112 </section>
    2113 </section>
    2114 
    2115 <section title="The Resource Identified by a Request" anchor="the.resource.identified.by.a.request">
    2116 <t>
    2117    The exact resource identified by an Internet request is determined by
    2118    examining both the Request-URI and the Host header field.
    2119 </t>
    2120 <t>
    2121    An origin server that does not allow resources to differ by the
    2122    requested host &MAY; ignore the Host header field value when
    2123    determining the resource identified by an HTTP/1.1 request. (But see
    2124    <xref target="changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses"/>
    2125    for other requirements on Host support in HTTP/1.1.)
    2126 </t>
    2127 <t>
    2128    An origin server that does differentiate resources based on the host
    2129    requested (sometimes referred to as virtual hosts or vanity host
    2130    names) &MUST; use the following rules for determining the requested
    2131    resource on an HTTP/1.1 request:
    2132   <list style="numbers">
    2133     <t>If Request-URI is an absoluteURI, the host is part of the
    2134      Request-URI. Any Host header field value in the request &MUST; be
    2135      ignored.</t>
    2136     <t>If the Request-URI is not an absoluteURI, and the request includes
    2137      a Host header field, the host is determined by the Host header
    2138      field value.</t>
    2139     <t>If the host as determined by rule 1 or 2 is not a valid host on
    2140      the server, the response &MUST; be a 400 (Bad Request) error message.</t>
    2141   </list>
    2142 </t>
    2143 <t>
    2144    Recipients of an HTTP/1.0 request that lacks a Host header field &MAY;
    2145    attempt to use heuristics (e.g., examination of the URI path for
    2146    something unique to a particular host) in order to determine what
    2147    exact resource is being requested.
    2148 </t>
    2149 </section>
    2150 
    2151 <section title="Request Header Fields" anchor="request.header.fields">
    2152 <t>
    2153    The request-header fields allow the client to pass additional
    2154    information about the request, and about the client itself, to the
    2155    server. These fields act as request modifiers, with semantics
    2156    equivalent to the parameters on a programming language method
    2157    invocation.
    2158 </t>
    2159 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="request-header"/>
    2160     request-header = Accept                   ; <xref target="header.accept"/>
    2161                    | Accept-Charset           ; <xref target="header.accept-charset"/>
    2162                    | Accept-Encoding          ; <xref target="header.accept-encoding"/>
    2163                    | Accept-Language          ; <xref target="header.accept-language"/>
    2164                    | Authorization            ; <xref target="header.authorization"/>
    2165                    | Expect                   ; <xref target="header.expect"/>
    2166                    | From                     ; <xref target="header.from"/>
    2167                    | Host                     ; <xref target="header.host"/>
    2168                    | If-Match                 ; <xref target="header.if-match"/>
    2169                    | If-Modified-Since        ; <xref target="header.if-modified-since"/>
    2170                    | If-None-Match            ; <xref target="header.if-none-match"/>
    2171                    | If-Range                 ; <xref target="header.if-range"/>
    2172                    | If-Unmodified-Since      ; <xref target="header.if-unmodified-since"/>
    2173                    | Max-Forwards             ; <xref target="header.max-forwards"/>
    2174                    | Proxy-Authorization      ; <xref target="header.proxy-authorization"/>
    2175                    | Range                    ; <xref target="header.range"/>
    2176                    | Referer                  ; <xref target="header.referer"/>
    2177                    | TE                       ; <xref target="header.te"/>
    2178                    | User-Agent               ; <xref target="header.user-agent"/>
    2179 </artwork></figure>
    2180 <t>
    2181    Request-header field names can be extended reliably only in
    2182    combination with a change in the protocol version. However, new or
    2183    experimental header fields &MAY; be given the semantics of request-header
    2184    fields if all parties in the communication recognize them to
    2185    be request-header fields. Unrecognized header fields are treated as
    2186    entity-header fields.
    2187 </t>
    2188 </section>
    2189 </section>
    2190 
    2191 
    2192 <section title="Response" anchor="response">
    2193 <t>
    2194    After receiving and interpreting a request message, a server responds
    2195    with an HTTP response message.
    2196 </t>
    2197 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Response"/>
    2198     Response      = Status-Line               ; <xref target="status-line"/>
    2199                     *(( general-header        ; <xref target="general.header.fields"/>
    2200                      | response-header        ; <xref target="response.header.fields"/>
    2201                      | entity-header ) CRLF)  ; <xref target="entity.header.fields"/>
    2202                     CRLF
    2203                     [ message-body ]          ; <xref target="entity.body"/>
    2204 </artwork></figure>
    2205 
    2206 <section title="Status-Line" anchor="status-line">
    2207 <t>
    2208    The first line of a Response message is the Status-Line, consisting
    2209    of the protocol version followed by a numeric status code and its
    2210    associated textual phrase, with each element separated by SP
    2211    characters. No CR or LF is allowed except in the final CRLF sequence.
    2212 </t>
    2213 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Status-Line"/>
    2214     Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
    2215 </artwork></figure>
    2216 
    2217 <section title="Status Code and Reason Phrase" anchor="status.code.and.reason.phrase">
    2218 <t>
    2219    The Status-Code element is a 3-digit integer result code of the
    2220    attempt to understand and satisfy the request. These codes are fully
    2221    defined in <xref target="status.codes"/>. The Reason-Phrase is intended to give a short
    2222    textual description of the Status-Code. The Status-Code is intended
    2223    for use by automata and the Reason-Phrase is intended for the human
    2224    user. The client is not required to examine or display the Reason-Phrase.
    2225 </t>
    2226 <t>
    2227    The first digit of the Status-Code defines the class of response. The
    2228    last two digits do not have any categorization role. There are 5
    2229    values for the first digit:
    2230   <list style="symbols">
    2231     <t>
    2232       1xx: Informational - Request received, continuing process
    2233     </t>
    2234     <t>
    2235       2xx: Success - The action was successfully received,
    2236         understood, and accepted
    2237     </t>
    2238     <t>
    2239       3xx: Redirection - Further action must be taken in order to
    2240         complete the request
    2241     </t>
    2242     <t>
    2243       4xx: Client Error - The request contains bad syntax or cannot
    2244         be fulfilled
    2245     </t>
    2246     <t>
    2247       5xx: Server Error - The server failed to fulfill an apparently
    2248         valid request
    2249     </t>
    2250   </list>
    2251 </t>
    2252 <t> 
    2253    The individual values of the numeric status codes defined for
    2254    HTTP/1.1, and an example set of corresponding Reason-Phrase's, are
    2255    presented below. The reason phrases listed here are only
    2256    recommendations -- they &MAY; be replaced by local equivalents without
    2257    affecting the protocol.
    2258 </t>
    2259 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Status-Code"/><iref primary="true" item="Grammar" subitem="extension-code"/><iref primary="true" item="Grammar" subitem="Reason-Phrase"/>
    2260    Status-Code    =
    2261          "100"  ; <xref target="status.100"/>: Continue
    2262        | "101"  ; <xref target="status.101"/>: Switching Protocols
    2263        | "200"  ; <xref target="status.200"/>: OK
    2264        | "201"  ; <xref target="status.201"/>: Created
    2265        | "202"  ; <xref target="status.202"/>: Accepted
    2266        | "203"  ; <xref target="status.203"/>: Non-Authoritative Information
    2267        | "204"  ; <xref target="status.204"/>: No Content
    2268        | "205"  ; <xref target="status.205"/>: Reset Content
    2269        | "206"  ; <xref target="status.206"/>: Partial Content
    2270        | "300"  ; <xref target="status.300"/>: Multiple Choices
    2271        | "301"  ; <xref target="status.301"/>: Moved Permanently
    2272        | "302"  ; <xref target="status.302"/>: Found
    2273        | "303"  ; <xref target="status.303"/>: See Other
    2274        | "304"  ; <xref target="status.304"/>: Not Modified
    2275        | "305"  ; <xref target="status.305"/>: Use Proxy
    2276        | "307"  ; <xref target="status.307"/>: Temporary Redirect
    2277        | "400"  ; <xref target="status.400"/>: Bad Request
    2278        | "401"  ; <xref target="status.401"/>: Unauthorized
    2279        | "402"  ; <xref target="status.402"/>: Payment Required
    2280        | "403"  ; <xref target="status.403"/>: Forbidden
    2281        | "404"  ; <xref target="status.404"/>: Not Found
    2282        | "405"  ; <xref target="status.405"/>: Method Not Allowed
    2283        | "406"  ; <xref target="status.406"/>: Not Acceptable
    2284        | "407"  ; <xref target="status.407"/>: Proxy Authentication Required
    2285        | "408"  ; <xref target="status.408"/>: Request Time-out
    2286        | "409"  ; <xref target="status.409"/>: Conflict
    2287        | "410"  ; <xref target="status.410"/>: Gone
    2288        | "411"  ; <xref target="status.411"/>: Length Required
    2289        | "412"  ; <xref target="status.412"/>: Precondition Failed
    2290        | "413"  ; <xref target="status.413"/>: Request Entity Too Large
    2291        | "414"  ; <xref target="status.414"/>: Request-URI Too Large
    2292        | "415"  ; <xref target="status.415"/>: Unsupported Media Type
    2293        | "416"  ; <xref target="status.416"/>: Requested range not satisfiable
    2294        | "417"  ; <xref target="status.417"/>: Expectation Failed
    2295        | "500"  ; <xref target="status.500"/>: Internal Server Error
    2296        | "501"  ; <xref target="status.501"/>: Not Implemented
    2297        | "502"  ; <xref target="status.502"/>: Bad Gateway
    2298        | "503"  ; <xref target="status.503"/>: Service Unavailable
    2299        | "504"  ; <xref target="status.504"/>: Gateway Time-out
    2300        | "505"  ; <xref target="status.505"/>: HTTP Version not supported
    2301        | extension-code
    2302 
    2303    extension-code = 3DIGIT
    2304    Reason-Phrase  = *&lt;TEXT, excluding CR, LF&gt;
    2305 </artwork></figure>
    2306 <t>
    2307    HTTP status codes are extensible. HTTP applications are not required
    2308    to understand the meaning of all registered status codes, though such
    2309    understanding is obviously desirable. However, applications &MUST;
    2310    understand the class of any status code, as indicated by the first
    2311    digit, and treat any unrecognized response as being equivalent to the
    2312    x00 status code of that class, with the exception that an
    2313    unrecognized response &MUST-NOT; be cached. For example, if an
    2314    unrecognized status code of 431 is received by the client, it can
    2315    safely assume that there was something wrong with its request and
    2316    treat the response as if it had received a 400 status code. In such
    2317    cases, user agents &SHOULD; present to the user the entity returned
    2318    with the response, since that entity is likely to include human-readable
    2319    information which will explain the unusual status.
    2320 </t>
    2321 </section>
    2322 </section>
    2323 
    2324 <section title="Response Header Fields" anchor="response.header.fields">
    2325 <t>
    2326    The response-header fields allow the server to pass additional
    2327    information about the response which cannot be placed in the Status-Line.
    2328    These header fields give information about the server and about
    2329    further access to the resource identified by the Request-URI.
    2330 </t>
    2331 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="response-header"/>
    2332     response-header = Accept-Ranges           ; <xref target="header.accept-ranges"/>
    2333                     | Age                     ; <xref target="header.age"/>
    2334                     | ETag                    ; <xref target="header.etag"/>
    2335                     | Location                ; <xref target="header.location"/>
    2336                     | Proxy-Authenticate      ; <xref target="header.proxy-authenticate"/>
    2337                     | Retry-After             ; <xref target="header.retry-after"/>
    2338                     | Server                  ; <xref target="header.server"/>
    2339                     | Vary                    ; <xref target="header.vary"/>
    2340                     | WWW-Authenticate        ; <xref target="header.www-authenticate"/>
    2341 </artwork></figure>
    2342 <t>
    2343    Response-header field names can be extended reliably only in
    2344    combination with a change in the protocol version. However, new or
    2345    experimental header fields &MAY; be given the semantics of response-header
    2346    fields if all parties in the communication recognize them to
    2347    be response-header fields. Unrecognized header fields are treated as
    2348    entity-header fields.
    2349 </t>
    2350 </section>
    2351 </section>
    2352 
    2353 
    2354 <section title="Entity" anchor="entity">
    2355 <t>
    2356    Request and Response messages &MAY; transfer an entity if not otherwise
    2357    restricted by the request method or response status code. An entity
    2358    consists of entity-header fields and an entity-body, although some
    2359    responses will only include the entity-headers.
    2360 </t>
    2361 <t>
    2362    In this section, both sender and recipient refer to either the client
    2363    or the server, depending on who sends and who receives the entity.
    2364 </t>
    2365 
    2366 <section title="Entity Header Fields" anchor="entity.header.fields">
    2367 <t>
    2368    Entity-header fields define metainformation about the entity-body or,
    2369    if no body is present, about the resource identified by the request.
    2370    Some of this metainformation is &OPTIONAL;; some might be &REQUIRED; by
    2371    portions of this specification.
    2372 </t>
    2373 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="entity-header"/><iref primary="true" item="Grammar" subitem="extension-header"/>
    2374     entity-header  = Allow                    ; <xref target="header.allow"/>
    2375                    | Content-Encoding         ; <xref target="header.content-encoding"/>
    2376                    | Content-Language         ; <xref target="header.content-language"/>
    2377                    | Content-Length           ; <xref target="header.content-length"/>
    2378                    | Content-Location         ; <xref target="header.content-location"/>
    2379                    | Content-MD5              ; <xref target="header.content-md5"/>
    2380                    | Content-Range            ; <xref target="header.content-range"/>
    2381                    | Content-Type             ; <xref target="header.content-type"/>
    2382                    | Expires                  ; <xref target="header.expires"/>
    2383                    | Last-Modified            ; <xref target="header.last-modified"/>
    2384                    | extension-header
    2385 
    2386     extension-header = message-header
    2387 </artwork></figure>
    2388 <t>
    2389    The extension-header mechanism allows additional entity-header fields
    2390    to be defined without changing the protocol, but these fields cannot
    2391    be assumed to be recognizable by the recipient. Unrecognized header
    2392    fields &SHOULD; be ignored by the recipient and &MUST; be forwarded by
    2393    transparent proxies.
    2394 </t>
    2395 </section>
    2396 
    2397 <section title="Entity Body" anchor="entity.body">
    2398 <t>
    2399    The entity-body (if any) sent with an HTTP request or response is in
    2400    a format and encoding defined by the entity-header fields.
    2401 </t>
    2402 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="entity-body"/>
    2403     entity-body    = *OCTET
    2404 </artwork></figure>
    2405 <t>
    2406    An entity-body is only present in a message when a message-body is
    2407    present, as described in <xref target="message.body"/>. The entity-body is obtained
    2408    from the message-body by decoding any Transfer-Encoding that might
    2409    have been applied to ensure safe and proper transfer of the message.
    2410 </t>
    2411 
    2412 <section title="Type" anchor="type">
    2413 <t>
    2414    When an entity-body is included with a message, the data type of that
    2415    body is determined via the header fields Content-Type and Content-Encoding.
    2416    These define a two-layer, ordered encoding model:
    2417 </t>
    2418 <figure><artwork type="example">
    2419     entity-body := Content-Encoding( Content-Type( data ) )
    2420 </artwork></figure>
    2421 <t>
    2422    Content-Type specifies the media type of the underlying data.
    2423    Content-Encoding may be used to indicate any additional content
    2424    codings applied to the data, usually for the purpose of data
    2425    compression, that are a property of the requested resource. There is
    2426    no default encoding.
    2427 </t>
    2428 <t>
    2429    Any HTTP/1.1 message containing an entity-body &SHOULD; include a
    2430    Content-Type header field defining the media type of that body. If
    2431    and only if the media type is not given by a Content-Type field, the
    2432    recipient &MAY; attempt to guess the media type via inspection of its
    2433    content and/or the name extension(s) of the URI used to identify the
    2434    resource. If the media type remains unknown, the recipient &SHOULD;
    2435    treat it as type "application/octet-stream".
    2436 </t>
    2437 </section>
    2438    
    2439 <section title="Entity Length" anchor="entity.length">
    2440 <t>
    2441    The entity-length of a message is the length of the message-body
    2442    before any transfer-codings have been applied. <xref target="message.length"/> defines
    2443    how the transfer-length of a message-body is determined.
    2444 </t>
    2445 </section>
    2446 </section>
    2447 </section>
    2448 
    2449 
    2450 
    2451 <section title="Connections" anchor="connections">
    2452 
    2453 <section title="Persistent Connections" anchor="persistent.connections">
    2454 
    2455 <section title="Purpose" anchor="persistent.purpose">
    2456 <t>
    2457    Prior to persistent connections, a separate TCP connection was
    2458    established to fetch each URL, increasing the load on HTTP servers
    2459    and causing congestion on the Internet. The use of inline images and
    2460    other associated data often require a client to make multiple
    2461    requests of the same server in a short amount of time. Analysis of
    2462    these performance problems and results from a prototype
    2463    implementation are available <xref target="Pad1995"/> <xref target="Spe"/>. Implementation experience and
    2464    measurements of actual HTTP/1.1 (RFC 2068) implementations show good
    2465    results <xref target="Nie1997"/>. Alternatives have also been explored, for example,
    2466    T/TCP <xref target="Tou1998"/>.
    2467 </t>
    2468 <t>
    2469    Persistent HTTP connections have a number of advantages:
    2470   <list style="symbols">
    2471       <t>
    2472         By opening and closing fewer TCP connections, CPU time is saved
    2473         in routers and hosts (clients, servers, proxies, gateways,
    2474         tunnels, or caches), and memory used for TCP protocol control
    2475         blocks can be saved in hosts.
    2476       </t>
    2477       <t>
    2478         HTTP requests and responses can be pipelined on a connection.
    2479         Pipelining allows a client to make multiple requests without
    2480         waiting for each response, allowing a single TCP connection to
    2481         be used much more efficiently, with much lower elapsed time.
    2482       </t>
    2483       <t>
    2484         Network congestion is reduced by reducing the number of packets
    2485         caused by TCP opens, and by allowing TCP sufficient time to
    2486         determine the congestion state of the network.
    2487       </t>
    2488       <t>
    2489         Latency on subsequent requests is reduced since there is no time
    2490         spent in TCP's connection opening handshake.
    2491       </t>
    2492       <t>
    2493         HTTP can evolve more gracefully, since errors can be reported
    2494         without the penalty of closing the TCP connection. Clients using
    2495         future versions of HTTP might optimistically try a new feature,
    2496         but if communicating with an older server, retry with old
    2497         semantics after an error is reported.
    2498       </t>
    2499     </list>
    2500 </t>
    2501 <t>
    2502    HTTP implementations &SHOULD; implement persistent connections.
    2503 </t>
    2504 </section>
    2505 
    2506 <section title="Overall Operation" anchor="persistent.overall">
    2507 <t>
    2508    A significant difference between HTTP/1.1 and earlier versions of
    2509    HTTP is that persistent connections are the default behavior of any
    2510    HTTP connection. That is, unless otherwise indicated, the client
    2511    &SHOULD; assume that the server will maintain a persistent connection,
    2512    even after error responses from the server.
    2513 </t>
    2514 <t>
    2515    Persistent connections provide a mechanism by which a client and a
    2516    server can signal the close of a TCP connection. This signaling takes
    2517    place using the Connection header field (<xref target="header.connection"/>). Once a close
    2518    has been signaled, the client &MUST-NOT; send any more requests on that
    2519    connection.
    2520 </t>
    2521 
    2522 <section title="Negotiation" anchor="persistent.negotiation">
    2523 <t>
    2524    An HTTP/1.1 server &MAY; assume that a HTTP/1.1 client intends to
    2525    maintain a persistent connection unless a Connection header including
    2526    the connection-token "close" was sent in the request. If the server
    2527    chooses to close the connection immediately after sending the
    2528    response, it &SHOULD; send a Connection header including the
    2529    connection-token close.
    2530 </t>
    2531 <t>
    2532    An HTTP/1.1 client &MAY; expect a connection to remain open, but would
    2533    decide to keep it open based on whether the response from a server
    2534    contains a Connection header with the connection-token close. In case
    2535    the client does not want to maintain a connection for more than that
    2536    request, it &SHOULD; send a Connection header including the
    2537    connection-token close.
    2538 </t>
    2539 <t>
    2540    If either the client or the server sends the close token in the
    2541    Connection header, that request becomes the last one for the
    2542    connection.
    2543 </t>
    2544 <t>
    2545    Clients and servers &SHOULD-NOT;  assume that a persistent connection is
    2546    maintained for HTTP versions less than 1.1 unless it is explicitly
    2547    signaled. See <xref target="compatibility.with.http.1.0.persistent.connections"/> for more information on backward
    2548    compatibility with HTTP/1.0 clients.
    2549 </t>
    2550 <t>
    2551    In order to remain persistent, all messages on the connection &MUST;
    2552    have a self-defined message length (i.e., one not defined by closure
    2553    of the connection), as described in <xref target="message.length"/>.
    2554 </t>
    2555 </section>
    2556 
    2557 <section title="Pipelining" anchor="pipelining">
    2558 <t>
    2559    A client that supports persistent connections &MAY; "pipeline" its
    2560    requests (i.e., send multiple requests without waiting for each
    2561    response). A server &MUST; send its responses to those requests in the
    2562    same order that the requests were received.
    2563 </t>
    2564 <t>
    2565    Clients which assume persistent connections and pipeline immediately
    2566    after connection establishment &SHOULD; be prepared to retry their
    2567    connection if the first pipelined attempt fails. If a client does
    2568    such a retry, it &MUST-NOT; pipeline before it knows the connection is
    2569    persistent. Clients &MUST; also be prepared to resend their requests if
    2570    the server closes the connection before sending all of the
    2571    corresponding responses.
    2572 </t>
    2573 <t>
    2574    Clients &SHOULD-NOT;  pipeline requests using non-idempotent methods or
    2575    non-idempotent sequences of methods (see <xref target="idempotent.methods"/>). Otherwise, a
    2576    premature termination of the transport connection could lead to
    2577    indeterminate results. A client wishing to send a non-idempotent
    2578    request &SHOULD; wait to send that request until it has received the
    2579    response status for the previous request.
    2580 </t>
    2581 </section>
    2582 </section>
    2583 
    2584 <section title="Proxy Servers" anchor="persistent.proxy">
    2585 <t>
    2586    It is especially important that proxies correctly implement the
    2587    properties of the Connection header field as specified in <xref target="header.connection"/>.
    2588 </t>
    2589 <t>
    2590    The proxy server &MUST; signal persistent connections separately with
    2591    its clients and the origin servers (or other proxy servers) that it
    2592    connects to. Each persistent connection applies to only one transport
    2593    link.
    2594 </t>
    2595 <t>
    2596    A proxy server &MUST-NOT; establish a HTTP/1.1 persistent connection
    2597    with an HTTP/1.0 client (but see RFC 2068 <xref target="RFC2068"/> for information and
    2598    discussion of the problems with the Keep-Alive header implemented by
    2599    many HTTP/1.0 clients).
    2600 </t>
    2601 </section>
    2602 
    2603 <section title="Practical Considerations" anchor="persistent.practical">
    2604 <t>
    2605    Servers will usually have some time-out value beyond which they will
    2606    no longer maintain an inactive connection. Proxy servers might make
    2607    this a higher value since it is likely that the client will be making
    2608    more connections through the same server. The use of persistent
    2609    connections places no requirements on the length (or existence) of
    2610    this time-out for either the client or the server.
    2611 </t>
    2612 <t>
    2613    When a client or server wishes to time-out it &SHOULD; issue a graceful
    2614    close on the transport connection. Clients and servers &SHOULD; both
    2615    constantly watch for the other side of the transport close, and
    2616    respond to it as appropriate. If a client or server does not detect
    2617    the other side's close promptly it could cause unnecessary resource
    2618    drain on the network.
    2619 </t>
    2620 <t>
    2621    A client, server, or proxy &MAY; close the transport connection at any
    2622    time. For example, a client might have started to send a new request
    2623    at the same time that the server has decided to close the "idle"
    2624    connection. From the server's point of view, the connection is being
    2625    closed while it was idle, but from the client's point of view, a
    2626    request is in progress.
    2627 </t>
    2628 <t>
    2629    This means that clients, servers, and proxies &MUST; be able to recover
    2630    from asynchronous close events. Client software &SHOULD; reopen the
    2631    transport connection and retransmit the aborted sequence of requests
    2632    without user interaction so long as the request sequence is
    2633    idempotent (see <xref target="idempotent.methods"/>). Non-idempotent methods or sequences
    2634    &MUST-NOT; be automatically retried, although user agents &MAY; offer a
    2635    human operator the choice of retrying the request(s). Confirmation by
    2636    user-agent software with semantic understanding of the application
    2637    &MAY; substitute for user confirmation. The automatic retry &SHOULD-NOT;
    2638    be repeated if the second sequence of requests fails.
    2639 </t>
    2640 <t>
    2641    Servers &SHOULD; always respond to at least one request per connection,
    2642    if at all possible. Servers &SHOULD-NOT;  close a connection in the
    2643    middle of transmitting a response, unless a network or client failure
    2644    is suspected.
    2645 </t>
    2646 <t>
    2647    Clients that use persistent connections &SHOULD; limit the number of
    2648    simultaneous connections that they maintain to a given server. A
    2649    single-user client &SHOULD-NOT; maintain more than 2 connections with
    2650    any server or proxy. A proxy &SHOULD; use up to 2*N connections to
    2651    another server or proxy, where N is the number of simultaneously
    2652    active users. These guidelines are intended to improve HTTP response
    2653    times and avoid congestion.
    2654 </t>
    2655 </section>
    2656 </section>
    2657 
    2658 <section title="Message Transmission Requirements" anchor="message.transmission.requirements">
    2659 
    2660 <section title="Persistent Connections and Flow Control" anchor="persistent.flow">
    2661 <t>
    2662    HTTP/1.1 servers &SHOULD; maintain persistent connections and use TCP's
    2663    flow control mechanisms to resolve temporary overloads, rather than
    2664    terminating connections with the expectation that clients will retry.
    2665    The latter technique can exacerbate network congestion.
    2666 </t>
    2667 </section>
    2668 
    2669 <section title="Monitoring Connections for Error Status Messages" anchor="persistent.monitor">
    2670 <t>
    2671    An HTTP/1.1 (or later) client sending a message-body &SHOULD; monitor
    2672    the network connection for an error status while it is transmitting
    2673    the request. If the client sees an error status, it &SHOULD;
    2674    immediately cease transmitting the body. If the body is being sent
    2675    using a "chunked" encoding (<xref target="transfer.codings"/>), a zero length chunk and
    2676    empty trailer &MAY; be used to prematurely mark the end of the message.
    2677    If the body was preceded by a Content-Length header, the client &MUST;
    2678    close the connection.
    2679 </t>
    2680 </section>
    2681 
    2682 <section title="Use of the 100 (Continue) Status" anchor="use.of.the.100.status">
    2683 <t>
    2684    The purpose of the 100 (Continue) status (see <xref target="status.100"/>) is to
    2685    allow a client that is sending a request message with a request body
    2686    to determine if the origin server is willing to accept the request
    2687    (based on the request headers) before the client sends the request
    2688    body. In some cases, it might either be inappropriate or highly
    2689    inefficient for the client to send the body if the server will reject
    2690    the message without looking at the body.
    2691 </t>
    2692 <t>
    2693    Requirements for HTTP/1.1 clients:
    2694   <list style="symbols">
    2695     <t>
    2696         If a client will wait for a 100 (Continue) response before
    2697         sending the request body, it &MUST; send an Expect request-header
    2698         field (<xref target="header.expect"/>) with the "100-continue" expectation.
    2699     </t>
    2700     <t>
    2701         A client &MUST-NOT; send an Expect request-header field (<xref target="header.expect"/>)
    2702         with the "100-continue" expectation if it does not intend
    2703         to send a request body.
    2704     </t>
    2705   </list>
    2706 </t>
    2707 <t>
    2708    Because of the presence of older implementations, the protocol allows
    2709    ambiguous situations in which a client may send "Expect: 100-continue"
    2710    without receiving either a 417 (Expectation Failed) status
    2711    or a 100 (Continue) status. Therefore, when a client sends this
    2712    header field to an origin server (possibly via a proxy) from which it
    2713    has never seen a 100 (Continue) status, the client &SHOULD-NOT;  wait
    2714    for an indefinite period before sending the request body.
    2715 </t>
    2716 <t>
    2717    Requirements for HTTP/1.1 origin servers:
    2718   <list style="symbols">
    2719     <t> Upon receiving a request which includes an Expect request-header
    2720         field with the "100-continue" expectation, an origin server &MUST;
    2721         either respond with 100 (Continue) status and continue to read
    2722         from the input stream, or respond with a final status code. The
    2723         origin server &MUST-NOT; wait for the request body before sending
    2724         the 100 (Continue) response. If it responds with a final status
    2725         code, it &MAY; close the transport connection or it &MAY; continue
    2726         to read and discard the rest of the request.  It &MUST-NOT;
    2727         perform the requested method if it returns a final status code.
    2728     </t>
    2729     <t> An origin server &SHOULD-NOT;  send a 100 (Continue) response if
    2730         the request message does not include an Expect request-header
    2731         field with the "100-continue" expectation, and &MUST-NOT; send a
    2732         100 (Continue) response if such a request comes from an HTTP/1.0
    2733         (or earlier) client. There is an exception to this rule: for
    2734         compatibility with RFC 2068, a server &MAY; send a 100 (Continue)
    2735         status in response to an HTTP/1.1 PUT or POST request that does
    2736         not include an Expect request-header field with the "100-continue"
    2737         expectation. This exception, the purpose of which is
    2738         to minimize any client processing delays associated with an
    2739         undeclared wait for 100 (Continue) status, applies only to
    2740         HTTP/1.1 requests, and not to requests with any other HTTP-version
    2741         value.
    2742     </t>
    2743     <t> An origin server &MAY; omit a 100 (Continue) response if it has
    2744         already received some or all of the request body for the
    2745         corresponding request.
    2746     </t>
    2747     <t> An origin server that sends a 100 (Continue) response &MUST;
    2748     ultimately send a final status code, once the request body is
    2749         received and processed, unless it terminates the transport
    2750         connection prematurely.
    2751     </t>
    2752     <t> If an origin server receives a request that does not include an
    2753         Expect request-header field with the "100-continue" expectation,
    2754         the request includes a request body, and the server responds
    2755         with a final status code before reading the entire request body
    2756         from the transport connection, then the server &SHOULD-NOT;  close
    2757         the transport connection until it has read the entire request,
    2758         or until the client closes the connection. Otherwise, the client
    2759         might not reliably receive the response message. However, this
    2760         requirement is not be construed as preventing a server from
    2761         defending itself against denial-of-service attacks, or from
    2762         badly broken client implementations.
    2763       </t>
    2764     </list>
    2765 </t>
    2766 <t>
    2767    Requirements for HTTP/1.1 proxies:
    2768   <list style="symbols">
    2769     <t> If a proxy receives a request that includes an Expect request-header
    2770         field with the "100-continue" expectation, and the proxy
    2771         either knows that the next-hop server complies with HTTP/1.1 or
    2772         higher, or does not know the HTTP version of the next-hop
    2773         server, it &MUST; forward the request, including the Expect header
    2774         field.
    2775     </t>
    2776     <t> If the proxy knows that the version of the next-hop server is
    2777         HTTP/1.0 or lower, it &MUST-NOT; forward the request, and it &MUST;
    2778         respond with a 417 (Expectation Failed) status.
    2779     </t>
    2780     <t> Proxies &SHOULD; maintain a cache recording the HTTP version
    2781         numbers received from recently-referenced next-hop servers.
    2782     </t>
    2783     <t> A proxy &MUST-NOT; forward a 100 (Continue) response if the
    2784         request message was received from an HTTP/1.0 (or earlier)
    2785         client and did not include an Expect request-header field with
    2786         the "100-continue" expectation. This requirement overrides the
    2787         general rule for forwarding of 1xx responses (see <xref target="status.1xx"/>).
    2788     </t>
    2789   </list>
    2790 </t>
    2791 </section>
    2792 
    2793 <section title="Client Behavior if Server Prematurely Closes Connection" anchor="connection.premature">
    2794 <t>
    2795    If an HTTP/1.1 client sends a request which includes a request body,
    2796    but which does not include an Expect request-header field with the
    2797    "100-continue" expectation, and if the client is not directly
    2798    connected to an HTTP/1.1 origin server, and if the client sees the
    2799    connection close before receiving any status from the server, the
    2800    client &SHOULD; retry the request.  If the client does retry this
    2801    request, it &MAY; use the following "binary exponential backoff"
    2802    algorithm to be assured of obtaining a reliable response:
    2803   <list style="numbers">
    2804     <t>
    2805       Initiate a new connection to the server
    2806     </t>
    2807     <t>
    2808       Transmit the request-headers
    2809     </t>
    2810     <t>
    2811       Initialize a variable R to the estimated round-trip time to the
    2812          server (e.g., based on the time it took to establish the
    2813          connection), or to a constant value of 5 seconds if the round-trip
    2814          time is not available.
    2815     </t>
    2816     <t>
    2817        Compute T = R * (2**N), where N is the number of previous
    2818          retries of this request.
    2819     </t>
    2820     <t>
    2821        Wait either for an error response from the server, or for T
    2822          seconds (whichever comes first)
    2823     </t>
    2824     <t>
    2825        If no error response is received, after T seconds transmit the
    2826          body of the request.
    2827     </t>
    2828     <t>
    2829        If client sees that the connection is closed prematurely,
    2830          repeat from step 1 until the request is accepted, an error
    2831          response is received, or the user becomes impatient and
    2832          terminates the retry process.
    2833     </t>
    2834   </list>
    2835 </t>
    2836 <t>
    2837    If at any point an error status is received, the client
    2838   <list style="symbols">
    2839       <t>&SHOULD-NOT;  continue and</t>
    2840 
    2841       <t>&SHOULD; close the connection if it has not completed sending the
    2842         request message.</t>
    2843     </list>
    2844 </t>
    2845 </section>
    2846 </section>
    2847 </section>
    2848 
    2849 
    2850 
    2851 <section title="Method Definitions" anchor="method.definitions">
    2852 <t>
    2853    The set of common methods for HTTP/1.1 is defined below. Although
    2854    this set can be expanded, additional methods cannot be assumed to
    2855    share the same semantics for separately extended clients and servers.
    2856 
    2857    The Host request-header field (<xref target="header.host"/>) &MUST; accompany all
    2858    HTTP/1.1 requests.
    2859 </t>
    2860 
    2861 <section title="Safe and Idempotent Methods" anchor="safe.and.idempotent">
    2862 
    2863 <section title="Safe Methods" anchor="safe.methods">
    2864 <t>
    2865    Implementors should be aware that the software represents the user in
    2866    their interactions over the Internet, and should be careful to allow
    2867    the user to be aware of any actions they might take which may have an
    2868    unexpected significance to themselves or others.
    2869 </t>
    2870 <t>
    2871    In particular, the convention has been established that the GET and
    2872    HEAD methods &SHOULD-NOT;  have the significance of taking an action
    2873    other than retrieval. These methods ought to be considered "safe".
    2874    This allows user agents to represent other methods, such as POST, PUT
    2875    and DELETE, in a special way, so that the user is made aware of the
    2876    fact that a possibly unsafe action is being requested.
    2877 </t>
    2878 <t>
    2879    Naturally, it is not possible to ensure that the server does not
    2880    generate side-effects as a result of performing a GET request; in
    2881    fact, some dynamic resources consider that a feature. The important
    2882    distinction here is that the user did not request the side-effects,
    2883    so therefore cannot be held accountable for them.
    2884 </t>
    2885 </section>
    2886 
    2887 <section title="Idempotent Methods" anchor="idempotent.methods">
    2888 <t>
    2889    Methods can also have the property of "idempotence" in that (aside
    2890    from error or expiration issues) the side-effects of N &gt; 0 identical
    2891    requests is the same as for a single request. The methods GET, HEAD,
    2892    PUT and DELETE share this property. Also, the methods OPTIONS and
    2893    TRACE &SHOULD-NOT;  have side effects, and so are inherently idempotent.
    2894 </t>
    2895 <t>
    2896    However, it is possible that a sequence of several requests is non-idempotent,
    2897    even if all of the methods executed in that sequence are
    2898    idempotent. (A sequence is idempotent if a single execution of the
    2899    entire sequence always yields a result that is not changed by a
    2900    reexecution of all, or part, of that sequence.) For example, a
    2901    sequence is non-idempotent if its result depends on a value that is
    2902    later modified in the same sequence.
    2903 </t>
    2904 <t>
    2905    A sequence that never has side effects is idempotent, by definition
    2906    (provided that no concurrent operations are being executed on the
    2907    same set of resources).
    2908 </t>
    2909 </section>
    2910 </section>
    2911 
    2912 <section title="OPTIONS" anchor="OPTIONS">
    2913   <iref primary="true" item="OPTIONS method" x:for-anchor=""/>
    2914   <iref primary="true" item="Methods" subitem="OPTIONS" x:for-anchor=""/>
    2915 <t>
    2916    The OPTIONS method represents a request for information about the
    2917    communication options available on the request/response chain
    2918    identified by the Request-URI. This method allows the client to
    2919    determine the options and/or requirements associated with a resource,
    2920    or the capabilities of a server, without implying a resource action
    2921    or initiating a resource retrieval.
    2922 </t>
    2923 <t>
    2924    Responses to this method are not cacheable.
    2925 </t>
    2926 <t>
    2927    If the OPTIONS request includes an entity-body (as indicated by the
    2928    presence of Content-Length or Transfer-Encoding), then the media type
    2929    &MUST; be indicated by a Content-Type field. Although this
    2930    specification does not define any use for such a body, future
    2931    extensions to HTTP might use the OPTIONS body to make more detailed
    2932    queries on the server. A server that does not support such an
    2933    extension &MAY; discard the request body.
    2934 </t>
    2935 <t>
    2936    If the Request-URI is an asterisk ("*"), the OPTIONS request is
    2937    intended to apply to the server in general rather than to a specific
    2938    resource. Since a server's communication options typically depend on
    2939    the resource, the "*" request is only useful as a "ping" or "no-op"
    2940    type of method; it does nothing beyond allowing the client to test
    2941    the capabilities of the server. For example, this can be used to test
    2942    a proxy for HTTP/1.1 compliance (or lack thereof).
    2943 </t>
    2944 <t>
    2945    If the Request-URI is not an asterisk, the OPTIONS request applies
    2946    only to the options that are available when communicating with that
    2947    resource.
    2948 </t>
    2949 <t>
    2950    A 200 response &SHOULD; include any header fields that indicate
    2951    optional features implemented by the server and applicable to that
    2952    resource (e.g., Allow), possibly including extensions not defined by
    2953    this specification. The response body, if any, &SHOULD; also include
    2954    information about the communication options. The format for such a
    2955    body is not defined by this specification, but might be defined by
    2956    future extensions to HTTP. Content negotiation &MAY; be used to select
    2957    the appropriate response format. If no response body is included, the
    2958    response &MUST; include a Content-Length field with a field-value of
    2959    "0".
    2960 </t>
    2961 <t>
    2962    The Max-Forwards request-header field &MAY; be used to target a
    2963    specific proxy in the request chain. When a proxy receives an OPTIONS
    2964    request on an absoluteURI for which request forwarding is permitted,
    2965    the proxy &MUST; check for a Max-Forwards field. If the Max-Forwards
    2966    field-value is zero ("0"), the proxy &MUST-NOT; forward the message;
    2967    instead, the proxy &SHOULD; respond with its own communication options.
    2968    If the Max-Forwards field-value is an integer greater than zero, the
    2969    proxy &MUST; decrement the field-value when it forwards the request. If
    2970    no Max-Forwards field is present in the request, then the forwarded
    2971    request &MUST-NOT; include a Max-Forwards field.
    2972 </t>
    2973 </section>
    2974 
    2975 <section title="GET" anchor="GET">
    2976   <iref primary="true" item="GET method" x:for-anchor=""/>
    2977   <iref primary="true" item="Methods" subitem="GET" x:for-anchor=""/>
    2978 <t>
    2979    The GET method means retrieve whatever information (in the form of an
    2980    entity) is identified by the Request-URI. If the Request-URI refers
    2981    to a data-producing process, it is the produced data which shall be
    2982    returned as the entity in the response and not the source text of the
    2983    process, unless that text happens to be the output of the process.
    2984 </t>
    2985 <t>
    2986    The semantics of the GET method change to a "conditional GET" if the
    2987    request message includes an If-Modified-Since, If-Unmodified-Since,
    2988    If-Match, If-None-Match, or If-Range header field. A conditional GET
    2989    method requests that the entity be transferred only under the
    2990    circumstances described by the conditional header field(s). The
    2991    conditional GET method is intended to reduce unnecessary network
    2992    usage by allowing cached entities to be refreshed without requiring
    2993    multiple requests or transferring data already held by the client.
    2994 </t>
    2995 <t>
    2996    The semantics of the GET method change to a "partial GET" if the
    2997    request message includes a Range header field. A partial GET requests
    2998    that only part of the entity be transferred, as described in <xref target="header.range"/>.
    2999    The partial GET method is intended to reduce unnecessary
    3000    network usage by allowing partially-retrieved entities to be
    3001    completed without transferring data already held by the client.
    3002 </t>
    3003 <t>
    3004    The response to a GET request is cacheable if and only if it meets
    3005    the requirements for HTTP caching described in <xref target="caching"/>.
    3006 </t>
    3007 <t>
    3008    See <xref target="encoding.sensitive.information.in.uris"/> for security considerations when used for forms.
    3009 </t>
    3010 </section>
    3011 
    3012 <section title="HEAD" anchor="HEAD">
    3013   <iref primary="true" item="HEAD method" x:for-anchor=""/>
    3014   <iref primary="true" item="Methods" subitem="HEAD" x:for-anchor=""/>
    3015 <t>
    3016    The HEAD method is identical to GET except that the server &MUST-NOT;
    3017    return a message-body in the response. The metainformation contained
    3018    in the HTTP headers in response to a HEAD request &SHOULD; be identical
    3019    to the information sent in response to a GET request. This method can
    3020    be used for obtaining metainformation about the entity implied by the
    3021    request without transferring the entity-body itself. This method is
    3022    often used for testing hypertext links for validity, accessibility,
    3023    and recent modification.
    3024 </t>
    3025 <t>
    3026    The response to a HEAD request &MAY; be cacheable in the sense that the
    3027    information contained in the response &MAY; be used to update a
    3028    previously cached entity from that resource. If the new field values
    3029    indicate that the cached entity differs from the current entity (as
    3030    would be indicated by a change in Content-Length, Content-MD5, ETag
    3031    or Last-Modified), then the cache &MUST; treat the cache entry as
    3032    stale.
    3033 </t>
    3034 </section>
    3035 
    3036 <section title="POST" anchor="POST">
    3037   <iref primary="true" item="POST method" x:for-anchor=""/>
    3038   <iref primary="true" item="Methods" subitem="POST" x:for-anchor=""/>
    3039 <t>
    3040    The POST method is used to request that the origin server accept the
    3041    entity enclosed in the request as a new subordinate of the resource
    3042    identified by the Request-URI in the Request-Line. POST is designed
    3043    to allow a uniform method to cover the following functions:
    3044   <list style="symbols">
    3045     <t>
    3046       Annotation of existing resources;
    3047     </t>
    3048     <t>
    3049         Posting a message to a bulletin board, newsgroup, mailing list,
    3050         or similar group of articles;
    3051     </t>
    3052     <t>
    3053         Providing a block of data, such as the result of submitting a
    3054         form, to a data-handling process;
    3055     </t>
    3056     <t>
    3057         Extending a database through an append operation.
    3058     </t>
    3059   </list>
    3060 </t>
    3061 <t>
    3062    The actual function performed by the POST method is determined by the
    3063    server and is usually dependent on the Request-URI. The posted entity
    3064    is subordinate to that URI in the same way that a file is subordinate
    3065    to a directory containing it, a news article is subordinate to a
    3066    newsgroup to which it is posted, or a record is subordinate to a
    3067    database.
    3068 </t>
    3069 <t>
    3070    The action performed by the POST method might not result in a
    3071    resource that can be identified by a URI. In this case, either 200
    3072    (OK) or 204 (No Content) is the appropriate response status,
    3073    depending on whether or not the response includes an entity that
    3074    describes the result.
    3075 </t>
    3076 <t>
    3077    If a resource has been created on the origin server, the response
    3078    &SHOULD; be 201 (Created) and contain an entity which describes the
    3079    status of the request and refers to the new resource, and a Location
    3080    header (see <xref target="header.location"/>).
    3081 </t>
    3082 <t>
    3083    Responses to this method are not cacheable, unless the response
    3084    includes appropriate Cache-Control or Expires header fields. However,
    3085    the 303 (See Other) response can be used to direct the user agent to
    3086    retrieve a cacheable resource.
    3087 </t>
    3088 <t>
    3089    POST requests &MUST; obey the message transmission requirements set out
    3090    in <xref target="message.transmission.requirements"/>.
    3091 </t>
    3092 <t>
    3093    See <xref target="encoding.sensitive.information.in.uris"/> for security considerations.
    3094 </t>
    3095 </section>
    3096 
    3097 <section title="PUT" anchor="PUT">
    3098   <iref primary="true" item="PUT method" x:for-anchor=""/>
    3099   <iref primary="true" item="Methods" subitem="PUT" x:for-anchor=""/>
    3100 <t>
    3101    The PUT method requests that the enclosed entity be stored under the
    3102    supplied Request-URI. If the Request-URI refers to an already
    3103    existing resource, the enclosed entity &SHOULD; be considered as a
    3104    modified version of the one residing on the origin server. If the
    3105    Request-URI does not point to an existing resource, and that URI is
    3106    capable of being defined as a new resource by the requesting user
    3107    agent, the origin server can create the resource with that URI. If a
    3108    new resource is created, the origin server &MUST; inform the user agent
    3109    via the 201 (Created) response. If an existing resource is modified,
    3110    either the 200 (OK) or 204 (No Content) response codes &SHOULD; be sent
    3111    to indicate successful completion of the request. If the resource
    3112    could not be created or modified with the Request-URI, an appropriate
    3113    error response &SHOULD; be given that reflects the nature of the
    3114    problem. The recipient of the entity &MUST-NOT; ignore any Content-*
    3115    (e.g. Content-Range) headers that it does not understand or implement
    3116    and &MUST; return a 501 (Not Implemented) response in such cases.
    3117 </t>
    3118 <t>
    3119    If the request passes through a cache and the Request-URI identifies
    3120    one or more currently cached entities, those entries &SHOULD; be
    3121    treated as stale. Responses to this method are not cacheable.
    3122 </t>
    3123 <t>
    3124    The fundamental difference between the POST and PUT requests is
    3125    reflected in the different meaning of the Request-URI. The URI in a
    3126    POST request identifies the resource that will handle the enclosed
    3127    entity. That resource might be a data-accepting process, a gateway to
    3128    some other protocol, or a separate entity that accepts annotations.
    3129    In contrast, the URI in a PUT request identifies the entity enclosed
    3130    with the request -- the user agent knows what URI is intended and the
    3131    server &MUST-NOT; attempt to apply the request to some other resource.
    3132    If the server desires that the request be applied to a different URI,
    3133    it &MUST; send a 301 (Moved Permanently) response; the user agent &MAY;
    3134    then make its own decision regarding whether or not to redirect the
    3135    request.
    3136 </t>
    3137 <t>
    3138    A single resource &MAY; be identified by many different URIs. For
    3139    example, an article might have a URI for identifying "the current
    3140    version" which is separate from the URI identifying each particular
    3141    version. In this case, a PUT request on a general URI might result in
    3142    several other URIs being defined by the origin server.
    3143 </t>
    3144 <t>
    3145    HTTP/1.1 does not define how a PUT method affects the state of an
    3146    origin server.
    3147 </t>
    3148 <t>
    3149    PUT requests &MUST; obey the message transmission requirements set out
    3150    in <xref target="message.transmission.requirements"/>.
    3151 </t>
    3152 <t>
    3153    Unless otherwise specified for a particular entity-header, the
    3154    entity-headers in the PUT request &SHOULD; be applied to the resource
    3155    created or modified by the PUT.
    3156 </t>
    3157 </section>
    3158 
    3159 <section title="DELETE" anchor="DELETE">
    3160   <iref primary="true" item="DELETE method" x:for-anchor=""/>
    3161   <iref primary="true" item="Methods" subitem="DELETE" x:for-anchor=""/>
    3162 <t>
    3163    The DELETE method requests that the origin server delete the resource
    3164    identified by the Request-URI. This method &MAY; be overridden by human
    3165    intervention (or other means) on the origin server. The client cannot
    3166    be guaranteed that the operation has been carried out, even if the
    3167    status code returned from the origin server indicates that the action
    3168    has been completed successfully. However, the server &SHOULD-NOT;
    3169    indicate success unless, at the time the response is given, it
    3170    intends to delete the resource or move it to an inaccessible
    3171    location.
    3172 </t>
    3173 <t>
    3174    A successful response &SHOULD; be 200 (OK) if the response includes an
    3175    entity describing the status, 202 (Accepted) if the action has not
    3176    yet been enacted, or 204 (No Content) if the action has been enacted
    3177    but the response does not include an entity.
    3178 </t>
    3179 <t>
    3180    If the request passes through a cache and the Request-URI identifies
    3181    one or more currently cached entities, those entries &SHOULD; be
    3182    treated as stale. Responses to this method are not cacheable.
    3183 </t>
    3184 </section>
    3185 
    3186 <section title="TRACE" anchor="TRACE">
    3187   <iref primary="true" item="TRACE method" x:for-anchor=""/>
    3188   <iref primary="true" item="Methods" subitem="TRACE" x:for-anchor=""/>
    3189 <t>
    3190    The TRACE method is used to invoke a remote, application-layer loop-back
    3191    of the request message. The final recipient of the request
    3192    &SHOULD; reflect the message received back to the client as the
    3193    entity-body of a 200 (OK) response. The final recipient is either the
    3194    origin server or the first proxy or gateway to receive a Max-Forwards
    3195    value of zero (0) in the request (see <xref target="header.max-forwards"/>). A TRACE request
    3196    &MUST-NOT; include an entity.
    3197 </t>
    3198 <t>
    3199    TRACE allows the client to see what is being received at the other
    3200    end of the request chain and use that data for testing or diagnostic
    3201    information. The value of the Via header field (<xref target="header.via"/>) is of
    3202    particular interest, since it acts as a trace of the request chain.
    3203    Use of the Max-Forwards header field allows the client to limit the
    3204    length of the request chain, which is useful for testing a chain of
    3205    proxies forwarding messages in an infinite loop.
    3206 </t>
    3207 <t>
    3208    If the request is valid, the response &SHOULD; contain the entire
    3209    request message in the entity-body, with a Content-Type of
    3210    "message/http". Responses to this method &MUST-NOT; be cached.
    3211 </t>
    3212 </section>
    3213 
    3214 <section title="CONNECT" anchor="CONNECT">
    3215   <iref primary="true" item="CONNECT method" x:for-anchor=""/>
    3216   <iref primary="true" item="Methods" subitem="CONNECT" x:for-anchor=""/>
    3217 <t>
    3218    This specification reserves the method name CONNECT for use with a
    3219    proxy that can dynamically switch to being a tunnel (e.g. SSL
    3220    tunneling <xref target="Luo1998"/>).
    3221 </t>
    3222 </section>
    3223 </section>
    3224 
    3225 
    3226 <section title="Status Code Definitions" anchor="status.codes">
    3227 <t>
    3228    Each Status-Code is described below, including a description of which
    3229    method(s) it can follow and any metainformation required in the
    3230    response.
    3231 </t>
    3232 
    3233 <section title="Informational 1xx" anchor="status.1xx">
    3234 <t>
    3235    This class of status code indicates a provisional response,
    3236    consisting only of the Status-Line and optional headers, and is
    3237    terminated by an empty line. There are no required headers for this
    3238    class of status code. Since HTTP/1.0 did not define any 1xx status
    3239    codes, servers &MUST-NOT; send a 1xx response to an HTTP/1.0 client
    3240    except under experimental conditions.
    3241 </t>
    3242 <t>
    3243    A client &MUST; be prepared to accept one or more 1xx status responses
    3244    prior to a regular response, even if the client does not expect a 100
    3245    (Continue) status message. Unexpected 1xx status responses &MAY; be
    3246    ignored by a user agent.
    3247 </t>
    3248 <t>
    3249    Proxies &MUST; forward 1xx responses, unless the connection between the
    3250    proxy and its client has been closed, or unless the proxy itself
    3251    requested the generation of the 1xx response. (For example, if a
    3252    proxy adds a "Expect: 100-continue" field when it forwards a request,
    3253    then it need not forward the corresponding 100 (Continue)
    3254    response(s).)
    3255 </t>
    3256 
    3257 <section title="100 Continue" anchor="status.100">
    3258   <iref primary="true" item="100 Continue (status code)" x:for-anchor=""/>
    3259   <iref primary="true" item="Status Codes" subitem="100 Continue" x:for-anchor=""/>
    3260 <t>
    3261    The client &SHOULD; continue with its request. This interim response is
    3262    used to inform the client that the initial part of the request has
    3263    been received and has not yet been rejected by the server. The client
    3264    &SHOULD; continue by sending the remainder of the request or, if the
    3265    request has already been completed, ignore this response. The server
    3266    &MUST; send a final response after the request has been completed. See
    3267    <xref target="use.of.the.100.status"/> for detailed discussion of the use and handling of this
    3268    status code.
    3269 </t>
    3270 </section>
    3271 
    3272 <section title="101 Switching Protocols" anchor="status.101">
    3273   <iref primary="true" item="101 Switching Protocols (status code)" x:for-anchor=""/>
    3274   <iref primary="true" item="Status Codes" subitem="101 Switching Protocols" x:for-anchor=""/>
    3275 <t>
    3276    The server understands and is willing to comply with the client's
    3277    request, via the Upgrade message header field (<xref target="header.upgrade"/>), for a
    3278    change in the application protocol being used on this connection. The
    3279    server will switch protocols to those defined by the response's
    3280    Upgrade header field immediately after the empty line which
    3281    terminates the 101 response.
    3282 </t>
    3283 <t>
    3284    The protocol &SHOULD; be switched only when it is advantageous to do
    3285    so. For example, switching to a newer version of HTTP is advantageous
    3286    over older versions, and switching to a real-time, synchronous
    3287    protocol might be advantageous when delivering resources that use
    3288    such features.
    3289 </t>
    3290 </section>
    3291 </section>
    3292 
    3293 <section title="Successful 2xx" anchor="status.2xx">
    3294 <t>
    3295    This class of status code indicates that the client's request was
    3296    successfully received, understood, and accepted.
    3297 </t>
    3298 
    3299 <section title="200 OK" anchor="status.200">
    3300   <iref primary="true" item="200 OK (status code)" x:for-anchor=""/>
    3301   <iref primary="true" item="Status Codes" subitem="200 OK" x:for-anchor=""/>
    3302 <t>
    3303    The request has succeeded. The information returned with the response
    3304    is dependent on the method used in the request, for example:
    3305   <list style="hanging">
    3306     <t hangText="GET">
    3307           an entity corresponding to the requested resource is sent in
    3308           the response;
    3309     </t>
    3310     <t hangText="HEAD">
    3311           the entity-header fields corresponding to the requested
    3312           resource are sent in the response without any message-body;
    3313     </t>
    3314     <t hangText="POST">
    3315       an entity describing or containing the result of the action;
    3316     </t>
    3317     <t hangText="TRACE">
    3318       an entity containing the request message as received by the
    3319       end server.
    3320     </t>
    3321   </list>
    3322 </t>
    3323 </section>
    3324 
    3325 <section title="201 Created" anchor="status.201">
    3326   <iref primary="true" item="201 Created (status code)" x:for-anchor=""/>
    3327   <iref primary="true" item="Status Codes" subitem="201 Created" x:for-anchor=""/>
    3328 <t>
    3329    The request has been fulfilled and resulted in a new resource being
    3330    created. The newly created resource can be referenced by the URI(s)
    3331    returned in the entity of the response, with the most specific URI
    3332    for the resource given by a Location header field. The response
    3333    &SHOULD; include an entity containing a list of resource
    3334    characteristics and location(s) from which the user or user agent can
    3335    choose the one most appropriate. The entity format is specified by
    3336    the media type given in the Content-Type header field. The origin
    3337    server &MUST; create the resource before returning the 201 status code.
    3338    If the action cannot be carried out immediately, the server &SHOULD;
    3339    respond with 202 (Accepted) response instead.
    3340 </t>
    3341 <t>
    3342    A 201 response &MAY; contain an ETag response header field indicating
    3343    the current value of the entity tag for the requested variant just
    3344    created, see <xref target="header.etag"/>.
    3345 </t>
    3346 </section>
    3347 
    3348 <section title="202 Accepted" anchor="status.202">
    3349   <iref primary="true" item="202 Accepted (status code)" x:for-anchor=""/>
    3350   <iref primary="true" item="Status Codes" subitem="202 Accepted" x:for-anchor=""/>
    3351 <t>
    3352    The request has been accepted for processing, but the processing has
    3353    not been completed.  The request might or might not eventually be
    3354    acted upon, as it might be disallowed when processing actually takes
    3355    place. There is no facility for re-sending a status code from an
    3356    asynchronous operation such as this.
    3357 </t>
    3358 <t>
    3359    The 202 response is intentionally non-committal. Its purpose is to
    3360    allow a server to accept a request for some other process (perhaps a
    3361    batch-oriented process that is only run once per day) without
    3362    requiring that the user agent's connection to the server persist
    3363    until the process is completed. The entity returned with this
    3364    response &SHOULD; include an indication of the request's current status
    3365    and either a pointer to a status monitor or some estimate of when the
    3366    user can expect the request to be fulfilled.
    3367 </t>
    3368 </section>
    3369 
    3370 <section title="203 Non-Authoritative Information" anchor="status.203">
    3371   <iref primary="true" item="203 Non-Authoritative Information (status code)" x:for-anchor=""/>
    3372   <iref primary="true" item="Status Codes" subitem="203 Non-Authoritative Information" x:for-anchor=""/>
    3373 <t>
    3374    The returned metainformation in the entity-header is not the
    3375    definitive set as available from the origin server, but is gathered
    3376    from a local or a third-party copy. The set presented &MAY; be a subset
    3377    or superset of the original version. For example, including local
    3378    annotation information about the resource might result in a superset
    3379    of the metainformation known by the origin server. Use of this
    3380    response code is not required and is only appropriate when the
    3381    response would otherwise be 200 (OK).
    3382 </t>
    3383 </section>
    3384 
    3385 <section title="204 No Content" anchor="status.204">
    3386   <iref primary="true" item="204 No Content (status code)" x:for-anchor=""/>
    3387   <iref primary="true" item="Status Codes" subitem="204 No Content" x:for-anchor=""/>
    3388 <t>
    3389    The server has fulfilled the request but does not need to return an
    3390    entity-body, and might want to return updated metainformation. The
    3391    response &MAY; include new or updated metainformation in the form of
    3392    entity-headers, which if present &SHOULD; be associated with the
    3393    requested variant.
    3394 </t>
    3395 <t>
    3396    If the client is a user agent, it &SHOULD-NOT;  change its document view
    3397    from that which caused the request to be sent. This response is
    3398    primarily intended to allow input for actions to take place without
    3399    causing a change to the user agent's active document view, although
    3400    any new or updated metainformation &SHOULD; be applied to the document
    3401    currently in the user agent's active view.
    3402 </t>
    3403 <t>
    3404    The 204 response &MUST-NOT; include a message-body, and thus is always
    3405    terminated by the first empty line after the header fields.
    3406 </t>
    3407 </section>
    3408 
    3409 <section title="205 Reset Content" anchor="status.205">
    3410   <iref primary="true" item="205 Reset Content (status code)" x:for-anchor=""/>
    3411   <iref primary="true" item="Status Codes" subitem="205 Reset Content" x:for-anchor=""/>
    3412 <t>
    3413    The server has fulfilled the request and the user agent &SHOULD; reset
    3414    the document view which caused the request to be sent. This response
    3415    is primarily intended to allow input for actions to take place via
    3416    user input, followed by a clearing of the form in which the input is
    3417    given so that the user can easily initiate another input action. The
    3418    response &MUST-NOT; include an entity.
    3419 </t>
    3420 </section>
    3421 
    3422 <section title="206 Partial Content" anchor="status.206">
    3423   <iref primary="true" item="206 Partial Content (status code)" x:for-anchor=""/>
    3424   <iref primary="true" item="Status Codes" subitem="206 Partial Content" x:for-anchor=""/>
    3425 <t>
    3426    The server has fulfilled the partial GET request for the resource.
    3427    The request &MUST; have included a Range header field (<xref target="header.range"/>)
    3428    indicating the desired range, and &MAY; have included an If-Range
    3429    header field (<xref target="header.if-range"/>) to make the request conditional.
    3430 </t>
    3431 <t>
    3432    The response &MUST; include the following header fields:
    3433   <list style="symbols">
    3434     <t>
    3435         Either a Content-Range header field (<xref target="header.content-range"/>) indicating
    3436         the range included with this response, or a multipart/byteranges
    3437         Content-Type including Content-Range fields for each part. If a
    3438         Content-Length header field is present in the response, its
    3439         value &MUST; match the actual number of OCTETs transmitted in the
    3440         message-body.
    3441     </t>
    3442     <t>
    3443         Date
    3444     </t>
    3445     <t>
    3446         ETag and/or Content-Location, if the header would have been sent
    3447         in a 200 response to the same request
    3448     </t>
    3449     <t>
    3450         Expires, Cache-Control, and/or Vary, if the field-value might
    3451         differ from that sent in any previous response for the same
    3452         variant
    3453     </t>
    3454   </list>
    3455 </t>
    3456 <t>
    3457    If the 206 response is the result of an If-Range request that used a
    3458    strong cache validator (see <xref target="weak.and.strong.validators"/>), the response &SHOULD-NOT;
    3459    include other entity-headers. If the response is the result of an
    3460    If-Range request that used a weak validator, the response &MUST-NOT;
    3461    include other entity-headers; this prevents inconsistencies between
    3462    cached entity-bodies and updated headers. Otherwise, the response
    3463    &MUST; include all of the entity-headers that would have been returned
    3464    with a 200 (OK) response to the same request.
    3465 </t>
    3466 <t>
    3467    A cache &MUST-NOT; combine a 206 response with other previously cached
    3468    content if the ETag or Last-Modified headers do not match exactly,
    3469    see <xref target="combining.byte.ranges" format="counter"/>.
    3470 </t>
    3471 <t>
    3472    A cache that does not support the Range and Content-Range headers
    3473    &MUST-NOT; cache 206 (Partial) responses.
    3474 </t>
    3475 </section>
    3476 </section>
    3477 
    3478 <section title="Redirection 3xx" anchor="status.3xx">
    3479 <t>
    3480    This class of status code indicates that further action needs to be
    3481    taken by the user agent in order to fulfill the request.  The action
    3482    required &MAY; be carried out by the user agent without interaction
    3483    with the user if and only if the method used in the second request is
    3484    GET or HEAD. A client &SHOULD; detect infinite redirection loops, since
    3485    such loops generate network traffic for each redirection.
    3486   <list><t>
    3487       <x:h>Note:</x:h> previous versions of this specification recommended a
    3488       maximum of five redirections. Content developers should be aware
    3489       that there might be clients that implement such a fixed
    3490       limitation.
    3491   </t></list>
    3492 </t>
    3493 
    3494 <section title="300 Multiple Choices" anchor="status.300">
    3495   <iref primary="true" item="300 Multiple Choices (status code)" x:for-anchor=""/>
    3496   <iref primary="true" item="Status Codes" subitem="300 Multiple Choices" x:for-anchor=""/>
    3497 <t>
    3498    The requested resource corresponds to any one of a set of
    3499    representations, each with its own specific location, and agent-driven
    3500    negotiation information (<xref target="content.negotiation"/>) is being provided so that
    3501    the user (or user agent) can select a preferred representation and
    3502    redirect its request to that location.
    3503 </t>
    3504 <t>
    3505    Unless it was a HEAD request, the response &SHOULD; include an entity
    3506    containing a list of resource characteristics and location(s) from
    3507    which the user or user agent can choose the one most appropriate. The
    3508    entity format is specified by the media type given in the Content-Type
    3509    header field. Depending upon the format and the capabilities of
    3510    the user agent, selection of the most appropriate choice &MAY; be
    3511    performed automatically. However, this specification does not define
    3512    any standard for such automatic selection.
    3513 </t>
    3514 <t>
    3515    If the server has a preferred choice of representation, it &SHOULD;
    3516    include the specific URI for that representation in the Location
    3517    field; user agents &MAY; use the Location field value for automatic
    3518    redirection. This response is cacheable unless indicated otherwise.
    3519 </t>
    3520 </section>
    3521 
    3522 <section title="301 Moved Permanently" anchor="status.301">
    3523   <iref primary="true" item="301 Moved Permanently (status code)" x:for-anchor=""/>
    3524   <iref primary="true" item="Status Codes" subitem="301 Moved Permanently" x:for-anchor=""/>
    3525 <t>
    3526    The requested resource has been assigned a new permanent URI and any
    3527    future references to this resource &SHOULD; use one of the returned
    3528    URIs.  Clients with link editing capabilities ought to automatically
    3529    re-link references to the Request-URI to one or more of the new
    3530    references returned by the server, where possible. This response is
    3531    cacheable unless indicated otherwise.
    3532 </t>
    3533 <t>
    3534    The new permanent URI &SHOULD; be given by the Location field in the
    3535    response. Unless the request method was HEAD, the entity of the
    3536    response &SHOULD; contain a short hypertext note with a hyperlink to
    3537    the new URI(s).
    3538 </t>
    3539 <t>
    3540    If the 301 status code is received in response to a request other
    3541    than GET or HEAD, the user agent &MUST-NOT; automatically redirect the
    3542    request unless it can be confirmed by the user, since this might
    3543    change the conditions under which the request was issued.
    3544   <list><t>
    3545       <x:h>Note:</x:h> When automatically redirecting a POST request after
    3546       receiving a 301 status code, some existing HTTP/1.0 user agents
    3547       will erroneously change it into a GET request.
    3548   </t></list>
    3549 </t>
    3550 </section>
    3551 
    3552 <section title="302 Found" anchor="status.302">
    3553   <iref primary="true" item="302 Found (status code)" x:for-anchor=""/>
    3554   <iref primary="true" item="Status Codes" subitem="302 Found" x:for-anchor=""/>
    3555 <t>
    3556    The requested resource resides temporarily under a different URI.
    3557    Since the redirection might be altered on occasion, the client &SHOULD;
    3558    continue to use the Request-URI for future requests.  This response
    3559    is only cacheable if indicated by a Cache-Control or Expires header
    3560    field.
    3561 </t>
    3562 <t>
    3563    The temporary URI &SHOULD; be given by the Location field in the
    3564    response. Unless the request method was HEAD, the entity of the
    3565    response &SHOULD; contain a short hypertext note with a hyperlink to
    3566    the new URI(s).
    3567 </t>
    3568 <t>
    3569    If the 302 status code is received in response to a request other
    3570    than GET or HEAD, the user agent &MUST-NOT; automatically redirect the
    3571    request unless it can be confirmed by the user, since this might
    3572    change the conditions under which the request was issued.
    3573   <list><t>
    3574       <x:h>Note:</x:h> RFC 1945 and RFC 2068 specify that the client is not allowed
    3575       to change the method on the redirected request.  However, most
    3576       existing user agent implementations treat 302 as if it were a 303
    3577       response, performing a GET on the Location field-value regardless
    3578       of the original request method. The status codes 303 and 307 have
    3579       been added for servers that wish to make unambiguously clear which
    3580       kind of reaction is expected of the client.
    3581   </t></list>
    3582 </t>
    3583 </section>
    3584 
    3585 <section title="303 See Other" anchor="status.303">
    3586   <iref primary="true" item="303 See Other (status code)" x:for-anchor=""/>
    3587   <iref primary="true" item="Status Codes" subitem="303 See Other" x:for-anchor=""/>
    3588 <t>
    3589    The response to the request can be found under a different URI and
    3590    &SHOULD; be retrieved using a GET method on that resource. This method
    3591    exists primarily to allow the output of a POST-activated script to
    3592    redirect the user agent to a selected resource. The new URI is not a
    3593    substitute reference for the originally requested resource. The 303
    3594    response &MUST-NOT; be cached, but the response to the second
    3595    (redirected) request might be cacheable.
    3596 </t>
    3597 <t>
    3598    The different URI &SHOULD; be given by the Location field in the
    3599    response. Unless the request method was HEAD, the entity of the
    3600    response &SHOULD; contain a short hypertext note with a hyperlink to
    3601    the new URI(s).
    3602   <list><t>
    3603       <x:h>Note:</x:h> Many pre-HTTP/1.1 user agents do not understand the 303
    3604       status. When interoperability with such clients is a concern, the
    3605       302 status code may be used instead, since most user agents react
    3606       to a 302 response as described here for 303.
    3607   </t></list>
    3608 </t>
    3609 </section>
    3610 
    3611 <section title="304 Not Modified" anchor="status.304">
    3612   <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/>
    3613   <iref primary="true" item="Status Codes" subitem="304 Not Modified" x:for-anchor=""/>
    3614 <t>
    3615    If the client has performed a conditional GET request and access is
    3616    allowed, but the document has not been modified, the server &SHOULD;
    3617    respond with this status code. The 304 response &MUST-NOT; contain a
    3618    message-body, and thus is always terminated by the first empty line
    3619    after the header fields.
    3620 </t>
    3621 <t>
    3622    The response &MUST; include the following header fields:
    3623   <list style="symbols">
    3624     <t>Date, unless its omission is required by <xref target="clockless.origin.server.operation"/></t>
    3625   </list>
    3626 </t>
    3627 <t>
    3628    If a clockless origin server obeys these rules, and proxies and
    3629    clients add their own Date to any response received without one (as
    3630    already specified by [RFC 2068], section <xref target="RFC2068" x:sec="14.19" x:fmt="number"/>), caches will operate
    3631    correctly.
    3632   <list style="symbols">
    3633     <t>ETag and/or Content-Location, if the header would have been sent
    3634         in a 200 response to the same request</t>
    3635     <t>Expires, Cache-Control, and/or Vary, if the field-value might
    3636         differ from that sent in any previous response for the same
    3637         variant</t>
    3638   </list>
    3639 </t>
    3640 <t>
    3641    If the conditional GET used a strong cache validator (see <xref target="weak.and.strong.validators"/>),
    3642    the response &SHOULD-NOT;  include other entity-headers.
    3643    Otherwise (i.e., the conditional GET used a weak validator), the
    3644    response &MUST-NOT; include other entity-headers; this prevents
    3645    inconsistencies between cached entity-bodies and updated headers.
    3646 </t>
    3647 <t>
    3648    If a 304 response indicates an entity not currently cached, then the
    3649    cache &MUST; disregard the response and repeat the request without the
    3650    conditional.
    3651 </t>
    3652 <t>
    3653    If a cache uses a received 304 response to update a cache entry, the
    3654    cache &MUST; update the entry to reflect any new field values given in
    3655    the response.
    3656 </t>
    3657 </section>
    3658 
    3659 <section title="305 Use Proxy" anchor="status.305">
    3660   <iref primary="true" item="305 Use Proxy (status code)" x:for-anchor=""/>
    3661   <iref primary="true" item="Status Codes" subitem="305 Use Proxy" x:for-anchor=""/>
    3662 <t>
    3663    The requested resource &MUST; be accessed through the proxy given by
    3664    the Location field. The Location field gives the URI of the proxy.
    3665    The recipient is expected to repeat this single request via the
    3666    proxy. 305 responses &MUST; only be generated by origin servers.
    3667   <list><t>
    3668       <x:h>Note:</x:h> RFC 2068 was not clear that 305 was intended to redirect a
    3669       single request, and to be generated by origin servers only.  Not
    3670       observing these limitations has significant security consequences.
    3671   </t></list>
    3672 </t>
    3673 </section>
    3674 
    3675 <section title="306 (Unused)" anchor="status.306">
    3676   <iref primary="true" item="306 (Unused) (status code)" x:for-anchor=""/>
    3677   <iref primary="true" item="Status Codes" subitem="306 (Unused)" x:for-anchor=""/>
    3678 <t>
    3679    The 306 status code was used in a previous version of the
    3680    specification, is no longer used, and the code is reserved.
    3681 </t>
    3682 </section>
    3683 
    3684 <section title="307 Temporary Redirect" anchor="status.307">
    3685   <iref primary="true" item="307 Temporary Redirect (status code)" x:for-anchor=""/>
    3686   <iref primary="true" item="Status Codes" subitem="307 Temporary Redirect" x:for-anchor=""/>
    3687 <t>
    3688    The requested resource resides temporarily under a different URI.
    3689    Since the redirection &MAY; be altered on occasion, the client &SHOULD;
    3690    continue to use the Request-URI for future requests.  This response
    3691    is only cacheable if indicated by a Cache-Control or Expires header
    3692    field.
    3693 </t>
    3694 <t>
    3695    The temporary URI &SHOULD; be given by the Location field in the
    3696    response. Unless the request method was HEAD, the entity of the
    3697    response &SHOULD; contain a short hypertext note with a hyperlink to
    3698    the new URI(s) , since many pre-HTTP/1.1 user agents do not
    3699    understand the 307 status. Therefore, the note &SHOULD; contain the
    3700    information necessary for a user to repeat the original request on
    3701    the new URI.
    3702 </t>
    3703 <t>
    3704    If the 307 status code is received in response to a request other
    3705    than GET or HEAD, the user agent &MUST-NOT; automatically redirect the
    3706    request unless it can be confirmed by the user, since this might
    3707    change the conditions under which the request was issued.
    3708 </t>
    3709 </section>
    3710 </section>
    3711 
    3712 <section title="Client Error 4xx" anchor="status.4xx">
    3713 <t>
    3714    The 4xx class of status code is intended for cases in which the
    3715    client seems to have erred. Except when responding to a HEAD request,
    3716    the server &SHOULD; include an entity containing an explanation of the
    3717    error situation, and whether it is a temporary or permanent
    3718    condition. These status codes are applicable to any request method.
    3719    User agents &SHOULD; display any included entity to the user.
    3720 </t>
    3721 <t>
    3722    If the client is sending data, a server implementation using TCP
    3723    &SHOULD; be careful to ensure that the client acknowledges receipt of
    3724    the packet(s) containing the response, before the server closes the
    3725    input connection. If the client continues sending data to the server
    3726    after the close, the server's TCP stack will send a reset packet to
    3727    the client, which may erase the client's unacknowledged input buffers
    3728    before they can be read and interpreted by the HTTP application.
    3729 </t>
    3730 
    3731 <section title="400 Bad Request" anchor="status.400">
    3732   <iref primary="true" item="400 Bad Request (status code)" x:for-anchor=""/>
    3733   <iref primary="true" item="Status Codes" subitem="400 Bad Request" x:for-anchor=""/>
    3734 <t>
    3735    The request could not be understood by the server due to malformed
    3736    syntax. The client &SHOULD-NOT;  repeat the request without
    3737    modifications.
    3738 </t>
    3739 </section>
    3740 
    3741 <section title="401 Unauthorized" anchor="status.401">
    3742   <iref primary="true" item="401 Unauthorized (status code)" x:for-anchor=""/>
    3743   <iref primary="true" item="Status Codes" subitem="401 Unauthorized" x:for-anchor=""/>
    3744 <t>
    3745    The request requires user authentication. The response &MUST; include a
    3746    WWW-Authenticate header field (<xref target="header.www-authenticate"/>) containing a challenge
    3747    applicable to the requested resource. The client &MAY; repeat the
    3748    request with a suitable Authorization header field (<xref target="header.authorization"/>). If
    3749    the request already included Authorization credentials, then the 401
    3750    response indicates that authorization has been refused for those
    3751    credentials. If the 401 response contains the same challenge as the
    3752    prior response, and the user agent has already attempted
    3753    authentication at least once, then the user &SHOULD; be presented the
    3754    entity that was given in the response, since that entity might
    3755    include relevant diagnostic information. HTTP access authentication
    3756    is explained in "HTTP Authentication: Basic and Digest Access
    3757    Authentication" <xref target="RFC2617"/>.
    3758 </t>
    3759 </section>
    3760 
    3761 <section title="402 Payment Required" anchor="status.402">
    3762   <iref primary="true" item="402 Payment Required (status code)" x:for-anchor=""/>
    3763   <iref primary="true" item="Status Codes" subitem="402 Payment Required" x:for-anchor=""/>
    3764 <t>
    3765    This code is reserved for future use.
    3766 </t>
    3767 </section>
    3768 
    3769 <section title="403 Forbidden" anchor="status.403">
    3770   <iref primary="true" item="403 Forbidden (status code)" x:for-anchor=""/>
    3771   <iref primary="true" item="Status Codes" subitem="403 Forbidden" x:for-anchor=""/>
    3772 <t>
    3773    The server understood the request, but is refusing to fulfill it.
    3774    Authorization will not help and the request &SHOULD-NOT;  be repeated.
    3775    If the request method was not HEAD and the server wishes to make
    3776    public why the request has not been fulfilled, it &SHOULD; describe the
    3777    reason for the refusal in the entity.  If the server does not wish to
    3778    make this information available to the client, the status code 404
    3779    (Not Found) can be used instead.
    3780 </t>
    3781 </section>
    3782 
    3783 <section title="404 Not Found" anchor="status.404">
    3784   <iref primary="true" item="404 Not Found (status code)" x:for-anchor=""/>
    3785   <iref primary="true" item="Status Codes" subitem="404 Not Found" x:for-anchor=""/>
    3786 <t>
    3787    The server has not found anything matching the Request-URI. No
    3788    indication is given of whether the condition is temporary or
    3789    permanent. The 410 (Gone) status code &SHOULD; be used if the server
    3790    knows, through some internally configurable mechanism, that an old
    3791    resource is permanently unavailable and has no forwarding address.
    3792    This status code is commonly used when the server does not wish to
    3793    reveal exactly why the request has been refused, or when no other
    3794    response is applicable.
    3795 </t>
    3796 </section>
    3797 
    3798 <section title="405 Method Not Allowed" anchor="status.405">
    3799   <iref primary="true" item="405 Method Not Allowed (status code)" x:for-anchor=""/>
    3800   <iref primary="true" item="Status Codes" subitem="405 Method Not Allowed" x:for-anchor=""/>
    3801 <t>
    3802    The method specified in the Request-Line is not allowed for the
    3803    resource identified by the Request-URI. The response &MUST; include an
    3804    Allow header containing a list of valid methods for the requested
    3805    resource.
    3806 </t>
    3807 </section>
    3808 
    3809 <section title="406 Not Acceptable" anchor="status.406">
    3810   <iref primary="true" item="406 Not Acceptable (status code)" x:for-anchor=""/>
    3811   <iref primary="true" item="Status Codes" subitem="406 Not Acceptable" x:for-anchor=""/>
    3812 <t>
    3813    The resource identified by the request is only capable of generating
    3814    response entities which have content characteristics not acceptable
    3815    according to the accept headers sent in the request.
    3816 </t>
    3817 <t>
    3818    Unless it was a HEAD request, the response &SHOULD; include an entity
    3819    containing a list of available entity characteristics and location(s)
    3820    from which the user or user agent can choose the one most
    3821    appropriate. The entity format is specified by the media type given
    3822    in the Content-Type header field. Depending upon the format and the
    3823    capabilities of the user agent, selection of the most appropriate
    3824    choice &MAY; be performed automatically. However, this specification
    3825    does not define any standard for such automatic selection.
    3826   <list><t>
    3827       <x:h>Note:</x:h> HTTP/1.1 servers are allowed to return responses which are
    3828       not acceptable according to the accept headers sent in the
    3829       request. In some cases, this may even be preferable to sending a
    3830       406 response. User agents are encouraged to inspect the headers of
    3831       an incoming response to determine if it is acceptable.
    3832   </t></list>
    3833 </t>
    3834 <t>
    3835    If the response could be unacceptable, a user agent &SHOULD;
    3836    temporarily stop receipt of more data and query the user for a
    3837    decision on further actions.
    3838 </t>
    3839 </section>
    3840 
    3841 <section title="407 Proxy Authentication Required" anchor="status.407">
    3842   <iref primary="true" item="407 Proxy Authentication Required (status code)" x:for-anchor=""/>
    3843   <iref primary="true" item="Status Codes" subitem="407 Proxy Authentication Required" x:for-anchor=""/>
    3844 <t>
    3845    This code is similar to 401 (Unauthorized), but indicates that the
    3846    client must first authenticate itself with the proxy. The proxy &MUST;
    3847    return a Proxy-Authenticate header field (<xref target="header.proxy-authenticate"/>) containing a
    3848    challenge applicable to the proxy for the requested resource. The
    3849    client &MAY; repeat the request with a suitable Proxy-Authorization
    3850    header field (<xref target="header.proxy-authorization"/>). HTTP access authentication is explained
    3851    in "HTTP Authentication: Basic and Digest Access Authentication"
    3852    <xref target="RFC2617"/>.
    3853 </t>
    3854 </section>
    3855 
    3856 <section title="408 Request Timeout" anchor="status.408">
    3857   <iref primary="true" item="408 Request Timeout (status code)" x:for-anchor=""/>
    3858   <iref primary="true" item="Status Codes" subitem="408 Request Timeout" x:for-anchor=""/>
    3859 <t>
    3860    The client did not produce a request within the time that the server
    3861    was prepared to wait. The client &MAY; repeat the request without
    3862    modifications at any later time.
    3863 </t>
    3864 </section>
    3865 
    3866 <section title="409 Conflict" anchor="status.409">
    3867   <iref primary="true" item="409 Conflict (status code)" x:for-anchor=""/>
    3868   <iref primary="true" item="Status Codes" subitem="409 Conflict" x:for-anchor=""/>
    3869 <t>
    3870    The request could not be completed due to a conflict with the current
    3871    state of the resource. This code is only allowed in situations where
    3872    it is expected that the user might be able to resolve the conflict
    3873    and resubmit the request. The response body &SHOULD; include enough
    3874    information for the user to recognize the source of the conflict.
    3875    Ideally, the response entity would include enough information for the
    3876    user or user agent to fix the problem; however, that might not be
    3877    possible and is not required.
    3878 </t>
    3879 <t>
    3880    Conflicts are most likely to occur in response to a PUT request. For
    3881    example, if versioning were being used and the entity being PUT
    3882    included changes to a resource which conflict with those made by an
    3883    earlier (third-party) request, the server might use the 409 response
    3884    to indicate that it can't complete the request. In this case, the
    3885    response entity would likely contain a list of the differences
    3886    between the two versions in a format defined by the response
    3887    Content-Type.
    3888 </t>
    3889 </section>
    3890 
    3891 <section title="410 Gone" anchor="status.410">
    3892   <iref primary="true" item="410 Gone (status code)" x:for-anchor=""/>
    3893   <iref primary="true" item="Status Codes" subitem="410 Gone" x:for-anchor=""/>
    3894 <t>
    3895    The requested resource is no longer available at the server and no
    3896    forwarding address is known. This condition is expected to be
    3897    considered permanent. Clients with link editing capabilities &SHOULD;
    3898    delete references to the Request-URI after user approval. If the
    3899    server does not know, or has no facility to determine, whether or not
    3900    the condition is permanent, the status code 404 (Not Found) &SHOULD; be
    3901    used instead. This response is cacheable unless indicated otherwise.
    3902 </t>
    3903 <t>
    3904    The 410 response is primarily intended to assist the task of web
    3905    maintenance by notifying the recipient that the resource is
    3906    intentionally unavailable and that the server owners desire that
    3907    remote links to that resource be removed. Such an event is common for
    3908    limited-time, promotional services and for resources belonging to
    3909    individuals no longer working at the server's site. It is not
    3910    necessary to mark all permanently unavailable resources as "gone" or
    3911    to keep the mark for any length of time -- that is left to the
    3912    discretion of the server owner.
    3913 </t>
    3914 </section>
    3915 
    3916 <section title="411 Length Required" anchor="status.411">
    3917   <iref primary="true" item="411 Length Required (status code)" x:for-anchor=""/>
    3918   <iref primary="true" item="Status Codes" subitem="411 Length Required" x:for-anchor=""/>
    3919 <t>
    3920    The server refuses to accept the request without a defined Content-Length.
    3921    The client &MAY; repeat the request if it adds a valid
    3922    Content-Length header field containing the length of the message-body
    3923    in the request message.
    3924 </t>
    3925 </section>
    3926 
    3927 <section title="412 Precondition Failed" anchor="status.412">
    3928   <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/>
    3929   <iref primary="true" item="Status Codes" subitem="412 Precondition Failed" x:for-anchor=""/>
    3930 <t>
    3931    The precondition given in one or more of the request-header fields
    3932    evaluated to false when it was tested on the server. This response
    3933    code allows the client to place preconditions on the current resource
    3934    metainformation (header field data) and thus prevent the requested
    3935    method from being applied to a resource other than the one intended.
    3936 </t>
    3937 </section>
    3938 
    3939 <section title="413 Request Entity Too Large" anchor="status.413">
    3940   <iref primary="true" item="413 Request Entity Too Large (status code)" x:for-anchor=""/>
    3941   <iref primary="true" item="Status Codes" subitem="413 Request Entity Too Large" x:for-anchor=""/>
    3942 <t>
    3943    The server is refusing to process a request because the request
    3944    entity is larger than the server is willing or able to process. The
    3945    server &MAY; close the connection to prevent the client from continuing
    3946    the request.
    3947 </t>
    3948 <t>
    3949    If the condition is temporary, the server &SHOULD; include a Retry-After
    3950    header field to indicate that it is temporary and after what
    3951    time the client &MAY; try again.
    3952 </t>
    3953 </section>
    3954 
    3955 <section title="414 Request-URI Too Long" anchor="status.414">
    3956   <iref primary="true" item="414 Request-URI Too Long (status code)" x:for-anchor=""/>
    3957   <iref primary="true" item="Status Codes" subitem="414 Request-URI Too Long" x:for-anchor=""/>
    3958 <t>
    3959    The server is refusing to service the request because the Request-URI
    3960    is longer than the server is willing to interpret. This rare
    3961    condition is only likely to occur when a client has improperly
    3962    converted a POST request to a GET request with long query
    3963    information, when the client has descended into a URI "black hole" of
    3964    redirection (e.g., a redirected URI prefix that points to a suffix of
    3965    itself), or when the server is under attack by a client attempting to
    3966    exploit security holes present in some servers using fixed-length
    3967    buffers for reading or manipulating the Request-URI.
    3968 </t>
    3969 </section>
    3970 
    3971 <section title="415 Unsupported Media Type" anchor="status.415">
    3972   <iref primary="true" item="415 Unsupported Media Type (status code)" x:for-anchor=""/>
    3973   <iref primary="true" item="Status Codes" subitem="415 Unsupported Media Type" x:for-anchor=""/>
    3974 <t>
    3975    The server is refusing to service the request because the entity of
    3976    the request is in a format not supported by the requested resource
    3977    for the requested method.
    3978 </t>
    3979 </section>
    3980 
    3981 <section title="416 Requested Range Not Satisfiable" anchor="status.416">
    3982   <iref primary="true" item="416 Requested Range Not Satisfiable (status code)" x:for-anchor=""/>
    3983   <iref primary="true" item="Status Codes" subitem="416 Requested Range Not Satisfiable" x:for-anchor=""/>
    3984 <t>
    3985    A server &SHOULD; return a response with this status code if a request
    3986    included a Range request-header field (<xref target="header.range"/>), and none of
    3987    the range-specifier values in this field overlap the current extent
    3988    of the selected resource, and the request did not include an If-Range
    3989    request-header field. (For byte-ranges, this means that the first-byte-pos
    3990    of all of the byte-range-spec values were greater than the
    3991    current length of the selected resource.)
    3992 </t>
    3993 <t>
    3994    When this status code is returned for a byte-range request, the
    3995    response &SHOULD; include a Content-Range entity-header field
    3996    specifying the current length of the selected resource (see <xref target="header.content-range"/>).
    3997    This response &MUST-NOT; use the multipart/byteranges content-type.
    3998 </t>
    3999 </section>
    4000 
    4001 <section title="417 Expectation Failed" anchor="status.417">
    4002   <iref primary="true" item="417 Expectation Failed (status code)" x:for-anchor=""/>
    4003   <iref primary="true" item="Status Codes" subitem="417 Expectation Failed" x:for-anchor=""/>
    4004 <t>
    4005    The expectation given in an Expect request-header field (see <xref target="header.expect"/>)
    4006    could not be met by this server, or, if the server is a proxy,
    4007    the server has unambiguous evidence that the request could not be met
    4008    by the next-hop server.
    4009 </t>
    4010 </section>
    4011 </section>
    4012 
    4013 <section title="Server Error 5xx" anchor="status.5xx">
    4014 <t>
    4015    Response status codes beginning with the digit "5" indicate cases in
    4016    which the server is aware that it has erred or is incapable of
    4017    performing the request. Except when responding to a HEAD request, the
    4018    server &SHOULD; include an entity containing an explanation of the
    4019    error situation, and whether it is a temporary or permanent
    4020    condition. User agents &SHOULD; display any included entity to the
    4021    user. These response codes are applicable to any request method.
    4022 </t>
    4023 
    4024 <section title="500 Internal Server Error" anchor="status.500">
    4025   <iref primary="true" item="500 Internal Server Error (status code)" x:for-anchor=""/>
    4026   <iref primary="true" item="Status Codes" subitem="500 Internal Server Error" x:for-anchor=""/>
    4027 <t>
    4028    The server encountered an unexpected condition which prevented it
    4029    from fulfilling the request.
    4030 </t>
    4031 </section>
    4032 
    4033 <section title="501 Not Implemented" anchor="status.501">
    4034   <iref primary="true" item="501 Not Implemented (status code)" x:for-anchor=""/>
    4035   <iref primary="true" item="Status Codes" subitem="501 Not Implemented" x:for-anchor=""/>
    4036 <t>
    4037    The server does not support the functionality required to fulfill the
    4038    request. This is the appropriate response when the server does not
    4039    recognize the request method and is not capable of supporting it for
    4040    any resource.
    4041 </t>
    4042 </section>
    4043 
    4044 <section title="502 Bad Gateway" anchor="status.502">
    4045   <iref primary="true" item="502 Bad Gateway (status code)" x:for-anchor=""/>
    4046   <iref primary="true" item="Status Codes" subitem="502 Bad Gateway" x:for-anchor=""/>
    4047 <t>
    4048    The server, while acting as a gateway or proxy, received an invalid
    4049    response from the upstream server it accessed in attempting to
    4050    fulfill the request.
    4051 </t>
    4052 </section>
    4053 
    4054 <section title="503 Service Unavailable" anchor="status.503">
    4055   <iref primary="true" item="503 Service Unavailable (status code)" x:for-anchor=""/>
    4056   <iref primary="true" item="Status Codes" subitem="503 Service Unavailable" x:for-anchor=""/>
    4057 <t>
    4058    The server is currently unable to handle the request due to a
    4059    temporary overloading or maintenance of the server. The implication
    4060    is that this is a temporary condition which will be alleviated after
    4061    some delay. If known, the length of the delay &MAY; be indicated in a
    4062    Retry-After header. If no Retry-After is given, the client &SHOULD;
    4063    handle the response as it would for a 500 response.
    4064   <list><t>
    4065       <x:h>Note:</x:h> The existence of the 503 status code does not imply that a
    4066       server must use it when becoming overloaded. Some servers may wish
    4067       to simply refuse the connection.
    4068   </t></list>
    4069 </t>
    4070 </section>
    4071 
    4072 <section title="504 Gateway Timeout" anchor="status.504">
    4073   <iref primary="true" item="504 Gateway Timeout (status code)" x:for-anchor=""/>
    4074   <iref primary="true" item="Status Codes" subitem="504 Gateway Timeout" x:for-anchor=""/>
    4075 <t>
    4076    The server, while acting as a gateway or proxy, did not receive a
    4077    timely response from the upstream server specified by the URI (e.g.
    4078    HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed
    4079    to access in attempting to complete the request.
    4080   <list><t>
    4081       <x:h>Note:</x:h> Note to implementors: some deployed proxies are known to
    4082       return 400 or 500 when DNS lookups time out.
    4083   </t></list>
    4084 </t>
    4085 </section>
    4086 
    4087 <section title="505 HTTP Version Not Supported" anchor="status.505">
    4088   <iref primary="true" item="505 HTTP Version Not Supported (status code)" x:for-anchor=""/>
    4089   <iref primary="true" item="Status Codes" subitem="505 HTTP Version Not Supported" x:for-anchor=""/>
    4090 <t>
    4091    The server does not support, or refuses to support, the HTTP protocol
    4092    version that was used in the request message. The server is
    4093    indicating that it is unable or unwilling to complete the request
    4094    using the same major version as the client, as described in <xref target="http.version"/>,
    4095    other than with this error message. The response &SHOULD; contain
    4096    an entity describing why that version is not supported and what other
    4097    protocols are supported by that server.
    4098 </t>
    4099 
    4100 </section>
    4101 </section>
    4102 </section>
    4103 
    4104 
    4105 <section title="Access Authentication" anchor="access.authentication">
    4106 <t>
    4107    HTTP provides several &OPTIONAL; challenge-response authentication
    4108 
    4109    mechanisms which can be used by a server to challenge a client
    4110    request and by a client to provide authentication information. The
    4111    general framework for access authentication, and the specification of
    4112    "basic" and "digest" authentication, are specified in "HTTP
    4113    Authentication: Basic and Digest Access Authentication" <xref target="RFC2617"/>. This
    4114    specification adopts the definitions of "challenge" and "credentials"
    4115    from that specification.
    4116 </t>
    4117 </section>
    4118 
    4119 <section title="Content Negotiation" anchor="content.negotiation">
    4120 <t>
    4121    Most HTTP responses include an entity which contains information for
    4122    interpretation by a human user. Naturally, it is desirable to supply
    4123    the user with the "best available" entity corresponding to the
    4124    request. Unfortunately for servers and caches, not all users have the
    4125    same preferences for what is "best," and not all user agents are
    4126    equally capable of rendering all entity types. For that reason, HTTP
    4127    has provisions for several mechanisms for "content negotiation" --
    4128    the process of selecting the best representation for a given response
    4129    when there are multiple representations available.
    4130   <list><t>
    4131       <x:h>Note:</x:h> This is not called "format negotiation" because the
    4132       alternate representations may be of the same media type, but use
    4133       different capabilities of that type, be in different languages,
    4134       etc.
    4135   </t></list>
    4136 </t>
    4137 <t>
    4138    Any response containing an entity-body &MAY; be subject to negotiation,
    4139    including error responses.
    4140 </t>
    4141 <t>
    4142    There are two kinds of content negotiation which are possible in
    4143    HTTP: server-driven and agent-driven negotiation. These two kinds of
    4144    negotiation are orthogonal and thus may be used separately or in
    4145    combination. One method of combination, referred to as transparent
    4146    negotiation, occurs when a cache uses the agent-driven negotiation
    4147    information provided by the origin server in order to provide
    4148    server-driven negotiation for subsequent requests.
    4149 </t>
    4150 
    4151 <section title="Server-driven Negotiation" anchor="server-driven.negotiation">
    4152 <t>
    4153    If the selection of the best representation for a response is made by
    4154    an algorithm located at the server, it is called server-driven
    4155    negotiation. Selection is based on the available representations of
    4156    the response (the dimensions over which it can vary; e.g. language,
    4157    content-coding, etc.) and the contents of particular header fields in
    4158    the request message or on other information pertaining to the request
    4159    (such as the network address of the client).
    4160 </t>
    4161 <t>
    4162    Server-driven negotiation is advantageous when the algorithm for
    4163    selecting from among the available representations is difficult to
    4164    describe to the user agent, or when the server desires to send its
    4165    "best guess" to the client along with the first response (hoping to
    4166    avoid the round-trip delay of a subsequent request if the "best
    4167    guess" is good enough for the user). In order to improve the server's
    4168    guess, the user agent &MAY; include request header fields (Accept,
    4169    Accept-Language, Accept-Encoding, etc.) which describe its
    4170    preferences for such a response.
    4171 </t>
    4172 <t>
    4173    Server-driven negotiation has disadvantages:
    4174   <list style="numbers">
    4175     <t>
    4176          It is impossible for the server to accurately determine what
    4177          might be "best" for any given user, since that would require
    4178          complete knowledge of both the capabilities of the user agent
    4179          and the intended use for the response (e.g., does the user want
    4180          to view it on screen or print it on paper?).
    4181     </t>
    4182     <t>
    4183          Having the user agent describe its capabilities in every
    4184          request can be both very inefficient (given that only a small
    4185          percentage of responses have multiple representations) and a
    4186          potential violation of the user's privacy.
    4187     </t>
    4188     <t>
    4189          It complicates the implementation of an origin server and the
    4190          algorithms for generating responses to a request.
    4191     </t>
    4192     <t>
    4193          It may limit a public cache's ability to use the same response
    4194          for multiple user's requests.
    4195     </t>
    4196   </list>
    4197 </t>
    4198 <t>
    4199    HTTP/1.1 includes the following request-header fields for enabling
    4200    server-driven negotiation through description of user agent
    4201    capabilities and user preferences: Accept (<xref target="header.accept"/>), Accept-Charset
    4202    (<xref target="header.accept-charset"/>), Accept-Encoding (<xref target="header.accept-encoding"/>), Accept-Language
    4203    (<xref target="header.accept-language"/>), and User-Agent (<xref target="header.user-agent"/>). However, an
    4204    origin server is not limited to these dimensions and &MAY; vary the
    4205    response based on any aspect of the request, including information
    4206    outside the request-header fields or within extension header fields
    4207    not defined by this specification.
    4208 </t>
    4209 <t>
    4210    The Vary  header field can be used to express the parameters the
    4211    server uses to select a representation that is subject to server-driven
    4212    negotiation. See <xref target="caching.negotiated.responses"/> for use of the Vary header field
    4213    by caches and <xref target="header.vary"/> for use of the Vary header field by
    4214    servers.
    4215 </t>
    4216 </section>
    4217 
    4218 <section title="Agent-driven Negotiation" anchor="agent-driven.negotiation">
    4219 <t>
    4220    With agent-driven negotiation, selection of the best representation
    4221    for a response is performed by the user agent after receiving an
    4222    initial response from the origin server. Selection is based on a list
    4223    of the available representations of the response included within the
    4224    header fields or entity-body of the initial response, with each
    4225    representation identified by its own URI. Selection from among the
    4226    representations may be performed automatically (if the user agent is
    4227    capable of doing so) or manually by the user selecting from a
    4228    generated (possibly hypertext) menu.
    4229 </t>
    4230 <t>
    4231    Agent-driven negotiation is advantageous when the response would vary
    4232    over commonly-used dimensions (such as type, language, or encoding),
    4233    when the origin server is unable to determine a user agent's
    4234    capabilities from examining the request, and generally when public
    4235    caches are used to distribute server load and reduce network usage.
    4236 </t>
    4237 <t>
    4238    Agent-driven negotiation suffers from the disadvantage of needing a
    4239    second request to obtain the best alternate representation. This
    4240    second request is only efficient when caching is used. In addition,
    4241    this specification does not define any mechanism for supporting
    4242    automatic selection, though it also does not prevent any such
    4243    mechanism from being developed as an extension and used within
    4244    HTTP/1.1.
    4245 </t>
    4246 <t>
    4247    HTTP/1.1 defines the 300 (Multiple Choices) and 406 (Not Acceptable)
    4248    status codes for enabling agent-driven negotiation when the server is
    4249    unwilling or unable to provide a varying response using server-driven
    4250    negotiation.
    4251 </t>
    4252 </section>
    4253 
    4254 <section title="Transparent Negotiation" anchor="transparent.negotiation">
    4255 <t>
    4256    Transparent negotiation is a combination of both server-driven and
    4257    agent-driven negotiation. When a cache is supplied with a form of the
    4258    list of available representations of the response (as in agent-driven
    4259    negotiation) and the dimensions of variance are completely understood
    4260    by the cache, then the cache becomes capable of performing server-driven
    4261    negotiation on behalf of the origin server for subsequent
    4262    requests on that resource.
    4263 </t>
    4264 <t>
    4265    Transparent negotiation has the advantage of distributing the
    4266    negotiation work that would otherwise be required of the origin
    4267    server and also removing the second request delay of agent-driven
    4268    negotiation when the cache is able to correctly guess the right
    4269    response.
    4270 </t>
    4271 <t>
    4272    This specification does not define any mechanism for transparent
    4273    negotiation, though it also does not prevent any such mechanism from
    4274    being developed as an extension that could be used within HTTP/1.1.
    4275 </t>
    4276 </section>
    4277 </section>
    4278 
    4279 
    4280316<section title="Caching in HTTP" anchor="caching">
    4281 
     317<section title="Overview" anchor="caching.overview">
    4282318<t>
    4283319   HTTP is typically used for distributed information systems, where
     
    4344380</t>
    4345381
    4346 <section title="">
    4347 
    4348382<section title="Cache Correctness" anchor="cache.correctness">
    4349383<t>
     
    4643677   HTTP/1.1 requires origin servers to send a Date header, if possible,
    4644678   with every response, giving the time at which the response was
    4645    generated (see <xref target="header.date"/>). We use the term "date_value" to denote
     679   generated (see &header-date;). We use the term "date_value" to denote
    4646680   the value of the Date header, in a form appropriate for arithmetic
    4647681   operations.
     
    4901935<t>
    4902936   The server then checks that validator against the current validator
    4903    for the entity, and, if they match (see <xref target="weak.and.strong.validators"/>), it responds
     937   for the entity, and, if they match (see &weak-and-strong-validators;), it responds
    4904938   with a special status code (usually, 304 (Not Modified)) and no
    4905939   entity-body. Otherwise, it returns a full response (including
     
    4946980</t>
    4947981<t>
    4948    Entity Tags are described in <xref target="entity.tags"/>. The headers used with
    4949    entity tags are described in sections <xref target="header.etag" format="counter"/>,
    4950    <xref target="header.if-match" format="counter"/>, <xref target="header.if-none-match" format="counter"/>
    4951    and <xref target="header.vary" format="counter"/>.
    4952 </t>
    4953 </section>
    4954 
    4955 <section title="Weak and Strong Validators" anchor="weak.and.strong.validators">
    4956 <t>
    4957    Since both origin servers and caches will compare two validators to
    4958    decide if they represent the same or different entities, one normally
    4959    would expect that if the entity (the entity-body or any entity-headers)
    4960    changes in any way, then the associated validator would
    4961    change as well. If this is true, then we call this validator a
    4962    "strong validator."
    4963 </t>
    4964 <t>
    4965    However, there might be cases when a server prefers to change the
    4966    validator only on semantically significant changes, and not when
    4967    insignificant aspects of the entity change. A validator that does not
    4968    always change when the resource changes is a "weak validator."
    4969 </t>
    4970 <t>
    4971    Entity tags are normally "strong validators," but the protocol
    4972    provides a mechanism to tag an entity tag as "weak." One can think of
    4973    a strong validator as one that changes whenever the bits of an entity
    4974    changes, while a weak value changes whenever the meaning of an entity
    4975    changes. Alternatively, one can think of a strong validator as part
    4976    of an identifier for a specific entity, while a weak validator is
    4977    part of an identifier for a set of semantically equivalent entities.
    4978   <list><t>
    4979       <x:h>Note:</x:h> One example of a strong validator is an integer that is
    4980       incremented in stable storage every time an entity is changed.
    4981     </t><t>
    4982       An entity's modification time, if represented with one-second
    4983       resolution, could be a weak validator, since it is possible that
    4984       the resource might be modified twice during a single second.
    4985     </t><t>
    4986       Support for weak validators is optional. However, weak validators
    4987       allow for more efficient caching of equivalent objects; for
    4988       example, a hit counter on a site is probably good enough if it is
    4989       updated every few days or weeks, and any value during that period
    4990       is likely "good enough" to be equivalent.
    4991     </t></list>
    4992 </t>
    4993 <t>
    4994    A "use" of a validator is either when a client generates a request
    4995    and includes the validator in a validating header field, or when a
    4996    server compares two validators.
    4997 </t>
    4998 <t>
    4999    Strong validators are usable in any context. Weak validators are only
    5000    usable in contexts that do not depend on exact equality of an entity.
    5001    For example, either kind is usable for a conditional GET of a full
    5002    entity. However, only a strong validator is usable for a sub-range
    5003    retrieval, since otherwise the client might end up with an internally
    5004    inconsistent entity.
    5005 </t>
    5006 <t>
    5007    Clients &MAY; issue simple (non-subrange) GET requests with either weak
    5008    validators or strong validators. Clients &MUST-NOT; use weak validators
    5009    in other forms of request.
    5010 </t>
    5011 <t>
    5012    The only function that the HTTP/1.1 protocol defines on validators is
    5013    comparison. There are two validator comparison functions, depending
    5014    on whether the comparison context allows the use of weak validators
    5015    or not:
    5016   <list style="symbols">
    5017      <t>The strong comparison function: in order to be considered equal,
    5018         both validators &MUST; be identical in every way, and both &MUST-NOT;
    5019         be weak.</t>
    5020      <t>The weak comparison function: in order to be considered equal,
    5021         both validators &MUST; be identical in every way, but either or
    5022         both of them &MAY; be tagged as "weak" without affecting the
    5023         result.</t>
    5024   </list>
    5025 </t>
    5026 <t>
    5027    An entity tag is strong unless it is explicitly tagged as weak.
    5028    <xref target="entity.tags"/> gives the syntax for entity tags.
    5029 </t>
    5030 <t>
    5031    A Last-Modified time, when used as a validator in a request, is
    5032    implicitly weak unless it is possible to deduce that it is strong,
    5033    using the following rules:
    5034   <list style="symbols">
    5035      <t>The validator is being compared by an origin server to the
    5036         actual current validator for the entity and,</t>
    5037      <t>That origin server reliably knows that the associated entity did
    5038         not change twice during the second covered by the presented
    5039         validator.</t>
    5040   </list>
    5041 </t>
    5042 <t>
    5043    or
    5044   <list style="symbols">
    5045      <t>The validator is about to be used by a client in an If-Modified-Since
    5046         or If-Unmodified-Since header, because the client
    5047         has a cache entry for the associated entity, and</t>
    5048      <t>That cache entry includes a Date value, which gives the time
    5049         when the origin server sent the original response, and</t>
    5050      <t>The presented Last-Modified time is at least 60 seconds before
    5051         the Date value.</t>
    5052   </list>
    5053 </t>
    5054 <t>
    5055    or
    5056   <list style="symbols">
    5057      <t>The validator is being compared by an intermediate cache to the
    5058         validator stored in its cache entry for the entity, and</t>
    5059      <t>That cache entry includes a Date value, which gives the time
    5060         when the origin server sent the original response, and</t>
    5061      <t>The presented Last-Modified time is at least 60 seconds before
    5062         the Date value.</t>
    5063   </list>
    5064 </t>
    5065 <t>
    5066    This method relies on the fact that if two different responses were
    5067    sent by the origin server during the same second, but both had the
    5068    same Last-Modified time, then at least one of those responses would
    5069    have a Date value equal to its Last-Modified time. The arbitrary 60-second
    5070    limit guards against the possibility that the Date and Last-Modified
    5071    values are generated from different clocks, or at somewhat
    5072    different times during the preparation of the response. An
    5073    implementation &MAY; use a value larger than 60 seconds, if it is
    5074    believed that 60 seconds is too short.
    5075 </t>
    5076 <t>
    5077    If a client wishes to perform a sub-range retrieval on a value for
    5078    which it has only a Last-Modified time and no opaque validator, it
    5079    &MAY; do this only if the Last-Modified time is strong in the sense
    5080    described here.
    5081 </t>
    5082 <t>
    5083    A cache or origin server receiving a conditional request, other than
    5084    a full-body GET request, &MUST; use the strong comparison function to
    5085    evaluate the condition.
    5086 </t>
    5087 <t>
    5088    These rules allow HTTP/1.1 caches and clients to safely perform sub-range
    5089    retrievals on values that have been obtained from HTTP/1.0
    5090    servers.
    5091 </t>
    5092 </section>
    5093 
    5094 <section title="Rules for When to Use Entity Tags and Last-Modified Dates" anchor="rules.for.when.to.use.entity.tags.and.last-modified.dates">
    5095 <t>
    5096    We adopt a set of rules and recommendations for origin servers,
    5097    clients, and caches regarding when various validator types ought to
    5098    be used, and for what purposes.
    5099 </t>
    5100 <t>
    5101    HTTP/1.1 origin servers:
    5102   <list style="symbols">
    5103      <t>&SHOULD; send an entity tag validator unless it is not feasible to
    5104         generate one.</t>
    5105 
    5106      <t>&MAY; send a weak entity tag instead of a strong entity tag, if
    5107         performance considerations support the use of weak entity tags,
    5108         or if it is unfeasible to send a strong entity tag.</t>
    5109 
    5110      <t>&SHOULD; send a Last-Modified value if it is feasible to send one,
    5111         unless the risk of a breakdown in semantic transparency that
    5112         could result from using this date in an If-Modified-Since header
    5113         would lead to serious problems.</t>
    5114   </list>
    5115 </t>
    5116 <t>
    5117    In other words, the preferred behavior for an HTTP/1.1 origin server
    5118    is to send both a strong entity tag and a Last-Modified value.
    5119 </t>
    5120 <t>
    5121    In order to be legal, a strong entity tag &MUST; change whenever the
    5122    associated entity value changes in any way. A weak entity tag &SHOULD;
    5123    change whenever the associated entity changes in a semantically
    5124    significant way.
    5125   <list><t>
    5126       <x:h>Note:</x:h> in order to provide semantically transparent caching, an
    5127       origin server must avoid reusing a specific strong entity tag
    5128       value for two different entities, or reusing a specific weak
    5129       entity tag value for two semantically different entities. Cache
    5130       entries might persist for arbitrarily long periods, regardless of
    5131       expiration times, so it might be inappropriate to expect that a
    5132       cache will never again attempt to validate an entry using a
    5133       validator that it obtained at some point in the past.
    5134   </t></list>
    5135 </t>
    5136 <t>
    5137    HTTP/1.1 clients:
    5138   <list style="symbols">
    5139      <t>If an entity tag has been provided by the origin server, &MUST;
    5140         use that entity tag in any cache-conditional request (using If-Match
    5141         or If-None-Match).</t>
    5142 
    5143      <t>If only a Last-Modified value has been provided by the origin
    5144         server, &SHOULD; use that value in non-subrange cache-conditional
    5145         requests (using If-Modified-Since).</t>
    5146 
    5147      <t>If only a Last-Modified value has been provided by an HTTP/1.0
    5148         origin server, &MAY; use that value in subrange cache-conditional
    5149         requests (using If-Unmodified-Since:). The user agent &SHOULD;
    5150         provide a way to disable this, in case of difficulty.</t>
    5151 
    5152      <t>If both an entity tag and a Last-Modified value have been
    5153         provided by the origin server, &SHOULD; use both validators in
    5154         cache-conditional requests. This allows both HTTP/1.0 and
    5155         HTTP/1.1 caches to respond appropriately.</t>
    5156   </list>
    5157 </t>
    5158 <t>
    5159    An HTTP/1.1 origin server, upon receiving a conditional request that
    5160    includes both a Last-Modified date (e.g., in an If-Modified-Since or
    5161    If-Unmodified-Since header field) and one or more entity tags (e.g.,
    5162    in an If-Match, If-None-Match, or If-Range header field) as cache
    5163    validators, &MUST-NOT; return a response status of 304 (Not Modified)
    5164    unless doing so is consistent with all of the conditional header
    5165    fields in the request.
    5166 </t>
    5167 <t>
    5168    An HTTP/1.1 caching proxy, upon receiving a conditional request that
    5169    includes both a Last-Modified date and one or more entity tags as
    5170    cache validators, &MUST-NOT; return a locally cached response to the
    5171    client unless that cached response is consistent with all of the
    5172    conditional header fields in the request.
    5173   <list><t>
    5174       <x:h>Note:</x:h> The general principle behind these rules is that HTTP/1.1
    5175       servers and clients should transmit as much non-redundant
    5176       information as is available in their responses and requests.
    5177       HTTP/1.1 systems receiving this information will make the most
    5178       conservative assumptions about the validators they receive.
    5179   </t><t>
    5180       HTTP/1.0 clients and caches will ignore entity tags. Generally,
    5181       last-modified values received or used by these systems will
    5182       support transparent and efficient caching, and so HTTP/1.1 origin
    5183       servers should provide Last-Modified values. In those rare cases
    5184       where the use of a Last-Modified value as a validator by an
    5185       HTTP/1.0 system could result in a serious problem, then HTTP/1.1
    5186       origin servers should not provide one.
    5187   </t></list>
     982   Entity Tags are described in &entity-tags;.
    5188983</t>
    5189984</section>
     
    52301025</t>
    52311026<t>
    5232    Note that <xref target="header.authorization"/> normally prevents a shared cache from saving
     1027   Note that &header-authorization; normally prevents a shared cache from saving
    52331028   and returning a response to a previous request if that request
    52341029   included an Authorization header.
     
    52961091<t>
    52971092   Other hop-by-hop headers &MUST; be listed in a Connection header,
    5298    (<xref target="header.connection"/>) to be introduced into HTTP/1.1 (or later).
     1093   (&header-connection;) to be introduced into HTTP/1.1 (or later).
    52991094</t>
    53001095</section>
     
    53551150<t>
    53561151   The Content-Length field of a request or response is added or deleted
    5357    according to the rules in <xref target="message.length"/>. A transparent proxy &MUST;
    5358    preserve the entity-length (<xref target="entity.length"/>) of the entity-body,
    5359    although it &MAY; change the transfer-length (<xref target="message.length"/>).
     1152   according to the rules in &message-length;. A transparent proxy &MUST;
     1153   preserve the entity-length (&entity-length;) of the entity-body,
     1154   although it &MAY; change the transfer-length (&message-length;).
    53601155</t>
    53611156</section>
     
    53751170   contents stored in the cache entry with the new contents received in
    53761171   the response and use the result as the entity-body of this outgoing
    5377    response, (see <xref target="combining.byte.ranges" format="counter"/>).
     1172   response, (see &combining-byte-ranges;).
    53781173</t>
    53791174<t>
     
    54151210</section>
    54161211
    5417 <section title="Combining Byte Ranges" anchor="combining.byte.ranges">
    5418 <t>
    5419    A response might transfer only a subrange of the bytes of an entity-body,
    5420    either because the request included one or more Range
    5421    specifications, or because a connection was broken prematurely. After
    5422    several such transfers, a cache might have received several ranges of
    5423    the same entity-body.
    5424 </t>
    5425 <t>
    5426    If a cache has a stored non-empty set of subranges for an entity, and
    5427    an incoming response transfers another subrange, the cache &MAY;
    5428    combine the new subrange with the existing set if both the following
    5429    conditions are met:
    5430   <list style="symbols">
    5431     <t>Both the incoming response and the cache entry have a cache
    5432         validator.</t>
    5433     <t>The two cache validators match using the strong comparison
    5434         function (see <xref target="weak.and.strong.validators"/>).</t>
    5435   </list>
    5436 </t>
    5437 <t>
    5438    If either requirement is not met, the cache &MUST; use only the most
    5439    recent partial response (based on the Date values transmitted with
    5440    every response, and using the incoming response if these values are
    5441    equal or missing), and &MUST; discard the other partial information.
    5442 </t>
    5443 </section>
    54441212</section>
    54451213
    54461214<section title="Caching Negotiated Responses" anchor="caching.negotiated.responses">
    54471215<t>
    5448    Use of server-driven content negotiation (<xref target="server-driven.negotiation"/>), as indicated
     1216   Use of server-driven content negotiation (&server-driven-negotiation;), as indicated
    54491217   by the presence of a Vary header field in a response, alters the
    54501218   conditions and procedure by which a cache can use the response for
     
    54741242   is allowed by the corresponding BNF, and/or combining multiple
    54751243   message-header fields with the same field name following the rules
    5476    about message headers in <xref target="message.headers"/>.
     1244   about message headers in &message-headers;.
    54771245</t>
    54781246<t>
     
    55351303   bytes of data than specified in a Content-Length header) &MAY; store
    55361304   the response. However, the cache &MUST; treat this as a partial
    5537    response. Partial responses &MAY; be combined as described in <xref target="combining.byte.ranges"/>;
     1305   response. Partial responses &MAY; be combined as described in &combining-byte-ranges;;
    55381306   the result might be a full response or might still be
    55391307   partial. A cache &MUST-NOT; return a partial response to a client
     
    55681336   the server provides an explicit expiration time. This specifically
    55691337   means that responses from HTTP/1.0 servers for such URIs &SHOULD-NOT;
    5570    be taken from a cache. See <xref target="safe.methods"/> for related information.
     1338   be taken from a cache. See &safe-methods; for related information.
    55711339</t>
    55721340</section>
     
    56951463</section>
    56961464
    5697 
    5698 
    5699 
    57001465<section title="Header Field Definitions" anchor="header.fields">
    57011466<t>
     
    57051470   sends and who receives the entity.
    57061471</t>
    5707 
    5708 <section title="Accept" anchor="header.accept">
    5709   <iref primary="true" item="Accept header" x:for-anchor=""/>
    5710   <iref primary="true" item="Headers" subitem="Accept" x:for-anchor=""/>
    5711 <t>
    5712    The Accept request-header field can be used to specify certain media
    5713    types which are acceptable for the response. Accept headers can be
    5714    used to indicate that the request is specifically limited to a small
    5715    set of desired types, as in the case of a request for an in-line
    5716    image.
    5717 </t>
    5718 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept"/><iref primary="true" item="Grammar" subitem="media-range"/><iref primary="true" item="Grammar" subitem="accept-params"/><iref primary="true" item="Grammar" subitem="accept-extension"/>
    5719     Accept         = "Accept" ":"
    5720                      #( media-range [ accept-params ] )
    5721 
    5722     media-range    = ( "*/*"
    5723                      | ( type "/" "*" )
    5724                      | ( type "/" subtype )
    5725                      ) *( ";" parameter )
    5726     accept-params  = ";" "q" "=" qvalue *( accept-extension )
    5727     accept-extension = ";" token [ "=" ( token | quoted-string ) ]
    5728 </artwork></figure>
    5729 <t>
    5730    The asterisk "*" character is used to group media types into ranges,
    5731    with "*/*" indicating all media types and "type/*" indicating all
    5732    subtypes of that type. The media-range &MAY; include media type
    5733    parameters that are applicable to that range.
    5734 </t>
    5735 <t>
    5736    Each media-range &MAY; be followed by one or more accept-params,
    5737    beginning with the "q" parameter for indicating a relative quality
    5738    factor. The first "q" parameter (if any) separates the media-range
    5739    parameter(s) from the accept-params. Quality factors allow the user
    5740    or user agent to indicate the relative degree of preference for that
    5741    media-range, using the qvalue scale from 0 to 1 (<xref target="quality.values"/>). The
    5742    default value is q=1.
    5743   <list><t>
    5744       <x:h>Note:</x:h> Use of the "q" parameter name to separate media type
    5745       parameters from Accept extension parameters is due to historical
    5746       practice. Although this prevents any media type parameter named
    5747       "q" from being used with a media range, such an event is believed
    5748       to be unlikely given the lack of any "q" parameters in the IANA
    5749       media type registry and the rare usage of any media type
    5750       parameters in Accept. Future media types are discouraged from
    5751       registering any parameter named "q".
    5752   </t></list>
    5753 </t>
    5754 <t>
    5755    The example
    5756 </t>
    5757 <figure><artwork type="example">
    5758     Accept: audio/*; q=0.2, audio/basic
    5759 </artwork></figure>
    5760 <t>
    5761    &SHOULD; be interpreted as "I prefer audio/basic, but send me any audio
    5762    type if it is the best available after an 80% mark-down in quality."
    5763 </t>
    5764 <t>
    5765    If no Accept header field is present, then it is assumed that the
    5766    client accepts all media types. If an Accept header field is present,
    5767    and if the server cannot send a response which is acceptable
    5768    according to the combined Accept field value, then the server &SHOULD;
    5769    send a 406 (not acceptable) response.
    5770 </t>
    5771 <t>
    5772    A more elaborate example is
    5773 </t>
    5774 <figure><artwork type="example">
    5775     Accept: text/plain; q=0.5, text/html,
    5776             text/x-dvi; q=0.8, text/x-c
    5777 </artwork></figure>
    5778 <t>
    5779    Verbally, this would be interpreted as "text/html and text/x-c are
    5780    the preferred media types, but if they do not exist, then send the
    5781    text/x-dvi entity, and if that does not exist, send the text/plain
    5782    entity."
    5783 </t>
    5784 <t>
    5785    Media ranges can be overridden by more specific media ranges or
    5786    specific media types. If more than one media range applies to a given
    5787    type, the most specific reference has precedence. For example,
    5788 </t>
    5789 <figure><artwork type="example">
    5790     Accept: text/*, text/html, text/html;level=1, */*
    5791 </artwork></figure>
    5792 <t>
    5793    have the following precedence:
    5794 </t>
    5795 <figure><artwork type="example">
    5796     1) text/html;level=1
    5797     2) text/html
    5798     3) text/*
    5799     4) */*
    5800 </artwork></figure>
    5801 <t>
    5802    The media type quality factor associated with a given type is
    5803    determined by finding the media range with the highest precedence
    5804    which matches that type. For example,
    5805 </t>
    5806 <figure><artwork type="example">
    5807     Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1,
    5808             text/html;level=2;q=0.4, */*;q=0.5
    5809 </artwork></figure>
    5810 <t>
    5811    would cause the following values to be associated:
    5812 </t>
    5813 <figure><artwork type="example">
    5814     text/html;level=1         = 1
    5815     text/html                 = 0.7
    5816     text/plain                = 0.3
    5817     image/jpeg                = 0.5
    5818     text/html;level=2         = 0.4
    5819     text/html;level=3         = 0.7
    5820 </artwork></figure>
    5821 <t>
    5822       <x:h>Note:</x:h> A user agent might be provided with a default set of quality
    5823       values for certain media ranges. However, unless the user agent is
    5824       a closed system which cannot interact with other rendering agents,
    5825       this default set ought to be configurable by the user.
    5826 </t>
    5827 </section>
    5828 
    5829 <section title="Accept-Charset" anchor="header.accept-charset">
    5830   <iref primary="true" item="Accept-Charset header" x:for-anchor=""/>
    5831   <iref primary="true" item="Headers" subitem="Accept-Charset" x:for-anchor=""/>
    5832 <t>
    5833    The Accept-Charset request-header field can be used to indicate what
    5834    character sets are acceptable for the response. This field allows
    5835    clients capable of understanding more comprehensive or special-purpose
    5836    character sets to signal that capability to a server which is
    5837    capable of representing documents in those character sets.
    5838 </t>
    5839 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Charset"/>
    5840    Accept-Charset = "Accept-Charset" ":"
    5841            1#( ( charset | "*" )[ ";" "q" "=" qvalue ] )
    5842 </artwork></figure>
    5843 <t>
    5844    Character set values are described in <xref target="character.sets"/>. Each charset &MAY;
    5845    be given an associated quality value which represents the user's
    5846    preference for that charset. The default value is q=1. An example is
    5847 </t>
    5848 <figure><artwork type="example">
    5849    Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
    5850 </artwork></figure>
    5851 <t>
    5852    The special value "*", if present in the Accept-Charset field,
    5853    matches every character set (including ISO-8859-1) which is not
    5854    mentioned elsewhere in the Accept-Charset field. If no "*" is present
    5855    in an Accept-Charset field, then all character sets not explicitly
    5856    mentioned get a quality value of 0, except for ISO-8859-1, which gets
    5857    a quality value of 1 if not explicitly mentioned.
    5858 </t>
    5859 <t>
    5860    If no Accept-Charset header is present, the default is that any
    5861    character set is acceptable. If an Accept-Charset header is present,
    5862    and if the server cannot send a response which is acceptable
    5863    according to the Accept-Charset header, then the server &SHOULD; send
    5864    an error response with the 406 (not acceptable) status code, though
    5865    the sending of an unacceptable response is also allowed.
    5866 </t>
    5867 </section>
    5868 
    5869 <section title="Accept-Encoding" anchor="header.accept-encoding">
    5870   <iref primary="true" item="Accept-Encoding header" x:for-anchor=""/>
    5871   <iref primary="true" item="Headers" subitem="Accept-Encoding" x:for-anchor=""/>
    5872 <t>
    5873    The Accept-Encoding request-header field is similar to Accept, but
    5874    restricts the content-codings (<xref target="content.codings"/>) that are acceptable in
    5875    the response.
    5876 </t>
    5877 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Encoding"/><iref primary="true" item="Grammar" subitem="codings"/>
    5878     Accept-Encoding  = "Accept-Encoding" ":"
    5879                        1#( codings [ ";" "q" "=" qvalue ] )
    5880     codings          = ( content-coding | "*" )
    5881 </artwork></figure>
    5882 <t>
    5883    Examples of its use are:
    5884 </t>
    5885 <figure><artwork type="example">
    5886     Accept-Encoding: compress, gzip
    5887     Accept-Encoding:
    5888     Accept-Encoding: *
    5889     Accept-Encoding: compress;q=0.5, gzip;q=1.0
    5890     Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
    5891 </artwork></figure>
    5892 <t>
    5893    A server tests whether a content-coding is acceptable, according to
    5894    an Accept-Encoding field, using these rules:
    5895   <list style="numbers">
    5896       <t>If the content-coding is one of the content-codings listed in
    5897          the Accept-Encoding field, then it is acceptable, unless it is
    5898          accompanied by a qvalue of 0. (As defined in <xref target="quality.values"/>, a
    5899          qvalue of 0 means "not acceptable.")</t>
    5900 
    5901       <t>The special "*" symbol in an Accept-Encoding field matches any
    5902          available content-coding not explicitly listed in the header
    5903          field.</t>
    5904 
    5905       <t>If multiple content-codings are acceptable, then the acceptable
    5906          content-coding with the highest non-zero qvalue is preferred.</t>
    5907 
    5908       <t>The "identity" content-coding is always acceptable, unless
    5909          specifically refused because the Accept-Encoding field includes
    5910          "identity;q=0", or because the field includes "*;q=0" and does
    5911          not explicitly include the "identity" content-coding. If the
    5912          Accept-Encoding field-value is empty, then only the "identity"
    5913          encoding is acceptable.</t>
    5914   </list>
    5915 </t>
    5916 <t>
    5917    If an Accept-Encoding field is present in a request, and if the
    5918    server cannot send a response which is acceptable according to the
    5919    Accept-Encoding header, then the server &SHOULD; send an error response
    5920    with the 406 (Not Acceptable) status code.
    5921 </t>
    5922 <t>
    5923    If no Accept-Encoding field is present in a request, the server &MAY;
    5924    assume that the client will accept any content coding. In this case,
    5925    if "identity" is one of the available content-codings, then the
    5926    server &SHOULD; use the "identity" content-coding, unless it has
    5927    additional information that a different content-coding is meaningful
    5928    to the client.
    5929   <list><t>
    5930       <x:h>Note:</x:h> If the request does not include an Accept-Encoding field,
    5931       and if the "identity" content-coding is unavailable, then
    5932       content-codings commonly understood by HTTP/1.0 clients (i.e.,
    5933       "gzip" and "compress") are preferred; some older clients
    5934       improperly display messages sent with other content-codings.  The
    5935       server might also make this decision based on information about
    5936       the particular user-agent or client.
    5937     </t><t>
    5938       <x:h>Note:</x:h> Most HTTP/1.0 applications do not recognize or obey qvalues
    5939       associated with content-codings. This means that qvalues will not
    5940       work and are not permitted with x-gzip or x-compress.
    5941     </t></list>
    5942 </t>
    5943 </section>
    5944 
    5945 <section title="Accept-Language" anchor="header.accept-language">
    5946   <iref primary="true" item="Accept-Language header" x:for-anchor=""/>
    5947   <iref primary="true" item="Headers" subitem="Accept-Language" x:for-anchor=""/>
    5948 <t>
    5949    The Accept-Language request-header field is similar to Accept, but
    5950    restricts the set of natural languages that are preferred as a
    5951    response to the request. Language tags are defined in <xref target="language.tags"/>.
    5952 </t>
    5953 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Language"/><iref primary="true" item="Grammar" subitem="language-range"/>
    5954     Accept-Language = "Accept-Language" ":"
    5955                       1#( language-range [ ";" "q" "=" qvalue ] )
    5956     language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
    5957 </artwork></figure>
    5958 <t>
    5959    Each language-range &MAY; be given an associated quality value which
    5960    represents an estimate of the user's preference for the languages
    5961    specified by that range. The quality value defaults to "q=1". For
    5962    example,
    5963 </t>
    5964 <figure><artwork type="example">
    5965     Accept-Language: da, en-gb;q=0.8, en;q=0.7
    5966 </artwork></figure>
    5967 <t>
    5968    would mean: "I prefer Danish, but will accept British English and
    5969    other types of English." A language-range matches a language-tag if
    5970    it exactly equals the tag, or if it exactly equals a prefix of the
    5971    tag such that the first tag character following the prefix is "-".
    5972    The special range "*", if present in the Accept-Language field,
    5973    matches every tag not matched by any other range present in the
    5974    Accept-Language field.
    5975   <list><t>
    5976       <x:h>Note:</x:h> This use of a prefix matching rule does not imply that
    5977       language tags are assigned to languages in such a way that it is
    5978       always true that if a user understands a language with a certain
    5979       tag, then this user will also understand all languages with tags
    5980       for which this tag is a prefix. The prefix rule simply allows the
    5981       use of prefix tags if this is the case.
    5982   </t></list>
    5983 </t>
    5984 <t>
    5985    The language quality factor assigned to a language-tag by the
    5986    Accept-Language field is the quality value of the longest language-range
    5987    in the field that matches the language-tag. If no language-range
    5988    in the field matches the tag, the language quality factor
    5989    assigned is 0. If no Accept-Language header is present in the
    5990    request, the server
    5991    &SHOULD; assume that all languages are equally acceptable. If an
    5992    Accept-Language header is present, then all languages which are
    5993    assigned a quality factor greater than 0 are acceptable.
    5994 </t>
    5995 <t>
    5996    It might be contrary to the privacy expectations of the user to send
    5997    an Accept-Language header with the complete linguistic preferences of
    5998    the user in every request. For a discussion of this issue, see
    5999    <xref target="privacy.issues.connected.to.accept.headers"/>.
    6000 </t>
    6001 <t>
    6002    As intelligibility is highly dependent on the individual user, it is
    6003    recommended that client applications make the choice of linguistic
    6004    preference available to the user. If the choice is not made
    6005    available, then the Accept-Language header field &MUST-NOT; be given in
    6006    the request.
    6007   <list><t>
    6008       <x:h>Note:</x:h> When making the choice of linguistic preference available to
    6009       the user, we remind implementors of  the fact that users are not
    6010       familiar with the details of language matching as described above,
    6011       and should provide appropriate guidance. As an example, users
    6012       might assume that on selecting "en-gb", they will be served any
    6013       kind of English document if British English is not available. A
    6014       user agent might suggest in such a case to add "en" to get the
    6015       best matching behavior.
    6016   </t></list>
    6017 </t>
    6018 </section>
    6019 
    6020 <section title="Accept-Ranges" anchor="header.accept-ranges">
    6021   <iref primary="true" item="Accept-Ranges header" x:for-anchor=""/>
    6022   <iref primary="true" item="Headers" subitem="Accept-Ranges" x:for-anchor=""/>
    6023 <t>
    6024       The Accept-Ranges response-header field allows the server to
    6025       indicate its acceptance of range requests for a resource:
    6026 </t>
    6027 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Accept-Ranges"/><iref primary="true" item="Grammar" subitem="acceptable-ranges"/>
    6028        Accept-Ranges     = "Accept-Ranges" ":" acceptable-ranges
    6029        acceptable-ranges = 1#range-unit | "none"
    6030 </artwork></figure>
    6031 <t>
    6032       Origin servers that accept byte-range requests &MAY; send
    6033 </t>
    6034 <figure><artwork type="example">
    6035        Accept-Ranges: bytes
    6036 </artwork></figure>
    6037 <t>
    6038       but are not required to do so. Clients &MAY; generate byte-range
    6039       requests without having received this header for the resource
    6040       involved. Range units are defined in <xref target="range.units"/>.
    6041 </t>
    6042 <t>
    6043       Servers that do not accept any kind of range request for a
    6044       resource &MAY; send
    6045 </t>
    6046 <figure><artwork type="example">
    6047        Accept-Ranges: none
    6048 </artwork></figure>
    6049 <t>
    6050       to advise the client not to attempt a range request.
    6051 </t>
    6052 </section>
    60531472
    60541473<section title="Age" anchor="header.age">
     
    60781497      own cache. Caches &SHOULD; use an arithmetic type of at least 31
    60791498      bits of range.
    6080 </t>
    6081 </section>
    6082 
    6083 <section title="Allow" anchor="header.allow">
    6084   <iref primary="true" item="Allow header" x:for-anchor=""/>
    6085   <iref primary="true" item="Headers" subitem="Allow" x:for-anchor=""/>
    6086 <t>
    6087       The Allow entity-header field lists the set of methods supported
    6088       by the resource identified by the Request-URI. The purpose of this
    6089       field is strictly to inform the recipient of valid methods
    6090       associated with the resource. An Allow header field &MUST; be
    6091       present in a 405 (Method Not Allowed) response.
    6092 </t>
    6093 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Allow"/>
    6094        Allow   = "Allow" ":" #Method
    6095 </artwork></figure>
    6096 <t>
    6097       Example of use:
    6098 </t>
    6099 <figure><artwork type="example">
    6100        Allow: GET, HEAD, PUT
    6101 </artwork></figure>
    6102 <t>
    6103       This field cannot prevent a client from trying other methods.
    6104       However, the indications given by the Allow header field value
    6105       &SHOULD; be followed. The actual set of allowed methods is defined
    6106       by the origin server at the time of each request.
    6107 </t>
    6108 <t>
    6109       The Allow header field &MAY; be provided with a PUT request to
    6110       recommend the methods to be supported by the new or modified
    6111       resource. The server is not required to support these methods and
    6112       &SHOULD; include an Allow header in the response giving the actual
    6113       supported methods.
    6114 </t>
    6115 <t>
    6116       A proxy &MUST-NOT; modify the Allow header field even if it does not
    6117       understand all the methods specified, since the user agent might
    6118       have other means of communicating with the origin server.
    6119 </t>
    6120 </section>
    6121 
    6122 <section title="Authorization" anchor="header.authorization">
    6123   <iref primary="true" item="Authorization header" x:for-anchor=""/>
    6124   <iref primary="true" item="Headers" subitem="Authorization" x:for-anchor=""/>
    6125 <t>
    6126       A user agent that wishes to authenticate itself with a server--
    6127       usually, but not necessarily, after receiving a 401 response--does
    6128       so by including an Authorization request-header field with the
    6129       request.  The Authorization field value consists of credentials
    6130       containing the authentication information of the user agent for
    6131       the realm of the resource being requested.
    6132 </t>
    6133 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Authorization"/>
    6134        Authorization  = "Authorization" ":" credentials
    6135 </artwork></figure>
    6136 <t>
    6137       HTTP access authentication is described in "HTTP Authentication:
    6138       Basic and Digest Access Authentication" <xref target="RFC2617"/>. If a request is
    6139       authenticated and a realm specified, the same credentials &SHOULD;
    6140       be valid for all other requests within this realm (assuming that
    6141       the authentication scheme itself does not require otherwise, such
    6142       as credentials that vary according to a challenge value or using
    6143       synchronized clocks).
    6144 </t>
    6145 <t>
    6146       When a shared cache (see <xref target="shared.and.non-shared.caches"/>) receives a request
    6147       containing an Authorization field, it &MUST-NOT; return the
    6148       corresponding response as a reply to any other request, unless one
    6149       of the following specific exceptions holds:
    6150 </t>
    6151 <t>
    6152   <list style="numbers">
    6153       <t>If the response includes the "s-maxage" cache-control
    6154          directive, the cache &MAY; use that response in replying to a
    6155          subsequent request. But (if the specified maximum age has
    6156          passed) a proxy cache &MUST; first revalidate it with the origin
    6157          server, using the request-headers from the new request to allow
    6158          the origin server to authenticate the new request. (This is the
    6159          defined behavior for s-maxage.) If the response includes "s-maxage=0",
    6160          the proxy &MUST; always revalidate it before re-using
    6161          it.</t>
    6162 
    6163       <t>If the response includes the "must-revalidate" cache-control
    6164          directive, the cache &MAY; use that response in replying to a
    6165          subsequent request. But if the response is stale, all caches
    6166          &MUST; first revalidate it with the origin server, using the
    6167          request-headers from the new request to allow the origin server
    6168          to authenticate the new request.</t>
    6169 
    6170       <t>If the response includes the "public" cache-control directive,
    6171          it &MAY; be returned in reply to any subsequent request.</t>
    6172   </list>
    61731499</t>
    61741500</section>
     
    62751601      Indicates that the response &MAY; be cached by any cache, even if it
    62761602      would normally be non-cacheable or cacheable only within a non-shared
    6277       cache. (See also Authorization, <xref target="header.authorization"/>, for
     1603      cache. (See also Authorization, &header-authorization;, for
    62781604      additional details.)
    62791605  </t></list>
     
    67182044</section>
    67192045
    6720 <section title="Connection" anchor="header.connection">
    6721   <iref primary="true" item="Connection header" x:for-anchor=""/>
    6722   <iref primary="true" item="Headers" subitem="Connection" x:for-anchor=""/>
    6723 <t>
    6724    The Connection general-header field allows the sender to specify
    6725    options that are desired for that particular connection and &MUST-NOT;
    6726    be communicated by proxies over further connections.
    6727 </t>
    6728 <t>
    6729    The Connection header has the following grammar:
    6730 </t>
    6731 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Connection"/><iref primary="true" item="Grammar" subitem="connection-token"/>
    6732     Connection = "Connection" ":" 1#(connection-token)
    6733     connection-token  = token
    6734 </artwork></figure>
    6735 <t>
    6736    HTTP/1.1 proxies &MUST; parse the Connection header field before a
    6737    message is forwarded and, for each connection-token in this field,
    6738    remove any header field(s) from the message with the same name as the
    6739    connection-token. Connection options are signaled by the presence of
    6740    a connection-token in the Connection header field, not by any
    6741    corresponding additional header field(s), since the additional header
    6742    field may not be sent if there are no parameters associated with that
    6743    connection option.
    6744 </t>
    6745 <t>
    6746    Message headers listed in the Connection header &MUST-NOT; include
    6747    end-to-end headers, such as Cache-Control.
    6748 </t>
    6749 <t>
    6750    HTTP/1.1 defines the "close" connection option for the sender to
    6751    signal that the connection will be closed after completion of the
    6752    response. For example,
    6753 </t>
    6754 <figure><artwork type="example">
    6755     Connection: close
    6756 </artwork></figure>
    6757 <t>
    6758    in either the request or the response header fields indicates that
    6759    the connection &SHOULD-NOT;  be considered `persistent' (<xref target="persistent.connections"/>)
    6760    after the current request/response is complete.
    6761 </t>
    6762 <t>
    6763    HTTP/1.1 applications that do not support persistent connections &MUST;
    6764    include the "close" connection option in every message.
    6765 </t>
    6766 <t>
    6767    A system receiving an HTTP/1.0 (or lower-version) message that
    6768    includes a Connection header MUST, for each connection-token in this
    6769    field, remove and ignore any header field(s) from the message with
    6770    the same name as the connection-token. This protects against mistaken
    6771    forwarding of such header fields by pre-HTTP/1.1 proxies. See <xref target="compatibility.with.http.1.0.persistent.connections"/>.
    6772 </t>
    6773 </section>
    6774 
    6775 <section title="Content-Encoding" anchor="header.content-encoding">
    6776   <iref primary="true" item="Content-Encoding header" x:for-anchor=""/>
    6777   <iref primary="true" item="Headers" subitem="Content-Encoding" x:for-anchor=""/>
    6778 <t>
    6779    The Content-Encoding entity-header field is used as a modifier to the
    6780    media-type. When present, its value indicates what additional content
    6781    codings have been applied to the entity-body, and thus what decoding
    6782    mechanisms must be applied in order to obtain the media-type
    6783    referenced by the Content-Type header field. Content-Encoding is
    6784    primarily used to allow a document to be compressed without losing
    6785    the identity of its underlying media type.
    6786 </t>
    6787 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Encoding"/>
    6788     Content-Encoding  = "Content-Encoding" ":" 1#content-coding
    6789 </artwork></figure>
    6790 <t>
    6791    Content codings are defined in <xref target="content.codings"/>. An example of its use is
    6792 </t>
    6793 <figure><artwork type="example">
    6794     Content-Encoding: gzip
    6795 </artwork></figure>
    6796 <t>
    6797    The content-coding is a characteristic of the entity identified by
    6798    the Request-URI. Typically, the entity-body is stored with this
    6799    encoding and is only decoded before rendering or analogous usage.
    6800    However, a non-transparent proxy &MAY; modify the content-coding if the
    6801    new coding is known to be acceptable to the recipient, unless the
    6802    "no-transform" cache-control directive is present in the message.
    6803 </t>
    6804 <t>
    6805    If the content-coding of an entity is not "identity", then the
    6806    response &MUST; include a Content-Encoding entity-header (<xref target="header.content-encoding"/>)
    6807    that lists the non-identity content-coding(s) used.
    6808 </t>
    6809 <t>
    6810    If the content-coding of an entity in a request message is not
    6811    acceptable to the origin server, the server &SHOULD; respond with a
    6812    status code of 415 (Unsupported Media Type).
    6813 </t>
    6814 <t>
    6815    If multiple encodings have been applied to an entity, the content
    6816    codings &MUST; be listed in the order in which they were applied.
    6817    Additional information about the encoding parameters &MAY; be provided
    6818    by other entity-header fields not defined by this specification.
    6819 </t>
    6820 </section>
    6821 
    6822 <section title="Content-Language" anchor="header.content-language">
    6823   <iref primary="true" item="Content-Language header" x:for-anchor=""/>
    6824   <iref primary="true" item="Headers" subitem="Content-Language" x:for-anchor=""/>
    6825 <t>
    6826    The Content-Language entity-header field describes the natural
    6827    language(s) of the intended audience for the enclosed entity. Note
    6828    that this might not be equivalent to all the languages used within
    6829    the entity-body.
    6830 </t>
    6831 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Language"/>
    6832     Content-Language  = "Content-Language" ":" 1#language-tag
    6833 </artwork></figure>
    6834 <t>
    6835    Language tags are defined in <xref target="language.tags"/>. The primary purpose of
    6836    Content-Language is to allow a user to identify and differentiate
    6837    entities according to the user's own preferred language. Thus, if the
    6838    body content is intended only for a Danish-literate audience, the
    6839    appropriate field is
    6840 </t>
    6841 <figure><artwork type="example">
    6842     Content-Language: da
    6843 </artwork></figure>
    6844 <t>
    6845    If no Content-Language is specified, the default is that the content
    6846    is intended for all language audiences. This might mean that the
    6847    sender does not consider it to be specific to any natural language,
    6848    or that the sender does not know for which language it is intended.
    6849 </t>
    6850 <t>
    6851    Multiple languages &MAY; be listed for content that is intended for
    6852    multiple audiences. For example, a rendition of the "Treaty of
    6853    Waitangi," presented simultaneously in the original Maori and English
    6854    versions, would call for
    6855 </t>
    6856 <figure><artwork type="example">
    6857     Content-Language: mi, en
    6858 </artwork></figure>
    6859 <t>
    6860    However, just because multiple languages are present within an entity
    6861    does not mean that it is intended for multiple linguistic audiences.
    6862    An example would be a beginner's language primer, such as "A First
    6863    Lesson in Latin," which is clearly intended to be used by an
    6864    English-literate audience. In this case, the Content-Language would
    6865    properly only include "en".
    6866 </t>
    6867 <t>
    6868    Content-Language &MAY; be applied to any media type -- it is not
    6869    limited to textual documents.
    6870 </t>
    6871 </section>
    6872 
    6873 <section title="Content-Length" anchor="header.content-length">
    6874   <iref primary="true" item="Content-Length header" x:for-anchor=""/>
    6875   <iref primary="true" item="Headers" subitem="Content-Length" x:for-anchor=""/>
    6876 <t>
    6877    The Content-Length entity-header field indicates the size of the
    6878    entity-body, in decimal number of OCTETs, sent to the recipient or,
    6879    in the case of the HEAD method, the size of the entity-body that
    6880    would have been sent had the request been a GET.
    6881 </t>
    6882 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Length"/>
    6883     Content-Length    = "Content-Length" ":" 1*DIGIT
    6884 </artwork></figure>
    6885 <t>
    6886    An example is
    6887 </t>
    6888 <figure><artwork type="example">
    6889     Content-Length: 3495
    6890 </artwork></figure>
    6891 <t>
    6892    Applications &SHOULD; use this field to indicate the transfer-length of
    6893    the message-body, unless this is prohibited by the rules in <xref target="message.length"/>.
    6894 </t>
    6895 <t>
    6896    Any Content-Length greater than or equal to zero is a valid value.
    6897    <xref target="message.length"/> describes how to determine the length of a message-body
    6898    if a Content-Length is not given.
    6899 </t>
    6900 <t>
    6901    Note that the meaning of this field is significantly different from
    6902    the corresponding definition in MIME, where it is an optional field
    6903    used within the "message/external-body" content-type. In HTTP, it
    6904    &SHOULD; be sent whenever the message's length can be determined prior
    6905    to being transferred, unless this is prohibited by the rules in
    6906    <xref target="message.length"/>.
    6907 </t>
    6908 </section>
    6909 
    6910 <section title="Content-Location" anchor="header.content-location">
    6911   <iref primary="true" item="Content-Location header" x:for-anchor=""/>
    6912   <iref primary="true" item="Headers" subitem="Content-Location" x:for-anchor=""/>
    6913 <t>
    6914    The Content-Location entity-header field &MAY; be used to supply the
    6915    resource location for the entity enclosed in the message when that
    6916    entity is accessible from a location separate from the requested
    6917    resource's URI. A server &SHOULD; provide a Content-Location for the
    6918    variant corresponding to the response entity; especially in the case
    6919    where a resource has multiple entities associated with it, and those
    6920    entities actually have separate locations by which they might be
    6921    individually accessed, the server &SHOULD; provide a Content-Location
    6922    for the particular variant which is returned.
    6923 </t>
    6924 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Location"/>
    6925     Content-Location = "Content-Location" ":"
    6926                       ( absoluteURI | relativeURI )
    6927 </artwork></figure>
    6928 <t>
    6929    The value of Content-Location also defines the base URI for the
    6930    entity.
    6931 </t>
    6932 <t>
    6933    The Content-Location value is not a replacement for the original
    6934    requested URI; it is only a statement of the location of the resource
    6935    corresponding to this particular entity at the time of the request.
    6936    Future requests &MAY; specify the Content-Location URI as the request-URI
    6937    if the desire is to identify the source of that particular
    6938    entity.
    6939 </t>
    6940 <t>
    6941    A cache cannot assume that an entity with a Content-Location
    6942    different from the URI used to retrieve it can be used to respond to
    6943    later requests on that Content-Location URI. However, the Content-Location
    6944    can be used to differentiate between multiple entities
    6945    retrieved from a single requested resource, as described in <xref target="caching.negotiated.responses"/>.
    6946 </t>
    6947 <t>
    6948    If the Content-Location is a relative URI, the relative URI is
    6949    interpreted relative to the Request-URI.
    6950 </t>
    6951 <t>
    6952    The meaning of the Content-Location header in PUT or POST requests is
    6953    undefined; servers are free to ignore it in those cases.
    6954 </t>
    6955 </section>
    6956 
    6957 <section title="Content-MD5" anchor="header.content-md5">
    6958   <iref primary="true" item="Content-MD5 header" x:for-anchor=""/>
    6959   <iref primary="true" item="Headers" subitem="Content-MD5" x:for-anchor=""/>
    6960 <t>
    6961    The Content-MD5 entity-header field, as defined in RFC 1864 <xref target="RFC1864"/>, is
    6962    an MD5 digest of the entity-body for the purpose of providing an
    6963    end-to-end message integrity check (MIC) of the entity-body. (Note: a
    6964    MIC is good for detecting accidental modification of the entity-body
    6965    in transit, but is not proof against malicious attacks.)
    6966 </t>
    6967 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-MD5"/><iref primary="true" item="Grammar" subitem="md5-digest"/>
    6968      Content-MD5   = "Content-MD5" ":" md5-digest
    6969      md5-digest   = &lt;base64 of 128 bit MD5 digest as per RFC 1864&gt;
    6970 </artwork></figure>
    6971 <t>
    6972    The Content-MD5 header field &MAY; be generated by an origin server or
    6973    client to function as an integrity check of the entity-body. Only
    6974    origin servers or clients &MAY; generate the Content-MD5 header field;
    6975    proxies and gateways &MUST-NOT; generate it, as this would defeat its
    6976    value as an end-to-end integrity check. Any recipient of the entity-body,
    6977    including gateways and proxies, &MAY; check that the digest value
    6978    in this header field matches that of the entity-body as received.
    6979 </t>
    6980 <t>
    6981    The MD5 digest is computed based on the content of the entity-body,
    6982    including any content-coding that has been applied, but not including
    6983    any transfer-encoding applied to the message-body. If the message is
    6984    received with a transfer-encoding, that encoding &MUST; be removed
    6985    prior to checking the Content-MD5 value against the received entity.
    6986 </t>
    6987 <t>
    6988    This has the result that the digest is computed on the octets of the
    6989    entity-body exactly as, and in the order that, they would be sent if
    6990    no transfer-encoding were being applied.
    6991 </t>
    6992 <t>
    6993    HTTP extends RFC 1864 to permit the digest to be computed for MIME
    6994    composite media-types (e.g., multipart/* and message/rfc822), but
    6995    this does not change how the digest is computed as defined in the
    6996    preceding paragraph.
    6997 </t>
    6998 <t>
    6999    There are several consequences of this. The entity-body for composite
    7000    types &MAY; contain many body-parts, each with its own MIME and HTTP
    7001    headers (including Content-MD5, Content-Transfer-Encoding, and
    7002    Content-Encoding headers). If a body-part has a Content-Transfer-Encoding
    7003    or Content-Encoding header, it is assumed that the content
    7004    of the body-part has had the encoding applied, and the body-part is
    7005    included in the Content-MD5 digest as is -- i.e., after the
    7006    application. The Transfer-Encoding header field is not allowed within
    7007    body-parts.
    7008 </t>
    7009 <t>
    7010    Conversion of all line breaks to CRLF &MUST-NOT; be done before
    7011    computing or checking the digest: the line break convention used in
    7012    the text actually transmitted &MUST; be left unaltered when computing
    7013    the digest.
    7014   <list><t>
    7015       <x:h>Note:</x:h> while the definition of Content-MD5 is exactly the same for
    7016       HTTP as in RFC 1864 for MIME entity-bodies, there are several ways
    7017       in which the application of Content-MD5 to HTTP entity-bodies
    7018       differs from its application to MIME entity-bodies. One is that
    7019       HTTP, unlike MIME, does not use Content-Transfer-Encoding, and
    7020       does use Transfer-Encoding and Content-Encoding. Another is that
    7021       HTTP more frequently uses binary content types than MIME, so it is
    7022       worth noting that, in such cases, the byte order used to compute
    7023       the digest is the transmission byte order defined for the type.
    7024       Lastly, HTTP allows transmission of text types with any of several
    7025       line break conventions and not just the canonical form using CRLF.
    7026   </t></list>
    7027 </t>
    7028 </section>
    7029 
    7030 <section title="Content-Range" anchor="header.content-range">
    7031   <iref primary="true" item="Content-Range header" x:for-anchor=""/>
    7032   <iref primary="true" item="Headers" subitem="Content-Range" x:for-anchor=""/>
    7033 <t>
    7034    The Content-Range entity-header is sent with a partial entity-body to
    7035    specify where in the full entity-body the partial body should be
    7036    applied. Range units are defined in <xref target="range.units"/>.
    7037 </t>
    7038 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Range"/><iref primary="true" item="Grammar" subitem="content-range-spec"/><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"/>
    7039     Content-Range = "Content-Range" ":" content-range-spec
    7040 
    7041     content-range-spec      = byte-content-range-spec
    7042     byte-content-range-spec = bytes-unit SP
    7043                               byte-range-resp-spec "/"
    7044                               ( instance-length | "*" )
    7045 
    7046     byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
    7047                                    | "*"
    7048     instance-length           = 1*DIGIT
    7049 </artwork></figure>
    7050 <t>
    7051    The header &SHOULD; indicate the total length of the full entity-body,
    7052    unless this length is unknown or difficult to determine. The asterisk
    7053    "*" character means that the instance-length is unknown at the time
    7054    when the response was generated.
    7055 </t>
    7056 <t>
    7057    Unlike byte-ranges-specifier values (see <xref target="byte.ranges"/>), a byte-range-resp-spec
    7058    &MUST; only specify one range, and &MUST; contain
    7059    absolute byte positions for both the first and last byte of the
    7060    range.
    7061 </t>
    7062 <t>
    7063    A byte-content-range-spec with a byte-range-resp-spec whose last-byte-pos
    7064    value is less than its first-byte-pos value, or whose
    7065    instance-length value is less than or equal to its last-byte-pos
    7066    value, is invalid. The recipient of an invalid byte-content-range-spec
    7067    &MUST; ignore it and any content transferred along with it.
    7068 </t>
    7069 <t>
    7070    A server sending a response with status code 416 (Requested range not
    7071    satisfiable) &SHOULD; include a Content-Range field with a byte-range-resp-spec
    7072    of "*". The instance-length specifies the current length of
    7073    the selected resource. A response with status code 206 (Partial
    7074    Content) &MUST-NOT; include a Content-Range field with a byte-range-resp-spec of "*".
    7075 </t>
    7076 <t>
    7077    Examples of byte-content-range-spec values, assuming that the entity
    7078    contains a total of 1234 bytes:
    7079    <list style="symbols">
    7080       <t>
    7081         The first 500 bytes:
    7082 <figure><artwork type="text/plain">
    7083    bytes 0-499/1234
    7084 </artwork></figure>
    7085       </t>   
    7086       <t>
    7087         The second 500 bytes:
    7088 <figure><artwork type="text/plain">
    7089    bytes 500-999/1234
    7090 </artwork></figure>
    7091       </t>   
    7092       <t>
    7093         All except for the first 500 bytes:
    7094 <figure><artwork type="text/plain">
    7095    bytes 500-1233/1234
    7096 </artwork></figure>
    7097       </t>   
    7098       <t>
    7099         The last 500 bytes:
    7100 <figure><artwork type="text/plain">
    7101    bytes 734-1233/1234
    7102 </artwork></figure>
    7103       </t>   
    7104    </list>
    7105 </t>
    7106 <t>
    7107    When an HTTP message includes the content of a single range (for
    7108    example, a response to a request for a single range, or to a request
    7109    for a set of ranges that overlap without any holes), this content is
    7110    transmitted with a Content-Range header, and a Content-Length header
    7111    showing the number of bytes actually transferred. For example,
    7112 </t>
    7113 <figure><artwork type="example">
    7114     HTTP/1.1 206 Partial content
    7115     Date: Wed, 15 Nov 1995 06:25:24 GMT
    7116     Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
    7117     Content-Range: bytes 21010-47021/47022
    7118     Content-Length: 26012
    7119     Content-Type: image/gif
    7120 </artwork></figure>
    7121 <t>
    7122    When an HTTP message includes the content of multiple ranges (for
    7123    example, a response to a request for multiple non-overlapping
    7124    ranges), these are transmitted as a multipart message. The multipart
    7125    media type used for this purpose is "multipart/byteranges" as defined
    7126    in <xref target="internet.media.type.multipart.byteranges"/>. See <xref target="changes.from.rfc.2068"/> for a compatibility issue.
    7127 </t>
    7128 <t>
    7129    A response to a request for a single range &MUST-NOT; be sent using the
    7130    multipart/byteranges media type.  A response to a request for
    7131    multiple ranges, whose result is a single range, &MAY; be sent as a
    7132    multipart/byteranges media type with one part. A client that cannot
    7133    decode a multipart/byteranges message &MUST-NOT; ask for multiple
    7134    byte-ranges in a single request.
    7135 </t>
    7136 <t>
    7137    When a client requests multiple byte-ranges in one request, the
    7138    server &SHOULD; return them in the order that they appeared in the
    7139    request.
    7140 </t>
    7141 <t>
    7142    If the server ignores a byte-range-spec because it is syntactically
    7143    invalid, the server &SHOULD; treat the request as if the invalid Range
    7144    header field did not exist. (Normally, this means return a 200
    7145    response containing the full entity).
    7146 </t>
    7147 <t>
    7148    If the server receives a request (other than one including an If-Range
    7149    request-header field) with an unsatisfiable Range request-header
    7150    field (that is, all of whose byte-range-spec values have a
    7151    first-byte-pos value greater than the current length of the selected
    7152    resource), it &SHOULD; return a response code of 416 (Requested range
    7153    not satisfiable) (<xref target="status.416"/>).
    7154   <list><t>
    7155       <x:h>Note:</x:h> clients cannot depend on servers to send a 416 (Requested
    7156       range not satisfiable) response instead of a 200 (OK) response for
    7157       an unsatisfiable Range request-header, since not all servers
    7158       implement this request-header.
    7159   </t></list>
    7160 </t>
    7161 </section>
    7162 
    7163 <section title="Content-Type" anchor="header.content-type">
    7164   <iref primary="true" item="Content-Type header" x:for-anchor=""/>
    7165   <iref primary="true" item="Headers" subitem="Content-Type" x:for-anchor=""/>
    7166 <t>
    7167    The Content-Type entity-header field indicates the media type of the
    7168    entity-body sent to the recipient or, in the case of the HEAD method,
    7169    the media type that would have been sent had the request been a GET.
    7170 </t>
    7171 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Type"/>
    7172     Content-Type   = "Content-Type" ":" media-type
    7173 </artwork></figure>
    7174 <t>
    7175    Media types are defined in <xref target="media.types"/>. An example of the field is
    7176 </t>
    7177 <figure><artwork type="example">
    7178     Content-Type: text/html; charset=ISO-8859-4
    7179 </artwork></figure>
    7180 <t>
    7181    Further discussion of methods for identifying the media type of an
    7182    entity is provided in <xref target="type"/>.
    7183 </t>
    7184 </section>
    7185 
    7186 <section title="Date" anchor="header.date">
    7187   <iref primary="true" item="Date header" x:for-anchor=""/>
    7188   <iref primary="true" item="Headers" subitem="Date" x:for-anchor=""/>
    7189 <t>
    7190    The Date general-header field represents the date and time at which
    7191    the message was originated, having the same semantics as orig-date in
    7192    RFC 822. The field value is an HTTP-date, as described in <xref target="full.date"/>;
    7193    it &MUST; be sent in RFC 1123 <xref target="RFC1123"/>-date format.
    7194 </t>
    7195 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Date"/>
    7196     Date  = "Date" ":" HTTP-date
    7197 </artwork></figure>
    7198 <t>
    7199    An example is
    7200 </t>
    7201 <figure><artwork type="example">
    7202     Date: Tue, 15 Nov 1994 08:12:31 GMT
    7203 </artwork></figure>
    7204 <t>
    7205    Origin servers &MUST; include a Date header field in all responses,
    7206    except in these cases:
    7207   <list style="numbers">
    7208       <t>If the response status code is 100 (Continue) or 101 (Switching
    7209          Protocols), the response &MAY; include a Date header field, at
    7210          the server's option.</t>
    7211 
    7212       <t>If the response status code conveys a server error, e.g. 500
    7213          (Internal Server Error) or 503 (Service Unavailable), and it is
    7214          inconvenient or impossible to generate a valid Date.</t>
    7215 
    7216       <t>If the server does not have a clock that can provide a
    7217          reasonable approximation of the current time, its responses
    7218          &MUST-NOT; include a Date header field. In this case, the rules
    7219          in <xref target="clockless.origin.server.operation"/> &MUST; be followed.</t>
    7220   </list>
    7221 </t>
    7222 <t>
    7223    A received message that does not have a Date header field &MUST; be
    7224    assigned one by the recipient if the message will be cached by that
    7225    recipient or gatewayed via a protocol which requires a Date. An HTTP
    7226    implementation without a clock &MUST-NOT; cache responses without
    7227    revalidating them on every use. An HTTP cache, especially a shared
    7228    cache, &SHOULD; use a mechanism, such as NTP <xref target="RFC1305"/>, to synchronize its
    7229    clock with a reliable external standard.
    7230 </t>
    7231 <t>
    7232    Clients &SHOULD; only send a Date header field in messages that include
    7233    an entity-body, as in the case of the PUT and POST requests, and even
    7234    then it is optional. A client without a clock &MUST-NOT; send a Date
    7235    header field in a request.
    7236 </t>
    7237 <t>
    7238    The HTTP-date sent in a Date header &SHOULD-NOT;  represent a date and
    7239    time subsequent to the generation of the message. It &SHOULD; represent
    7240    the best available approximation of the date and time of message
    7241    generation, unless the implementation has no means of generating a
    7242    reasonably accurate date and time. In theory, the date ought to
    7243    represent the moment just before the entity is generated. In
    7244    practice, the date can be generated at any time during the message
    7245    origination without affecting its semantic value.
    7246 </t>
    7247 
    7248 <section title="Clockless Origin Server Operation" anchor="clockless.origin.server.operation">
    7249 <t>
    7250    Some origin server implementations might not have a clock available.
    7251    An origin server without a clock &MUST-NOT; assign Expires or Last-Modified
    7252    values to a response, unless these values were associated
    7253    with the resource by a system or user with a reliable clock. It &MAY;
    7254    assign an Expires value that is known, at or before server
    7255    configuration time, to be in the past (this allows "pre-expiration"
    7256    of responses without storing separate Expires values for each
    7257    resource).
    7258 </t>
    7259 </section>
    7260 </section>
    7261 
    7262 <section title="ETag" anchor="header.etag">
    7263   <iref primary="true" item="ETag header" x:for-anchor=""/>
    7264   <iref primary="true" item="Headers" subitem="ETag" x:for-anchor=""/>
    7265 <t>
    7266    The ETag response-header field provides the current value of the
    7267    entity tag for the requested variant. The headers used with entity
    7268    tags are described in sections <xref target="header.if-match" format="counter"/>, <xref target="header.if-none-match" format="counter"/> and <xref target="header.vary" format="counter"/>. The entity tag
    7269    &MAY; be used for comparison with other entities from the same resource
    7270    (see <xref target="weak.and.strong.validators"/>).
    7271 </t>
    7272 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/>
    7273     ETag = "ETag" ":" entity-tag
    7274 </artwork></figure>
    7275 <figure><preamble>
    7276    Examples:
    7277 </preamble>
    7278 <artwork type="example">
    7279    ETag: "xyzzy"
    7280    ETag: W/"xyzzy"
    7281    ETag: ""
    7282 </artwork></figure>
    7283 </section>
    7284 
    7285 <section title="Expect" anchor="header.expect">
    7286   <iref primary="true" item="Expect header" x:for-anchor=""/>
    7287   <iref primary="true" item="Headers" subitem="Expect" x:for-anchor=""/>
    7288 <t>
    7289    The Expect request-header field is used to indicate that particular
    7290    server behaviors are required by the client.
    7291 </t>
    7292 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Expect"/><iref primary="true" item="Grammar" subitem="expectation"/><iref primary="true" item="Grammar" subitem="expectation-extension"/><iref primary="true" item="Grammar" subitem="expect-params"/>
    7293    Expect       =  "Expect" ":" 1#expectation
    7294 
    7295    expectation  =  "100-continue" | expectation-extension
    7296    expectation-extension =  token [ "=" ( token | quoted-string )
    7297                             *expect-params ]
    7298    expect-params =  ";" token [ "=" ( token | quoted-string ) ]
    7299 </artwork></figure>
    7300 <t>
    7301    A server that does not understand or is unable to comply with any of
    7302    the expectation values in the Expect field of a request &MUST; respond
    7303    with appropriate error status. The server &MUST; respond with a 417
    7304    (Expectation Failed) status if any of the expectations cannot be met
    7305    or, if there are other problems with the request, some other 4xx
    7306    status.
    7307 </t>
    7308 <t>
    7309    This header field is defined with extensible syntax to allow for
    7310    future extensions. If a server receives a request containing an
    7311    Expect field that includes an expectation-extension that it does not
    7312    support, it &MUST; respond with a 417 (Expectation Failed) status.
    7313 </t>
    7314 <t>
    7315    Comparison of expectation values is case-insensitive for unquoted
    7316    tokens (including the 100-continue token), and is case-sensitive for
    7317    quoted-string expectation-extensions.
    7318 </t>
    7319 <t>
    7320    The Expect mechanism is hop-by-hop: that is, an HTTP/1.1 proxy &MUST;
    7321    return a 417 (Expectation Failed) status if it receives a request
    7322    with an expectation that it cannot meet. However, the Expect
    7323    request-header itself is end-to-end; it &MUST; be forwarded if the
    7324    request is forwarded.
    7325 </t>
    7326 <t>
    7327    Many older HTTP/1.0 and HTTP/1.1 applications do not understand the
    7328    Expect header.
    7329 </t>
    7330 <t>
    7331    See <xref target="use.of.the.100.status"/> for the use of the 100 (continue) status.
    7332 </t>
    7333 </section>
    7334 
    73352046<section title="Expires" anchor="header.expires">
    73362047  <iref primary="true" item="Expires header" x:for-anchor=""/>
     
    73512062<t>
    73522063   The format is an absolute date and time as defined by HTTP-date in
    7353    <xref target="full.date"/>; it &MUST; be in RFC 1123 date format:
     2064   &full-date;; it &MUST; be in RFC 1123 date format:
    73542065</t>
    73552066<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Expires"/>
     
    73902101   non-cacheable indicates that the response is cacheable, unless
    73912102   indicated otherwise by a Cache-Control header field (<xref target="header.cache-control"/>).
    7392 </t>
    7393 </section>
    7394 
    7395 <section title="From" anchor="header.from">
    7396   <iref primary="true" item="From header" x:for-anchor=""/>
    7397   <iref primary="true" item="Headers" subitem="From" x:for-anchor=""/>
    7398 <t>
    7399    The From request-header field, if given, &SHOULD; contain an Internet
    7400    e-mail address for the human user who controls the requesting user
    7401    agent. The address &SHOULD; be machine-usable, as defined by "mailbox"
    7402    in RFC 822 <xref target="RFC822"/> as updated by RFC 1123 <xref target="RFC1123"/>:
    7403 </t>
    7404 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="From"/>
    7405     From   = "From" ":" mailbox
    7406 </artwork></figure>
    7407 <t>
    7408    An example is:
    7409 </t>
    7410 <figure><artwork type="example">
    7411     From: webmaster@w3.org
    7412 </artwork></figure>
    7413 <t>
    7414    This header field &MAY; be used for logging purposes and as a means for
    7415    identifying the source of invalid or unwanted requests. It &SHOULD-NOT;
    7416    be used as an insecure form of access protection. The interpretation
    7417    of this field is that the request is being performed on behalf of the
    7418    person given, who accepts responsibility for the method performed. In
    7419    particular, robot agents &SHOULD; include this header so that the
    7420    person responsible for running the robot can be contacted if problems
    7421    occur on the receiving end.
    7422 </t>
    7423 <t>
    7424    The Internet e-mail address in this field &MAY; be separate from the
    7425    Internet host which issued the request. For example, when a request
    7426    is passed through a proxy the original issuer's address &SHOULD; be
    7427    used.
    7428 </t>
    7429 <t>
    7430    The client &SHOULD-NOT;  send the From header field without the user's
    7431    approval, as it might conflict with the user's privacy interests or
    7432    their site's security policy. It is strongly recommended that the
    7433    user be able to disable, enable, and modify the value of this field
    7434    at any time prior to a request.
    7435 </t>
    7436 </section>
    7437 
    7438 <section title="Host" anchor="header.host">
    7439   <iref primary="true" item="Host header" x:for-anchor=""/>
    7440   <iref primary="true" item="Headers" subitem="Host" x:for-anchor=""/>
    7441 <t>
    7442    The Host request-header field specifies the Internet host and port
    7443    number of the resource being requested, as obtained from the original
    7444    URI given by the user or referring resource (generally an HTTP URL,
    7445    as described in <xref target="http.url"/>). The Host field value &MUST; represent
    7446    the naming authority of the origin server or gateway given by the
    7447    original URL. This allows the origin server or gateway to
    7448    differentiate between internally-ambiguous URLs, such as the root "/"
    7449    URL of a server for multiple host names on a single IP address.
    7450 </t>
    7451 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Host"/>
    7452     Host = "Host" ":" host [ ":" port ] ; <xref target="http.url"/>
    7453 </artwork></figure>
    7454 <t>
    7455    A "host" without any trailing port information implies the default
    7456    port for the service requested (e.g., "80" for an HTTP URL). For
    7457    example, a request on the origin server for
    7458    &lt;http://www.w3.org/pub/WWW/&gt; would properly include:
    7459 </t>
    7460 <figure><artwork type="example">
    7461     GET /pub/WWW/ HTTP/1.1
    7462     Host: www.w3.org
    7463 </artwork></figure>
    7464 <t>
    7465    A client &MUST; include a Host header field in all HTTP/1.1 request
    7466    messages . If the requested URI does not include an Internet host
    7467    name for the service being requested, then the Host header field &MUST;
    7468    be given with an empty value. An HTTP/1.1 proxy &MUST; ensure that any
    7469    request message it forwards does contain an appropriate Host header
    7470    field that identifies the service being requested by the proxy. All
    7471    Internet-based HTTP/1.1 servers &MUST; respond with a 400 (Bad Request)
    7472    status code to any HTTP/1.1 request message which lacks a Host header
    7473    field.
    7474 </t>
    7475 <t>
    7476    See sections <xref target="the.resource.identified.by.a.request" format="counter"/>
    7477    and <xref target="changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses" format="counter"/>
    7478    for other requirements relating to Host.
    7479 </t>
    7480 </section>
    7481 
    7482 <section title="If-Match" anchor="header.if-match">
    7483   <iref primary="true" item="If-Match header" x:for-anchor=""/>
    7484   <iref primary="true" item="Headers" subitem="If-Match" x:for-anchor=""/>
    7485 <t>
    7486    The If-Match request-header field is used with a method to make it
    7487    conditional. A client that has one or more entities previously
    7488    obtained from the resource can verify that one of those entities is
    7489    current by including a list of their associated entity tags in the
    7490    If-Match header field. Entity tags are defined in <xref target="entity.tags"/>. The
    7491    purpose of this feature is to allow efficient updates of cached
    7492    information with a minimum amount of transaction overhead. It is also
    7493    used, on updating requests, to prevent inadvertent modification of
    7494    the wrong version of a resource. As a special case, the value "*"
    7495    matches any current entity of the resource.
    7496 </t>
    7497 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
    7498     If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
    7499 </artwork></figure>
    7500 <t>
    7501    If any of the entity tags match the entity tag of the entity that
    7502    would have been returned in the response to a similar GET request
    7503    (without the If-Match header) on that resource, or if "*" is given
    7504    and any current entity exists for that resource, then the server &MAY;
    7505    perform the requested method as if the If-Match header field did not
    7506    exist.
    7507 </t>
    7508 <t>
    7509    A server &MUST; use the strong comparison function (see <xref target="weak.and.strong.validators"/>)
    7510    to compare the entity tags in If-Match.
    7511 </t>
    7512 <t>
    7513    If none of the entity tags match, or if "*" is given and no current
    7514    entity exists, the server &MUST-NOT; perform the requested method, and
    7515    &MUST; return a 412 (Precondition Failed) response. This behavior is
    7516    most useful when the client wants to prevent an updating method, such
    7517    as PUT, from modifying a resource that has changed since the client
    7518    last retrieved it.
    7519 </t>
    7520 <t>
    7521    If the request would, without the If-Match header field, result in
    7522    anything other than a 2xx or 412 status, then the If-Match header
    7523    &MUST; be ignored.
    7524 </t>
    7525 <t>
    7526    The meaning of "If-Match: *" is that the method &SHOULD; be performed
    7527    if the representation selected by the origin server (or by a cache,
    7528    possibly using the Vary mechanism, see <xref target="header.vary"/>) exists, and
    7529    &MUST-NOT; be performed if the representation does not exist.
    7530 </t>
    7531 <t>
    7532    A request intended to update a resource (e.g., a PUT) &MAY; include an
    7533    If-Match header field to signal that the request method &MUST-NOT; be
    7534    applied if the entity corresponding to the If-Match value (a single
    7535    entity tag) is no longer a representation of that resource. This
    7536    allows the user to indicate that they do not wish the request to be
    7537    successful if the resource has been changed without their knowledge.
    7538    Examples:
    7539 </t>
    7540 <figure><artwork type="example">
    7541     If-Match: "xyzzy"
    7542     If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
    7543     If-Match: *
    7544 </artwork></figure>
    7545 <t>
    7546    The result of a request having both an If-Match header field and
    7547    either an If-None-Match or an If-Modified-Since header fields is
    7548    undefined by this specification.
    7549 </t>
    7550 </section>
    7551 
    7552 <section title="If-Modified-Since" anchor="header.if-modified-since">
    7553   <iref primary="true" item="If-Modified-Since header" x:for-anchor=""/>
    7554   <iref primary="true" item="Headers" subitem="If-Modified-Since" x:for-anchor=""/>
    7555 <t>
    7556    The If-Modified-Since request-header field is used with a method to
    7557    make it conditional: if the requested variant has not been modified
    7558    since the time specified in this field, an entity will not be
    7559    returned from the server; instead, a 304 (not modified) response will
    7560    be returned without any message-body.
    7561 </t>
    7562 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
    7563     If-Modified-Since = "If-Modified-Since" ":" HTTP-date
    7564 </artwork></figure>
    7565 <t>
    7566    An example of the field is:
    7567 </t>
    7568 <figure><artwork type="example">
    7569     If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
    7570 </artwork></figure>
    7571 <t>
    7572    A GET method with an If-Modified-Since header and no Range header
    7573    requests that the identified entity be transferred only if it has
    7574    been modified since the date given by the If-Modified-Since header.
    7575    The algorithm for determining this includes the following cases:
    7576   <list style="numbers">
    7577       <t>If the request would normally result in anything other than a
    7578          200 (OK) status, or if the passed If-Modified-Since date is
    7579          invalid, the response is exactly the same as for a normal GET.
    7580          A date which is later than the server's current time is
    7581          invalid.</t>
    7582 
    7583       <t>If the variant has been modified since the If-Modified-Since
    7584          date, the response is exactly the same as for a normal GET.</t>
    7585 
    7586       <t>If the variant has not been modified since a valid If-Modified-Since
    7587          date, the server &SHOULD; return a 304 (Not
    7588          Modified) response.</t>
    7589   </list>
    7590 </t>
    7591 <t>
    7592    The purpose of this feature is to allow efficient updates of cached
    7593    information with a minimum amount of transaction overhead.
    7594   <list><t>
    7595       <x:h>Note:</x:h> The Range request-header field modifies the meaning of If-Modified-Since;
    7596       see <xref target="header.range"/> for full details.
    7597     </t><t>
    7598       <x:h>Note:</x:h> If-Modified-Since times are interpreted by the server, whose
    7599       clock might not be synchronized with the client.
    7600     </t><t>
    7601       <x:h>Note:</x:h> When handling an If-Modified-Since header field, some
    7602       servers will use an exact date comparison function, rather than a
    7603       less-than function, for deciding whether to send a 304 (Not
    7604       Modified) response. To get best results when sending an If-Modified-Since
    7605       header field for cache validation, clients are
    7606       advised to use the exact date string received in a previous Last-Modified
    7607       header field whenever possible.
    7608     </t><t>
    7609       <x:h>Note:</x:h> If a client uses an arbitrary date in the If-Modified-Since
    7610       header instead of a date taken from the Last-Modified header for
    7611       the same request, the client should be aware of the fact that this
    7612       date is interpreted in the server's understanding of time. The
    7613       client should consider unsynchronized clocks and rounding problems
    7614       due to the different encodings of time between the client and
    7615       server. This includes the possibility of race conditions if the
    7616       document has changed between the time it was first requested and
    7617       the If-Modified-Since date of a subsequent request, and the
    7618       possibility of clock-skew-related problems if the If-Modified-Since
    7619       date is derived from the client's clock without correction
    7620       to the server's clock. Corrections for different time bases
    7621       between client and server are at best approximate due to network
    7622       latency.
    7623     </t>
    7624   </list>
    7625 </t>
    7626 <t>
    7627    The result of a request having both an If-Modified-Since header field
    7628    and either an If-Match or an If-Unmodified-Since header fields is
    7629    undefined by this specification.
    7630 </t>
    7631 </section>
    7632 
    7633 <section title="If-None-Match" anchor="header.if-none-match">
    7634   <iref primary="true" item="If-None-Match header" x:for-anchor=""/>
    7635   <iref primary="true" item="Headers" subitem="If-None-Match" x:for-anchor=""/>
    7636 <t>
    7637    The If-None-Match request-header field is used with a method to make
    7638    it conditional. A client that has one or more entities previously
    7639    obtained from the resource can verify that none of those entities is
    7640    current by including a list of their associated entity tags in the
    7641    If-None-Match header field. The purpose of this feature is to allow
    7642    efficient updates of cached information with a minimum amount of
    7643    transaction overhead. It is also used to prevent a method (e.g. PUT)
    7644    from inadvertently modifying an existing resource when the client
    7645    believes that the resource does not exist.
    7646 </t>
    7647 <t>
    7648    As a special case, the value "*" matches any current entity of the
    7649    resource.
    7650 </t>
    7651 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
    7652     If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
    7653 </artwork></figure>
    7654 <t>
    7655    If any of the entity tags match the entity tag of the entity that
    7656    would have been returned in the response to a similar GET request
    7657    (without the If-None-Match header) on that resource, or if "*" is
    7658    given and any current entity exists for that resource, then the
    7659    server &MUST-NOT; perform the requested method, unless required to do
    7660    so because the resource's modification date fails to match that
    7661    supplied in an If-Modified-Since header field in the request.
    7662    Instead, if the request method was GET or HEAD, the server &SHOULD;
    7663    respond with a 304 (Not Modified) response, including the cache-related
    7664    header fields (particularly ETag) of one of the entities that
    7665    matched. For all other request methods, the server &MUST; respond with
    7666    a status of 412 (Precondition Failed).
    7667 </t>
    7668 <t>
    7669    See <xref target="weak.and.strong.validators"/> for rules on how to determine if two entities tags
    7670    match. The weak comparison function can only be used with GET or HEAD
    7671    requests.
    7672 </t>
    7673 <t>
    7674    If none of the entity tags match, then the server &MAY; perform the
    7675    requested method as if the If-None-Match header field did not exist,
    7676    but &MUST; also ignore any If-Modified-Since header field(s) in the
    7677    request. That is, if no entity tags match, then the server &MUST-NOT;
    7678    return a 304 (Not Modified) response.
    7679 </t>
    7680 <t>
    7681    If the request would, without the If-None-Match header field, result
    7682    in anything other than a 2xx or 304 status, then the If-None-Match
    7683    header &MUST; be ignored. (See <xref target="rules.for.when.to.use.entity.tags.and.last-modified.dates"/> for a discussion of
    7684    server behavior when both If-Modified-Since and If-None-Match appear
    7685    in the same request.)
    7686 </t>
    7687 <t>
    7688    The meaning of "If-None-Match: *" is that the method &MUST-NOT; be
    7689    performed if the representation selected by the origin server (or by
    7690    a cache, possibly using the Vary mechanism, see <xref target="header.vary"/>)
    7691    exists, and &SHOULD; be performed if the representation does not exist.
    7692    This feature is intended to be useful in preventing races between PUT
    7693    operations.
    7694 </t>
    7695 <t>
    7696    Examples:
    7697 </t>
    7698 <figure><artwork type="example">
    7699     If-None-Match: "xyzzy"
    7700     If-None-Match: W/"xyzzy"
    7701     If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
    7702     If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
    7703     If-None-Match: *
    7704 </artwork></figure>
    7705 <t>
    7706    The result of a request having both an If-None-Match header field and
    7707    either an If-Match or an If-Unmodified-Since header fields is
    7708    undefined by this specification.
    7709 </t>
    7710 </section>
    7711 
    7712 <section title="If-Range" anchor="header.if-range">
    7713   <iref primary="true" item="If-Range header" x:for-anchor=""/>
    7714   <iref primary="true" item="Headers" subitem="If-Range" x:for-anchor=""/>
    7715 <t>
    7716    If a client has a partial copy of an entity in its cache, and wishes
    7717    to have an up-to-date copy of the entire entity in its cache, it
    7718    could use the Range request-header with a conditional GET (using
    7719    either or both of If-Unmodified-Since and If-Match.) However, if the
    7720    condition fails because the entity has been modified, the client
    7721    would then have to make a second request to obtain the entire current
    7722    entity-body.
    7723 </t>
    7724 <t>
    7725    The If-Range header allows a client to "short-circuit" the second
    7726    request. Informally, its meaning is `if the entity is unchanged, send
    7727    me the part(s) that I am missing; otherwise, send me the entire new
    7728    entity'.
    7729 </t>
    7730 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Range"/>
    7731      If-Range = "If-Range" ":" ( entity-tag | HTTP-date )
    7732 </artwork></figure>
    7733 <t>
    7734    If the client has no entity tag for an entity, but does have a Last-Modified
    7735    date, it &MAY; use that date in an If-Range header. (The
    7736    server can distinguish between a valid HTTP-date and any form of
    7737    entity-tag by examining no more than two characters.) The If-Range
    7738    header &SHOULD; only be used together with a Range header, and &MUST; be
    7739    ignored if the request does not include a Range header, or if the
    7740    server does not support the sub-range operation.
    7741 </t>
    7742 <t>
    7743    If the entity tag given in the If-Range header matches the current
    7744    entity tag for the entity, then the server &SHOULD; provide the
    7745    specified sub-range of the entity using a 206 (Partial content)
    7746    response. If the entity tag does not match, then the server &SHOULD;
    7747    return the entire entity using a 200 (OK) response.
    7748 </t>
    7749 </section>
    7750 
    7751 <section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
    7752   <iref primary="true" item="If-Unmodified-Since header" x:for-anchor=""/>
    7753   <iref primary="true" item="Headers" subitem="If-Unmodified-Since" x:for-anchor=""/>
    7754 <t>
    7755    The If-Unmodified-Since request-header field is used with a method to
    7756    make it conditional. If the requested resource has not been modified
    7757    since the time specified in this field, the server &SHOULD; perform the
    7758    requested operation as if the If-Unmodified-Since header were not
    7759    present.
    7760 </t>
    7761 <t>
    7762    If the requested variant has been modified since the specified time,
    7763    the server &MUST-NOT; perform the requested operation, and &MUST; return
    7764    a 412 (Precondition Failed).
    7765 </t>
    7766 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
    7767    If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
    7768 </artwork></figure>
    7769 <t>
    7770    An example of the field is:
    7771 </t>
    7772 <figure><artwork type="example">
    7773     If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
    7774 </artwork></figure>
    7775 <t>
    7776    If the request normally (i.e., without the If-Unmodified-Since
    7777    header) would result in anything other than a 2xx or 412 status, the
    7778    If-Unmodified-Since header &SHOULD; be ignored.
    7779 </t>
    7780 <t>
    7781    If the specified date is invalid, the header is ignored.
    7782 </t>
    7783 <t>
    7784    The result of a request having both an If-Unmodified-Since header
    7785    field and either an If-None-Match or an If-Modified-Since header
    7786    fields is undefined by this specification.
    7787 </t>
    7788 </section>
    7789 
    7790 <section title="Last-Modified" anchor="header.last-modified">
    7791   <iref primary="true" item="Last-Modified header" x:for-anchor=""/>
    7792   <iref primary="true" item="Headers" subitem="Last-Modified" x:for-anchor=""/>
    7793 <t>
    7794    The Last-Modified entity-header field indicates the date and time at
    7795    which the origin server believes the variant was last modified.
    7796 </t>
    7797 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
    7798     Last-Modified  = "Last-Modified" ":" HTTP-date
    7799 </artwork></figure>
    7800 <t>
    7801    An example of its use is
    7802 </t>
    7803 <figure><artwork type="example">
    7804     Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
    7805 </artwork></figure>
    7806 <t>
    7807    The exact meaning of this header field depends on the implementation
    7808    of the origin server and the nature of the original resource. For
    7809    files, it may be just the file system last-modified time. For
    7810    entities with dynamically included parts, it may be the most recent
    7811    of the set of last-modify times for its component parts. For database
    7812    gateways, it may be the last-update time stamp of the record. For
    7813    virtual objects, it may be the last time the internal state changed.
    7814 </t>
    7815 <t>
    7816    An origin server &MUST-NOT; send a Last-Modified date which is later
    7817    than the server's time of message origination. In such cases, where
    7818    the resource's last modification would indicate some time in the
    7819    future, the server &MUST; replace that date with the message
    7820    origination date.
    7821 </t>
    7822 <t>
    7823    An origin server &SHOULD; obtain the Last-Modified value of the entity
    7824    as close as possible to the time that it generates the Date value of
    7825    its response. This allows a recipient to make an accurate assessment
    7826    of the entity's modification time, especially if the entity changes
    7827    near the time that the response is generated.
    7828 </t>
    7829 <t>
    7830    HTTP/1.1 servers &SHOULD; send Last-Modified whenever feasible.
    7831 </t>
    7832 </section>
    7833 
    7834 <section title="Location" anchor="header.location">
    7835   <iref primary="true" item="Location header" x:for-anchor=""/>
    7836   <iref primary="true" item="Headers" subitem="Location" x:for-anchor=""/>
    7837 <t>
    7838    The Location response-header field is used to redirect the recipient
    7839    to a location other than the Request-URI for completion of the
    7840    request or identification of a new resource. For 201 (Created)
    7841    responses, the Location is that of the new resource which was created
    7842    by the request. For 3xx responses, the location &SHOULD; indicate the
    7843    server's preferred URI for automatic redirection to the resource. The
    7844    field value consists of a single absolute URI.
    7845 </t>
    7846 <figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Location"/>
    7847     Location       = "Location" ":" absoluteURI
    7848 </artwork></figure>
    7849 <t>
    7850    An example is:
    7851 </t>
    7852 <figure><artwork type="example">
    7853     Location: http://www.w3.org/pub/WWW/People.html
    7854 </artwork></figure>
    7855