source: draft-ietf-httpbis/latest/p1-messaging.xml @ 2196

Last change on this file since 2196 was 2195, checked in by julian.reschke@…, 8 years ago

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

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/xml
File size: 225.6 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?>
3<!DOCTYPE rfc [
4  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
5  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
6  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
7  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
8  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
9  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
10  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
11  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
12  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
13  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
14  <!ENTITY ID-VERSION "latest">
15  <!ENTITY ID-MONTH "March">
16  <!ENTITY ID-YEAR "2013">
17  <!ENTITY mdash "&#8212;">
18  <!ENTITY Note "<x:h xmlns:x='http://purl.org/net/xml2rfc/ext'>Note:</x:h>">
19  <!ENTITY caching-overview       "<xref target='Part6' x:rel='#caching.overview' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
20  <!ENTITY cache-incomplete       "<xref target='Part6' x:rel='#response.cacheability' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
21  <!ENTITY payload                "<xref target='Part2' x:rel='#payload' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
22  <!ENTITY media-type            "<xref target='Part2' x:rel='#media.type' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
23  <!ENTITY content-codings        "<xref target='Part2' x:rel='#content.codings' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
24  <!ENTITY CONNECT                "<xref target='Part2' x:rel='#CONNECT' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
25  <!ENTITY content.negotiation    "<xref target='Part2' x:rel='#content.negotiation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
26  <!ENTITY diff-mime              "<xref target='Part2' x:rel='#differences.between.http.and.mime' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
27  <!ENTITY representation         "<xref target='Part2' x:rel='#representations' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
28  <!ENTITY HEAD                   "<xref target='Part2' x:rel='#HEAD' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
29  <!ENTITY header-allow           "<xref target='Part2' x:rel='#header.allow' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
30  <!ENTITY header-cache-control   "<xref target='Part6' x:rel='#header.cache-control' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
31  <!ENTITY header-content-encoding    "<xref target='Part2' x:rel='#header.content-encoding' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
32  <!ENTITY header-content-location    "<xref target='Part2' x:rel='#header.content-location' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
33  <!ENTITY header-content-range   "<xref target='Part5' x:rel='#header.content-range' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
34  <!ENTITY header-content-type    "<xref target='Part2' x:rel='#header.content-type' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
35  <!ENTITY header-date            "<xref target='Part2' x:rel='#header.date' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
36  <!ENTITY header-etag            "<xref target='Part4' x:rel='#header.etag' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
37  <!ENTITY header-expires         "<xref target='Part6' x:rel='#header.expires' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
38  <!ENTITY header-last-modified   "<xref target='Part4' x:rel='#header.last-modified' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
39  <!ENTITY header-mime-version    "<xref target='Part2' x:rel='#mime-version' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
40  <!ENTITY header-pragma          "<xref target='Part6' x:rel='#header.pragma' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
41  <!ENTITY header-proxy-authenticate  "<xref target='Part7' x:rel='#header.proxy-authenticate' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
42  <!ENTITY header-proxy-authorization "<xref target='Part7' x:rel='#header.proxy-authorization' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
43  <!ENTITY header-server          "<xref target='Part2' x:rel='#header.server' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
44  <!ENTITY header-warning         "<xref target='Part6' x:rel='#header.warning' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
45  <!ENTITY idempotent-methods     "<xref target='Part2' x:rel='#idempotent.methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
46  <!ENTITY safe-methods           "<xref target='Part2' x:rel='#safe.methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
47  <!ENTITY methods                "<xref target='Part2' x:rel='#methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
48  <!ENTITY OPTIONS                "<xref target='Part2' x:rel='#OPTIONS' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
49  <!ENTITY qvalue                 "<xref target='Part2' x:rel='#quality.values' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
50  <!ENTITY resource               "<xref target='Part2' x:rel='#resources' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
51  <!ENTITY status-codes           "<xref target='Part2' x:rel='#status.codes' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
52  <!ENTITY status-1xx             "<xref target='Part2' x:rel='#status.1xx' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
53  <!ENTITY status-203             "<xref target='Part2' x:rel='#status.203' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
54  <!ENTITY status-3xx             "<xref target='Part2' x:rel='#status.3xx' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
55  <!ENTITY status-304             "<xref target='Part4' x:rel='#status.304' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
56  <!ENTITY status-4xx             "<xref target='Part2' x:rel='#status.4xx' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
57  <!ENTITY status-414             "<xref target='Part2' x:rel='#status.414' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
58  <!ENTITY iana-header-registry   "<xref target='Part2' x:rel='#header.field.registry' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
59]>
60<?rfc toc="yes" ?>
61<?rfc symrefs="yes" ?>
62<?rfc sortrefs="yes" ?>
63<?rfc compact="yes"?>
64<?rfc subcompact="no" ?>
65<?rfc linkmailto="no" ?>
66<?rfc editing="no" ?>
67<?rfc comments="yes"?>
68<?rfc inline="yes"?>
69<?rfc rfcedstyle="yes"?>
70<?rfc-ext allow-markup-in-artwork="yes" ?>
71<?rfc-ext include-references-in-index="yes" ?>
72<rfc obsoletes="2145,2616" updates="2817,2818" category="std" x:maturity-level="proposed"
73     ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"
74     xmlns:x='http://purl.org/net/xml2rfc/ext'>
75<x:link rel="next" basename="p2-semantics"/>
76<x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=&lt;{ref}&gt;:"/>
77<front>
78
79  <title abbrev="HTTP/1.1 Message Syntax and Routing">Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
80
81  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
82    <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
83    <address>
84      <postal>
85        <street>345 Park Ave</street>
86        <city>San Jose</city>
87        <region>CA</region>
88        <code>95110</code>
89        <country>USA</country>
90      </postal>
91      <email>fielding@gbiv.com</email>
92      <uri>http://roy.gbiv.com/</uri>
93    </address>
94  </author>
95
96  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
97    <organization abbrev="greenbytes">greenbytes GmbH</organization>
98    <address>
99      <postal>
100        <street>Hafenweg 16</street>
101        <city>Muenster</city><region>NW</region><code>48155</code>
102        <country>Germany</country>
103      </postal>
104      <email>julian.reschke@greenbytes.de</email>
105      <uri>http://greenbytes.de/tech/webdav/</uri>
106    </address>
107  </author>
108
109  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
110  <workgroup>HTTPbis Working Group</workgroup>
111
112<abstract>
113<t>
114   The Hypertext Transfer Protocol (HTTP) is an application-level protocol for
115   distributed, collaborative, hypertext information systems. HTTP has been in
116   use by the World Wide Web global information initiative since 1990.
117   This document provides an overview of HTTP architecture and its associated
118   terminology, defines the "http" and "https" Uniform Resource Identifier
119   (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements,
120   and describes general security concerns for implementations.
121</t>   
122</abstract>
123
124<note title="Editorial Note (To be removed by RFC Editor)">
125  <t>
126    Discussion of this draft takes place on the HTTPBIS working group
127    mailing list (ietf-http-wg@w3.org), which is archived at
128    <eref target="http://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
129  </t>
130  <t>
131    The current issues list is at
132    <eref target="http://tools.ietf.org/wg/httpbis/trac/report/3"/> and related
133    documents (including fancy diffs) can be found at
134    <eref target="http://tools.ietf.org/wg/httpbis/"/>.
135  </t>
136  <t>
137    The changes in this draft are summarized in <xref target="changes.since.22"/>.
138  </t>
139</note>
140</front>
141<middle>
142<section title="Introduction" anchor="introduction">
143<t>
144   The Hypertext Transfer Protocol (HTTP) is an application-level
145   request/response protocol that uses extensible semantics and self-descriptive
146   message payloads for flexible interaction with network-based hypertext
147   information systems. This document is the first in a series of documents
148   that collectively form the HTTP/1.1 specification:
149   <list style="empty">
150    <t>RFC xxx1: Message Syntax and Routing</t>
151    <t><xref target="Part2" x:fmt="none">RFC xxx2</xref>: Semantics and Content</t>
152    <t><xref target="Part4" x:fmt="none">RFC xxx3</xref>: Conditional Requests</t>
153    <t><xref target="Part5" x:fmt="none">RFC xxx4</xref>: Range Requests</t>
154    <t><xref target="Part6" x:fmt="none">RFC xxx5</xref>: Caching</t>
155    <t><xref target="Part7" x:fmt="none">RFC xxx6</xref>: Authentication</t>
156   </list>
157</t>
158<t>
159   This HTTP/1.1 specification obsoletes and moves to historic status
160   <xref target="RFC2616" x:fmt="none">RFC 2616</xref>, its predecessor
161   <xref target="RFC2068" x:fmt="none">RFC 2068</xref>, and
162   <xref target="RFC2145" x:fmt="none">RFC 2145</xref> (on HTTP versioning).
163   This specification also updates the use of CONNECT to establish a tunnel,
164   previously defined in <xref target="RFC2817" x:fmt="none">RFC 2817</xref>,
165   and defines the "https" URI scheme that was described informally in
166   <xref target="RFC2818" x:fmt="none">RFC 2818</xref>.
167</t>
168<t>
169   HTTP is a generic interface protocol for information systems. It is
170   designed to hide the details of how a service is implemented by presenting
171   a uniform interface to clients that is independent of the types of
172   resources provided. Likewise, servers do not need to be aware of each
173   client's purpose: an HTTP request can be considered in isolation rather
174   than being associated with a specific type of client or a predetermined
175   sequence of application steps. The result is a protocol that can be used
176   effectively in many different contexts and for which implementations can
177   evolve independently over time.
178</t>
179<t>
180   HTTP is also designed for use as an intermediation protocol for translating
181   communication to and from non-HTTP information systems.
182   HTTP proxies and gateways can provide access to alternative information
183   services by translating their diverse protocols into a hypertext
184   format that can be viewed and manipulated by clients in the same way
185   as HTTP services.
186</t>
187<t>
188   One consequence of this flexibility is that the protocol cannot be
189   defined in terms of what occurs behind the interface. Instead, we
190   are limited to defining the syntax of communication, the intent
191   of received communication, and the expected behavior of recipients.
192   If the communication is considered in isolation, then successful
193   actions ought to be reflected in corresponding changes to the
194   observable interface provided by servers. However, since multiple
195   clients might act in parallel and perhaps at cross-purposes, we
196   cannot require that such changes be observable beyond the scope
197   of a single response.
198</t>
199<t>
200   This document describes the architectural elements that are used or
201   referred to in HTTP, defines the "http" and "https" URI schemes,
202   describes overall network operation and connection management,
203   and defines HTTP message framing and forwarding requirements.
204   Our goal is to define all of the mechanisms necessary for HTTP message
205   handling that are independent of message semantics, thereby defining the
206   complete set of requirements for message parsers and
207   message-forwarding intermediaries.
208</t>
209
210
211<section title="Requirement Notation" anchor="intro.requirements">
212<t>
213   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
214   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
215   document are to be interpreted as described in <xref target="RFC2119"/>.
216</t>
217<t>
218   Conformance criteria and considerations regarding error handling
219   are defined in <xref target="conformance"/>.
220</t>
221</section>
222
223<section title="Syntax Notation" anchor="notation">
224<iref primary="true" item="Grammar" subitem="ALPHA"/>
225<iref primary="true" item="Grammar" subitem="CR"/>
226<iref primary="true" item="Grammar" subitem="CRLF"/>
227<iref primary="true" item="Grammar" subitem="CTL"/>
228<iref primary="true" item="Grammar" subitem="DIGIT"/>
229<iref primary="true" item="Grammar" subitem="DQUOTE"/>
230<iref primary="true" item="Grammar" subitem="HEXDIG"/>
231<iref primary="true" item="Grammar" subitem="HTAB"/>
232<iref primary="true" item="Grammar" subitem="LF"/>
233<iref primary="true" item="Grammar" subitem="OCTET"/>
234<iref primary="true" item="Grammar" subitem="SP"/>
235<iref primary="true" item="Grammar" subitem="VCHAR"/>
236<t>
237   This specification uses the Augmented Backus-Naur Form (ABNF) notation
238   of <xref target="RFC5234"/> with the list rule extension defined in
239   <xref target="abnf.extension"/>.  <xref target="collected.abnf"/> shows
240   the collected ABNF with the list rule expanded.
241</t>
242<t anchor="core.rules">
243  <x:anchor-alias value="ALPHA"/>
244  <x:anchor-alias value="CTL"/>
245  <x:anchor-alias value="CR"/>
246  <x:anchor-alias value="CRLF"/>
247  <x:anchor-alias value="DIGIT"/>
248  <x:anchor-alias value="DQUOTE"/>
249  <x:anchor-alias value="HEXDIG"/>
250  <x:anchor-alias value="HTAB"/>
251  <x:anchor-alias value="LF"/>
252  <x:anchor-alias value="OCTET"/>
253  <x:anchor-alias value="SP"/>
254  <x:anchor-alias value="VCHAR"/>
255   The following core rules are included by
256   reference, as defined in <xref target="RFC5234" x:fmt="," x:sec="B.1"/>:
257   ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls),
258   DIGIT (decimal 0-9), DQUOTE (double quote),
259   HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line feed),
260   OCTET (any 8-bit sequence of data), SP (space), and
261   VCHAR (any visible <xref target="USASCII"/> character).
262</t>
263<t>
264   As a convention, ABNF rule names prefixed with "obs-" denote
265   "obsolete" grammar rules that appear for historical reasons.
266</t>
267</section>
268</section>
269
270<section title="Architecture" anchor="architecture">
271<t>
272   HTTP was created for the World Wide Web architecture
273   and has evolved over time to support the scalability needs of a worldwide
274   hypertext system. Much of that architecture is reflected in the terminology
275   and syntax productions used to define HTTP.
276</t>
277
278<section title="Client/Server Messaging" anchor="operation">
279<iref primary="true" item="client"/>
280<iref primary="true" item="server"/>
281<iref primary="true" item="connection"/>
282<t>
283   HTTP is a stateless request/response protocol that operates by exchanging
284   <x:dfn>messages</x:dfn> (<xref target="http.message"/>) across a reliable
285   transport or session-layer
286   "<x:dfn>connection</x:dfn>" (<xref target="connection.management"/>).
287   An HTTP "<x:dfn>client</x:dfn>" is a program that establishes a connection
288   to a server for the purpose of sending one or more HTTP requests.
289   An HTTP "<x:dfn>server</x:dfn>" is a program that accepts connections
290   in order to service HTTP requests by sending HTTP responses.
291</t>
292<iref primary="true" item="user agent"/>
293<iref primary="true" item="origin server"/>
294<iref primary="true" item="browser"/>
295<iref primary="true" item="spider"/>
296<iref primary="true" item="sender"/>
297<iref primary="true" item="recipient"/>
298<t>
299   The terms client and server refer only to the roles that
300   these programs perform for a particular connection.  The same program
301   might act as a client on some connections and a server on others.
302   We use the term "<x:dfn>user agent</x:dfn>" to refer to any of the various
303   client programs that initiate a request, including (but not limited to)
304   browsers, spiders (web-based robots), command-line tools, native
305   applications, and mobile apps.  The term "<x:dfn>origin server</x:dfn>" is
306   used to refer to the program that can originate authoritative responses to
307   a request. For general requirements, we use the terms
308   "<x:dfn>sender</x:dfn>" and "<x:dfn>recipient</x:dfn>" to refer to any
309   component that sends or receives, respectively, a given message.
310</t>
311<t>
312   HTTP relies upon the Uniform Resource Identifier (URI)
313   standard <xref target="RFC3986"/> to indicate the target resource
314   (<xref target="target-resource"/>) and relationships between resources.
315   Messages are passed in a format similar to that used by Internet mail
316   <xref target="RFC5322"/> and the Multipurpose Internet Mail Extensions
317   (MIME) <xref target="RFC2045"/> (see &diff-mime; for the differences
318   between HTTP and MIME messages).
319</t>
320<t>
321   Most HTTP communication consists of a retrieval request (GET) for
322   a representation of some resource identified by a URI.  In the
323   simplest case, this might be accomplished via a single bidirectional
324   connection (===) between the user agent (UA) and the origin server (O).
325</t>
326<figure><artwork type="drawing">
327         request   &gt;
328    <x:highlight>UA</x:highlight> ======================================= <x:highlight>O</x:highlight>
329                                &lt;   response
330</artwork></figure>
331<iref primary="true" item="message"/>
332<iref primary="true" item="request"/>
333<iref primary="true" item="response"/>
334<t>
335   A client sends an HTTP request to a server in the form of a <x:dfn>request</x:dfn>
336   message, beginning with a request-line that includes a method, URI, and
337   protocol version (<xref target="request.line"/>),
338   followed by header fields containing
339   request modifiers, client information, and representation metadata
340   (<xref target="header.fields"/>),
341   an empty line to indicate the end of the header section, and finally
342   a message body containing the payload body (if any,
343   <xref target="message.body"/>).
344</t>
345<t>
346   A server responds to a client's request by sending one or more HTTP
347   <x:dfn>response</x:dfn>
348   messages, each beginning with a status line that
349   includes the protocol version, a success or error code, and textual
350   reason phrase (<xref target="status.line"/>),
351   possibly followed by header fields containing server
352   information, resource metadata, and representation metadata
353   (<xref target="header.fields"/>),
354   an empty line to indicate the end of the header section, and finally
355   a message body containing the payload body (if any,
356   <xref target="message.body"/>).
357</t>
358<t>
359   A connection might be used for multiple request/response exchanges,
360   as defined in <xref target="persistent.connections"/>.
361</t>
362<t>
363   The following example illustrates a typical message exchange for a
364   GET request on the URI "http://www.example.com/hello.txt":
365</t>
366<figure><preamble>
367client request:
368</preamble><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
369GET /hello.txt HTTP/1.1
370User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
371Host: www.example.com
372Accept-Language: en, mi
373
374</artwork></figure>
375<figure><preamble>
376server response:
377</preamble><artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with="  ">
378HTTP/1.1 200 OK
379Date: Mon, 27 Jul 2009 12:28:53 GMT
380Server: Apache
381Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
382ETag: "34aa387-d-1568eb00"
383Accept-Ranges: bytes
384Content-Length: <x:length-of target="exbody"/>
385Vary: Accept-Encoding
386Content-Type: text/plain
387
388<x:span anchor="exbody">Hello World!
389</x:span></artwork>
390<postamble>
391(Note that the content length includes the trailing CR/LF sequence of the body text)
392</postamble></figure>
393</section>
394
395<section title="Implementation Diversity" anchor="implementation-diversity">
396<t>
397   When considering the design of HTTP, it is easy to fall into a trap of
398   thinking that all user agents are general-purpose browsers and all origin
399   servers are large public websites. That is not the case in practice.
400   Common HTTP user agents include household appliances, stereos, scales,
401   firmware update scripts, command-line programs, mobile apps,
402   and communication devices in a multitude of shapes and sizes.  Likewise,
403   common HTTP origin servers include home automation units, configurable
404   networking components, office machines, autonomous robots, news feeds,
405   traffic cameras, ad selectors, and video delivery platforms.
406</t>
407<t>
408   The term "user agent" does not imply that there is a human user directly
409   interacting with the software agent at the time of a request. In many
410   cases, a user agent is installed or configured to run in the background
411   and save its results for later inspection (or save only a subset of those
412   results that might be interesting or erroneous). Spiders, for example, are
413   typically given a start URI and configured to follow certain behavior while
414   crawling the Web as a hypertext graph.
415</t>
416<t>
417   The implementation diversity of HTTP means that we cannot assume the
418   user agent can make interactive suggestions to a user or provide adequate
419   warning for security or privacy options.  In the few cases where this
420   specification requires reporting of errors to the user, it is acceptable
421   for such reporting to only be observable in an error console or log file.
422   Likewise, requirements that an automated action be confirmed by the user
423   before proceeding can be met via advance configuration choices,
424   run-time options, or simply not proceeding with the unsafe action.
425</t>
426</section>
427
428<section title="Intermediaries" anchor="intermediaries">
429<iref primary="true" item="intermediary"/>
430<t>
431   HTTP enables the use of intermediaries to satisfy requests through
432   a chain of connections.  There are three common forms of HTTP
433   <x:dfn>intermediary</x:dfn>: proxy, gateway, and tunnel.  In some cases,
434   a single intermediary might act as an origin server, proxy, gateway,
435   or tunnel, switching behavior based on the nature of each request.
436</t>
437<figure><artwork type="drawing">
438         &gt;             &gt;             &gt;             &gt;
439    <x:highlight>UA</x:highlight> =========== <x:highlight>A</x:highlight> =========== <x:highlight>B</x:highlight> =========== <x:highlight>C</x:highlight> =========== <x:highlight>O</x:highlight>
440               &lt;             &lt;             &lt;             &lt;
441</artwork></figure>
442<t>
443   The figure above shows three intermediaries (A, B, and C) between the
444   user agent and origin server. A request or response message that
445   travels the whole chain will pass through four separate connections.
446   Some HTTP communication options
447   might apply only to the connection with the nearest, non-tunnel
448   neighbor, only to the end-points of the chain, or to all connections
449   along the chain. Although the diagram is linear, each participant might
450   be engaged in multiple, simultaneous communications. For example, B
451   might be receiving requests from many clients other than A, and/or
452   forwarding requests to servers other than C, at the same time that it
453   is handling A's request.
454</t>
455<t>
456<iref primary="true" item="upstream"/><iref primary="true" item="downstream"/>
457<iref primary="true" item="inbound"/><iref primary="true" item="outbound"/>
458   We use the terms "<x:dfn>upstream</x:dfn>" and "<x:dfn>downstream</x:dfn>"
459   to describe various requirements in relation to the directional flow of a
460   message: all messages flow from upstream to downstream.
461   Likewise, we use the terms inbound and outbound to refer to
462   directions in relation to the request path:
463   "<x:dfn>inbound</x:dfn>" means toward the origin server and
464   "<x:dfn>outbound</x:dfn>" means toward the user agent.
465</t>
466<t><iref primary="true" item="proxy"/>
467   A "<x:dfn>proxy</x:dfn>" is a message forwarding agent that is selected by the
468   client, usually via local configuration rules, to receive requests
469   for some type(s) of absolute URI and attempt to satisfy those
470   requests via translation through the HTTP interface.  Some translations
471   are minimal, such as for proxy requests for "http" URIs, whereas
472   other requests might require translation to and from entirely different
473   application-level protocols. Proxies are often used to group an
474   organization's HTTP requests through a common intermediary for the
475   sake of security, annotation services, or shared caching.
476</t>
477<t>
478<iref primary="true" item="transforming proxy"/>
479<iref primary="true" item="non-transforming proxy"/>
480   An HTTP-to-HTTP proxy is called a "<x:dfn>transforming proxy</x:dfn>" if it is designed
481   or configured to modify request or response messages in a semantically
482   meaningful way (i.e., modifications, beyond those required by normal
483   HTTP processing, that change the message in a way that would be
484   significant to the original sender or potentially significant to
485   downstream recipients).  For example, a transforming proxy might be
486   acting as a shared annotation server (modifying responses to include
487   references to a local annotation database), a malware filter, a
488   format transcoder, or an intranet-to-Internet privacy filter.  Such
489   transformations are presumed to be desired by the client (or client
490   organization) that selected the proxy and are beyond the scope of
491   this specification.  However, when a proxy is not intended to transform
492   a given message, we use the term "<x:dfn>non-transforming proxy</x:dfn>" to target
493   requirements that preserve HTTP message semantics. See &status-203; and
494   &header-warning; for status and warning codes related to transformations.
495</t>
496<t><iref primary="true" item="gateway"/><iref primary="true" item="reverse proxy"/>
497<iref primary="true" item="accelerator"/>
498   A "<x:dfn>gateway</x:dfn>" (a.k.a., "<x:dfn>reverse proxy</x:dfn>")
499   is a receiving agent that acts
500   as a layer above some other server(s) and translates the received
501   requests to the underlying server's protocol.  Gateways are often
502   used to encapsulate legacy or untrusted information services, to
503   improve server performance through "<x:dfn>accelerator</x:dfn>" caching, and to
504   enable partitioning or load-balancing of HTTP services across
505   multiple machines.
506</t>
507<t>
508   A gateway behaves as an origin server on its outbound connection and
509   as a user agent on its inbound connection.
510   All HTTP requirements applicable to an origin server
511   also apply to the outbound communication of a gateway.
512   A gateway communicates with inbound servers using any protocol that
513   it desires, including private extensions to HTTP that are outside
514   the scope of this specification.  However, an HTTP-to-HTTP gateway
515   that wishes to interoperate with third-party HTTP servers &MUST;
516   conform to HTTP user agent requirements on the gateway's inbound
517   connection and &MUST; implement the <x:ref>Connection</x:ref>
518   (<xref target="header.connection"/>) and <x:ref>Via</x:ref>
519   (<xref target="header.via"/>) header fields for both connections.
520</t>
521<t><iref primary="true" item="tunnel"/>
522   A "<x:dfn>tunnel</x:dfn>" acts as a blind relay between two connections
523   without changing the messages. Once active, a tunnel is not
524   considered a party to the HTTP communication, though the tunnel might
525   have been initiated by an HTTP request. A tunnel ceases to exist when
526   both ends of the relayed connection are closed. Tunnels are used to
527   extend a virtual connection through an intermediary, such as when
528   Transport Layer Security (TLS, <xref target="RFC5246"/>) is used to
529   establish confidential communication through a shared firewall proxy.
530</t>
531<t><iref primary="true" item="interception proxy"/>
532<iref primary="true" item="transparent proxy"/>
533<iref primary="true" item="captive portal"/>
534   The above categories for intermediary only consider those acting as
535   participants in the HTTP communication.  There are also intermediaries
536   that can act on lower layers of the network protocol stack, filtering or
537   redirecting HTTP traffic without the knowledge or permission of message
538   senders. Network intermediaries often introduce security flaws or
539   interoperability problems by violating HTTP semantics.  For example, an
540   "<x:dfn>interception proxy</x:dfn>" <xref target="RFC3040"/> (also commonly
541   known as a "<x:dfn>transparent proxy</x:dfn>" <xref target="RFC1919"/> or
542   "<x:dfn>captive portal</x:dfn>")
543   differs from an HTTP proxy because it is not selected by the client.
544   Instead, an interception proxy filters or redirects outgoing TCP port 80
545   packets (and occasionally other common port traffic).
546   Interception proxies are commonly found on public network access points,
547   as a means of enforcing account subscription prior to allowing use of
548   non-local Internet services, and within corporate firewalls to enforce
549   network usage policies.
550   They are indistinguishable from a man-in-the-middle attack.
551</t>
552<t>
553   HTTP is defined as a stateless protocol, meaning that each request message
554   can be understood in isolation.  Many implementations depend on HTTP's
555   stateless design in order to reuse proxied connections or dynamically
556   load-balance requests across multiple servers.  Hence, servers &MUST-NOT;
557   assume that two requests on the same connection are from the same user
558   agent unless the connection is secured and specific to that agent.
559   Some non-standard HTTP extensions (e.g., <xref target="RFC4559"/>) have
560   been known to violate this requirement, resulting in security and
561   interoperability problems.
562</t>
563</section>
564
565<section title="Caches" anchor="caches">
566<iref primary="true" item="cache"/>
567<t>
568   A "<x:dfn>cache</x:dfn>" is a local store of previous response messages and the
569   subsystem that controls its message storage, retrieval, and deletion.
570   A cache stores cacheable responses in order to reduce the response
571   time and network bandwidth consumption on future, equivalent
572   requests. Any client or server &MAY; employ a cache, though a cache
573   cannot be used by a server while it is acting as a tunnel.
574</t>
575<t>
576   The effect of a cache is that the request/response chain is shortened
577   if one of the participants along the chain has a cached response
578   applicable to that request. The following illustrates the resulting
579   chain if B has a cached copy of an earlier response from O (via C)
580   for a request that has not been cached by UA or A.
581</t>
582<figure><artwork type="drawing">
583            &gt;             &gt;
584       <x:highlight>UA</x:highlight> =========== <x:highlight>A</x:highlight> =========== <x:highlight>B</x:highlight> - - - - - - <x:highlight>C</x:highlight> - - - - - - <x:highlight>O</x:highlight>
585                  &lt;             &lt;
586</artwork></figure>
587<t><iref primary="true" item="cacheable"/>
588   A response is "<x:dfn>cacheable</x:dfn>" if a cache is allowed to store a copy of
589   the response message for use in answering subsequent requests.
590   Even when a response is cacheable, there might be additional
591   constraints placed by the client or by the origin server on when
592   that cached response can be used for a particular request. HTTP
593   requirements for cache behavior and cacheable responses are
594   defined in &caching-overview;. 
595</t>
596<t>
597   There are a wide variety of architectures and configurations
598   of caches deployed across the World Wide Web and
599   inside large organizations. These include national hierarchies
600   of proxy caches to save transoceanic bandwidth, collaborative systems that
601   broadcast or multicast cache entries, archives of pre-fetched cache
602   entries for use in off-line or high-latency environments, and so on.
603</t>
604</section>
605
606<section title="Conformance and Error Handling" anchor="conformance">
607<t>
608   This specification targets conformance criteria according to the role of
609   a participant in HTTP communication.  Hence, HTTP requirements are placed
610   on senders, recipients, clients, servers, user agents, intermediaries,
611   origin servers, proxies, gateways, or caches, depending on what behavior
612   is being constrained by the requirement. Additional (social) requirements
613   are placed on implementations, resource owners, and protocol element
614   registrations when they apply beyond the scope of a single communication.
615</t>
616<t>
617   The verb "generate" is used instead of "send" where a requirement
618   differentiates between creating a protocol element and merely forwarding a
619   received element downstream.
620</t>
621<t>
622   An implementation is considered conformant if it complies with all of the
623   requirements associated with the roles it partakes in HTTP. Note that
624   SHOULD-level requirements are relevant here, unless one of the documented
625   exceptions is applicable.
626</t>
627<t>
628   Conformance applies to both the syntax and semantics of HTTP protocol
629   elements. A sender &MUST-NOT; generate protocol elements that convey a
630   meaning that is known by that sender to be false. A sender &MUST-NOT;
631   generate protocol elements that do not match the grammar defined by the
632   ABNF rules for those protocol elements that are applicable to the sender's
633   role. If a received protocol element is processed, the recipient &MUST; be
634   able to parse any value that would match the ABNF rules for that protocol
635   element, excluding only those rules not applicable to the recipient's role.
636</t>
637<t>
638   Unless noted otherwise, a recipient &MAY; attempt to recover a usable
639   protocol element from an invalid construct.  HTTP does not define
640   specific error handling mechanisms except when they have a direct impact
641   on security, since different applications of the protocol require
642   different error handling strategies.  For example, a Web browser might
643   wish to transparently recover from a response where the
644   <x:ref>Location</x:ref> header field doesn't parse according to the ABNF,
645   whereas a systems control client might consider any form of error recovery
646   to be dangerous.
647</t>
648</section>
649
650<section title="Protocol Versioning" anchor="http.version">
651  <x:anchor-alias value="HTTP-version"/>
652  <x:anchor-alias value="HTTP-name"/>
653<t>
654   HTTP uses a "&lt;major&gt;.&lt;minor&gt;" numbering scheme to indicate
655   versions of the protocol. This specification defines version "1.1".
656   The protocol version as a whole indicates the sender's conformance
657   with the set of requirements laid out in that version's corresponding
658   specification of HTTP.
659</t>
660<t>
661   The version of an HTTP message is indicated by an HTTP-version field
662   in the first line of the message. HTTP-version is case-sensitive.
663</t>
664<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-version"/><iref primary="true" item="Grammar" subitem="HTTP-name"/>
665  <x:ref>HTTP-version</x:ref>  = <x:ref>HTTP-name</x:ref> "/" <x:ref>DIGIT</x:ref> "." <x:ref>DIGIT</x:ref>
666  <x:ref>HTTP-name</x:ref>     = <x:abnf-char-sequence>"HTTP"</x:abnf-char-sequence> ; "HTTP", case-sensitive
667</artwork></figure>
668<t>
669   The HTTP version number consists of two decimal digits separated by a "."
670   (period or decimal point).  The first digit ("major version") indicates the
671   HTTP messaging syntax, whereas the second digit ("minor version") indicates
672   the highest minor version to which the sender is
673   conformant and able to understand for future communication.  The minor
674   version advertises the sender's communication capabilities even when the
675   sender is only using a backwards-compatible subset of the protocol,
676   thereby letting the recipient know that more advanced features can
677   be used in response (by servers) or in future requests (by clients).
678</t>
679<t>
680   When an HTTP/1.1 message is sent to an HTTP/1.0 recipient
681   <xref target="RFC1945"/> or a recipient whose version is unknown,
682   the HTTP/1.1 message is constructed such that it can be interpreted
683   as a valid HTTP/1.0 message if all of the newer features are ignored.
684   This specification places recipient-version requirements on some
685   new features so that a conformant sender will only use compatible
686   features until it has determined, through configuration or the
687   receipt of a message, that the recipient supports HTTP/1.1.
688</t>
689<t>
690   The interpretation of a header field does not change between minor
691   versions of the same major HTTP version, though the default
692   behavior of a recipient in the absence of such a field can change.
693   Unless specified otherwise, header fields defined in HTTP/1.1 are
694   defined for all versions of HTTP/1.x.  In particular, the <x:ref>Host</x:ref>
695   and <x:ref>Connection</x:ref> header fields ought to be implemented by all
696   HTTP/1.x implementations whether or not they advertise conformance with
697   HTTP/1.1.
698</t>
699<t>
700   New header fields can be defined such that, when they are
701   understood by a recipient, they might override or enhance the
702   interpretation of previously defined header fields.  When an
703   implementation receives an unrecognized header field, the recipient
704   &MUST; ignore that header field for local processing regardless of
705   the message's HTTP version.  An unrecognized header field received
706   by a proxy &MUST; be forwarded downstream unless the header field's
707   field-name is listed in the message's <x:ref>Connection</x:ref> header field
708   (see <xref target="header.connection"/>).
709   These requirements allow HTTP's functionality to be enhanced without
710   requiring prior update of deployed intermediaries.
711</t>
712<t>
713   Intermediaries that process HTTP messages (i.e., all intermediaries
714   other than those acting as tunnels) &MUST; send their own HTTP-version
715   in forwarded messages.  In other words, they &MUST-NOT; blindly
716   forward the first line of an HTTP message without ensuring that the
717   protocol version in that message matches a version to which that
718   intermediary is conformant for both the receiving and
719   sending of messages.  Forwarding an HTTP message without rewriting
720   the HTTP-version might result in communication errors when downstream
721   recipients use the message sender's version to determine what features
722   are safe to use for later communication with that sender.
723</t>
724<t>
725   An HTTP client &SHOULD; send a request version equal to the highest
726   version to which the client is conformant and
727   whose major version is no higher than the highest version supported
728   by the server, if this is known.  An HTTP client &MUST-NOT; send a
729   version to which it is not conformant.
730</t>
731<t>
732   An HTTP client &MAY; send a lower request version if it is known that
733   the server incorrectly implements the HTTP specification, but only
734   after the client has attempted at least one normal request and determined
735   from the response status or header fields (e.g., <x:ref>Server</x:ref>) that
736   the server improperly handles higher request versions.
737</t>
738<t>
739   An HTTP server &SHOULD; send a response version equal to the highest
740   version to which the server is conformant and
741   whose major version is less than or equal to the one received in the
742   request.  An HTTP server &MUST-NOT; send a version to which it is not
743   conformant.  A server &MAY; send a <x:ref>505 (HTTP Version Not
744   Supported)</x:ref> response if it cannot send a response using the
745   major version used in the client's request.
746</t>
747<t>
748   An HTTP server &MAY; send an HTTP/1.0 response to an HTTP/1.0 request
749   if it is known or suspected that the client incorrectly implements the
750   HTTP specification and is incapable of correctly processing later
751   version responses, such as when a client fails to parse the version
752   number correctly or when an intermediary is known to blindly forward
753   the HTTP-version even when it doesn't conform to the given minor
754   version of the protocol. Such protocol downgrades &SHOULD-NOT; be
755   performed unless triggered by specific client attributes, such as when
756   one or more of the request header fields (e.g., <x:ref>User-Agent</x:ref>)
757   uniquely match the values sent by a client known to be in error.
758</t>
759<t>
760   The intention of HTTP's versioning design is that the major number
761   will only be incremented if an incompatible message syntax is
762   introduced, and that the minor number will only be incremented when
763   changes made to the protocol have the effect of adding to the message
764   semantics or implying additional capabilities of the sender.  However,
765   the minor version was not incremented for the changes introduced between
766   <xref target="RFC2068"/> and <xref target="RFC2616"/>, and this revision
767   has specifically avoiding any such changes to the protocol.
768</t>
769</section>
770
771<section title="Uniform Resource Identifiers" anchor="uri">
772<iref primary="true" item="resource"/>
773<t>
774   Uniform Resource Identifiers (URIs) <xref target="RFC3986"/> are used
775   throughout HTTP as the means for identifying resources (&resource;).
776   URI references are used to target requests, indicate redirects, and define
777   relationships.
778</t>
779  <x:anchor-alias value="URI-reference"/>
780  <x:anchor-alias value="absolute-URI"/>
781  <x:anchor-alias value="relative-part"/>
782  <x:anchor-alias value="authority"/>
783  <x:anchor-alias value="path-abempty"/>
784  <x:anchor-alias value="port"/>
785  <x:anchor-alias value="query"/>
786  <x:anchor-alias value="segment"/>
787  <x:anchor-alias value="uri-host"/>
788  <x:anchor-alias value="absolute-path"/>
789  <x:anchor-alias value="partial-URI"/>
790<t>
791   This specification adopts the definitions of "URI-reference",
792   "absolute-URI", "relative-part", "port", "host",
793   "path-abempty", "query", "segment", and "authority" from the
794   URI generic syntax.
795   In addition, we define an "absolute-path" rule (that differs from
796   RFC 3986's "path-absolute" in that it allows a leading "//")
797   and a "partial-URI" rule for protocol elements
798   that allow a relative URI but not a fragment.
799</t>
800<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="URI-reference"><!--exported production--></iref><iref primary="true" item="Grammar" subitem="absolute-URI"/><iref primary="true" item="Grammar" subitem="authority"/><iref primary="true" item="Grammar" subitem="absolute-path"/><iref primary="true" item="Grammar" subitem="port"/><iref primary="true" item="Grammar" subitem="query"/><iref primary="true" item="Grammar" subitem="segment"/><iref primary="true" item="Grammar" subitem="uri-host"/><iref primary="true" item="Grammar" subitem="partial-URI"><!--exported production--></iref>
801  <x:ref>URI-reference</x:ref> = &lt;URI-reference, defined in <xref target="RFC3986" x:fmt="," x:sec="4.1"/>&gt;
802  <x:ref>absolute-URI</x:ref>  = &lt;absolute-URI, defined in <xref target="RFC3986" x:fmt="," x:sec="4.3"/>&gt;
803  <x:ref>relative-part</x:ref> = &lt;relative-part, defined in <xref target="RFC3986" x:fmt="," x:sec="4.2"/>&gt;
804  <x:ref>authority</x:ref>     = &lt;authority, defined in <xref target="RFC3986" x:fmt="," x:sec="3.2"/>&gt;
805  <x:ref>path-abempty</x:ref>  = &lt;path-abempty, defined in <xref target="RFC3986" x:fmt="," x:sec="3.3"/>&gt;
806  <x:ref>port</x:ref>          = &lt;port, defined in <xref target="RFC3986" x:fmt="," x:sec="3.2.3"/>&gt;
807  <x:ref>query</x:ref>         = &lt;query, defined in <xref target="RFC3986" x:fmt="," x:sec="3.4"/>&gt;
808  <x:ref>segment</x:ref>       = &lt;segment, defined in <xref target="RFC3986" x:fmt="," x:sec="3.3"/>&gt;
809  <x:ref>uri-host</x:ref>      = &lt;host, defined in <xref target="RFC3986" x:fmt="," x:sec="3.2.2"/>&gt;
810 
811  <x:ref>absolute-path</x:ref> = 1*( "/" segment )
812  <x:ref>partial-URI</x:ref>   = relative-part [ "?" query ]
813</artwork></figure>
814<t>
815   Each protocol element in HTTP that allows a URI reference will indicate
816   in its ABNF production whether the element allows any form of reference
817   (URI-reference), only a URI in absolute form (absolute-URI), only the
818   path and optional query components, or some combination of the above.
819   Unless otherwise indicated, URI references are parsed
820   relative to the effective request URI
821   (<xref target="effective.request.uri"/>).
822</t>
823
824<section title="http URI scheme" anchor="http.uri">
825  <x:anchor-alias value="http-URI"/>
826  <iref item="http URI scheme" primary="true"/>
827  <iref item="URI scheme" subitem="http" primary="true"/>
828<t>
829   The "http" URI scheme is hereby defined for the purpose of minting
830   identifiers according to their association with the hierarchical
831   namespace governed by a potential HTTP origin server listening for
832   TCP connections on a given port.
833</t>
834<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="http-URI"><!--terminal production--></iref>
835  <x:ref>http-URI</x:ref> = "http:" "//" <x:ref>authority</x:ref> <x:ref>path-abempty</x:ref> [ "?" <x:ref>query</x:ref> ]
836</artwork></figure>
837<t>
838   The HTTP origin server is identified by the generic syntax's
839   <x:ref>authority</x:ref> component, which includes a host identifier
840   and optional TCP port (<xref target="RFC3986" x:fmt="," x:sec="3.2.2"/>).
841   The remainder of the URI, consisting of both the hierarchical path
842   component and optional query component, serves as an identifier for
843   a potential resource within that origin server's name space.
844</t>
845<t>
846   If the host identifier is provided as an IP address,
847   then the origin server is any listener on the indicated TCP port at
848   that IP address. If host is a registered name, then that name is
849   considered an indirect identifier and the recipient might use a name
850   resolution service, such as DNS, to find the address of a listener
851   for that host.
852   The host &MUST-NOT; be empty; if an "http" URI is received with an
853   empty host, then it &MUST; be rejected as invalid.
854   If the port subcomponent is empty or not given, then TCP port 80 is
855   assumed (the default reserved port for WWW services).
856</t>
857<t>
858   Regardless of the form of host identifier, access to that host is not
859   implied by the mere presence of its name or address. The host might or might
860   not exist and, even when it does exist, might or might not be running an
861   HTTP server or listening to the indicated port. The "http" URI scheme
862   makes use of the delegated nature of Internet names and addresses to
863   establish a naming authority (whatever entity has the ability to place
864   an HTTP server at that Internet name or address) and allows that
865   authority to determine which names are valid and how they might be used.
866</t>
867<t>
868   When an "http" URI is used within a context that calls for access to the
869   indicated resource, a client &MAY; attempt access by resolving
870   the host to an IP address, establishing a TCP connection to that address
871   on the indicated port, and sending an HTTP request message
872   (<xref target="http.message"/>) containing the URI's identifying data
873   (<xref target="message.routing"/>) to the server.
874   If the server responds to that request with a non-interim HTTP response
875   message, as described in &status-codes;, then that response
876   is considered an authoritative answer to the client's request.
877</t>
878<t>
879   Although HTTP is independent of the transport protocol, the "http"
880   scheme is specific to TCP-based services because the name delegation
881   process depends on TCP for establishing authority.
882   An HTTP service based on some other underlying connection protocol
883   would presumably be identified using a different URI scheme, just as
884   the "https" scheme (below) is used for resources that require an
885   end-to-end secured connection. Other protocols might also be used to
886   provide access to "http" identified resources &mdash; it is only the
887   authoritative interface used for mapping the namespace that is
888   specific to TCP.
889</t>
890<t>
891   The URI generic syntax for authority also includes a deprecated
892   userinfo subcomponent (<xref target="RFC3986" x:fmt="," x:sec="3.2.1"/>)
893   for including user authentication information in the URI.  Some
894   implementations make use of the userinfo component for internal
895   configuration of authentication information, such as within command
896   invocation options, configuration files, or bookmark lists, even
897   though such usage might expose a user identifier or password.
898   Senders &MUST; exclude the userinfo subcomponent (and its "@"
899   delimiter) when an "http" URI is transmitted within a message as a
900   request target or header field value.
901   Recipients of an "http" URI reference &SHOULD; parse for userinfo and
902   treat its presence as an error, since it is likely being used to obscure
903   the authority for the sake of phishing attacks.
904</t>
905</section>
906
907<section title="https URI scheme" anchor="https.uri">
908   <x:anchor-alias value="https-URI"/>
909   <iref item="https URI scheme"/>
910   <iref item="URI scheme" subitem="https"/>
911<t>
912   The "https" URI scheme is hereby defined for the purpose of minting
913   identifiers according to their association with the hierarchical
914   namespace governed by a potential HTTP origin server listening to a
915   given TCP port for TLS-secured connections <xref target="RFC5246"/>.
916</t>
917<t>
918   All of the requirements listed above for the "http" scheme are also
919   requirements for the "https" scheme, except that a default TCP port
920   of 443 is assumed if the port subcomponent is empty or not given,
921   and the TCP connection &MUST; be secured, end-to-end, through the
922   use of strong encryption prior to sending the first HTTP request.
923</t>
924<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="https-URI"><!--terminal production--></iref>
925  <x:ref>https-URI</x:ref> = "https:" "//" <x:ref>authority</x:ref> <x:ref>path-abempty</x:ref> [ "?" <x:ref>query</x:ref> ]
926</artwork></figure>
927<t>
928   Resources made available via the "https" scheme have no shared
929   identity with the "http" scheme even if their resource identifiers
930   indicate the same authority (the same host listening to the same
931   TCP port).  They are distinct name spaces and are considered to be
932   distinct origin servers.  However, an extension to HTTP that is
933   defined to apply to entire host domains, such as the Cookie protocol
934   <xref target="RFC6265"/>, can allow information
935   set by one service to impact communication with other services
936   within a matching group of host domains.
937</t>
938<t>
939   The process for authoritative access to an "https" identified
940   resource is defined in <xref target="RFC2818"/>.
941</t>
942</section>
943
944<section title="http and https URI Normalization and Comparison" anchor="uri.comparison">
945<t>
946   Since the "http" and "https" schemes conform to the URI generic syntax,
947   such URIs are normalized and compared according to the algorithm defined
948   in <xref target="RFC3986" x:fmt="," x:sec="6"/>, using the defaults
949   described above for each scheme.
950</t>
951<t>
952   If the port is equal to the default port for a scheme, the normal form is
953   to elide the port subcomponent. When not being used in absolute form as the
954   request target of an OPTIONS request, an empty path component is equivalent
955   to an absolute path of "/", so the normal form is to provide a path of "/"
956   instead. The scheme and host are case-insensitive and normally provided in
957   lowercase; all other components are compared in a case-sensitive manner.
958   Characters other than those in the "reserved" set are equivalent to their
959   percent-encoded octets (see <xref target="RFC3986" x:fmt=","
960   x:sec="2.1"/>): the normal form is to not encode them.
961</t>
962<t>
963   For example, the following three URIs are equivalent:
964</t>
965<figure><artwork type="example">
966   http://example.com:80/~smith/home.html
967   http://EXAMPLE.com/%7Esmith/home.html
968   http://EXAMPLE.com:/%7esmith/home.html
969</artwork></figure>
970</section>
971</section>
972</section>
973
974<section title="Message Format" anchor="http.message">
975<x:anchor-alias value="generic-message"/>
976<x:anchor-alias value="message.types"/>
977<x:anchor-alias value="HTTP-message"/>
978<x:anchor-alias value="start-line"/>
979<iref item="header section"/>
980<iref item="headers"/>
981<iref item="header field"/>
982<t>
983   All HTTP/1.1 messages consist of a start-line followed by a sequence of
984   octets in a format similar to the Internet Message Format
985   <xref target="RFC5322"/>: zero or more header fields (collectively
986   referred to as the "headers" or the "header section"), an empty line
987   indicating the end of the header section, and an optional message body.
988</t>
989<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-message"><!--terminal production--></iref>
990  <x:ref>HTTP-message</x:ref>   = <x:ref>start-line</x:ref>
991                   *( <x:ref>header-field</x:ref> <x:ref>CRLF</x:ref> )
992                   <x:ref>CRLF</x:ref>
993                   [ <x:ref>message-body</x:ref> ]
994</artwork></figure>
995<t>
996   The normal procedure for parsing an HTTP message is to read the
997   start-line into a structure, read each header field into a hash
998   table by field name until the empty line, and then use the parsed
999   data to determine if a message body is expected.  If a message body
1000   has been indicated, then it is read as a stream until an amount
1001   of octets equal to the message body length is read or the connection
1002   is closed.
1003</t>
1004<t>
1005   Recipients &MUST; parse an HTTP message as a sequence of octets in an
1006   encoding that is a superset of US-ASCII <xref target="USASCII"/>.
1007   Parsing an HTTP message as a stream of Unicode characters, without regard
1008   for the specific encoding, creates security vulnerabilities due to the
1009   varying ways that string processing libraries handle invalid multibyte
1010   character sequences that contain the octet LF (%x0A).  String-based
1011   parsers can only be safely used within protocol elements after the element
1012   has been extracted from the message, such as within a header field-value
1013   after message parsing has delineated the individual fields.
1014</t>
1015<t>
1016   An HTTP message can be parsed as a stream for incremental processing or
1017   forwarding downstream.  However, recipients cannot rely on incremental
1018   delivery of partial messages, since some implementations will buffer or
1019   delay message forwarding for the sake of network efficiency, security
1020   checks, or payload transformations.
1021</t>
1022
1023<section title="Start Line" anchor="start.line">
1024  <x:anchor-alias value="Start-Line"/>
1025<t>
1026   An HTTP message can either be a request from client to server or a
1027   response from server to client.  Syntactically, the two types of message
1028   differ only in the start-line, which is either a request-line (for requests)
1029   or a status-line (for responses), and in the algorithm for determining
1030   the length of the message body (<xref target="message.body"/>).
1031</t>
1032<t>
1033   In theory, a client could receive requests and a server could receive
1034   responses, distinguishing them by their different start-line formats,
1035   but in practice servers are implemented to only expect a request
1036   (a response is interpreted as an unknown or invalid request method)
1037   and clients are implemented to only expect a response.
1038</t>
1039<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="start-line"/>
1040  <x:ref>start-line</x:ref>     = <x:ref>request-line</x:ref> / <x:ref>status-line</x:ref>
1041</artwork></figure>
1042<t>
1043   A sender &MUST-NOT; send whitespace between the start-line and
1044   the first header field. The presence of such whitespace in a request
1045   might be an attempt to trick a server into ignoring that field or
1046   processing the line after it as a new request, either of which might
1047   result in a security vulnerability if other implementations within
1048   the request chain interpret the same message differently.
1049   Likewise, the presence of such whitespace in a response might be
1050   ignored by some clients or cause others to cease parsing.
1051</t>
1052<t>
1053   A recipient that receives whitespace between the start-line and
1054   the first header field &MUST; either reject the message as invalid or
1055   consume each whitespace-preceded line without further processing of it
1056   (i.e., ignore the entire line, along with any subsequent lines preceded
1057   by whitespace, until a properly formed header field is received or the
1058   header block is terminated).
1059</t>
1060
1061<section title="Request Line" anchor="request.line">
1062  <x:anchor-alias value="Request"/>
1063  <x:anchor-alias value="request-line"/>
1064<t>
1065   A request-line begins with a method token, followed by a single
1066   space (SP), the request-target, another single space (SP), the
1067   protocol version, and ending with CRLF.
1068</t>
1069<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="request-line"/>
1070  <x:ref>request-line</x:ref>   = <x:ref>method</x:ref> <x:ref>SP</x:ref> <x:ref>request-target</x:ref> <x:ref>SP</x:ref> <x:ref>HTTP-version</x:ref> <x:ref>CRLF</x:ref>
1071</artwork></figure>
1072<iref primary="true" item="method"/>
1073<t anchor="method">
1074   The method token indicates the request method to be performed on the
1075   target resource. The request method is case-sensitive.
1076</t>
1077<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="method"/>
1078  <x:ref>method</x:ref>         = <x:ref>token</x:ref>
1079</artwork></figure>
1080<t>
1081   The methods defined by this specification can be found in
1082   &methods;, along with information regarding the HTTP method registry
1083   and considerations for defining new methods.
1084</t>
1085<iref item="request-target"/>
1086<t>
1087   The request-target identifies the target resource upon which to apply
1088   the request, as defined in <xref target="request-target"/>.
1089</t>
1090<t>
1091   No whitespace is allowed inside the method, request-target, and
1092   protocol version.  Hence, recipients typically parse the request-line
1093   into its component parts by splitting on whitespace
1094   (see <xref target="message.robustness"/>).
1095</t>
1096<t>
1097   Unfortunately, some user agents fail to properly encode hypertext
1098   references that have embedded whitespace, sending the characters directly
1099   instead of properly encoding or excluding the disallowed characters.
1100   Recipients of an invalid request-line &SHOULD; respond with either a
1101   <x:ref>400 (Bad Request)</x:ref> error or a <x:ref>301 (Moved Permanently)</x:ref>
1102   redirect with the request-target properly encoded.  Recipients &SHOULD-NOT;
1103   attempt to autocorrect and then process the request without a redirect,
1104   since the invalid request-line might be deliberately crafted to bypass
1105   security filters along the request chain.
1106</t>
1107<t>
1108   HTTP does not place a pre-defined limit on the length of a request-line.
1109   A server that receives a method longer than any that it implements
1110   &SHOULD; respond with a <x:ref>501 (Not Implemented)</x:ref> status code.
1111   A server &MUST; be prepared to receive URIs of unbounded length and
1112   respond with the <x:ref>414 (URI Too Long)</x:ref> status code if the received
1113   request-target would be longer than the server wishes to handle
1114   (see &status-414;).
1115</t>
1116<t>
1117   Various ad-hoc limitations on request-line length are found in practice.
1118   It is &RECOMMENDED; that all HTTP senders and recipients support, at a
1119   minimum, request-line lengths of 8000 octets.
1120</t>
1121</section>
1122
1123<section title="Status Line" anchor="status.line">
1124  <x:anchor-alias value="response"/>
1125  <x:anchor-alias value="status-line"/>
1126  <x:anchor-alias value="status-code"/>
1127  <x:anchor-alias value="reason-phrase"/>
1128<t>
1129   The first line of a response message is the status-line, consisting
1130   of the protocol version, a space (SP), the status code, another space,
1131   a possibly-empty textual phrase describing the status code, and
1132   ending with CRLF.
1133</t>
1134<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="status-line"/>
1135  <x:ref>status-line</x:ref> = <x:ref>HTTP-version</x:ref> <x:ref>SP</x:ref> <x:ref>status-code</x:ref> <x:ref>SP</x:ref> <x:ref>reason-phrase</x:ref> <x:ref>CRLF</x:ref>
1136</artwork></figure>
1137<t>
1138   The status-code element is a 3-digit integer code describing the
1139   result of the server's attempt to understand and satisfy the client's
1140   corresponding request. The rest of the response message is to be
1141   interpreted in light of the semantics defined for that status code.
1142   See &status-codes; for information about the semantics of status codes,
1143   including the classes of status code (indicated by the first digit),
1144   the status codes defined by this specification, considerations for the
1145   definition of new status codes, and the IANA registry.
1146</t>
1147<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="status-code"/>
1148  <x:ref>status-code</x:ref>    = 3<x:ref>DIGIT</x:ref>
1149</artwork></figure>
1150<t>  
1151   The reason-phrase element exists for the sole purpose of providing a
1152   textual description associated with the numeric status code, mostly
1153   out of deference to earlier Internet application protocols that were more
1154   frequently used with interactive text clients. A client &SHOULD; ignore
1155   the reason-phrase content.
1156</t>
1157<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="reason-phrase"/>
1158  <x:ref>reason-phrase</x:ref>  = *( <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
1159</artwork></figure>
1160</section>
1161</section>
1162
1163<section title="Header Fields" anchor="header.fields">
1164  <x:anchor-alias value="header-field"/>
1165  <x:anchor-alias value="field-content"/>
1166  <x:anchor-alias value="field-name"/>
1167  <x:anchor-alias value="field-value"/>
1168  <x:anchor-alias value="obs-fold"/>
1169<t>
1170   Each HTTP header field consists of a case-insensitive field name
1171   followed by a colon (":"), optional whitespace, and the field value.
1172</t>
1173<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="header-field"/><iref primary="true" item="Grammar" subitem="field-name"/><iref primary="true" item="Grammar" subitem="field-value"/><iref primary="true" item="Grammar" subitem="field-content"/><iref primary="true" item="Grammar" subitem="obs-fold"/>
1174  <x:ref>header-field</x:ref>   = <x:ref>field-name</x:ref> ":" <x:ref>OWS</x:ref> <x:ref>field-value</x:ref> <x:ref>BWS</x:ref>
1175  <x:ref>field-name</x:ref>     = <x:ref>token</x:ref>
1176  <x:ref>field-value</x:ref>    = *( <x:ref>field-content</x:ref> / <x:ref>obs-fold</x:ref> )
1177  <x:ref>field-content</x:ref>  = *( <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
1178  <x:ref>obs-fold</x:ref>       = <x:ref>CRLF</x:ref> ( <x:ref>SP</x:ref> / <x:ref>HTAB</x:ref> )
1179                 ; obsolete line folding
1180                 ; see <xref target="field.parsing"/>
1181</artwork></figure>
1182<t>
1183   The field-name token labels the corresponding field-value as having the
1184   semantics defined by that header field.  For example, the <x:ref>Date</x:ref>
1185   header field is defined in &header-date; as containing the origination
1186   timestamp for the message in which it appears.
1187</t>
1188
1189<section title="Field Extensibility" anchor="field.extensibility">
1190<t>
1191   HTTP header fields are fully extensible: there is no limit on the
1192   introduction of new field names, each presumably defining new semantics,
1193   nor on the number of header fields used in a given message.  Existing
1194   fields are defined in each part of this specification and in many other
1195   specifications outside the core standard.
1196   New header fields can be introduced without changing the protocol version
1197   if their defined semantics allow them to be safely ignored by recipients
1198   that do not recognize them.
1199</t>
1200<t>
1201   New HTTP header fields ought to be be registered with IANA in the
1202   Message Header Field Registry, as described in &iana-header-registry;.
1203   A proxy &MUST; forward unrecognized header fields unless the
1204   field-name is listed in the <x:ref>Connection</x:ref> header field
1205   (<xref target="header.connection"/>) or the proxy is specifically
1206   configured to block, or otherwise transform, such fields.
1207   Other recipients &SHOULD; ignore unrecognized header fields.
1208</t>
1209</section>
1210
1211<section title="Field Order" anchor="field.order">
1212<t>
1213   The order in which header fields with differing field names are
1214   received is not significant. However, it is "good practice" to send
1215   header fields that contain control data first, such as <x:ref>Host</x:ref>
1216   on requests and <x:ref>Date</x:ref> on responses, so that implementations
1217   can decide when not to handle a message as early as possible.  A server
1218   &MUST; wait until the entire header section is received before interpreting
1219   a request message, since later header fields might include conditionals,
1220   authentication credentials, or deliberately misleading duplicate
1221   header fields that would impact request processing.
1222</t>
1223<t>
1224   A sender &MUST-NOT; generate multiple header fields with the same field
1225   name in a message unless either the entire field value for that
1226   header field is defined as a comma-separated list [i.e., #(values)]
1227   or the header field is a well-known exception (as noted below).
1228</t>
1229<t>
1230   Multiple header fields with the same field name can be combined into
1231   one "field-name: field-value" pair, without changing the semantics of the
1232   message, by appending each subsequent field value to the combined
1233   field value in order, separated by a comma. The order in which
1234   header fields with the same field name are received is therefore
1235   significant to the interpretation of the combined field value;
1236   a proxy &MUST-NOT; change the order of these field values when
1237   forwarding a message.
1238</t>
1239<x:note>
1240  <t>
1241   &Note; In practice, the "Set-Cookie" header field (<xref target="RFC6265"/>)
1242   often appears multiple times in a response message and does not use the
1243   list syntax, violating the above requirements on multiple header fields
1244   with the same name. Since it cannot be combined into a single field-value,
1245   recipients ought to handle "Set-Cookie" as a special case while processing
1246   header fields. (See Appendix A.2.3 of <xref target="Kri2001"/> for details.)
1247  </t>
1248</x:note>
1249</section>
1250
1251<section title="Whitespace" anchor="whitespace">
1252<t anchor="rule.LWS">
1253   This specification uses three rules to denote the use of linear
1254   whitespace: OWS (optional whitespace), RWS (required whitespace), and
1255   BWS ("bad" whitespace).
1256</t>
1257<t anchor="rule.OWS">
1258   The OWS rule is used where zero or more linear whitespace octets might
1259   appear. OWS &SHOULD; either not be generated or be generated as a single
1260   SP. Multiple OWS octets that occur within field-content &SHOULD; either
1261   be replaced with a single SP or transformed to all SP octets (each
1262   octet other than SP replaced with SP) before interpreting the field value
1263   or forwarding the message downstream.
1264</t>
1265<t anchor="rule.RWS">
1266   RWS is used when at least one linear whitespace octet is required to
1267   separate field tokens. RWS &SHOULD; be generated as a single SP.
1268   Multiple RWS octets that occur within field-content &SHOULD; either
1269   be replaced with a single SP or transformed to all SP octets before
1270   interpreting the field value or forwarding the message downstream.
1271</t>
1272<t anchor="rule.BWS">
1273   BWS is used where the grammar allows optional whitespace, for historical
1274   reasons, but senders &SHOULD-NOT; generate it in messages;
1275   recipients &MUST; accept such bad optional whitespace and remove it before
1276   interpreting the field value or forwarding the message downstream.
1277</t>
1278<t anchor="rule.whitespace">
1279  <x:anchor-alias value="BWS"/>
1280  <x:anchor-alias value="OWS"/>
1281  <x:anchor-alias value="RWS"/>
1282</t>
1283<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="OWS"/><iref primary="true" item="Grammar" subitem="RWS"/><iref primary="true" item="Grammar" subitem="BWS"/>
1284  <x:ref>OWS</x:ref>            = *( <x:ref>SP</x:ref> / <x:ref>HTAB</x:ref> )
1285                 ; optional whitespace
1286  <x:ref>RWS</x:ref>            = 1*( <x:ref>SP</x:ref> / <x:ref>HTAB</x:ref> )
1287                 ; required whitespace
1288  <x:ref>BWS</x:ref>            = <x:ref>OWS</x:ref>
1289                 ; "bad" whitespace
1290</artwork></figure>
1291</section>
1292
1293<section title="Field Parsing" anchor="field.parsing">
1294<t>
1295   No whitespace is allowed between the header field-name and colon.
1296   In the past, differences in the handling of such whitespace have led to
1297   security vulnerabilities in request routing and response handling.
1298   A server &MUST; reject any received request message that contains
1299   whitespace between a header field-name and colon with a response code of
1300   <x:ref>400 (Bad Request)</x:ref>. A proxy &MUST; remove any such whitespace
1301   from a response message before forwarding the message downstream.
1302</t>
1303<t>
1304   A field value is preceded by optional whitespace (OWS); a single SP is
1305   preferred. The field value does not include any leading or trailing white
1306   space: OWS occurring before the first non-whitespace octet of the
1307   field value or after the last non-whitespace octet of the field value
1308   is ignored and &SHOULD; be removed before further processing (as this does
1309   not change the meaning of the header field).
1310</t>
1311<t>
1312   Historically, HTTP header field values could be extended over multiple
1313   lines by preceding each extra line with at least one space or horizontal
1314   tab (obs-fold). This specification deprecates such line folding except
1315   within the message/http media type
1316   (<xref target="internet.media.type.message.http"/>).
1317   Senders &MUST-NOT; generate messages that include line folding
1318   (i.e., that contain any field-value that contains a match to the
1319   <x:ref>obs-fold</x:ref> rule) unless the message is intended for packaging
1320   within the message/http media type. When an <x:ref>obs-fold</x:ref> is
1321   received in a message, recipients &MUST; do one of:
1322   <list style="symbols">
1323      <t>accept the message and replace any embedded <x:ref>obs-fold</x:ref>
1324         whitespace with either a single <x:ref>SP</x:ref> or a matching
1325         number of <x:ref>SP</x:ref> octets (to avoid buffer copying) prior to
1326         interpreting the field value or forwarding the message
1327         downstream;</t>
1328
1329      <t>if it is a request, reject the message by sending a
1330         <x:ref>400 (Bad Request)</x:ref> response with a representation
1331         explaining that obsolete line folding is unacceptable; or,</t>
1332         
1333      <t>if it is a response, discard the message and generate a
1334         <x:ref>502 (Bad Gateway)</x:ref> response with a representation
1335         explaining that unacceptable line folding was received.</t>
1336   </list>
1337   Recipients that choose not to implement <x:ref>obs-fold</x:ref> processing
1338   (as described above) &MUST-NOT; accept messages containing header fields
1339   with leading whitespace, as this can expose them to attacks that exploit
1340   this difference in processing.
1341</t>
1342<t>
1343   Historically, HTTP has allowed field content with text in the ISO-8859-1
1344   <xref target="ISO-8859-1"/> charset, supporting other charsets only
1345   through use of <xref target="RFC2047"/> encoding.
1346   In practice, most HTTP header field values use only a subset of the
1347   US-ASCII charset <xref target="USASCII"/>. Newly defined
1348   header fields &SHOULD; limit their field values to US-ASCII octets.
1349   Recipients &SHOULD; treat other octets in field content (obs-text) as
1350   opaque data.
1351</t>
1352</section>
1353
1354<section title="Field Limits" anchor="field.limits">
1355<t>
1356   HTTP does not place a pre-defined limit on the length of each header field
1357   or on the length of the header block as a whole.  Various ad-hoc
1358   limitations on individual header field length are found in practice,
1359   often depending on the specific field semantics.
1360</t>
1361<t>
1362   A server &MUST; be prepared to receive request header fields of unbounded
1363   length and respond with an appropriate <x:ref>4xx (Client Error)</x:ref>
1364   status code if the received header field(s) are larger than the server
1365   wishes to process.
1366</t>
1367<t>
1368   A client &MUST; be prepared to receive response header fields of unbounded
1369   length. A client &MAY; discard or truncate received header fields that are
1370   larger than the client wishes to process if the field semantics are such
1371   that the dropped value(s) can be safely ignored without changing the
1372   response semantics.
1373</t>
1374</section>
1375
1376<section title="Field value components" anchor="field.components">
1377<t anchor="rule.token.separators">
1378  <x:anchor-alias value="tchar"/>
1379  <x:anchor-alias value="token"/>
1380  <x:anchor-alias value="special"/>
1381  <x:anchor-alias value="word"/>
1382   Many HTTP header field values consist of words (token or quoted-string)
1383   separated by whitespace or special characters. These special characters
1384   &MUST; be in a quoted string to be used within a parameter value (as defined
1385   in <xref target="transfer.codings"/>).
1386</t>
1387<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="word"/><iref primary="true" item="Grammar" subitem="token"/><iref primary="true" item="Grammar" subitem="tchar"/><iref primary="true" item="Grammar" subitem="special"><!--unused production--></iref>
1388  <x:ref>word</x:ref>           = <x:ref>token</x:ref> / <x:ref>quoted-string</x:ref>
1389
1390  <x:ref>token</x:ref>          = 1*<x:ref>tchar</x:ref>
1391<!--
1392  IMPORTANT: when editing "tchar" make sure that "special" is updated accordingly!!!
1393 -->
1394  <x:ref>tchar</x:ref>          = "!" / "#" / "$" / "%" / "&amp;" / "'" / "*"
1395                 / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
1396                 / <x:ref>DIGIT</x:ref> / <x:ref>ALPHA</x:ref>
1397                 ; any <x:ref>VCHAR</x:ref>, except <x:ref>special</x:ref>
1398
1399  <x:ref>special</x:ref>        = "(" / ")" / "&lt;" / ">" / "@" / ","
1400                 / ";" / ":" / "\" / DQUOTE / "/" / "["
1401                 / "]" / "?" / "=" / "{" / "}"
1402</artwork></figure>
1403<t anchor="rule.quoted-string">
1404  <x:anchor-alias value="quoted-string"/>
1405  <x:anchor-alias value="qdtext"/>
1406  <x:anchor-alias value="obs-text"/>
1407   A string of text is parsed as a single word if it is quoted using
1408   double-quote marks.
1409</t>
1410<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-string"/><iref primary="true" item="Grammar" subitem="qdtext"/><iref primary="true" item="Grammar" subitem="obs-text"/>
1411  <x:ref>quoted-string</x:ref>  = <x:ref>DQUOTE</x:ref> *( <x:ref>qdtext</x:ref> / <x:ref>quoted-pair</x:ref> ) <x:ref>DQUOTE</x:ref>
1412  <x:ref>qdtext</x:ref>         = <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> /%x21 / %x23-5B / %x5D-7E / <x:ref>obs-text</x:ref>
1413  <x:ref>obs-text</x:ref>       = %x80-FF
1414</artwork></figure>
1415<t anchor="rule.quoted-pair">
1416  <x:anchor-alias value="quoted-pair"/>
1417   The backslash octet ("\") can be used as a single-octet
1418   quoting mechanism within quoted-string constructs:
1419</t>
1420<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-pair"/>
1421  <x:ref>quoted-pair</x:ref>    = "\" ( <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
1422</artwork></figure>
1423<t>
1424   Recipients that process the value of a quoted-string &MUST; handle a
1425   quoted-pair as if it were replaced by the octet following the backslash.
1426</t>
1427<t>
1428   Senders &SHOULD-NOT; generate a quoted-pair in a quoted-string except where
1429   necessary to quote DQUOTE and backslash octets occurring within that string.
1430</t>
1431<t anchor="rule.comment">
1432  <x:anchor-alias value="comment"/>
1433  <x:anchor-alias value="ctext"/>
1434   Comments can be included in some HTTP header fields by surrounding
1435   the comment text with parentheses. Comments are only allowed in
1436   fields containing "comment" as part of their field value definition.
1437</t>
1438<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="comment"/><iref primary="true" item="Grammar" subitem="ctext"/>
1439  <x:ref>comment</x:ref>        = "(" *( <x:ref>ctext</x:ref> / <x:ref>quoted-cpair</x:ref> / <x:ref>comment</x:ref> ) ")"
1440  <x:ref>ctext</x:ref>          = <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> / %x21-27 / %x2A-5B / %x5D-7E / <x:ref>obs-text</x:ref>
1441</artwork></figure>
1442<t anchor="rule.quoted-cpair">
1443  <x:anchor-alias value="quoted-cpair"/>
1444   The backslash octet ("\") can be used as a single-octet
1445   quoting mechanism within comment constructs:
1446</t>
1447<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-cpair"/>
1448  <x:ref>quoted-cpair</x:ref>   = "\" ( <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
1449</artwork></figure>
1450<t>
1451   Senders &SHOULD-NOT; escape octets in comments that do not require escaping
1452   (i.e., other than the backslash octet "\" and the parentheses "(" and ")").
1453</t>
1454</section>
1455
1456</section>
1457
1458<section title="Message Body" anchor="message.body">
1459  <x:anchor-alias value="message-body"/>
1460<t>
1461   The message body (if any) of an HTTP message is used to carry the
1462   payload body of that request or response.  The message body is
1463   identical to the payload body unless a transfer coding has been
1464   applied, as described in <xref target="header.transfer-encoding"/>.
1465</t>
1466<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="message-body"/>
1467  <x:ref>message-body</x:ref> = *OCTET
1468</artwork></figure>
1469<t>
1470   The rules for when a message body is allowed in a message differ for
1471   requests and responses.
1472</t>
1473<t>
1474   The presence of a message body in a request is signaled by a
1475   <x:ref>Content-Length</x:ref> or <x:ref>Transfer-Encoding</x:ref> header
1476   field. Request message framing is independent of method semantics,
1477   even if the method does not define any use for a message body.
1478</t>
1479<t>
1480   The presence of a message body in a response depends on both
1481   the request method to which it is responding and the response
1482   status code (<xref target="status.line"/>).
1483   Responses to the HEAD request method never include a message body
1484   because the associated response header fields (e.g.,
1485   <x:ref>Transfer-Encoding</x:ref>, <x:ref>Content-Length</x:ref>, etc.),
1486   if present, indicate only what their values would have been if the request
1487   method had been GET (&HEAD;).
1488   <x:ref>2xx (Successful)</x:ref> responses to CONNECT switch to tunnel
1489   mode instead of having a message body (&CONNECT;).
1490   All <x:ref>1xx (Informational)</x:ref>, <x:ref>204 (No Content)</x:ref>, and
1491   <x:ref>304 (Not Modified)</x:ref> responses do not include a message body.
1492   All other responses do include a message body, although the body
1493   might be of zero length.
1494</t>
1495
1496<section title="Transfer-Encoding" anchor="header.transfer-encoding">
1497  <iref primary="true" item="Transfer-Encoding header field" x:for-anchor=""/>
1498  <iref item="chunked (Coding Format)"/>
1499  <x:anchor-alias value="Transfer-Encoding"/>
1500<t>
1501   The Transfer-Encoding header field lists the transfer coding names
1502   corresponding to the sequence of transfer codings that have been
1503   (or will be) applied to the payload body in order to form the message body.
1504   Transfer codings are defined in <xref target="transfer.codings"/>.
1505</t>
1506<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Transfer-Encoding"/>
1507  <x:ref>Transfer-Encoding</x:ref> = 1#<x:ref>transfer-coding</x:ref>
1508</artwork></figure>
1509<t>
1510   Transfer-Encoding is analogous to the Content-Transfer-Encoding field of
1511   MIME, which was designed to enable safe transport of binary data over a
1512   7-bit transport service (<xref target="RFC2045" x:fmt="," x:sec="6"/>).
1513   However, safe transport has a different focus for an 8bit-clean transfer
1514   protocol. In HTTP's case, Transfer-Encoding is primarily intended to
1515   accurately delimit a dynamically generated payload and to distinguish
1516   payload encodings that are only applied for transport efficiency or
1517   security from those that are characteristics of the selected resource.
1518</t>
1519<t>
1520   All HTTP/1.1 recipients &MUST; implement the chunked transfer coding
1521   (<xref target="chunked.encoding"/>) because it plays a crucial role in
1522   framing messages when the payload body size is not known in advance.
1523   If chunked is applied to a payload body, the sender &MUST-NOT; apply
1524   chunked more than once (i.e., chunking an already chunked message is not
1525   allowed).
1526   If any transfer coding is applied to a request payload body, the
1527   sender &MUST; apply chunked as the final transfer coding to ensure that
1528   the message is properly framed.
1529   If any transfer coding is applied to a response payload body, the
1530   sender &MUST; either apply chunked as the final transfer coding or
1531   terminate the message by closing the connection.
1532</t>
1533<figure><preamble>
1534   For example,
1535</preamble><artwork type="example">
1536  Transfer-Encoding: gzip, chunked
1537</artwork><postamble>
1538   indicates that the payload body has been compressed using the gzip
1539   coding and then chunked using the chunked coding while forming the
1540   message body.
1541</postamble></figure>
1542<t>
1543   Unlike <x:ref>Content-Encoding</x:ref> (&content-codings;),
1544   Transfer-Encoding is a property of the message, not of the representation, and
1545   any recipient along the request/response chain &MAY; decode the received
1546   transfer coding(s) or apply additional transfer coding(s) to the message
1547   body, assuming that corresponding changes are made to the Transfer-Encoding
1548   field-value. Additional information about the encoding parameters &MAY; be
1549   provided by other header fields not defined by this specification.
1550</t>
1551<t>
1552   Transfer-Encoding &MAY; be sent in a response to a HEAD request or in a
1553   <x:ref>304 (Not Modified)</x:ref> response (&status-304;) to a GET request,
1554   neither of which includes a message body,
1555   to indicate that the origin server would have applied a transfer coding
1556   to the message body if the request had been an unconditional GET.
1557   This indication is not required, however, because any recipient on
1558   the response chain (including the origin server) can remove transfer
1559   codings when they are not needed.
1560</t>
1561<t>
1562   Transfer-Encoding was added in HTTP/1.1.  It is generally assumed that
1563   implementations advertising only HTTP/1.0 support will not understand
1564   how to process a transfer-encoded payload.
1565   A client &MUST-NOT; send a request containing Transfer-Encoding unless it
1566   knows the server will handle HTTP/1.1 (or later) requests; such knowledge
1567   might be in the form of specific user configuration or by remembering the
1568   version of a prior received response.
1569   A server &MUST-NOT; send a response containing Transfer-Encoding unless
1570   the corresponding request indicates HTTP/1.1 (or later).
1571</t>
1572<t>
1573   A server that receives a request message with a transfer coding it does
1574   not understand &SHOULD; respond with <x:ref>501 (Not Implemented)</x:ref>.
1575</t>
1576</section>
1577
1578<section title="Content-Length" anchor="header.content-length">
1579  <iref primary="true" item="Content-Length header field" x:for-anchor=""/>
1580  <x:anchor-alias value="Content-Length"/>
1581<t>
1582   When a message does not have a <x:ref>Transfer-Encoding</x:ref> header
1583   field, a Content-Length header field can provide the anticipated size,
1584   as a decimal number of octets, for a potential payload body.
1585   For messages that do include a payload body, the Content-Length field-value
1586   provides the framing information necessary for determining where the body
1587   (and message) ends.  For messages that do not include a payload body, the
1588   Content-Length indicates the size of the selected representation
1589   (&representation;).
1590</t>
1591<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Length"/>
1592  <x:ref>Content-Length</x:ref> = 1*<x:ref>DIGIT</x:ref>
1593</artwork></figure>
1594<t>
1595   An example is
1596</t>
1597<figure><artwork type="example">
1598  Content-Length: 3495
1599</artwork></figure>
1600<t>
1601   A sender &MUST-NOT; send a Content-Length header field in any message that
1602   contains a <x:ref>Transfer-Encoding</x:ref> header field.
1603</t>
1604<t>
1605   A user agent &SHOULD; send a Content-Length in a request message when no
1606   <x:ref>Transfer-Encoding</x:ref> is sent and the request method defines
1607   a meaning for an enclosed payload body. For example, a Content-Length
1608   header field is normally sent in a POST request even when the value is
1609   0 (indicating an empty payload body).  A user agent &SHOULD-NOT; send a
1610   Content-Length header field when the request message does not contain a
1611   payload body and the method semantics do not anticipate such a body.
1612</t>
1613<t>
1614   A server &MAY; send a Content-Length header field in a response to a HEAD
1615   request (&HEAD;); a server &MUST-NOT; send Content-Length in such a
1616   response unless its field-value equals the decimal number of octets that
1617   would have been sent in the payload body of a response if the same
1618   request had used the GET method.
1619</t>
1620<t>
1621   A server &MAY; send a Content-Length header field in a
1622   <x:ref>304 (Not Modified)</x:ref> response to a conditional GET request
1623   (&status-304;); a server &MUST-NOT; send Content-Length in such a
1624   response unless its field-value equals the decimal number of octets that
1625   would have been sent in the payload body of a <x:ref>200 (OK)</x:ref>
1626   response to the same request.
1627</t>
1628<t>
1629   A server &MUST-NOT; send a Content-Length header field in any response
1630   with a status code of
1631   <x:ref>1xx (Informational)</x:ref> or <x:ref>204 (No Content)</x:ref>.
1632   A server &SHOULD-NOT; send a Content-Length header field in any
1633   <x:ref>2xx (Successful)</x:ref> response to a CONNECT request (&CONNECT;).
1634</t>
1635<t>
1636   Aside from the cases defined above, in the absence of Transfer-Encoding,
1637   an origin server &SHOULD; send a Content-Length header field when the
1638   payload body size is known prior to sending the complete header block.
1639   This will allow downstream recipients to measure transfer progress,
1640   know when a received message is complete, and potentially reuse the
1641   connection for additional requests.
1642</t>
1643<t>
1644   Any Content-Length field value greater than or equal to zero is valid.
1645   Since there is no predefined limit to the length of a payload,
1646   recipients &SHOULD; anticipate potentially large decimal numerals and
1647   prevent parsing errors due to integer conversion overflows
1648   (<xref target="attack.protocol.element.size.overflows"/>).
1649</t>
1650<t>
1651   If a message is received that has multiple Content-Length header fields
1652   with field-values consisting of the same decimal value, or a single
1653   Content-Length header field with a field value containing a list of
1654   identical decimal values (e.g., "Content-Length: 42, 42"), indicating that
1655   duplicate Content-Length header fields have been generated or combined by an
1656   upstream message processor, then the recipient &MUST; either reject the
1657   message as invalid or replace the duplicated field-values with a single
1658   valid Content-Length field containing that decimal value prior to
1659   determining the message body length.
1660</t>
1661<x:note>
1662  <t>
1663   &Note; HTTP's use of Content-Length for message framing differs
1664   significantly from the same field's use in MIME, where it is an optional
1665   field used only within the "message/external-body" media-type.
1666  </t>
1667</x:note>
1668</section>
1669
1670<section title="Message Body Length" anchor="message.body.length">
1671  <iref item="chunked (Coding Format)"/>
1672<t>
1673   The length of a message body is determined by one of the following
1674   (in order of precedence):
1675</t>
1676<t>
1677  <list style="numbers">
1678    <x:lt><t>
1679     Any response to a HEAD request and any response with a
1680     <x:ref>1xx (Informational)</x:ref>, <x:ref>204 (No Content)</x:ref>, or
1681     <x:ref>304 (Not Modified)</x:ref> status code is always
1682     terminated by the first empty line after the header fields, regardless of
1683     the header fields present in the message, and thus cannot contain a
1684     message body.
1685    </t></x:lt>
1686    <x:lt><t>
1687     Any <x:ref>2xx (Successful)</x:ref> response to a CONNECT request implies that the
1688     connection will become a tunnel immediately after the empty line that
1689     concludes the header fields.  A client &MUST; ignore any
1690     <x:ref>Content-Length</x:ref> or <x:ref>Transfer-Encoding</x:ref> header
1691     fields received in such a message.
1692    </t></x:lt>
1693    <x:lt><t>
1694     If a <x:ref>Transfer-Encoding</x:ref> header field is present
1695     and the chunked transfer coding (<xref target="chunked.encoding"/>)
1696     is the final encoding, the message body length is determined by reading
1697     and decoding the chunked data until the transfer coding indicates the
1698     data is complete.
1699    </t>
1700    <t>
1701     If a <x:ref>Transfer-Encoding</x:ref> header field is present in a
1702     response and the chunked transfer coding is not the final encoding, the
1703     message body length is determined by reading the connection until it is
1704     closed by the server.
1705     If a <x:ref>Transfer-Encoding</x:ref> header field is present in a request and the
1706     chunked transfer coding is not the final encoding, the message body
1707     length cannot be determined reliably; the server &MUST; respond with
1708     the <x:ref>400 (Bad Request)</x:ref> status code and then close the connection.
1709    </t>
1710    <t>
1711     If a message is received with both a <x:ref>Transfer-Encoding</x:ref>
1712     and a <x:ref>Content-Length</x:ref> header field, the Transfer-Encoding
1713     overrides the Content-Length. Such a message might indicate an attempt
1714     to perform request or response smuggling (bypass of security-related
1715     checks on message routing or content) and thus ought to be handled as
1716     an error.  A sender &MUST; remove the received Content-Length field
1717     prior to forwarding such a message downstream.
1718    </t></x:lt>
1719    <x:lt><t>
1720     If a message is received without <x:ref>Transfer-Encoding</x:ref> and with
1721     either multiple <x:ref>Content-Length</x:ref> header fields having
1722     differing field-values or a single Content-Length header field having an
1723     invalid value, then the message framing is invalid and &MUST; be treated
1724     as an error to prevent request or response smuggling.
1725     If this is a request message, the server &MUST; respond with
1726     a <x:ref>400 (Bad Request)</x:ref> status code and then close the connection.
1727     If this is a response message received by a proxy, the proxy
1728     &MUST; discard the received response, send a <x:ref>502 (Bad Gateway)</x:ref>
1729     status code as its downstream response, and then close the connection.
1730     If this is a response message received by a user agent, it &MUST; be
1731     treated as an error by discarding the message and closing the connection.
1732    </t></x:lt>
1733    <x:lt><t>
1734     If a valid <x:ref>Content-Length</x:ref> header field is present without
1735     <x:ref>Transfer-Encoding</x:ref>, its decimal value defines the
1736     expected message body length in octets.
1737     If the sender closes the connection or the recipient times out before the
1738     indicated number of octets are received, the recipient &MUST; consider
1739     the message to be incomplete and close the connection.
1740    </t></x:lt>
1741    <x:lt><t>
1742     If this is a request message and none of the above are true, then the
1743     message body length is zero (no message body is present).
1744    </t></x:lt>
1745    <x:lt><t>
1746     Otherwise, this is a response message without a declared message body
1747     length, so the message body length is determined by the number of octets
1748     received prior to the server closing the connection.
1749    </t></x:lt>
1750  </list>
1751</t>
1752<t>
1753   Since there is no way to distinguish a successfully completed,
1754   close-delimited message from a partially-received message interrupted
1755   by network failure, a server &SHOULD; use encoding or
1756   length-delimited messages whenever possible.  The close-delimiting
1757   feature exists primarily for backwards compatibility with HTTP/1.0.
1758</t>
1759<t>
1760   A server &MAY; reject a request that contains a message body but
1761   not a <x:ref>Content-Length</x:ref> by responding with
1762   <x:ref>411 (Length Required)</x:ref>.
1763</t>
1764<t>
1765   Unless a transfer coding other than chunked has been applied,
1766   a client that sends a request containing a message body &SHOULD;
1767   use a valid <x:ref>Content-Length</x:ref> header field if the message body
1768   length is known in advance, rather than the chunked transfer coding, since some
1769   existing services respond to chunked with a <x:ref>411 (Length Required)</x:ref>
1770   status code even though they understand the chunked transfer coding.  This
1771   is typically because such services are implemented via a gateway that
1772   requires a content-length in advance of being called and the server
1773   is unable or unwilling to buffer the entire request before processing.
1774</t>
1775<t>
1776   A user agent that sends a request containing a message body &MUST; send a
1777   valid <x:ref>Content-Length</x:ref> header field if it does not know the
1778   server will handle HTTP/1.1 (or later) requests; such knowledge can be in
1779   the form of specific user configuration or by remembering the version of a
1780   prior received response.
1781</t>
1782<t>
1783   If the final response to the last request on a connection has been
1784   completely received and there remains additional data to read, a user agent
1785   &MAY; discard the remaining data or attempt to determine if that data
1786   belongs as part of the prior response body, which might be the case if the
1787   prior message's Content-Length value is incorrect. A client &MUST-NOT;
1788   process, cache, or forward such extra data as a separate response, since
1789   such behavior would be vulnerable to cache poisoning.
1790</t>
1791</section>
1792</section>
1793
1794<section anchor="incomplete.messages" title="Handling Incomplete Messages">
1795<t>
1796   A server that receives an incomplete request message, usually due to a
1797   canceled request or a triggered time-out exception, &MAY; send an error
1798   response prior to closing the connection.
1799</t>
1800<t>
1801   A client that receives an incomplete response message, which can occur
1802   when a connection is closed prematurely or when decoding a supposedly
1803   chunked transfer coding fails, &MUST; record the message as incomplete.
1804   Cache requirements for incomplete responses are defined in
1805   &cache-incomplete;.
1806</t>
1807<t>
1808   If a response terminates in the middle of the header block (before the
1809   empty line is received) and the status code might rely on header fields to
1810   convey the full meaning of the response, then the client cannot assume
1811   that meaning has been conveyed; the client might need to repeat the
1812   request in order to determine what action to take next.
1813</t>
1814<t>
1815   A message body that uses the chunked transfer coding is
1816   incomplete if the zero-sized chunk that terminates the encoding has not
1817   been received.  A message that uses a valid <x:ref>Content-Length</x:ref> is
1818   incomplete if the size of the message body received (in octets) is less than
1819   the value given by Content-Length.  A response that has neither chunked
1820   transfer coding nor Content-Length is terminated by closure of the
1821   connection, and thus is considered complete regardless of the number of
1822   message body octets received, provided that the header block was received
1823   intact.
1824</t>
1825</section>
1826
1827<section title="Message Parsing Robustness" anchor="message.robustness">
1828<t>
1829   Older HTTP/1.0 user agent implementations might send an extra CRLF
1830   after a POST request as a lame workaround for some early server
1831   applications that failed to read message body content that was
1832   not terminated by a line-ending. An HTTP/1.1 user agent &MUST-NOT;
1833   preface or follow a request with an extra CRLF.  If terminating
1834   the request message body with a line-ending is desired, then the
1835   user agent &MUST; count the terminating CRLF octets as part of the
1836   message body length.
1837</t>
1838<t>
1839   In the interest of robustness, servers &SHOULD; ignore at least one
1840   empty line received where a request-line is expected. In other words, if
1841   a server is reading the protocol stream at the beginning of a
1842   message and receives a CRLF first, the server &SHOULD; ignore the CRLF.
1843</t>
1844<t>
1845   Although the line terminator for the start-line and header
1846   fields is the sequence CRLF, recipients &MAY; recognize a
1847   single LF as a line terminator and ignore any preceding CR.
1848</t>
1849<t>
1850   Although the request-line and status-line grammar rules require that each
1851   of the component elements be separated by a single SP octet, recipients
1852   &MAY; instead parse on whitespace-delimited word boundaries and, aside
1853   from the CRLF terminator, treat any form of whitespace as the SP separator
1854   while ignoring preceding or trailing whitespace;
1855   such whitespace includes one or more of the following octets:
1856   SP, HTAB, VT (%x0B), FF (%x0C), or bare CR.
1857</t>
1858<t>
1859   When a server listening only for HTTP request messages, or processing
1860   what appears from the start-line to be an HTTP request message,
1861   receives a sequence of octets that does not match the HTTP-message
1862   grammar aside from the robustness exceptions listed above, the
1863   server &SHOULD; respond with a <x:ref>400 (Bad Request)</x:ref> response. 
1864</t>
1865</section>
1866</section>
1867
1868<section title="Transfer Codings" anchor="transfer.codings">
1869  <x:anchor-alias value="transfer-coding"/>
1870  <x:anchor-alias value="transfer-extension"/>
1871<t>
1872   Transfer coding names are used to indicate an encoding
1873   transformation that has been, can be, or might need to be applied to a
1874   payload body in order to ensure "safe transport" through the network.
1875   This differs from a content coding in that the transfer coding is a
1876   property of the message rather than a property of the representation
1877   that is being transferred.
1878</t>
1879<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="transfer-coding"/><iref primary="true" item="Grammar" subitem="transfer-extension"/>
1880  <x:ref>transfer-coding</x:ref>    = "chunked" ; <xref target="chunked.encoding"/>
1881                     / "compress" ; <xref target="compress.coding"/>
1882                     / "deflate" ; <xref target="deflate.coding"/>
1883                     / "gzip" ; <xref target="gzip.coding"/>
1884                     / <x:ref>transfer-extension</x:ref>
1885  <x:ref>transfer-extension</x:ref> = <x:ref>token</x:ref> *( <x:ref>OWS</x:ref> ";" <x:ref>OWS</x:ref> <x:ref>transfer-parameter</x:ref> )
1886</artwork></figure>
1887<t anchor="rule.parameter">
1888  <x:anchor-alias value="attribute"/>
1889  <x:anchor-alias value="transfer-parameter"/>
1890  <x:anchor-alias value="value"/>
1891   Parameters are in the form of attribute/value pairs.
1892</t>
1893<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="transfer-parameter"/><iref primary="true" item="Grammar" subitem="attribute"/><iref primary="true" item="Grammar" subitem="value"/><iref primary="true" item="Grammar" subitem="date2"/><iref primary="true" item="Grammar" subitem="date3"/>
1894  <x:ref>transfer-parameter</x:ref> = <x:ref>attribute</x:ref> <x:ref>BWS</x:ref> "=" <x:ref>BWS</x:ref> <x:ref>value</x:ref>
1895  <x:ref>attribute</x:ref>          = <x:ref>token</x:ref>
1896  <x:ref>value</x:ref>              = <x:ref>word</x:ref>
1897</artwork></figure>
1898<t>
1899   All transfer-coding names are case-insensitive and ought to be registered
1900   within the HTTP Transfer Coding registry, as defined in
1901   <xref target="transfer.coding.registry"/>.
1902   They are used in the <x:ref>TE</x:ref> (<xref target="header.te"/>) and
1903   <x:ref>Transfer-Encoding</x:ref> (<xref target="header.transfer-encoding"/>)
1904   header fields.
1905</t>
1906
1907<section title="Chunked Transfer Coding" anchor="chunked.encoding">
1908  <iref primary="true" item="chunked (Coding Format)"/>
1909  <x:anchor-alias value="chunk"/>
1910  <x:anchor-alias value="chunked-body"/>
1911  <x:anchor-alias value="chunk-data"/>
1912  <x:anchor-alias value="chunk-ext"/>
1913  <x:anchor-alias value="chunk-ext-name"/>
1914  <x:anchor-alias value="chunk-ext-val"/>
1915  <x:anchor-alias value="chunk-size"/>
1916  <x:anchor-alias value="last-chunk"/>
1917  <x:anchor-alias value="trailer-part"/>
1918  <x:anchor-alias value="quoted-str-nf"/>
1919  <x:anchor-alias value="qdtext-nf"/>
1920<t>
1921   The chunked transfer coding modifies the body of a message in order to
1922   transfer it as a series of chunks, each with its own size indicator,
1923   followed by an &OPTIONAL; trailer containing header fields. This
1924   allows dynamically generated content to be transferred along with the
1925   information necessary for the recipient to verify that it has
1926   received the full message.
1927</t>
1928<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="chunked-body"><!--terminal production--></iref><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-ext"/><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-part"/><iref primary="true" item="Grammar" subitem="quoted-str-nf"/><iref primary="true" item="Grammar" subitem="qdtext-nf"/>
1929  <x:ref>chunked-body</x:ref>   = *<x:ref>chunk</x:ref>
1930                   <x:ref>last-chunk</x:ref>
1931                   <x:ref>trailer-part</x:ref>
1932                   <x:ref>CRLF</x:ref>
1933 
1934  <x:ref>chunk</x:ref>          = <x:ref>chunk-size</x:ref> [ <x:ref>chunk-ext</x:ref> ] <x:ref>CRLF</x:ref>
1935                   <x:ref>chunk-data</x:ref> <x:ref>CRLF</x:ref>
1936  <x:ref>chunk-size</x:ref>     = 1*<x:ref>HEXDIG</x:ref>
1937  <x:ref>last-chunk</x:ref>     = 1*("0") [ <x:ref>chunk-ext</x:ref> ] <x:ref>CRLF</x:ref>
1938 
1939  <x:ref>chunk-ext</x:ref>      = *( ";" <x:ref>chunk-ext-name</x:ref> [ "=" <x:ref>chunk-ext-val</x:ref> ] )
1940  <x:ref>chunk-ext-name</x:ref> = <x:ref>token</x:ref>
1941  <x:ref>chunk-ext-val</x:ref>  = <x:ref>token</x:ref> / <x:ref>quoted-str-nf</x:ref>
1942  <x:ref>chunk-data</x:ref>     = 1*<x:ref>OCTET</x:ref> ; a sequence of chunk-size octets
1943  <x:ref>trailer-part</x:ref>   = *( <x:ref>header-field</x:ref> <x:ref>CRLF</x:ref> )
1944 
1945  <x:ref>quoted-str-nf</x:ref>  = <x:ref>DQUOTE</x:ref> *( <x:ref>qdtext-nf</x:ref> / <x:ref>quoted-pair</x:ref> ) <x:ref>DQUOTE</x:ref>
1946                 ; like <x:ref>quoted-string</x:ref>, but disallowing line folding
1947  <x:ref>qdtext-nf</x:ref>      = <x:ref>HTAB</x:ref> / <x:ref>SP</x:ref> / %x21 / %x23-5B / %x5D-7E / <x:ref>obs-text</x:ref>
1948</artwork></figure>
1949<t>
1950   Chunk extensions within the chunked transfer coding are deprecated.
1951   Senders &SHOULD-NOT; send chunk-ext.
1952   Definition of new chunk extensions is discouraged.
1953</t>
1954<t>
1955   The chunk-size field is a string of hex digits indicating the size of
1956   the chunk-data in octets. The chunked transfer coding is complete when a
1957   chunk with a chunk-size of zero is received, possibly followed by a
1958   trailer, and finally terminated by an empty line.
1959</t>
1960
1961<section title="Trailer" anchor="header.trailer">
1962  <iref primary="true" item="Trailer header field" x:for-anchor=""/>
1963  <x:anchor-alias value="Trailer"/>
1964<t>
1965   A trailer allows the sender to include additional fields at the end of a
1966   chunked message in order to supply metadata that might be dynamically
1967   generated while the message body is sent, such as a message integrity
1968   check, digital signature, or post-processing status.
1969   The trailer &MUST-NOT; contain fields that need to be known before a
1970   recipient processes the body, such as <x:ref>Transfer-Encoding</x:ref>,
1971   <x:ref>Content-Length</x:ref>, and <x:ref>Trailer</x:ref>.
1972</t>
1973<t>
1974   When a message includes a message body encoded with the chunked
1975   transfer coding and the sender desires to send metadata in the form of
1976   trailer fields at the end of the message, the sender &SHOULD; send a
1977   <x:ref>Trailer</x:ref> header field before the message body to indicate
1978   which fields will be present in the trailers. This allows the recipient
1979   to prepare for receipt of that metadata before it starts processing the body,
1980   which is useful if the message is being streamed and the recipient wishes
1981   to confirm an integrity check on the fly.
1982</t>
1983<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Trailer"/>
1984  <x:ref>Trailer</x:ref> = 1#<x:ref>field-name</x:ref>
1985</artwork></figure>
1986<t>
1987   If no <x:ref>Trailer</x:ref> header field is present, the sender of a
1988   chunked message body &SHOULD; send an empty trailer.
1989</t>
1990<t>
1991   A server &MUST; send an empty trailer with the chunked transfer coding
1992   unless at least one of the following is true:
1993  <list style="numbers">
1994    <t>the request included a <x:ref>TE</x:ref> header field that indicates
1995    "trailers" is acceptable in the transfer coding of the response, as
1996    described in <xref target="header.te"/>; or,</t>
1997     
1998    <t>the trailer fields consist entirely of optional metadata and the
1999    recipient could use the message (in a manner acceptable to the server where
2000    the field originated) without receiving that metadata. In other words,
2001    the server that generated the header field is willing to accept the
2002    possibility that the trailer fields might be silently discarded along
2003    the path to the client.</t>
2004  </list>
2005</t>
2006<t>
2007   The above requirement prevents the need for an infinite buffer when a
2008   message is being received by an HTTP/1.1 (or later) proxy and forwarded to
2009   an HTTP/1.0 recipient.
2010</t>
2011</section>
2012
2013<section title="Decoding chunked" anchor="decoding.chunked">
2014<t>
2015   A process for decoding the chunked transfer coding
2016   can be represented in pseudo-code as:
2017</t>
2018<figure><artwork type="code">
2019  length := 0
2020  read chunk-size, chunk-ext (if any) and CRLF
2021  while (chunk-size &gt; 0) {
2022     read chunk-data and CRLF
2023     append chunk-data to decoded-body
2024     length := length + chunk-size
2025     read chunk-size and CRLF
2026  }
2027  read header-field
2028  while (header-field not empty) {
2029     append header-field to existing header fields
2030     read header-field
2031  }
2032  Content-Length := length
2033  Remove "chunked" from Transfer-Encoding
2034  Remove Trailer from existing header fields
2035</artwork></figure>
2036<t>
2037   All recipients &MUST; be able to receive and decode the
2038   chunked transfer coding and &MUST; ignore chunk-ext extensions
2039   they do not understand.
2040</t>
2041</section>
2042</section>
2043
2044<section title="Compression Codings" anchor="compression.codings">
2045<t>
2046   The codings defined below can be used to compress the payload of a
2047   message.
2048</t>
2049
2050<section title="Compress Coding" anchor="compress.coding">
2051<iref item="compress (Coding Format)"/>
2052<t>
2053   The "compress" format is produced by the common UNIX file compression
2054   program "compress". This format is an adaptive Lempel-Ziv-Welch
2055   coding (LZW). Recipients &SHOULD; consider "x-compress" to be
2056   equivalent to "compress".
2057</t>
2058</section>
2059
2060<section title="Deflate Coding" anchor="deflate.coding">
2061<iref item="deflate (Coding Format)"/>
2062<t>
2063   The "deflate" format is defined as the "deflate" compression mechanism
2064   (described in <xref target="RFC1951"/>) used inside the "zlib"
2065   data format (<xref target="RFC1950"/>).
2066</t>
2067<x:note>
2068  <t>
2069    &Note; Some incorrect implementations send the "deflate"
2070    compressed data without the zlib wrapper.
2071   </t>
2072</x:note>
2073</section>
2074
2075<section title="Gzip Coding" anchor="gzip.coding">
2076<iref item="gzip (Coding Format)"/>
2077<t>
2078   The "gzip" format is produced by the file compression program
2079   "gzip" (GNU zip), as described in <xref target="RFC1952"/>. This format is a
2080   Lempel-Ziv coding (LZ77) with a 32 bit CRC.
2081   Recipients &SHOULD; consider "x-gzip" to be equivalent to "gzip".
2082</t>
2083</section>
2084
2085</section>
2086
2087<section title="TE" anchor="header.te">
2088  <iref primary="true" item="TE header field" x:for-anchor=""/>
2089  <x:anchor-alias value="TE"/>
2090  <x:anchor-alias value="t-codings"/>
2091  <x:anchor-alias value="t-ranking"/>
2092  <x:anchor-alias value="rank"/>
2093<t>
2094   The "TE" header field in a request indicates what transfer codings,
2095   besides chunked, the client is willing to accept in response, and
2096   whether or not the client is willing to accept trailer fields in a
2097   chunked transfer coding.
2098</t>
2099<t>
2100   The TE field-value consists of a comma-separated list of transfer coding
2101   names, each allowing for optional parameters (as described in
2102   <xref target="transfer.codings"/>), and/or the keyword "trailers".
2103   Clients &MUST-NOT; send the chunked transfer coding name in TE;
2104   chunked is always acceptable for HTTP/1.1 recipients.
2105</t>
2106<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="TE"/><iref primary="true" item="Grammar" subitem="t-codings"/><iref primary="true" item="Grammar" subitem="t-ranking"/><iref primary="true" item="Grammar" subitem="rank"/>
2107  <x:ref>TE</x:ref>        = #<x:ref>t-codings</x:ref>
2108  <x:ref>t-codings</x:ref> = "trailers" / ( <x:ref>transfer-coding</x:ref> [ <x:ref>t-ranking</x:ref> ] )
2109  <x:ref>t-ranking</x:ref> = <x:ref>OWS</x:ref> ";" <x:ref>OWS</x:ref> "q=" <x:ref>rank</x:ref>
2110  <x:ref>rank</x:ref>      = ( "0" [ "." 0*3<x:ref>DIGIT</x:ref> ] )
2111             / ( "1" [ "." 0*3("0") ] )
2112</artwork></figure>
2113<t>
2114   Three examples of TE use are below.
2115</t>
2116<figure><artwork type="example">
2117  TE: deflate
2118  TE:
2119  TE: trailers, deflate;q=0.5
2120</artwork></figure>
2121<t>
2122   The presence of the keyword "trailers" indicates that the client is
2123   willing to accept trailer fields in a chunked transfer coding,
2124   as defined in <xref target="chunked.encoding"/>, on behalf of itself and
2125   any downstream clients. For chained requests, this implies that either:
2126   (a) all downstream clients are willing to accept trailer fields in the
2127   forwarded response; or,
2128   (b) the client will attempt to buffer the response on behalf of downstream
2129   recipients.
2130   Note that HTTP/1.1 does not define any means to limit the size of a
2131   chunked response such that a client can be assured of buffering the
2132   entire response.
2133</t>
2134<t>
2135   When multiple transfer codings are acceptable, the client &MAY; rank the
2136   codings by preference using a case-insensitive "q" parameter (similar to
2137   the qvalues used in content negotiation fields, &qvalue;). The rank value
2138   is a real number in the range 0 through 1, where 0.001 is the least
2139   preferred and 1 is the most preferred; a value of 0 means "not acceptable".
2140</t>
2141<t>
2142   If the TE field-value is empty or if no TE field is present, the only
2143   acceptable transfer coding is chunked. A message with no transfer coding
2144   is always acceptable.
2145</t>
2146<t>
2147   Since the TE header field only applies to the immediate connection,
2148   a sender of TE &MUST; also send a "TE" connection option within the
2149   <x:ref>Connection</x:ref> header field (<xref target="header.connection"/>)
2150   in order to prevent the TE field from being forwarded by intermediaries
2151   that do not support its semantics.
2152</t>
2153</section>
2154</section>
2155
2156<section title="Message Routing" anchor="message.routing">
2157<t>
2158   HTTP request message routing is determined by each client based on the
2159   target resource, the client's proxy configuration, and
2160   establishment or reuse of an inbound connection.  The corresponding
2161   response routing follows the same connection chain back to the client.
2162</t>
2163
2164<section title="Identifying a Target Resource" anchor="target-resource">
2165  <iref primary="true" item="target resource"/>
2166  <iref primary="true" item="target URI"/>
2167  <x:anchor-alias value="target resource"/>
2168  <x:anchor-alias value="target URI"/>
2169<t>
2170   HTTP is used in a wide variety of applications, ranging from
2171   general-purpose computers to home appliances.  In some cases,
2172   communication options are hard-coded in a client's configuration.
2173   However, most HTTP clients rely on the same resource identification
2174   mechanism and configuration techniques as general-purpose Web browsers.
2175</t>
2176<t>
2177   HTTP communication is initiated by a user agent for some purpose.
2178   The purpose is a combination of request semantics, which are defined in
2179   <xref target="Part2"/>, and a target resource upon which to apply those
2180   semantics.  A URI reference (<xref target="uri"/>) is typically used as
2181   an identifier for the "<x:dfn>target resource</x:dfn>", which a user agent
2182   would resolve to its absolute form in order to obtain the
2183   "<x:dfn>target URI</x:dfn>".  The target URI
2184   excludes the reference's fragment identifier component, if any,
2185   since fragment identifiers are reserved for client-side processing
2186   (<xref target="RFC3986" x:fmt="," x:sec="3.5"/>).
2187</t>
2188</section>
2189
2190<section title="Connecting Inbound" anchor="connecting.inbound">
2191<t>
2192   Once the target URI is determined, a client needs to decide whether
2193   a network request is necessary to accomplish the desired semantics and,
2194   if so, where that request is to be directed.
2195</t>
2196<t>
2197   If the client has a response cache and the request semantics can be
2198   satisfied by a cache (<xref target="Part6"/>), then the request is
2199   usually directed to the cache first.
2200</t>
2201<t>
2202   If the request is not satisfied by a cache, then a typical client will
2203   check its configuration to determine whether a proxy is to be used to
2204   satisfy the request.  Proxy configuration is implementation-dependent,
2205   but is often based on URI prefix matching, selective authority matching,
2206   or both, and the proxy itself is usually identified by an "http" or
2207   "https" URI.  If a proxy is applicable, the client connects inbound by
2208   establishing (or reusing) a connection to that proxy.
2209</t>
2210<t>
2211   If no proxy is applicable, a typical client will invoke a handler routine,
2212   usually specific to the target URI's scheme, to connect directly
2213   to an authority for the target resource.  How that is accomplished is
2214   dependent on the target URI scheme and defined by its associated
2215   specification, similar to how this specification defines origin server
2216   access for resolution of the "http" (<xref target="http.uri"/>) and
2217   "https" (<xref target="https.uri"/>) schemes.
2218</t>
2219<t>
2220   HTTP requirements regarding connection management are defined in
2221   <xref target="connection.management"/>.
2222</t>
2223</section>
2224
2225<section title="Request Target" anchor="request-target">
2226<t>
2227   Once an inbound connection is obtained,
2228   the client sends an HTTP request message (<xref target="http.message"/>)
2229   with a request-target derived from the target URI.
2230   There are four distinct formats for the request-target, depending on both
2231   the method being requested and whether the request is to a proxy.
2232</t>   
2233<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="request-target"/><iref primary="true" item="Grammar" subitem="origin-form"/><iref primary="true" item="Grammar" subitem="absolute-form"/><iref primary="true" item="Grammar" subitem="authority-form"/><iref primary="true" item="Grammar" subitem="asterisk-form"/>
2234  <x:ref>request-target</x:ref> = <x:ref>origin-form</x:ref>
2235                 / <x:ref>absolute-form</x:ref>
2236                 / <x:ref>authority-form</x:ref>
2237                 / <x:ref>asterisk-form</x:ref>
2238
2239  <x:ref>origin-form</x:ref>    = <x:ref>absolute-path</x:ref> [ "?" <x:ref>query</x:ref> ]
2240  <x:ref>absolute-form</x:ref>  = <x:ref>absolute-URI</x:ref>
2241  <x:ref>authority-form</x:ref> = <x:ref>authority</x:ref>
2242  <x:ref>asterisk-form</x:ref>  = "*"
2243</artwork></figure>
2244<t anchor="origin-form"><iref item="origin-form (of request-target)"/>
2245  <x:h>origin-form</x:h>
2246</t>
2247<t>
2248   The most common form of request-target is the <x:dfn>origin-form</x:dfn>.
2249   When making a request directly to an origin server, other than a CONNECT
2250   or server-wide OPTIONS request (as detailed below),
2251   a client &MUST; send only the absolute path and query components of
2252   the target URI as the request-target.
2253   If the target URI's path component is empty, then the client &MUST; send
2254   "/" as the path within the origin-form of request-target.
2255   A <x:ref>Host</x:ref> header field is also sent, as defined in
2256   <xref target="header.host"/>, containing the target URI's
2257   authority component (excluding any userinfo).
2258</t>
2259<t>
2260   For example, a client wishing to retrieve a representation of the resource
2261   identified as
2262</t>
2263<figure><artwork x:indent-with="  " type="example">
2264http://www.example.org/where?q=now
2265</artwork></figure>
2266<t>
2267   directly from the origin server would open (or reuse) a TCP connection
2268   to port 80 of the host "www.example.org" and send the lines:
2269</t>
2270<figure><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2271GET /where?q=now HTTP/1.1
2272Host: www.example.org
2273</artwork></figure>
2274<t>
2275   followed by the remainder of the request message.
2276</t>
2277<t anchor="absolute-form"><iref item="absolute-form (of request-target)"/>
2278  <x:h>absolute-form</x:h>
2279</t>
2280<t>
2281   When making a request to a proxy, other than a CONNECT or server-wide
2282   OPTIONS request (as detailed below), a client &MUST; send the target URI
2283   in <x:dfn>absolute-form</x:dfn> as the request-target.
2284   The proxy is requested to either service that request from a valid cache,
2285   if possible, or make the same request on the client's behalf to either
2286   the next inbound proxy server or directly to the origin server indicated
2287   by the request-target.  Requirements on such "forwarding" of messages are
2288   defined in <xref target="message.forwarding"/>.
2289</t>
2290<t>
2291   An example absolute-form of request-line would be:
2292</t>
2293<figure><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2294GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1
2295</artwork></figure>
2296<t>
2297   To allow for transition to the absolute-form for all requests in some
2298   future version of HTTP, HTTP/1.1 servers &MUST; accept the absolute-form
2299   in requests, even though HTTP/1.1 clients will only send them in requests
2300   to proxies.
2301</t>
2302<t anchor="authority-form"><iref item="authority-form (of request-target)"/>
2303  <x:h>authority-form</x:h>
2304</t>
2305<t>
2306   The <x:dfn>authority-form</x:dfn> of request-target is only used for CONNECT requests
2307   (&CONNECT;).  When making a CONNECT request to establish a tunnel through
2308   one or more proxies, a client &MUST; send only the target URI's
2309   authority component (excluding any userinfo) as the request-target.
2310   For example,
2311</t>
2312<figure><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2313CONNECT www.example.com:80 HTTP/1.1
2314</artwork></figure>
2315<t anchor="asterisk-form"><iref item="asterisk-form (of request-target)"/>
2316  <x:h>asterisk-form</x:h>
2317</t>
2318<t>
2319   The <x:dfn>asterisk-form</x:dfn> of request-target is only used for a server-wide
2320   OPTIONS request (&OPTIONS;).  When a client wishes to request OPTIONS
2321   for the server as a whole, as opposed to a specific named resource of
2322   that server, the client &MUST; send only "*" (%x2A) as the request-target.
2323   For example,
2324</t>
2325<figure><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2326OPTIONS * HTTP/1.1
2327</artwork></figure>
2328<t>
2329   If a proxy receives an OPTIONS request with an absolute-form of
2330   request-target in which the URI has an empty path and no query component,
2331   then the last proxy on the request chain &MUST; send a request-target
2332   of "*" when it forwards the request to the indicated origin server.
2333</t>
2334<figure><preamble>  
2335   For example, the request
2336</preamble><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2337OPTIONS http://www.example.org:8001 HTTP/1.1
2338</artwork></figure>
2339<figure><preamble>  
2340  would be forwarded by the final proxy as
2341</preamble><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2342OPTIONS * HTTP/1.1
2343Host: www.example.org:8001
2344</artwork>
2345<postamble>
2346   after connecting to port 8001 of host "www.example.org".
2347</postamble>
2348</figure>
2349</section>
2350
2351<section title="Host" anchor="header.host">
2352  <iref primary="true" item="Host header field" x:for-anchor=""/>
2353  <x:anchor-alias value="Host"/>
2354<t>
2355   The "Host" header field in a request provides the host and port
2356   information from the target URI, enabling the origin
2357   server to distinguish among resources while servicing requests
2358   for multiple host names on a single IP address.  Since the Host
2359   field-value is critical information for handling a request, it
2360   &SHOULD; be sent as the first header field following the request-line.
2361</t>
2362<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Host"/>
2363  <x:ref>Host</x:ref> = <x:ref>uri-host</x:ref> [ ":" <x:ref>port</x:ref> ] ; <xref target="http.uri"/>
2364</artwork></figure>
2365<t>
2366   A client &MUST; send a Host header field in all HTTP/1.1 request
2367   messages.  If the target URI includes an authority component, then
2368   the Host field-value &MUST; be identical to that authority component
2369   after excluding any userinfo (<xref target="http.uri"/>).
2370   If the authority component is missing or undefined for the target URI,
2371   then the Host header field &MUST; be sent with an empty field-value.
2372</t>
2373<t>
2374   For example, a GET request to the origin server for
2375   &lt;http://www.example.org/pub/WWW/&gt; would begin with:
2376</t>
2377<figure><artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
2378GET /pub/WWW/ HTTP/1.1
2379Host: www.example.org
2380</artwork></figure>
2381<t>
2382   The Host header field &MUST; be sent in an HTTP/1.1 request even
2383   if the request-target is in the absolute-form, since this
2384   allows the Host information to be forwarded through ancient HTTP/1.0
2385   proxies that might not have implemented Host.
2386</t>
2387<t>
2388   When a proxy receives a request with an absolute-form of
2389   request-target, the proxy &MUST; ignore the received
2390   Host header field (if any) and instead replace it with the host
2391   information of the request-target.  If the proxy forwards the request,
2392   it &MUST; generate a new Host field-value based on the received
2393   request-target rather than forward the received Host field-value.
2394</t>
2395<t>
2396   Since the Host header field acts as an application-level routing
2397   mechanism, it is a frequent target for malware seeking to poison
2398   a shared cache or redirect a request to an unintended server.
2399   An interception proxy is particularly vulnerable if it relies on
2400   the Host field-value for redirecting requests to internal
2401   servers, or for use as a cache key in a shared cache, without
2402   first verifying that the intercepted connection is targeting a
2403   valid IP address for that host.
2404</t>
2405<t>
2406   A server &MUST; respond with a <x:ref>400 (Bad Request)</x:ref> status code
2407   to any HTTP/1.1 request message that lacks a Host header field and
2408   to any request message that contains more than one Host header field
2409   or a Host header field with an invalid field-value.
2410</t>
2411</section>
2412
2413<section title="Effective Request URI" anchor="effective.request.uri">
2414  <iref primary="true" item="effective request URI"/>
2415  <x:anchor-alias value="effective request URI"/>
2416<t>
2417   A server that receives an HTTP request message &MUST; reconstruct
2418   the user agent's original target URI, based on the pieces of information
2419   learned from the request-target, <x:ref>Host</x:ref> header field, and
2420   connection context, in order to identify the intended target resource and
2421   properly service the request. The URI derived from this reconstruction
2422   process is referred to as the "<x:dfn>effective request URI</x:dfn>".
2423</t>
2424<t>
2425   For a user agent, the effective request URI is the target URI.
2426</t>
2427<t>
2428   If the request-target is in absolute-form, then the effective request URI
2429   is the same as the request-target.  Otherwise, the effective request URI
2430   is constructed as follows.
2431</t>
2432<t>
2433   If the request is received over a TLS-secured TCP connection,
2434   then the effective request URI's scheme is "https"; otherwise, the
2435   scheme is "http".
2436</t>
2437<t>
2438   If the request-target is in authority-form, then the effective
2439   request URI's authority component is the same as the request-target.
2440   Otherwise, if a <x:ref>Host</x:ref> header field is supplied with a
2441   non-empty field-value, then the authority component is the same as the
2442   Host field-value. Otherwise, the authority component is the concatenation of
2443   the default host name configured for the server, a colon (":"), and the
2444   connection's incoming TCP port number in decimal form.
2445</t>
2446<t>
2447   If the request-target is in authority-form or asterisk-form, then the
2448   effective request URI's combined path and query component is empty.
2449   Otherwise, the combined path and query component is the same as the
2450   request-target.
2451</t>
2452<t>
2453   The components of the effective request URI, once determined as above,
2454   can be combined into absolute-URI form by concatenating the scheme,
2455   "://", authority, and combined path and query component.
2456</t>
2457<figure>
2458<preamble>
2459   Example 1: the following message received over an insecure TCP connection
2460</preamble>
2461<artwork type="example" x:indent-with="  ">
2462GET /pub/WWW/TheProject.html HTTP/1.1
2463Host: www.example.org:8080
2464</artwork>
2465</figure>
2466<figure>
2467<preamble>
2468  has an effective request URI of
2469</preamble>
2470<artwork type="example" x:indent-with="  ">
2471http://www.example.org:8080/pub/WWW/TheProject.html
2472</artwork>
2473</figure>
2474<figure>
2475<preamble>
2476   Example 2: the following message received over a TLS-secured TCP connection
2477</preamble>
2478<artwork type="example" x:indent-with="  ">
2479OPTIONS * HTTP/1.1
2480Host: www.example.org
2481</artwork>
2482</figure>
2483<figure>
2484<preamble>
2485  has an effective request URI of
2486</preamble>
2487<artwork type="example" x:indent-with="  ">
2488https://www.example.org
2489</artwork>
2490</figure>
2491<t>
2492   An origin server that does not allow resources to differ by requested
2493   host &MAY; ignore the <x:ref>Host</x:ref> field-value and instead replace it
2494   with a configured server name when constructing the effective request URI.
2495</t>
2496<t>
2497   Recipients of an HTTP/1.0 request that lacks a <x:ref>Host</x:ref> header
2498   field &MAY; attempt to use heuristics (e.g., examination of the URI path for
2499   something unique to a particular host) in order to guess the
2500   effective request URI's authority component.
2501</t>
2502</section>
2503
2504<section title="Associating a Response to a Request" anchor="associating.response.to.request">
2505<t>
2506   HTTP does not include a request identifier for associating a given
2507   request message with its corresponding one or more response messages.
2508   Hence, it relies on the order of response arrival to correspond exactly
2509   to the order in which requests are made on the same connection.
2510   More than one response message per request only occurs when one or more
2511   informational responses (<x:ref>1xx</x:ref>, see &status-1xx;) precede a
2512   final response to the same request.
2513</t>
2514<t>
2515   A client that has more than one outstanding request on a connection &MUST;
2516   maintain a list of outstanding requests in the order sent and &MUST;
2517   associate each received response message on that connection to the highest
2518   ordered request that has not yet received a final (non-<x:ref>1xx</x:ref>)
2519   response.
2520</t>
2521</section>
2522
2523<section title="Message Forwarding" anchor="message.forwarding">
2524<t>
2525   As described in <xref target="intermediaries"/>, intermediaries can serve
2526   a variety of roles in the processing of HTTP requests and responses.
2527   Some intermediaries are used to improve performance or availability.
2528   Others are used for access control or to filter content.
2529   Since an HTTP stream has characteristics similar to a pipe-and-filter
2530   architecture, there are no inherent limits to the extent an intermediary
2531   can enhance (or interfere) with either direction of the stream.
2532</t>
2533<t>
2534   Intermediaries that forward a message &MUST; implement the
2535   <x:ref>Connection</x:ref> header field, as specified in
2536   <xref target="header.connection"/>, to exclude fields that are only
2537   intended for the incoming connection.
2538</t>
2539<t>
2540   In order to avoid request loops, a proxy that forwards requests to other
2541   proxies &MUST; be able to recognize and exclude all of its own server
2542   names, including any aliases, local variations, or literal IP addresses.
2543</t>
2544
2545<section title="Via" anchor="header.via">
2546  <iref primary="true" item="Via header field" x:for-anchor=""/>
2547  <x:anchor-alias value="pseudonym"/>
2548  <x:anchor-alias value="received-by"/>
2549  <x:anchor-alias value="received-protocol"/>
2550  <x:anchor-alias value="Via"/>
2551<t>
2552   The "Via" header field &MUST; be sent by a proxy or gateway in forwarded
2553   messages to indicate the intermediate protocols and recipients between the
2554   user agent and the server on requests, and between the origin server and
2555   the client on responses. It is analogous to the "Received" field
2556   used by email systems (<xref target="RFC5322" x:fmt="of" x:sec="3.6.7"/>).
2557   Via is used in HTTP for tracking message forwards,
2558   avoiding request loops, and identifying the protocol capabilities of
2559   all senders along the request/response chain.
2560</t>
2561<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Via"/><iref primary="true" item="Grammar" subitem="received-protocol"/><iref primary="true" item="Grammar" subitem="protocol-name"/><iref primary="true" item="Grammar" subitem="protocol-version"/><iref primary="true" item="Grammar" subitem="received-by"/><iref primary="true" item="Grammar" subitem="pseudonym"/>
2562  <x:ref>Via</x:ref>               = 1#( <x:ref>received-protocol</x:ref> <x:ref>RWS</x:ref> <x:ref>received-by</x:ref>
2563                          [ <x:ref>RWS</x:ref> <x:ref>comment</x:ref> ] )
2564  <x:ref>received-protocol</x:ref> = [ <x:ref>protocol-name</x:ref> "/" ] <x:ref>protocol-version</x:ref>
2565                      ; see <xref target="header.upgrade"/>
2566  <x:ref>received-by</x:ref>       = ( <x:ref>uri-host</x:ref> [ ":" <x:ref>port</x:ref> ] ) / <x:ref>pseudonym</x:ref>
2567  <x:ref>pseudonym</x:ref>         = <x:ref>token</x:ref>
2568</artwork></figure>
2569<t>
2570   The received-protocol indicates the protocol version of the message
2571   received by the server or client along each segment of the
2572   request/response chain. The received-protocol version is appended to
2573   the Via field value when the message is forwarded so that information
2574   about the protocol capabilities of upstream applications remains
2575   visible to all recipients.
2576</t>
2577<t>
2578   The protocol-name is excluded if and only if it would be "HTTP". The
2579   received-by field is normally the host and optional port number of a
2580   recipient server or client that subsequently forwarded the message.
2581   However, if the real host is considered to be sensitive information,
2582   it &MAY; be replaced by a pseudonym. If the port is not given, it &MAY;
2583   be assumed to be the default port of the received-protocol.
2584</t>
2585<t>
2586   Multiple Via field values represent each proxy or gateway that has
2587   forwarded the message. Each recipient &MUST; append its information
2588   such that the end result is ordered according to the sequence of
2589   forwarding applications.
2590</t>
2591<t>
2592   Comments &MAY; be used in the Via header field to identify the software
2593   of each recipient, analogous to the <x:ref>User-Agent</x:ref> and
2594   <x:ref>Server</x:ref> header fields. However, all comments in the Via field
2595   are optional and &MAY; be removed by any recipient prior to forwarding the
2596   message.
2597</t>
2598<t>
2599   For example, a request message could be sent from an HTTP/1.0 user
2600   agent to an internal proxy code-named "fred", which uses HTTP/1.1 to
2601   forward the request to a public proxy at p.example.net, which completes
2602   the request by forwarding it to the origin server at www.example.com.
2603   The request received by www.example.com would then have the following
2604   Via header field:
2605</t>
2606<figure><artwork type="example">
2607  Via: 1.0 fred, 1.1 p.example.net (Apache/1.1)
2608</artwork></figure>
2609<t>
2610   A proxy or gateway used as a portal through a network firewall
2611   &SHOULD-NOT; forward the names and ports of hosts within the firewall
2612   region unless it is explicitly enabled to do so. If not enabled, the
2613   received-by host of any host behind the firewall &SHOULD; be replaced
2614   by an appropriate pseudonym for that host.
2615</t>
2616<t>
2617   A proxy or gateway &MAY; combine an ordered subsequence of Via header
2618   field entries into a single such entry if the entries have identical
2619   received-protocol values. For example,
2620</t>
2621<figure><artwork type="example">
2622  Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy
2623</artwork></figure>
2624<t>
2625  could be collapsed to
2626</t>
2627<figure><artwork type="example">
2628  Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
2629</artwork></figure>
2630<t>
2631   Senders &SHOULD-NOT; combine multiple entries unless they are all
2632   under the same organizational control and the hosts have already been
2633   replaced by pseudonyms. Senders &MUST-NOT; combine entries that
2634   have different received-protocol values.
2635</t>
2636</section>
2637
2638<section title="Transformations" anchor="message.transformations">
2639<t>
2640   Some intermediaries include features for transforming messages and their
2641   payloads.  A transforming proxy might, for example, convert between image
2642   formats in order to save cache space or to reduce the amount of traffic on
2643   a slow link. However, operational problems might occur when these
2644   transformations are applied to payloads intended for critical applications,
2645   such as medical imaging or scientific data analysis, particularly when
2646   integrity checks or digital signatures are used to ensure that the payload
2647   received is identical to the original.
2648</t>
2649<t>
2650   If a proxy receives a request-target with a host name that is not a
2651   fully qualified domain name, it &MAY; add its own domain to the host name
2652   it received when forwarding the request.  A proxy &MUST-NOT; change the
2653   host name if it is a fully qualified domain name.
2654</t>
2655<t>
2656   A proxy &MUST-NOT; modify the "absolute-path" and "query" parts of the
2657   received request-target when forwarding it to the next inbound server,
2658   except as noted above to replace an empty path with "/" or "*".
2659</t>
2660<t>
2661   A proxy &MUST-NOT; modify header fields that provide information about the
2662   end points of the communication chain, the resource state, or the selected
2663   representation. A proxy &MAY; change the message body through application
2664   or removal of a transfer coding (<xref target="transfer.codings"/>).
2665</t>
2666<t>
2667   A non-transforming proxy &MUST; preserve the message payload (&payload;).
2668   A transforming proxy &MUST; preserve the payload of a message that
2669   contains the no-transform cache-control directive.
2670</t>
2671<t>
2672   A transforming proxy &MAY; transform the payload of a message
2673   that does not contain the no-transform cache-control directive;
2674   if the payload is transformed, the transforming proxy &MUST; add a
2675   Warning 214 (Transformation applied) header field if one does not
2676   already appear in the message (see &header-warning;).
2677</t>
2678</section>
2679</section>
2680</section>
2681
2682<section title="Connection Management" anchor="connection.management">
2683<t>
2684   HTTP messaging is independent of the underlying transport or
2685   session-layer connection protocol(s).  HTTP only presumes a reliable
2686   transport with in-order delivery of requests and the corresponding
2687   in-order delivery of responses.  The mapping of HTTP request and
2688   response structures onto the data units of an underlying transport
2689   protocol is outside the scope of this specification.
2690</t>
2691<t>
2692   As described in <xref target="connecting.inbound"/>, the specific
2693   connection protocols to be used for an HTTP interaction are determined by
2694   client configuration and the <x:ref>target URI</x:ref>.
2695   For example, the "http" URI scheme
2696   (<xref target="http.uri"/>) indicates a default connection of TCP
2697   over IP, with a default TCP port of 80, but the client might be
2698   configured to use a proxy via some other connection, port, or protocol.
2699</t>
2700<t>
2701   HTTP implementations are expected to engage in connection management,
2702   which includes maintaining the state of current connections,
2703   establishing a new connection or reusing an existing connection,
2704   processing messages received on a connection, detecting connection
2705   failures, and closing each connection.
2706   Most clients maintain multiple connections in parallel, including
2707   more than one connection per server endpoint.
2708   Most servers are designed to maintain thousands of concurrent connections,
2709   while controlling request queues to enable fair use and detect
2710   denial of service attacks.
2711</t>
2712
2713<section title="Connection" anchor="header.connection">
2714  <iref primary="true" item="Connection header field" x:for-anchor=""/>
2715  <iref primary="true" item="close" x:for-anchor=""/>
2716  <x:anchor-alias value="Connection"/>
2717  <x:anchor-alias value="connection-option"/>
2718  <x:anchor-alias value="close"/>
2719<t>
2720   The "Connection" header field allows the sender to indicate desired
2721   control options for the current connection.  In order to avoid confusing
2722   downstream recipients, a proxy or gateway &MUST; remove or replace any
2723   received connection options before forwarding the message.
2724</t>
2725<t>
2726   When a header field aside from Connection is used to supply control
2727   information for or about the current connection, the sender &MUST; list
2728   the corresponding field-name within the "Connection" header field.
2729   A proxy or gateway &MUST; parse a received Connection
2730   header field before a message is forwarded and, for each
2731   connection-option in this field, remove any header field(s) from
2732   the message with the same name as the connection-option, and then
2733   remove the Connection header field itself (or replace it with the
2734   intermediary's own connection options for the forwarded message).
2735</t>
2736<t>
2737   Hence, the Connection header field provides a declarative way of
2738   distinguishing header fields that are only intended for the
2739   immediate recipient ("hop-by-hop") from those fields that are
2740   intended for all recipients on the chain ("end-to-end"), enabling the
2741   message to be self-descriptive and allowing future connection-specific
2742   extensions to be deployed without fear that they will be blindly
2743   forwarded by older intermediaries.
2744</t>
2745<t>
2746   The Connection header field's value has the following grammar:
2747</t>
2748<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Connection"/><iref primary="true" item="Grammar" subitem="connection-option"/>
2749  <x:ref>Connection</x:ref>        = 1#<x:ref>connection-option</x:ref>
2750  <x:ref>connection-option</x:ref> = <x:ref>token</x:ref>
2751</artwork></figure>
2752<t>
2753   Connection options are case-insensitive.
2754</t>
2755<t>
2756   A sender &MUST-NOT; send a connection option corresponding to a header
2757   field that is intended for all recipients of the payload.
2758   For example, <x:ref>Cache-Control</x:ref> is never appropriate as a
2759   connection option (&header-cache-control;).
2760</t>
2761<t>
2762   The connection options do not have to correspond to a header field
2763   present in the message, since a connection-specific header field
2764   might not be needed if there are no parameters associated with that
2765   connection option.  Recipients that trigger certain connection
2766   behavior based on the presence of connection options &MUST; do so
2767   based on the presence of the connection-option rather than only the
2768   presence of the optional header field.  In other words, if the
2769   connection option is received as a header field but not indicated
2770   within the Connection field-value, then the recipient &MUST; ignore
2771   the connection-specific header field because it has likely been
2772   forwarded by an intermediary that is only partially conformant.
2773</t>
2774<t>
2775   When defining new connection options, specifications ought to
2776   carefully consider existing deployed header fields and ensure
2777   that the new connection option does not share the same name as
2778   an unrelated header field that might already be deployed.
2779   Defining a new connection option essentially reserves that potential
2780   field-name for carrying additional information related to the
2781   connection option, since it would be unwise for senders to use
2782   that field-name for anything else.
2783</t>
2784<t>
2785   The "<x:dfn>close</x:dfn>" connection option is defined for a
2786   sender to signal that this connection will be closed after completion of
2787   the response. For example,
2788</t>
2789<figure><artwork type="example">
2790  Connection: close
2791</artwork></figure>
2792<t>
2793   in either the request or the response header fields indicates that
2794   the connection &MUST; be closed after the current request/response
2795   is complete (<xref target="persistent.tear-down"/>).
2796</t>
2797<t>
2798   A client that does not support <x:ref>persistent connections</x:ref> &MUST;
2799   send the "close" connection option in every request message.
2800</t>
2801<t>
2802   A server that does not support <x:ref>persistent connections</x:ref> &MUST;
2803   send the "close" connection option in every response message that
2804   does not have a <x:ref>1xx (Informational)</x:ref> status code.
2805</t>
2806</section>
2807
2808<section title="Establishment" anchor="persistent.establishment">
2809<t>
2810   It is beyond the scope of this specification to describe how connections
2811   are established via various transport or session-layer protocols.
2812   Each connection applies to only one transport link.
2813</t>
2814</section>
2815
2816<section title="Persistence" anchor="persistent.connections">
2817   <x:anchor-alias value="persistent connections"/>
2818<t>
2819   HTTP/1.1 defaults to the use of "<x:dfn>persistent connections</x:dfn>",
2820   allowing multiple requests and responses to be carried over a single
2821   connection. The "<x:ref>close</x:ref>" connection-option is used to signal
2822   that a connection will not persist after the current request/response.
2823   HTTP implementations &SHOULD; support persistent connections.
2824</t>
2825<t>
2826   A recipient determines whether a connection is persistent or not based on
2827   the most recently received message's protocol version and
2828   <x:ref>Connection</x:ref> header field (if any):
2829   <list style="symbols">
2830     <t>If the <x:ref>close</x:ref> connection option is present, the
2831        connection will not persist after the current response; else,</t>
2832     <t>If the received protocol is HTTP/1.1 (or later), the connection will
2833        persist after the current response; else,</t>
2834     <t>If the received protocol is HTTP/1.0, the "keep-alive"
2835        connection option is present, the recipient is not a proxy, and
2836        the recipient wishes to honor the HTTP/1.0 "keep-alive" mechanism,
2837        the connection will persist after the current response; otherwise,</t>
2838     <t>The connection will close after the current response.</t>
2839   </list>
2840</t>
2841<t>
2842   A server &MAY; assume that an HTTP/1.1 client intends to maintain a
2843   persistent connection until a <x:ref>close</x:ref> connection option
2844   is received in a request.
2845</t>
2846<t>
2847   A client &MAY; reuse a persistent connection until it sends or receives
2848   a <x:ref>close</x:ref> connection option or receives an HTTP/1.0 response
2849   without a "keep-alive" connection option.
2850</t>
2851<t>
2852   In order to remain persistent, all messages on a connection &MUST;
2853   have a self-defined message length (i.e., one not defined by closure
2854   of the connection), as described in <xref target="message.body"/>.
2855   A server &MUST; read the entire request message body or close
2856   the connection after sending its response, since otherwise the
2857   remaining data on a persistent connection would be misinterpreted
2858   as the next request.  Likewise,
2859   a client &MUST; read the entire response message body if it intends
2860   to reuse the same connection for a subsequent request.
2861</t>
2862<t>
2863   A proxy server &MUST-NOT; maintain a persistent connection with an
2864   HTTP/1.0 client (see <xref x:sec="19.7.1" x:fmt="of" target="RFC2068"/> for
2865   information and discussion of the problems with the Keep-Alive header field
2866   implemented by many HTTP/1.0 clients).
2867</t>
2868<t>
2869   Clients and servers &SHOULD-NOT; assume that a persistent connection is
2870   maintained for HTTP versions less than 1.1 unless it is explicitly
2871   signaled.
2872   See <xref target="compatibility.with.http.1.0.persistent.connections"/>
2873   for more information on backward compatibility with HTTP/1.0 clients.
2874</t>
2875
2876<section title="Retrying Requests" anchor="persistent.retrying.requests">
2877<t>
2878   Connections can be closed at any time, with or without intention.
2879   Implementations ought to anticipate the need to recover
2880   from asynchronous close events.
2881</t>
2882<t>
2883   When an inbound connection is closed prematurely, a client &MAY; open a new
2884   connection and automatically retransmit an aborted sequence of requests if
2885   all of those requests have idempotent methods (&idempotent-methods;).
2886   A proxy &MUST-NOT; automatically retry non-idempotent requests.
2887</t>
2888<t>
2889   A user agent &MUST-NOT; automatically retry a request with a non-idempotent
2890   method unless it has some means to know that the request semantics are
2891   actually idempotent, regardless of the method, or some means to detect that
2892   the original request was never applied. For example, a user agent that
2893   knows (through design or configuration) that a POST request to a given
2894   resource is safe can repeat that request automatically.
2895   Likewise, a user agent designed specifically to operate on a version
2896   control repository might be able to recover from partial failure conditions
2897   by checking the target resource revision(s) after a failed connection,
2898   reverting or fixing any changes that were partially applied, and then
2899   automatically retrying the requests that failed.
2900</t>
2901<t>
2902   An automatic retry &SHOULD-NOT; be repeated if it fails.
2903</t>
2904</section>
2905
2906<section title="Pipelining" anchor="pipelining">
2907   <x:anchor-alias value="pipeline"/>
2908<t>
2909   A client that supports persistent connections &MAY; "<x:dfn>pipeline</x:dfn>"
2910   its requests (i.e., send multiple requests without waiting for each
2911   response). A server &MAY; process a sequence of pipelined requests in
2912   parallel if they all have safe methods (&safe-methods;), but &MUST; send
2913   the corresponding responses in the same order that the requests were
2914   received.
2915</t>
2916<t>
2917   A client that pipelines requests &MUST; be prepared to retry those
2918   requests if the connection closes before it receives all of the
2919   corresponding responses. A client that assumes a persistent connection and
2920   pipelines immediately after connection establishment &MUST-NOT; pipeline
2921   on a retry connection until it knows the connection is persistent.
2922</t>
2923<t>
2924   Idempotent methods (&idempotent-methods;) are significant to pipelining
2925   because they can be automatically retried after a connection failure.
2926   A user agent &SHOULD-NOT; pipeline requests after a non-idempotent method
2927   until the final response status code for that method has been received,
2928   unless the user agent has a means to detect and recover from partial
2929   failure conditions involving the pipelined sequence.
2930</t>
2931<t>
2932   An intermediary that receives pipelined requests &MAY; pipeline those
2933   requests when forwarding them inbound, since it can rely on the outbound
2934   user agent(s) to determine what requests can be safely pipelined. If the
2935   inbound connection fails before receiving a response, the pipelining
2936   intermediary &MAY; attempt to retry a sequence of requests that have yet
2937   to receive a response if the requests all have idempotent methods;
2938   otherwise, the pipelining intermediary &SHOULD; forward any received
2939   responses and then close the corresponding outbound connection(s) so that
2940   the outbound user agent(s) can recover accordingly.
2941</t>
2942</section>
2943</section>
2944   
2945<section title="Concurrency" anchor="persistent.concurrency">
2946<t>
2947   Clients &SHOULD; limit the number of simultaneous
2948   connections that they maintain to a given server.
2949</t>
2950<t>
2951   Previous revisions of HTTP gave a specific number of connections as a
2952   ceiling, but this was found to be impractical for many applications. As a
2953   result, this specification does not mandate a particular maximum number of
2954   connections, but instead encourages clients to be conservative when opening
2955   multiple connections.
2956</t>
2957<t>
2958   Multiple connections are typically used to avoid the "head-of-line
2959   blocking" problem, wherein a request that takes significant server-side
2960   processing and/or has a large payload blocks subsequent requests on the
2961   same connection. However, each connection consumes server resources.
2962   Furthermore, using multiple connections can cause undesirable side effects
2963   in congested networks.
2964</t>
2965<t>
2966   Note that servers might reject traffic that they deem abusive, including an
2967   excessive number of connections from a client.
2968</t>
2969</section>
2970
2971<section title="Failures and Time-outs" anchor="persistent.failures">
2972<t>
2973   Servers will usually have some time-out value beyond which they will
2974   no longer maintain an inactive connection. Proxy servers might make
2975   this a higher value since it is likely that the client will be making
2976   more connections through the same server. The use of persistent
2977   connections places no requirements on the length (or existence) of
2978   this time-out for either the client or the server.
2979</t>
2980<t>
2981   When a client or server wishes to time-out it &SHOULD; issue a graceful
2982   close on the transport connection. Clients and servers &SHOULD; both
2983   constantly watch for the other side of the transport close, and
2984   respond to it as appropriate. If a client or server does not detect
2985   the other side's close promptly it could cause unnecessary resource
2986   drain on the network.
2987</t>
2988<t>
2989   A client, server, or proxy &MAY; close the transport connection at any
2990   time. For example, a client might have started to send a new request
2991   at the same time that the server has decided to close the "idle"
2992   connection. From the server's point of view, the connection is being
2993   closed while it was idle, but from the client's point of view, a
2994   request is in progress.
2995</t>
2996<t>
2997   Servers &SHOULD; maintain persistent connections and allow the underlying
2998   transport's flow control mechanisms to resolve temporary overloads, rather
2999   than terminate connections with the expectation that clients will retry.
3000   The latter technique can exacerbate network congestion.
3001</t>
3002<t>
3003   A client sending a message body &SHOULD; monitor
3004   the network connection for an error status code while it is transmitting
3005   the request. If the client sees an error status code, it &SHOULD;
3006   immediately cease transmitting the body and close the connection.
3007</t>
3008</section>
3009   
3010<section title="Tear-down" anchor="persistent.tear-down">
3011  <iref primary="false" item="Connection header field" x:for-anchor=""/>
3012  <iref primary="false" item="close" x:for-anchor=""/>
3013<t>
3014   The <x:ref>Connection</x:ref> header field
3015   (<xref target="header.connection"/>) provides a "<x:ref>close</x:ref>"
3016   connection option that a sender &SHOULD; send when it wishes to close
3017   the connection after the current request/response pair.
3018</t>
3019<t>
3020   A client that sends a <x:ref>close</x:ref> connection option &MUST-NOT;
3021   send further requests on that connection (after the one containing
3022   <x:ref>close</x:ref>) and &MUST; close the connection after reading the
3023   final response message corresponding to this request.
3024</t>
3025<t>
3026   A server that receives a <x:ref>close</x:ref> connection option &MUST;
3027   initiate a lingering close (see below) of the connection after it sends the
3028   final response to the request that contained <x:ref>close</x:ref>.
3029   The server &SHOULD; send a <x:ref>close</x:ref> connection option
3030   in its final response on that connection. The server &MUST-NOT; process
3031   any further requests received on that connection.
3032</t>
3033<t>
3034   A server that sends a <x:ref>close</x:ref> connection option &MUST;
3035   initiate a lingering close of the connection after it sends the
3036   response containing <x:ref>close</x:ref>. The server &MUST-NOT; process
3037   any further requests received on that connection.
3038</t>
3039<t>
3040   A client that receives a <x:ref>close</x:ref> connection option &MUST;
3041   cease sending requests on that connection and close the connection
3042   after reading the response message containing the close; if additional
3043   pipelined requests had been sent on the connection, the client &SHOULD;
3044   assume that they will not be processed by the server.
3045</t>
3046<t>
3047   If a server performs an immediate close of a TCP connection, there is a
3048   significant risk that the client will not be able to read the last HTTP
3049   response.  If the server receives additional data from the client on a
3050   fully-closed connection, such as another request that was sent by the
3051   client before receiving the server's response, the server's TCP stack will
3052   send a reset packet to the client; unfortunately, the reset packet might
3053   erase the client's unacknowledged input buffers before they can be read
3054   and interpreted by the client's HTTP parser.
3055</t>
3056<t>
3057   To avoid the TCP reset problem, a server can perform a lingering close on a
3058   connection by closing only the write side of the read/write connection
3059   (a half-close) and continuing to read from the connection until the
3060   connection is closed by the client or the server is reasonably certain
3061   that its own TCP stack has received the client's acknowledgement of the
3062   packet(s) containing the server's last response. It is then safe for the
3063   server to fully close the connection.
3064</t>
3065<t>
3066   It is unknown whether the reset problem is exclusive to TCP or might also
3067   be found in other transport connection protocols.
3068</t>
3069</section>
3070
3071<section title="Upgrade" anchor="header.upgrade">
3072  <iref primary="true" item="Upgrade header field" x:for-anchor=""/>
3073  <x:anchor-alias value="Upgrade"/>
3074  <x:anchor-alias value="protocol"/>
3075  <x:anchor-alias value="protocol-name"/>
3076  <x:anchor-alias value="protocol-version"/>
3077<t>
3078   The "Upgrade" header field is intended to provide a simple mechanism
3079   for transitioning from HTTP/1.1 to some other protocol on the same
3080   connection.  A client &MAY; send a list of protocols in the Upgrade
3081   header field of a request to invite the server to switch to one or
3082   more of those protocols before sending the final response.
3083   A server &MUST; send an Upgrade header field in <x:ref>101 (Switching
3084   Protocols)</x:ref> responses to indicate which protocol(s) are being
3085   switched to, and &MUST; send it in <x:ref>426 (Upgrade Required)</x:ref>
3086   responses to indicate acceptable protocols.
3087   A server &MAY; send an Upgrade header field in any other response to
3088   indicate that they might be willing to upgrade to one of the
3089   specified protocols for a future request.
3090</t>
3091<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Upgrade"/>
3092  <x:ref>Upgrade</x:ref>          = 1#<x:ref>protocol</x:ref>
3093
3094  <x:ref>protocol</x:ref>         = <x:ref>protocol-name</x:ref> ["/" <x:ref>protocol-version</x:ref>]
3095  <x:ref>protocol-name</x:ref>    = <x:ref>token</x:ref>
3096  <x:ref>protocol-version</x:ref> = <x:ref>token</x:ref>
3097</artwork></figure>
3098<t>
3099   For example,
3100</t>
3101<figure><artwork type="example">
3102  Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
3103</artwork></figure>
3104<t>
3105   Upgrade eases the difficult transition between incompatible protocols by
3106   allowing the client to initiate a request in the more commonly
3107   supported protocol while indicating to the server that it would like
3108   to use a "better" protocol if available (where "better" is determined
3109   by the server, possibly according to the nature of the request method
3110   or target resource).
3111</t>
3112<t>
3113   Upgrade cannot be used to insist on a protocol change; its acceptance and
3114   use by the server is optional. The capabilities and nature of the
3115   application-level communication after the protocol change is entirely
3116   dependent upon the new protocol chosen, although the first action
3117   after changing the protocol &MUST; be a response to the initial HTTP
3118   request that contained the Upgrade header field.
3119</t>
3120<t>
3121   For example, if the Upgrade header field is received in a GET request
3122   and the server decides to switch protocols, then it first responds
3123   with a <x:ref>101 (Switching Protocols)</x:ref> message in HTTP/1.1 and
3124   then immediately follows that with the new protocol's equivalent of a
3125   response to a GET on the target resource.  This allows a connection to be
3126   upgraded to protocols with the same semantics as HTTP without the
3127   latency cost of an additional round-trip.  A server &MUST-NOT; switch
3128   protocols unless the received message semantics can be honored by the new
3129   protocol; an OPTIONS request can be honored by any protocol.
3130</t>
3131<t>
3132   When Upgrade is sent, a sender &MUST; also send a
3133   <x:ref>Connection</x:ref> header field (<xref target="header.connection"/>)
3134   that contains the "upgrade" connection option, in order to prevent Upgrade
3135   from being accidentally forwarded by intermediaries that might not implement
3136   the listed protocols.  A server &MUST; ignore an Upgrade header field that
3137   is received in an HTTP/1.0 request.
3138</t>
3139<t>
3140   The Upgrade header field only applies to switching application-level
3141   protocols on the existing connection; it cannot be used
3142   to switch to a protocol on a different connection. For that purpose, it is
3143   more appropriate to use a <x:ref>3xx (Redirection)</x:ref> response
3144   (&status-3xx;).
3145</t>
3146<t>
3147   This specification only defines the protocol name "HTTP" for use by
3148   the family of Hypertext Transfer Protocols, as defined by the HTTP
3149   version rules of <xref target="http.version"/> and future updates to this
3150   specification. Additional tokens ought to be registered with IANA using the
3151   registration procedure defined in <xref target="upgrade.token.registry"/>.
3152</t>
3153</section>
3154</section>
3155
3156<section title="IANA Considerations" anchor="IANA.considerations">
3157
3158<section title="Header Field Registration" anchor="header.field.registration">
3159<t>
3160   HTTP header fields are registered within the Message Header Field Registry
3161   <xref target="BCP90"/> maintained by IANA at
3162   <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/>.
3163</t>
3164<t>
3165   This document defines the following HTTP header fields, so their
3166   associated registry entries shall be updated according to the permanent
3167   registrations below:
3168</t>
3169<?BEGININC p1-messaging.iana-headers ?>
3170<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
3171<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
3172   <ttcol>Header Field Name</ttcol>
3173   <ttcol>Protocol</ttcol>
3174   <ttcol>Status</ttcol>
3175   <ttcol>Reference</ttcol>
3176
3177   <c>Connection</c>
3178   <c>http</c>
3179   <c>standard</c>
3180   <c>
3181      <xref target="header.connection"/>
3182   </c>
3183   <c>Content-Length</c>
3184   <c>http</c>
3185   <c>standard</c>
3186   <c>
3187      <xref target="header.content-length"/>
3188   </c>
3189   <c>Host</c>
3190   <c>http</c>
3191   <c>standard</c>
3192   <c>
3193      <xref target="header.host"/>
3194   </c>
3195   <c>TE</c>
3196   <c>http</c>
3197   <c>standard</c>
3198   <c>
3199      <xref target="header.te"/>
3200   </c>
3201   <c>Trailer</c>
3202   <c>http</c>
3203   <c>standard</c>
3204   <c>
3205      <xref target="header.trailer"/>
3206   </c>
3207   <c>Transfer-Encoding</c>
3208   <c>http</c>
3209   <c>standard</c>
3210   <c>
3211      <xref target="header.transfer-encoding"/>
3212   </c>
3213   <c>Upgrade</c>
3214   <c>http</c>
3215   <c>standard</c>
3216   <c>
3217      <xref target="header.upgrade"/>
3218   </c>
3219   <c>Via</c>
3220   <c>http</c>
3221   <c>standard</c>
3222   <c>
3223      <xref target="header.via"/>
3224   </c>
3225</texttable>
3226<!--(END)-->
3227<?ENDINC p1-messaging.iana-headers ?>
3228<t>
3229   Furthermore, the header field-name "Close" shall be registered as
3230   "reserved", since using that name as an HTTP header field might
3231   conflict with the "close" connection option of the "<x:ref>Connection</x:ref>"
3232   header field (<xref target="header.connection"/>).
3233</t>
3234<texttable align="left" suppress-title="true">
3235   <ttcol>Header Field Name</ttcol>
3236   <ttcol>Protocol</ttcol>
3237   <ttcol>Status</ttcol>
3238   <ttcol>Reference</ttcol>
3239
3240   <c>Close</c>
3241   <c>http</c>
3242   <c>reserved</c>
3243   <c>
3244      <xref target="header.field.registration"/>
3245   </c>
3246</texttable>
3247<t>
3248   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
3249</t>
3250</section>
3251
3252<section title="URI Scheme Registration" anchor="uri.scheme.registration">
3253<t>
3254   IANA maintains the registry of URI Schemes <xref target="BCP115"/> at
3255   <eref target="http://www.iana.org/assignments/uri-schemes.html"/>.
3256</t>
3257<t>
3258   This document defines the following URI schemes, so their
3259   associated registry entries shall be updated according to the permanent
3260   registrations below:
3261</t>
3262<texttable align="left" suppress-title="true">
3263   <ttcol>URI Scheme</ttcol>
3264   <ttcol>Description</ttcol>
3265   <ttcol>Reference</ttcol>
3266
3267   <c>http</c>
3268   <c>Hypertext Transfer Protocol</c>
3269   <c><xref target="http.uri"/></c>
3270
3271   <c>https</c>
3272   <c>Hypertext Transfer Protocol Secure</c>
3273   <c><xref target="https.uri"/></c>
3274</texttable>
3275</section>
3276
3277<section title="Internet Media Type Registration" anchor="internet.media.type.http">
3278<t>
3279   This document serves as the specification for the Internet media types
3280   "message/http" and "application/http". The following is to be registered with
3281   IANA (see <xref target="BCP13"/>).
3282</t>
3283<section title="Internet Media Type message/http" anchor="internet.media.type.message.http">
3284<iref item="Media Type" subitem="message/http" primary="true"/>
3285<iref item="message/http Media Type" primary="true"/>
3286<t>
3287   The message/http type can be used to enclose a single HTTP request or
3288   response message, provided that it obeys the MIME restrictions for all
3289   "message" types regarding line length and encodings.
3290</t>
3291<t>
3292  <list style="hanging" x:indent="12em">
3293    <t hangText="Type name:">
3294      message
3295    </t>
3296    <t hangText="Subtype name:">
3297      http
3298    </t>
3299    <t hangText="Required parameters:">
3300      none
3301    </t>
3302    <t hangText="Optional parameters:">
3303      version, msgtype
3304      <list style="hanging">
3305        <t hangText="version:">
3306          The HTTP-version number of the enclosed message
3307          (e.g., "1.1"). If not present, the version can be
3308          determined from the first line of the body.
3309        </t>
3310        <t hangText="msgtype:">
3311          The message type &mdash; "request" or "response". If not
3312          present, the type can be determined from the first
3313          line of the body.
3314        </t>
3315      </list>
3316    </t>
3317    <t hangText="Encoding considerations:">
3318      only "7bit", "8bit", or "binary" are permitted
3319    </t>
3320    <t hangText="Security considerations:">
3321      none
3322    </t>
3323    <t hangText="Interoperability considerations:">
3324      none
3325    </t>
3326    <t hangText="Published specification:">
3327      This specification (see <xref target="internet.media.type.message.http"/>).
3328    </t>
3329    <t hangText="Applications that use this media type:">
3330    </t>
3331    <t hangText="Additional information:">
3332      <list style="hanging">
3333        <t hangText="Magic number(s):">none</t>
3334        <t hangText="File extension(s):">none</t>
3335        <t hangText="Macintosh file type code(s):">none</t>
3336      </list>
3337    </t>
3338    <t hangText="Person and email address to contact for further information:">
3339      See Authors Section.
3340    </t>
3341    <t hangText="Intended usage:">
3342      COMMON
3343    </t>
3344    <t hangText="Restrictions on usage:">
3345      none
3346    </t>
3347    <t hangText="Author/Change controller:">
3348      IESG
3349    </t>
3350  </list>
3351</t>
3352</section>
3353<section title="Internet Media Type application/http" anchor="internet.media.type.application.http">
3354<iref item="Media Type" subitem="application/http" primary="true"/>
3355<iref item="application/http Media Type" primary="true"/>
3356<t>
3357   The application/http type can be used to enclose a pipeline of one or more
3358   HTTP request or response messages (not intermixed).
3359</t>
3360<t>
3361  <list style="hanging" x:indent="12em">
3362    <t hangText="Type name:">
3363      application
3364    </t>
3365    <t hangText="Subtype name:">
3366      http
3367    </t>
3368    <t hangText="Required parameters:">
3369      none
3370    </t>
3371    <t hangText="Optional parameters:">
3372      version, msgtype
3373      <list style="hanging">
3374        <t hangText="version:">
3375          The HTTP-version number of the enclosed messages
3376          (e.g., "1.1"). If not present, the version can be
3377          determined from the first line of the body.
3378        </t>
3379        <t hangText="msgtype:">
3380          The message type &mdash; "request" or "response". If not
3381          present, the type can be determined from the first
3382          line of the body.
3383        </t>
3384      </list>
3385    </t>
3386    <t hangText="Encoding considerations:">
3387      HTTP messages enclosed by this type
3388      are in "binary" format; use of an appropriate
3389      Content-Transfer-Encoding is required when
3390      transmitted via E-mail.
3391    </t>
3392    <t hangText="Security considerations:">
3393      none
3394    </t>
3395    <t hangText="Interoperability considerations:">
3396      none
3397    </t>
3398    <t hangText="Published specification:">
3399      This specification (see <xref target="internet.media.type.application.http"/>).
3400    </t>
3401    <t hangText="Applications that use this media type:">
3402    </t>
3403    <t hangText="Additional information:">
3404      <list style="hanging">
3405        <t hangText="Magic number(s):">none</t>
3406        <t hangText="File extension(s):">none</t>
3407        <t hangText="Macintosh file type code(s):">none</t>
3408      </list>
3409    </t>
3410    <t hangText="Person and email address to contact for further information:">
3411      See Authors Section.
3412    </t>
3413    <t hangText="Intended usage:">
3414      COMMON
3415    </t>
3416    <t hangText="Restrictions on usage:">
3417      none
3418    </t>
3419    <t hangText="Author/Change controller:">
3420      IESG
3421    </t>
3422  </list>
3423</t>
3424</section>
3425</section>
3426
3427<section title="Transfer Coding Registry" anchor="transfer.coding.registry">
3428<t>
3429   The HTTP Transfer Coding Registry defines the name space for transfer
3430   coding names.
3431</t>
3432<t>
3433   Registrations &MUST; include the following fields:
3434   <list style="symbols">
3435     <t>Name</t>
3436     <t>Description</t>
3437     <t>Pointer to specification text</t>
3438   </list>
3439</t>
3440<t>
3441   Names of transfer codings &MUST-NOT; overlap with names of content codings
3442   (&content-codings;) unless the encoding transformation is identical, as
3443   is the case for the compression codings defined in
3444   <xref target="compression.codings"/>.
3445</t>
3446<t>
3447   Values to be added to this name space require IETF Review (see
3448   <xref target="RFC5226" x:fmt="of" x:sec="4.1"/>), and &MUST;
3449   conform to the purpose of transfer coding defined in this section.
3450   Use of program names for the identification of encoding formats
3451   is not desirable and is discouraged for future encodings.
3452</t>
3453<t>
3454   The registry itself is maintained at
3455   <eref target="http://www.iana.org/assignments/http-parameters"/>.
3456</t>
3457</section>
3458
3459<section title="Transfer Coding Registration" anchor="transfer.coding.registration">
3460<t>
3461   The HTTP Transfer Coding Registry shall be updated with the registrations
3462   below:
3463</t>
3464<texttable align="left" suppress-title="true" anchor="iana.transfer.coding.registration.table">
3465   <ttcol>Name</ttcol>
3466   <ttcol>Description</ttcol>
3467   <ttcol>Reference</ttcol>
3468   <c>chunked</c>
3469   <c>Transfer in a series of chunks</c>
3470   <c>
3471      <xref target="chunked.encoding"/>
3472   </c>
3473   <c>compress</c>
3474   <c>UNIX "compress" program method</c>
3475   <c>
3476      <xref target="compress.coding"/>
3477   </c>
3478   <c>deflate</c>
3479   <c>"deflate" compression mechanism (<xref target="RFC1951"/>) used inside
3480   the "zlib" data format (<xref target="RFC1950"/>)
3481   </c>
3482   <c>
3483      <xref target="deflate.coding"/>
3484   </c>
3485   <c>gzip</c>
3486   <c>Same as GNU zip <xref target="RFC1952"/></c>
3487   <c>
3488      <xref target="gzip.coding"/>
3489   </c>
3490</texttable>
3491</section>
3492
3493<section title="Upgrade Token Registry" anchor="upgrade.token.registry">
3494<t>
3495   The HTTP Upgrade Token Registry defines the name space for protocol-name
3496   tokens used to identify protocols in the <x:ref>Upgrade</x:ref> header
3497   field. Each registered protocol name is associated with contact information
3498   and an optional set of specifications that details how the connection
3499   will be processed after it has been upgraded.
3500</t>
3501<t>
3502   Registrations happen on a "First Come First Served" basis (see
3503   <xref target="RFC5226" x:sec="4.1" x:fmt="of"/>) and are subject to the
3504   following rules:
3505  <list style="numbers">
3506    <t>A protocol-name token, once registered, stays registered forever.</t>
3507    <t>The registration &MUST; name a responsible party for the
3508       registration.</t>
3509    <t>The registration &MUST; name a point of contact.</t>
3510    <t>The registration &MAY; name a set of specifications associated with
3511       that token. Such specifications need not be publicly available.</t>
3512    <t>The registration &SHOULD; name a set of expected "protocol-version"
3513       tokens associated with that token at the time of registration.</t>
3514    <t>The responsible party &MAY; change the registration at any time.
3515       The IANA will keep a record of all such changes, and make them
3516       available upon request.</t>
3517    <t>The IESG &MAY; reassign responsibility for a protocol token.
3518       This will normally only be used in the case when a
3519       responsible party cannot be contacted.</t>
3520  </list>
3521</t>
3522<t>
3523   This registration procedure for HTTP Upgrade Tokens replaces that
3524   previously defined in <xref target="RFC2817" x:fmt="of" x:sec="7.2"/>.
3525</t>
3526</section>
3527
3528<section title="Upgrade Token Registration" anchor="upgrade.token.registration">
3529<t>
3530   The HTTP Upgrade Token Registry shall be updated with the registration
3531   below:
3532</t>
3533<texttable align="left" suppress-title="true">
3534   <ttcol>Value</ttcol>
3535   <ttcol>Description</ttcol>
3536   <ttcol>Expected Version Tokens</ttcol>
3537   <ttcol>Reference</ttcol>
3538
3539   <c>HTTP</c>
3540   <c>Hypertext Transfer Protocol</c>
3541   <c>any DIGIT.DIGIT (e.g, "2.0")</c>
3542   <c><xref target="http.version"/></c>
3543</texttable>
3544<t>
3545   The responsible party is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
3546</t>
3547</section>
3548
3549</section>
3550
3551<section title="Security Considerations" anchor="security.considerations">
3552<t>
3553   This section is meant to inform developers, information providers, and
3554   users of known security concerns relevant to HTTP/1.1 message syntax,
3555   parsing, and routing.
3556</t>
3557
3558<section title="DNS-related Attacks" anchor="dns.related.attacks">
3559<t>
3560   HTTP clients rely heavily on the Domain Name Service (DNS), and are thus
3561   generally prone to security attacks based on the deliberate misassociation
3562   of IP addresses and DNS names not protected by DNSSEC. Clients need to be
3563   cautious in assuming the validity of an IP number/DNS name association unless
3564   the response is protected by DNSSEC (<xref target="RFC4033"/>).
3565</t>
3566</section>
3567
3568<section title="Intermediaries and Caching" anchor="attack.intermediaries">
3569<t>
3570   By their very nature, HTTP intermediaries are men-in-the-middle, and
3571   represent an opportunity for man-in-the-middle attacks. Compromise of
3572   the systems on which the intermediaries run can result in serious security
3573   and privacy problems. Intermediaries have access to security-related
3574   information, personal information about individual users and
3575   organizations, and proprietary information belonging to users and
3576   content providers. A compromised intermediary, or an intermediary
3577   implemented or configured without regard to security and privacy
3578   considerations, might be used in the commission of a wide range of
3579   potential attacks.
3580</t>
3581<t>
3582   Intermediaries that contain a shared cache are especially vulnerable
3583   to cache poisoning attacks.
3584</t>
3585<t>
3586   Implementers need to consider the privacy and security
3587   implications of their design and coding decisions, and of the
3588   configuration options they provide to operators (especially the
3589   default configuration).
3590</t>
3591<t>
3592   Users need to be aware that intermediaries are no more trustworthy than
3593   the people who run them; HTTP itself cannot solve this problem.
3594</t>
3595</section>
3596
3597<section title="Buffer Overflows" anchor="attack.protocol.element.size.overflows">
3598<t>
3599   Because HTTP uses mostly textual, character-delimited fields, attackers can
3600   overflow buffers in implementations, and/or perform a Denial of Service
3601   against implementations that accept fields with unlimited lengths.
3602</t>
3603<t>
3604   To promote interoperability, this specification makes specific
3605   recommendations for minimum size limits on request-line
3606   (<xref target="request.line"/>)
3607   and blocks of header fields (<xref target="header.fields"/>). These are
3608   minimum recommendations, chosen to be supportable even by implementations
3609   with limited resources; it is expected that most implementations will
3610   choose substantially higher limits.
3611</t>
3612<t>
3613   This specification also provides a way for servers to reject messages that
3614   have request-targets that are too long (&status-414;) or request entities
3615   that are too large (&status-4xx;).
3616</t>
3617<t>
3618   Recipients &SHOULD; carefully limit the extent to which they read other
3619   fields, including (but not limited to) request methods, response status
3620   phrases, header field-names, and body chunks, so as to avoid denial of
3621   service attacks without impeding interoperability.
3622</t>
3623</section>
3624
3625<section title="Message Integrity" anchor="message.integrity">
3626<t>
3627   HTTP does not define a specific mechanism for ensuring message integrity,
3628   instead relying on the error-detection ability of underlying transport
3629   protocols and the use of length or chunk-delimited framing to detect
3630   completeness. Additional integrity mechanisms, such as hash functions or
3631   digital signatures applied to the content, can be selectively added to
3632   messages via extensible metadata header fields. Historically, the lack of
3633   a single integrity mechanism has been justified by the informal nature of
3634   most HTTP communication.  However, the prevalence of HTTP as an information
3635   access mechanism has resulted in its increasing use within environments
3636   where verification of message integrity is crucial.
3637</t>
3638<t>
3639   User agents are encouraged to implement configurable means for detecting
3640   and reporting failures of message integrity such that those means can be
3641   enabled within environments for which integrity is necessary. For example,
3642   a browser being used to view medical history or drug interaction
3643   information needs to indicate to the user when such information is detected
3644   by the protocol to be incomplete, expired, or corrupted during transfer.
3645   Such mechanisms might be selectively enabled via user agent extensions or
3646   the presence of message integrity metadata in a response.
3647   At a minimum, user agents ought to provide some indication that allows a
3648   user to distinguish between a complete and incomplete response message
3649   (<xref target="incomplete.messages"/>) when such verification is desired.
3650</t>
3651</section>
3652
3653<section title="Server Log Information" anchor="abuse.of.server.log.information">
3654<t>
3655   A server is in the position to save personal data about a user's requests
3656   over time, which might identify their reading patterns or subjects of
3657   interest.  In particular, log information gathered at an intermediary
3658   often contains a history of user agent interaction, across a multitude
3659   of sites, that can be traced to individual users.
3660</t>
3661<t>
3662   HTTP log information is confidential in nature; its handling is often
3663   constrained by laws and regulations.  Log information needs to be securely
3664   stored and appropriate guidelines followed for its analysis.
3665   Anonymization of personal information within individual entries helps,
3666   but is generally not sufficient to prevent real log traces from being
3667   re-identified based on correlation with other access characteristics.
3668   As such, access traces that are keyed to a specific client should not
3669   be published even if the key is pseudonymous.
3670</t>
3671<t>
3672   To minimize the risk of theft or accidental publication, log information
3673   should be purged of personally identifiable information, including
3674   user identifiers, IP addresses, and user-provided query parameters,
3675   as soon as that information is no longer necessary to support operational
3676   needs for security, auditing, or fraud control.
3677</t>
3678</section>
3679</section>
3680
3681<section title="Acknowledgments" anchor="acks">
3682<t>
3683   This edition of HTTP/1.1 builds on the many contributions that went into
3684   <xref target="RFC1945" format="none">RFC 1945</xref>,
3685   <xref target="RFC2068" format="none">RFC 2068</xref>,
3686   <xref target="RFC2145" format="none">RFC 2145</xref>, and
3687   <xref target="RFC2616" format="none">RFC 2616</xref>, including
3688   substantial contributions made by the previous authors, editors, and
3689   working group chairs: Tim Berners-Lee, Ari Luotonen, Roy T. Fielding,
3690   Henrik Frystyk Nielsen, Jim Gettys, Jeffrey C. Mogul, Larry Masinter,
3691   and Paul J. Leach. Mark Nottingham oversaw this effort as working group chair.
3692</t>
3693<t>
3694   Since 1999, the following contributors have helped improve the HTTP
3695   specification by reporting bugs, asking smart questions, drafting or
3696   reviewing text, and evaluating open issues:
3697</t>
3698<?BEGININC acks ?>
3699<t>Adam Barth,
3700Adam Roach,
3701Addison Phillips,
3702Adrian Chadd,
3703Adrien W. de Croy,
3704Alan Ford,
3705Alan Ruttenberg,
3706Albert Lunde,
3707Alek Storm,
3708Alex Rousskov,
3709Alexandre Morgaut,
3710Alexey Melnikov,
3711Alisha Smith,
3712Amichai Rothman,
3713Amit Klein,
3714Amos Jeffries,
3715Andreas Maier,
3716Andreas Petersson,
3717Anil Sharma,
3718Anne van Kesteren,
3719Anthony Bryan,
3720Asbjorn Ulsberg,
3721Ashok Kumar,
3722Balachander Krishnamurthy,
3723Barry Leiba,
3724Ben Laurie,
3725Benjamin Niven-Jenkins,
3726Bil Corry,
3727Bill Burke,
3728Bjoern Hoehrmann,
3729Bob Scheifler,
3730Boris Zbarsky,
3731Brett Slatkin,
3732Brian Kell,
3733Brian McBarron,
3734Brian Pane,
3735Brian Smith,
3736Bryce Nesbitt,
3737Cameron Heavon-Jones,
3738Carl Kugler,
3739Carsten Bormann,
3740Charles Fry,
3741Chris Newman,
3742Chris Weber,
3743Cyrus Daboo,
3744Dale Robert Anderson,
3745Dan Wing,
3746Dan Winship,
3747Daniel Stenberg,
3748Darrel Miller,
3749Dave Cridland,
3750Dave Crocker,
3751Dave Kristol,
3752David Booth,
3753David Singer,
3754David W. Morris,
3755Diwakar Shetty,
3756Dmitry Kurochkin,
3757Drummond Reed,
3758Duane Wessels,
3759Duncan Cragg,
3760Edward Lee,
3761Eliot Lear,
3762Eran Hammer-Lahav,
3763Eric D. Williams,
3764Eric J. Bowman,
3765Eric Lawrence,
3766Eric Rescorla,
3767Erik Aronesty,
3768Evan Prodromou,
3769Florian Weimer,
3770Frank Ellermann,
3771Fred Bohle,
3772Gabriel Montenegro,
3773Geoffrey Sneddon,
3774Gervase Markham,
3775Grahame Grieve,
3776Greg Wilkins,
3777Harald Tveit Alvestrand,
3778Harry Halpin,
3779Helge Hess,
3780Henrik Nordstrom,
3781Henry S. Thompson,
3782Henry Story,
3783Herbert van de Sompel,
3784Howard Melman,
3785Hugo Haas,
3786Ian Fette,
3787Ian Hickson,
3788Ido Safruti,
3789Ilya Grigorik,
3790Ingo Struck,
3791J. Ross Nicoll,
3792James H. Manger,
3793James Lacey,
3794James M. Snell,
3795Jamie Lokier,
3796Jan Algermissen,
3797Jeff Hodges (who came up with the term 'effective Request-URI'),
3798Jeff Walden,
3799Jeroen de Borst,
3800Jim Luther,
3801Joe D. Williams,
3802Joe Gregorio,
3803Joe Orton,
3804John C. Klensin,
3805John C. Mallery,
3806John Cowan,
3807John Kemp,
3808John Panzer,
3809John Schneider,
3810John Stracke,
3811John Sullivan,
3812Jonas Sicking,
3813Jonathan A. Rees,
3814Jonathan Billington,
3815Jonathan Moore,
3816Jonathan Rees,
3817Jonathan Silvera,
3818Jordi Ros,
3819Joris Dobbelsteen,
3820Josh Cohen,
3821Julien Pierre,
3822Jungshik Shin,
3823Justin Chapweske,
3824Justin Erenkrantz,
3825Justin James,
3826Kalvinder Singh,
3827Karl Dubost,
3828Keith Hoffman,
3829Keith Moore,
3830Ken Murchison,
3831Koen Holtman,
3832Konstantin Voronkov,
3833Kris Zyp,
3834Lisa Dusseault,
3835Maciej Stachowiak,
3836Marc Schneider,
3837Marc Slemko,
3838Mark Baker,
3839Mark Pauley,
3840Mark Watson,
3841Markus Isomaki,
3842Markus Lanthaler,
3843Martin J. Duerst,
3844Martin Musatov,
3845Martin Nilsson,
3846Martin Thomson,
3847Matt Lynch,
3848Matthew Cox,
3849Max Clark,
3850Michael Burrows,
3851Michael Hausenblas,
3852Mike Amundsen,
3853Mike Belshe,
3854Mike Kelly,
3855Mike Schinkel,
3856Miles Sabin,
3857Murray S. Kucherawy,
3858Mykyta Yevstifeyev,
3859Nathan Rixham,
3860Nicholas Shanks,
3861Nico Williams,
3862Nicolas Alvarez,
3863Nicolas Mailhot,
3864Noah Slater,
3865Pablo Castro,
3866Pat Hayes,
3867Patrick R. McManus,
3868Patrik Faltstrom,
3869Paul E. Jones,
3870Paul Hoffman,
3871Paul Marquess,
3872Peter Lepeska,
3873Peter Saint-Andre,
3874Peter Watkins,
3875Phil Archer,
3876Philippe Mougin,
3877Phillip Hallam-Baker,
3878Poul-Henning Kamp,
3879Preethi Natarajan,
3880Rajeev Bector,
3881Ray Polk,
3882Reto Bachmann-Gmuer,
3883Richard Cyganiak,
3884Robert Brewer,
3885Robert Collins,
3886Robert O'Callahan,
3887Robert Olofsson,
3888Robert Sayre,
3889Robert Siemer,
3890Robert de Wilde,
3891Roberto Javier Godoy,
3892Roberto Peon,
3893Roland Zink,
3894Ronny Widjaja,
3895S. Mike Dierken,
3896Salvatore Loreto,
3897Sam Johnston,
3898Sam Ruby,
3899Scott Lawrence (who maintained the original issues list),
3900Sean B. Palmer,
3901Shane McCarron,
3902Stefan Eissing,
3903Stefan Tilkov,
3904Stefanos Harhalakis,
3905Stephane Bortzmeyer,
3906Stephen Farrell,
3907Stephen Ludin,
3908Stuart Williams,
3909Subbu Allamaraju,
3910Subramanian Moonesamy,
3911Sylvain Hellegouarch,
3912Tapan Divekar,
3913Tatsuya Hayashi,
3914Ted Hardie,
3915Thomas Broyer,
3916Thomas Fossati,
3917Thomas Nordin,
3918Thomas Roessler,
3919Tim Bray,
3920Tim Morgan,
3921Tim Olsen,
3922Tobias Oberstein,
3923Tom Zhou,
3924Travis Snoozy,
3925Tyler Close,
3926Vincent Murphy,
3927Wenbo Zhu,
3928Werner Baumann,
3929Wilbur Streett,
3930Wilfredo Sanchez Vega,
3931William A. Rowe Jr.,
3932William Chan,
3933Willy Tarreau,
3934Xiaoshu Wang,
3935Yaron Goland,
3936Yngve Nysaeter Pettersen,
3937Yoav Nir,
3938Yogesh Bang,
3939Yutaka Oiwa,
3940Yves Lafon (long-time member of the editor team),
3941Zed A. Shaw, and
3942Zhong Yu.
3943</t>
3944<?ENDINC acks ?>
3945<t>
3946   See <xref target="RFC2616" x:fmt="of" x:sec="16"/> for additional
3947   acknowledgements from prior revisions.
3948</t>
3949</section>
3950
3951</middle>
3952<back>
3953
3954<references title="Normative References">
3955
3956<reference anchor="Part2">
3957  <front>
3958    <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
3959    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
3960      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
3961      <address><email>fielding@gbiv.com</email></address>
3962    </author>
3963    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
3964      <organization abbrev="greenbytes">greenbytes GmbH</organization>
3965      <address><email>julian.reschke@greenbytes.de</email></address>
3966    </author>
3967    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
3968  </front>
3969  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;"/>
3970  <x:source href="p2-semantics.xml" basename="p2-semantics">
3971    <x:defines>1xx (Informational)</x:defines>
3972    <x:defines>1xx</x:defines>
3973    <x:defines>100 (Continue)</x:defines>
3974    <x:defines>101 (Switching Protocols)</x:defines>
3975    <x:defines>2xx (Successful)</x:defines>
3976    <x:defines>2xx</x:defines>
3977    <x:defines>200 (OK)</x:defines>
3978    <x:defines>204 (No Content)</x:defines>
3979    <x:defines>3xx (Redirection)</x:defines>
3980    <x:defines>3xx</x:defines>
3981    <x:defines>301 (Moved Permanently)</x:defines>
3982    <x:defines>4xx (Client Error)</x:defines>
3983    <x:defines>4xx</x:defines>
3984    <x:defines>400 (Bad Request)</x:defines>
3985    <x:defines>411 (Length Required)</x:defines>
3986    <x:defines>414 (URI Too Long)</x:defines>
3987    <x:defines>417 (Expectation Failed)</x:defines>
3988    <x:defines>426 (Upgrade Required)</x:defines>
3989    <x:defines>501 (Not Implemented)</x:defines>
3990    <x:defines>502 (Bad Gateway)</x:defines>
3991    <x:defines>505 (HTTP Version Not Supported)</x:defines>
3992    <x:defines>Allow</x:defines>
3993    <x:defines>Content-Encoding</x:defines>
3994    <x:defines>Content-Location</x:defines>
3995    <x:defines>Content-Type</x:defines>
3996    <x:defines>Date</x:defines>
3997    <x:defines>Expect</x:defines>
3998    <x:defines>Location</x:defines>
3999    <x:defines>Server</x:defines>
4000    <x:defines>User-Agent</x:defines>
4001  </x:source>
4002</reference>
4003
4004<reference anchor="Part4">
4005  <front>
4006    <title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
4007    <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
4008      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
4009      <address><email>fielding@gbiv.com</email></address>
4010    </author>
4011    <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
4012      <organization abbrev="greenbytes">greenbytes GmbH</organization>
4013      <address><email>julian.reschke@greenbytes.de</email></address>
4014    </author>
4015    <date month="&ID-MONTH;" year="&ID-YEAR;" />
4016  </front>
4017  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p4-conditional-&ID-VERSION;" />
4018  <x:source basename="p4-conditional" href="p4-conditional.xml">
4019    <x:defines>304 (Not Modified)</x:defines>
4020    <x:defines>ETag</x:defines>
4021    <x:defines>Last-Modified</x:defines>
4022  </x:source>
4023</reference>
4024
4025<reference anchor="Part5">
4026  <front>
4027    <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
4028    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
4029      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
4030      <address><email>fielding@gbiv.com</email></address>
4031    </author>
4032    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
4033      <organization abbrev="W3C">World Wide Web Consortium</organization>
4034      <address><email>ylafon@w3.org</email></address>
4035    </author>
4036    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
4037      <organization abbrev="greenbytes">greenbytes GmbH</organization>
4038      <address><email>julian.reschke@greenbytes.de</email></address>
4039    </author>
4040    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
4041  </front>
4042  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/>
4043  <x:source href="p5-range.xml" basename="p5-range">
4044    <x:defines>Content-Range</x:defines>
4045  </x:source>
4046</reference>
4047
4048<reference anchor="Part6">
4049  <front>
4050    <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
4051    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
4052      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
4053      <address><email>fielding@gbiv.com</email></address>
4054    </author>
4055    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
4056      <organization>Akamai</organization>
4057      <address><email>mnot@mnot.net</email></address>
4058    </author>
4059    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
4060      <organization abbrev="greenbytes">greenbytes GmbH</organization>
4061      <address><email>julian.reschke@greenbytes.de</email></address>
4062    </author>
4063    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
4064  </front>
4065  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
4066  <x:source href="p6-cache.xml" basename="p6-cache">
4067    <x:defines>Cache-Control</x:defines>
4068    <x:defines>Expires</x:defines>
4069  </x:source>
4070</reference>
4071
4072<reference anchor="Part7">
4073  <front>
4074    <title>Hypertext Transfer Protocol (HTTP/1.1): Authentication</title>
4075    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
4076      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
4077      <address><email>fielding@gbiv.com</email></address>
4078    </author>
4079    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
4080      <organization abbrev="greenbytes">greenbytes GmbH</organization>
4081      <address><email>julian.reschke@greenbytes.de</email></address>
4082    </author>
4083    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
4084  </front>
4085  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p7-auth-&ID-VERSION;"/>
4086  <x:source href="p7-auth.xml" basename="p7-auth">
4087    <x:defines>Proxy-Authenticate</x:defines>
4088    <x:defines>Proxy-Authorization</x:defines>
4089  </x:source>
4090</reference>
4091
4092<reference anchor="RFC5234">
4093  <front>
4094    <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
4095    <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
4096      <organization>Brandenburg InternetWorking</organization>
4097      <address>
4098        <email>dcrocker@bbiw.net</email>
4099      </address> 
4100    </author>
4101    <author initials="P." surname="Overell" fullname="Paul Overell">
4102      <organization>THUS plc.</organization>
4103      <address>
4104        <email>paul.overell@thus.net</email>
4105      </address>
4106    </author>
4107    <date month="January" year="2008"/>
4108  </front>
4109  <seriesInfo name="STD" value="68"/>
4110  <seriesInfo name="RFC" value="5234"/>
4111</reference>
4112
4113<reference anchor="RFC2119">
4114  <front>
4115    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
4116    <author initials="S." surname="Bradner" fullname="Scott Bradner">
4117      <organization>Harvard University</organization>
4118      <address><email>sob@harvard.edu</email></address>
4119    </author>
4120    <date month="March" year="1997"/>
4121  </front>
4122  <seriesInfo name="BCP" value="14"/>
4123  <seriesInfo name="RFC" value="2119"/>
4124</reference>
4125
4126<reference anchor="RFC3986">
4127 <front>
4128  <title abbrev='URI Generic Syntax'>Uniform Resource Identifier (URI): Generic Syntax</title>
4129  <author initials='T.' surname='Berners-Lee' fullname='Tim Berners-Lee'>
4130    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
4131    <address>
4132       <email>timbl@w3.org</email>
4133       <uri>http://www.w3.org/People/Berners-Lee/</uri>
4134    </address>
4135  </author>
4136  <author initials='R.' surname='Fielding' fullname='Roy T. Fielding'>
4137    <organization abbrev="Day Software">Day Software</organization>
4138    <address>
4139      <email>fielding@gbiv.com</email>
4140      <uri>http://roy.gbiv.com/</uri>
4141    </address>
4142  </author>
4143  <author initials='L.' surname='Masinter' fullname='Larry Masinter'>
4144    <organization abbrev="Adobe Systems">Adobe Systems Incorporated</organization>
4145    <address>
4146      <email>LMM@acm.org</email>
4147      <uri>http://larry.masinter.net/</uri>
4148    </address>
4149  </author>
4150  <date month='January' year='2005'></date>
4151 </front>
4152 <seriesInfo name="STD" value="66"/>
4153 <seriesInfo name="RFC" value="3986"/>
4154</reference>
4155
4156<reference anchor="USASCII">
4157  <front>
4158    <title>Coded Character Set -- 7-bit American Standard Code for Information Interchange</title>
4159    <author>
4160      <organization>American National Standards Institute</organization>
4161    </author>
4162    <date year="1986"/>
4163  </front>
4164  <seriesInfo name="ANSI" value="X3.4"/>
4165</reference>
4166
4167<reference anchor="RFC1950">
4168  <front>
4169    <title>ZLIB Compressed Data Format Specification version 3.3</title>
4170    <author initials="L.P." surname="Deutsch" fullname="L. Peter Deutsch">
4171      <organization>Aladdin Enterprises</organization>
4172      <address><email>ghost@aladdin.com</email></address>
4173    </author>
4174    <author initials="J-L." surname="Gailly" fullname="Jean-Loup Gailly"/>
4175    <date month="May" year="1996"/>
4176  </front>
4177  <seriesInfo name="RFC" value="1950"/>
4178  <!--<annotation>
4179    RFC 1950 is an Informational RFC, thus it might be less stable than
4180    this specification. On the other hand, this downward reference was
4181    present since the publication of <xref target="RFC2068" x:fmt="none">RFC 2068</xref> in 1997,
4182    therefore it is unlikely to cause problems in practice. See also
4183    <xref target="BCP97"/>.
4184  </annotation>-->
4185</reference>
4186
4187<reference anchor="RFC1951">
4188  <front>
4189    <title>DEFLATE Compressed Data Format Specification version 1.3</title>
4190    <author initials="P." surname="Deutsch" fullname="L. Peter Deutsch">
4191      <organization>Aladdin Enterprises</organization>
4192      <address><email>ghost@aladdin.com</email></address>
4193    </author>
4194    <date month="May" year="1996"/>
4195  </front>
4196  <seriesInfo name="RFC" value="1951"/>
4197  <!--<annotation>
4198    RFC 1951 is an Informational RFC, thus it might be less stable than
4199    this specification. On the other hand, this downward reference was
4200    present since the publication of <xref target="RFC2068" x:fmt="none">RFC 2068</xref> in 1997,
4201    therefore it is unlikely to cause problems in practice. See also
4202    <xref target="BCP97"/>.
4203  </annotation>-->
4204</reference>
4205
4206<reference anchor="RFC1952">
4207  <front>
4208    <title>GZIP file format specification version 4.3</title>
4209    <author initials="P." surname="Deutsch" fullname="L. Peter Deutsch">
4210      <organization>Aladdin Enterprises</organization>
4211      <address><email>ghost@aladdin.com</email></address>
4212    </author>
4213    <author initials="J-L." surname="Gailly" fullname="Jean-Loup Gailly">
4214      <address><email>gzip@prep.ai.mit.edu</email></address>
4215    </author>
4216    <author initials="M." surname="Adler" fullname="Mark Adler">
4217      <address><email>madler@alumni.caltech.edu</email></address>
4218    </author>
4219    <author initials="L.P." surname="Deutsch" fullname="L. Peter Deutsch">
4220      <address><email>ghost@aladdin.com</email></address>
4221    </author>
4222    <author initials="G." surname="Randers-Pehrson" fullname="Glenn Randers-Pehrson">
4223      <address><email>randeg@alumni.rpi.edu</email></address>
4224    </author>
4225    <date month="May" year="1996"/>
4226  </front>
4227  <seriesInfo name="RFC" value="1952"/>
4228  <!--<annotation>
4229    RFC 1952 is an Informational RFC, thus it might be less stable than
4230    this specification. On the other hand, this downward reference was
4231    present since the publication of <xref target="RFC2068" x:fmt="none">RFC 2068</xref> in 1997,
4232    therefore it is unlikely to cause problems in practice. See also
4233    <xref target="BCP97"/>.
4234  </annotation>-->
4235</reference>
4236
4237</references>
4238
4239<references title="Informative References">
4240
4241<reference anchor="ISO-8859-1">
4242  <front>
4243    <title>
4244     Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1
4245    </title>
4246    <author>
4247      <organization>International Organization for Standardization</organization>
4248    </author>
4249    <date year="1998"/>
4250  </front>
4251  <seriesInfo name="ISO/IEC" value="8859-1:1998"/>
4252</reference>
4253
4254<reference anchor='RFC1919'>
4255  <front>
4256    <title>Classical versus Transparent IP Proxies</title>
4257    <author initials='M.' surname='Chatel' fullname='Marc Chatel'>
4258      <address><email>mchatel@pax.eunet.ch</email></address>
4259    </author>
4260    <date year='1996' month='March' />
4261  </front>
4262  <seriesInfo name='RFC' value='1919' />
4263</reference>
4264
4265<reference anchor="RFC1945">
4266  <front>
4267    <title abbrev="HTTP/1.0">Hypertext Transfer Protocol -- HTTP/1.0</title>
4268    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
4269      <organization>MIT, Laboratory for Computer Science</organization>
4270      <address><email>timbl@w3.org</email></address>
4271    </author>
4272    <author initials="R.T." surname="Fielding" fullname="Roy T. Fielding">
4273      <organization>University of California, Irvine, Department of Information and Computer Science</organization>
4274      <address><email>fielding@ics.uci.edu</email></address>
4275    </author>
4276    <author initials="H.F." surname="Nielsen" fullname="Henrik Frystyk Nielsen">
4277      <organization>W3 Consortium, MIT Laboratory for Computer Science</organization>
4278      <address><email>frystyk@w3.org</email></address>
4279    </author>
4280    <date month="May" year="1996"/>
4281  </front>
4282  <seriesInfo name="RFC" value="1945"/>
4283</reference>
4284
4285<reference anchor="RFC2045">
4286  <front>
4287    <title abbrev="Internet Message Bodies">Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</title>
4288    <author initials="N." surname="Freed" fullname="Ned Freed">
4289      <organization>Innosoft International, Inc.</organization>
4290      <address><email>ned@innosoft.com</email></address>
4291    </author>
4292    <author initials="N.S." surname="Borenstein" fullname="Nathaniel S. Borenstein">
4293      <organization>First Virtual Holdings</organization>
4294      <address><email>nsb@nsb.fv.com</email></address>
4295    </author>
4296    <date month="November" year="1996"/>
4297  </front>
4298  <seriesInfo name="RFC" value="2045"/>
4299</reference>
4300
4301<reference anchor="RFC2047">
4302  <front>
4303    <title abbrev="Message Header Extensions">MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text</title>
4304    <author initials="K." surname="Moore" fullname="Keith Moore">
4305      <organization>University of Tennessee</organization>
4306      <address><email>moore@cs.utk.edu</email></address>
4307    </author>
4308    <date month="November" year="1996"/>
4309  </front>
4310  <seriesInfo name="RFC" value="2047"/>
4311</reference>
4312
4313<reference anchor="RFC2068">
4314  <front>
4315    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
4316    <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
4317      <organization>University of California, Irvine, Department of Information and Computer Science</organization>
4318      <address><email>fielding@ics.uci.edu</email></address>
4319    </author>
4320    <author initials="J." surname="Gettys" fullname="Jim Gettys">
4321      <organization>MIT Laboratory for Computer Science</organization>
4322      <address><email>jg@w3.org</email></address>
4323    </author>
4324    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
4325      <organization>Digital Equipment Corporation, Western Research Laboratory</organization>
4326      <address><email>mogul@wrl.dec.com</email></address>
4327    </author>
4328    <author initials="H." surname="Nielsen" fullname="Henrik Frystyk Nielsen">
4329      <organization>MIT Laboratory for Computer Science</organization>
4330      <address><email>frystyk@w3.org</email></address>
4331    </author>
4332    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
4333      <organization>MIT Laboratory for Computer Science</organization>
4334      <address><email>timbl@w3.org</email></address>
4335    </author>
4336    <date month="January" year="1997"/>
4337  </front>
4338  <seriesInfo name="RFC" value="2068"/>
4339</reference>
4340
4341<reference anchor="RFC2145">
4342  <front>
4343    <title abbrev="HTTP Version Numbers">Use and Interpretation of HTTP Version Numbers</title>
4344    <author initials="J.C." surname="Mogul" fullname="Jeffrey C. Mogul">
4345      <organization>Western Research Laboratory</organization>
4346      <address><email>mogul@wrl.dec.com</email></address>
4347    </author>
4348    <author initials="R.T." surname="Fielding" fullname="Roy T. Fielding">
4349      <organization>Department of Information and Computer Science</organization>
4350      <address><email>fielding@ics.uci.edu</email></address>
4351    </author>
4352    <author initials="J." surname="Gettys" fullname="Jim Gettys">
4353      <organization>MIT Laboratory for Computer Science</organization>
4354      <address><email>jg@w3.org</email></address>
4355    </author>
4356    <author initials="H.F." surname="Nielsen" fullname="Henrik Frystyk Nielsen">
4357      <organization>W3 Consortium</organization>
4358      <address><email>frystyk@w3.org</email></address>
4359    </author>
4360    <date month="May" year="1997"/>
4361  </front>
4362  <seriesInfo name="RFC" value="2145"/>
4363</reference>
4364
4365<reference anchor="RFC2616">
4366  <front>
4367    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
4368    <author initials="R." surname="Fielding" fullname="R. Fielding">
4369      <organization>University of California, Irvine</organization>
4370      <address><email>fielding@ics.uci.edu</email></address>
4371    </author>
4372    <author initials="J." surname="Gettys" fullname="J. Gettys">
4373      <organization>W3C</organization>
4374      <address><email>jg@w3.org</email></address>
4375    </author>
4376    <author initials="J." surname="Mogul" fullname="J. Mogul">
4377      <organization>Compaq Computer Corporation</organization>
4378      <address><email>mogul@wrl.dec.com</email></address>
4379    </author>
4380    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
4381      <organization>MIT Laboratory for Computer Science</organization>
4382      <address><email>frystyk@w3.org</email></address>
4383    </author>
4384    <author initials="L." surname="Masinter" fullname="L. Masinter">
4385      <organization>Xerox Corporation</organization>
4386      <address><email>masinter@parc.xerox.com</email></address>
4387    </author>
4388    <author initials="P." surname="Leach" fullname="P. Leach">
4389      <organization>Microsoft Corporation</organization>
4390      <address><email>paulle@microsoft.com</email></address>
4391    </author>
4392    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
4393      <organization>W3C</organization>
4394      <address><email>timbl@w3.org</email></address>
4395    </author>
4396    <date month="June" year="1999"/>
4397  </front>
4398  <seriesInfo name="RFC" value="2616"/>
4399</reference>
4400
4401<reference anchor='RFC2817'>
4402  <front>
4403    <title>Upgrading to TLS Within HTTP/1.1</title>
4404    <author initials='R.' surname='Khare' fullname='R. Khare'>
4405      <organization>4K Associates / UC Irvine</organization>
4406      <address><email>rohit@4K-associates.com</email></address>
4407    </author>
4408    <author initials='S.' surname='Lawrence' fullname='S. Lawrence'>
4409      <organization>Agranat Systems, Inc.</organization>
4410      <address><email>lawrence@agranat.com</email></address>
4411    </author>
4412    <date year='2000' month='May' />
4413  </front>
4414  <seriesInfo name='RFC' value='2817' />
4415</reference>
4416
4417<reference anchor='RFC2818'>
4418  <front>
4419    <title>HTTP Over TLS</title>
4420    <author initials='E.' surname='Rescorla' fullname='Eric Rescorla'>
4421      <organization>RTFM, Inc.</organization>
4422      <address><email>ekr@rtfm.com</email></address>
4423    </author>
4424    <date year='2000' month='May' />
4425  </front>
4426  <seriesInfo name='RFC' value='2818' />
4427</reference>
4428
4429<reference anchor='RFC3040'>
4430  <front>
4431    <title>Internet Web Replication and Caching Taxonomy</title>
4432    <author initials='I.' surname='Cooper' fullname='I. Cooper'>
4433      <organization>Equinix, Inc.</organization>
4434    </author>
4435    <author initials='I.' surname='Melve' fullname='I. Melve'>
4436      <organization>UNINETT</organization>
4437    </author>
4438    <author initials='G.' surname='Tomlinson' fullname='G. Tomlinson'>
4439      <organization>CacheFlow Inc.</organization>
4440    </author>
4441    <date year='2001' month='January' />
4442  </front>
4443  <seriesInfo name='RFC' value='3040' />
4444</reference>
4445
4446<reference anchor='BCP90'>
4447  <front>
4448    <title>Registration Procedures for Message Header Fields</title>
4449    <author initials='G.' surname='Klyne' fullname='G. Klyne'>
4450      <organization>Nine by Nine</organization>
4451      <address><email>GK-IETF@ninebynine.org</email></address>
4452    </author>
4453    <author initials='M.' surname='Nottingham' fullname='M. Nottingham'>
4454      <organization>BEA Systems</organization>
4455      <address><email>mnot@pobox.com</email></address>
4456    </author>
4457    <author initials='J.' surname='Mogul' fullname='J. Mogul'>
4458      <organization>HP Labs</organization>
4459      <address><email>JeffMogul@acm.org</email></address>
4460    </author>
4461    <date year='2004' month='September' />
4462  </front>
4463  <seriesInfo name='BCP' value='90' />
4464  <seriesInfo name='RFC' value='3864' />
4465</reference>
4466
4467<reference anchor='RFC4033'>
4468  <front>
4469    <title>DNS Security Introduction and Requirements</title>
4470    <author initials='R.' surname='Arends' fullname='R. Arends'/>
4471    <author initials='R.' surname='Austein' fullname='R. Austein'/>
4472    <author initials='M.' surname='Larson' fullname='M. Larson'/>
4473    <author initials='D.' surname='Massey' fullname='D. Massey'/>
4474    <author initials='S.' surname='Rose' fullname='S. Rose'/>
4475    <date year='2005' month='March' />
4476  </front>
4477  <seriesInfo name='RFC' value='4033' />
4478</reference>
4479
4480<reference anchor="BCP13">
4481  <front>
4482    <title>Media Type Specifications and Registration Procedures</title>
4483    <author initials="N." surname="Freed" fullname="Ned Freed">
4484      <organization>Oracle</organization>
4485      <address>
4486        <email>ned+ietf@mrochek.com</email>
4487      </address>
4488    </author>
4489    <author initials="J." surname="Klensin" fullname="John C. Klensin">
4490      <address>
4491        <email>john+ietf@jck.com</email>
4492      </address>
4493    </author>
4494    <author initials="T." surname="Hansen" fullname="Tony Hansen">
4495      <organization>AT&amp;T Laboratories</organization>
4496      <address>
4497        <email>tony+mtsuffix@maillennium.att.com</email>
4498      </address>
4499    </author>
4500    <date year="2013" month="January"/>
4501  </front>
4502  <seriesInfo name="BCP" value="13"/>
4503  <seriesInfo name="RFC" value="6838"/>
4504</reference>
4505
4506<reference anchor='BCP115'>
4507  <front>
4508    <title>Guidelines and Registration Procedures for New URI Schemes</title>
4509    <author initials='T.' surname='Hansen' fullname='T. Hansen'>
4510      <organization>AT&amp;T Laboratories</organization>
4511      <address>
4512        <email>tony+urireg@maillennium.att.com</email>
4513      </address>
4514    </author>
4515    <author initials='T.' surname='Hardie' fullname='T. Hardie'>
4516      <organization>Qualcomm, Inc.</organization>
4517      <address>
4518        <email>hardie@qualcomm.com</email>
4519      </address>
4520    </author>
4521    <author initials='L.' surname='Masinter' fullname='L. Masinter'>
4522      <organization>Adobe Systems</organization>
4523      <address>
4524        <email>LMM@acm.org</email>
4525      </address>
4526    </author>
4527    <date year='2006' month='February' />
4528  </front>
4529  <seriesInfo name='BCP' value='115' />
4530  <seriesInfo name='RFC' value='4395' />
4531</reference>
4532
4533<reference anchor='RFC4559'>
4534  <front>
4535    <title>SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows</title>
4536    <author initials='K.' surname='Jaganathan' fullname='K. Jaganathan'/>
4537    <author initials='L.' surname='Zhu' fullname='L. Zhu'/>
4538    <author initials='J.' surname='Brezak' fullname='J. Brezak'/>
4539    <date year='2006' month='June' />
4540  </front>
4541  <seriesInfo name='RFC' value='4559' />
4542</reference>
4543
4544<reference anchor='RFC5226'>
4545  <front>
4546    <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
4547    <author initials='T.' surname='Narten' fullname='T. Narten'>
4548      <organization>IBM</organization>
4549      <address><email>narten@us.ibm.com</email></address>
4550    </author>
4551    <author initials='H.' surname='Alvestrand' fullname='H. Alvestrand'>
4552      <organization>Google</organization>
4553      <address><email>Harald@Alvestrand.no</email></address>
4554    </author>
4555    <date year='2008' month='May' />
4556  </front>
4557  <seriesInfo name='BCP' value='26' />
4558  <seriesInfo name='RFC' value='5226' />
4559</reference>
4560
4561<reference anchor='RFC5246'>
4562   <front>
4563      <title>The Transport Layer Security (TLS) Protocol Version 1.2</title>
4564      <author initials='T.' surname='Dierks' fullname='T. Dierks'>
4565         <organization />
4566      </author>
4567      <author initials='E.' surname='Rescorla' fullname='E. Rescorla'>
4568         <organization>RTFM, Inc.</organization>
4569      </author>
4570      <date year='2008' month='August' />
4571   </front>
4572   <seriesInfo name='RFC' value='5246' />
4573</reference>
4574
4575<reference anchor="RFC5322">
4576  <front>
4577    <title>Internet Message Format</title>
4578    <author initials="P." surname="Resnick" fullname="P. Resnick">
4579      <organization>Qualcomm Incorporated</organization>
4580    </author>
4581    <date year="2008" month="October"/>
4582  </front>
4583  <seriesInfo name="RFC" value="5322"/>
4584</reference>
4585
4586<reference anchor="RFC6265">
4587  <front>
4588    <title>HTTP State Management Mechanism</title>
4589    <author initials="A." surname="Barth" fullname="Adam Barth">
4590      <organization abbrev="U.C. Berkeley">
4591        University of California, Berkeley
4592      </organization>
4593      <address><email>abarth@eecs.berkeley.edu</email></address>
4594    </author>
4595    <date year="2011" month="April" />
4596  </front>
4597  <seriesInfo name="RFC" value="6265"/>
4598</reference>
4599
4600<!--<reference anchor='BCP97'>
4601  <front>
4602    <title>Handling Normative References to Standards-Track Documents</title>
4603    <author initials='J.' surname='Klensin' fullname='J. Klensin'>
4604      <address>
4605        <email>klensin+ietf@jck.com</email>
4606      </address>
4607    </author>
4608    <author initials='S.' surname='Hartman' fullname='S. Hartman'>
4609      <organization>MIT</organization>
4610      <address>
4611        <email>hartmans-ietf@mit.edu</email>
4612      </address>
4613    </author>
4614    <date year='2007' month='June' />
4615  </front>
4616  <seriesInfo name='BCP' value='97' />
4617  <seriesInfo name='RFC' value='4897' />
4618</reference>-->
4619
4620<reference anchor="Kri2001" target="http://arxiv.org/abs/cs.SE/0105018">
4621  <front>
4622    <title>HTTP Cookies: Standards, Privacy, and Politics</title>
4623    <author initials="D." surname="Kristol" fullname="David M. Kristol"/>
4624    <date year="2001" month="November"/>
4625  </front>
4626  <seriesInfo name="ACM Transactions on Internet Technology" value="Vol. 1, #2"/>
4627</reference>
4628
4629</references>
4630
4631
4632<section title="HTTP Version History" anchor="compatibility">
4633<t>
4634   HTTP has been in use by the World-Wide Web global information initiative
4635   since 1990. The first version of HTTP, later referred to as HTTP/0.9,
4636   was a simple protocol for hypertext data transfer across the Internet
4637   with only a single request method (GET) and no metadata.
4638   HTTP/1.0, as defined by <xref target="RFC1945"/>, added a range of request
4639   methods and MIME-like messaging that could include metadata about the data
4640   transferred and modifiers on the request/response semantics. However,
4641   HTTP/1.0 did not sufficiently take into consideration the effects of
4642   hierarchical proxies, caching, the need for persistent connections, or
4643   name-based virtual hosts. The proliferation of incompletely-implemented
4644   applications calling themselves "HTTP/1.0" further necessitated a
4645   protocol version change in order for two communicating applications
4646   to determine each other's true capabilities.
4647</t>
4648<t>
4649   HTTP/1.1 remains compatible with HTTP/1.0 by including more stringent
4650   requirements that enable reliable implementations, adding only
4651   those new features that will either be safely ignored by an HTTP/1.0
4652   recipient or only sent when communicating with a party advertising
4653   conformance with HTTP/1.1.
4654</t>
4655<t>
4656   It is beyond the scope of a protocol specification to mandate
4657   conformance with previous versions. HTTP/1.1 was deliberately
4658   designed, however, to make supporting previous versions easy.
4659   We would expect a general-purpose HTTP/1.1 server to understand
4660   any valid request in the format of HTTP/1.0 and respond appropriately
4661   with an HTTP/1.1 message that only uses features understood (or
4662   safely ignored) by HTTP/1.0 clients.  Likewise, we would expect
4663   an HTTP/1.1 client to understand any valid HTTP/1.0 response.
4664</t>
4665<t>
4666   Since HTTP/0.9 did not support header fields in a request,
4667   there is no mechanism for it to support name-based virtual
4668   hosts (selection of resource by inspection of the <x:ref>Host</x:ref> header
4669   field).  Any server that implements name-based virtual hosts
4670   ought to disable support for HTTP/0.9.  Most requests that
4671   appear to be HTTP/0.9 are, in fact, badly constructed HTTP/1.x
4672   requests wherein a buggy client failed to properly encode
4673   linear whitespace found in a URI reference and placed in
4674   the request-target.
4675</t>
4676
4677<section title="Changes from HTTP/1.0" anchor="changes.from.1.0">
4678<t>
4679   This section summarizes major differences between versions HTTP/1.0
4680   and HTTP/1.1.
4681</t>
4682
4683<section title="Multi-homed Web Servers" anchor="changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses">
4684<t>
4685   The requirements that clients and servers support the <x:ref>Host</x:ref>
4686   header field (<xref target="header.host"/>), report an error if it is
4687   missing from an HTTP/1.1 request, and accept absolute URIs (<xref target="request-target"/>)
4688   are among the most important changes defined by HTTP/1.1.
4689</t>
4690<t>
4691   Older HTTP/1.0 clients assumed a one-to-one relationship of IP
4692   addresses and servers; there was no other established mechanism for
4693   distinguishing the intended server of a request than the IP address
4694   to which that request was directed. The <x:ref>Host</x:ref> header field was
4695   introduced during the development of HTTP/1.1 and, though it was
4696   quickly implemented by most HTTP/1.0 browsers, additional requirements
4697   were placed on all HTTP/1.1 requests in order to ensure complete
4698   adoption.  At the time of this writing, most HTTP-based services
4699   are dependent upon the Host header field for targeting requests.
4700</t>
4701</section>
4702
4703<section title="Keep-Alive Connections" anchor="compatibility.with.http.1.0.persistent.connections">
4704<t>
4705   In HTTP/1.0, each connection is established by the client prior to the
4706   request and closed by the server after sending the response. However, some
4707   implementations implement the explicitly negotiated ("Keep-Alive") version
4708   of persistent connections described in <xref x:sec="19.7.1" x:fmt="of"
4709   target="RFC2068"/>.
4710</t>
4711<t>
4712   Some clients and servers might wish to be compatible with these previous
4713   approaches to persistent connections, by explicitly negotiating for them
4714   with a "Connection: keep-alive" request header field. However, some
4715   experimental implementations of HTTP/1.0 persistent connections are faulty;
4716   for example, if an HTTP/1.0 proxy server doesn't understand
4717   <x:ref>Connection</x:ref>, it will erroneously forward that header field
4718   to the next inbound server, which would result in a hung connection.
4719</t>
4720<t>
4721   One attempted solution was the introduction of a Proxy-Connection header
4722   field, targeted specifically at proxies. In practice, this was also
4723   unworkable, because proxies are often deployed in multiple layers, bringing
4724   about the same problem discussed above.
4725</t>
4726<t>
4727   As a result, clients are encouraged not to send the Proxy-Connection header
4728   field in any requests.
4729</t>
4730<t>
4731   Clients are also encouraged to consider the use of Connection: keep-alive
4732   in requests carefully; while they can enable persistent connections with
4733   HTTP/1.0 servers, clients using them need will need to monitor the
4734   connection for "hung" requests (which indicate that the client ought stop
4735   sending the header field), and this mechanism ought not be used by clients
4736   at all when a proxy is being used.
4737</t>
4738</section>
4739
4740<section title="Introduction of Transfer-Encoding" anchor="introduction.of.transfer-encoding">
4741<t>
4742   HTTP/1.1 introduces the <x:ref>Transfer-Encoding</x:ref> header field
4743   (<xref target="header.transfer-encoding"/>).
4744   Transfer codings need to be decoded prior to forwarding an HTTP message
4745   over a MIME-compliant protocol.
4746</t>
4747</section>
4748
4749</section>
4750
4751<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
4752<t>
4753  HTTP's approach to error handling has been explained.
4754  (<xref target="conformance"/>)
4755</t>
4756<t>
4757  The expectation to support HTTP/0.9 requests has been removed.
4758</t>
4759<t>
4760  The term "Effective Request URI" has been introduced.
4761  (<xref target="effective.request.uri" />)
4762</t>
4763<t>
4764  HTTP messages can be (and often are) buffered by implementations; despite
4765  it sometimes being available as a stream, HTTP is fundamentally a
4766  message-oriented protocol.
4767  (<xref target="http.message" />)
4768</t>
4769<t>
4770  Minimum supported sizes for various protocol elements have been
4771  suggested, to improve interoperability.
4772</t>
4773<t>
4774  Header fields that span multiple lines ("line folding") are deprecated.
4775  (<xref target="field.parsing" />)
4776</t>
4777<t>
4778  The HTTP-version ABNF production has been clarified to be case-sensitive.
4779  Additionally, version numbers has been restricted to single digits, due
4780  to the fact that implementations are known to handle multi-digit version
4781  numbers incorrectly.
4782  (<xref target="http.version"/>)
4783</t>
4784<t>
4785  The HTTPS URI scheme is now defined by this specification; previously,
4786  it was done in  <xref target="RFC2818" x:fmt="of" x:sec="2.4"/>.
4787  (<xref target="https.uri"/>)
4788</t>
4789<t>
4790  The HTTPS URI scheme implies end-to-end security.
4791  (<xref target="https.uri"/>)
4792</t>
4793<t>
4794  Userinfo (i.e., username and password) are now disallowed in HTTP and
4795  HTTPS URIs, because of security issues related to their transmission on the
4796  wire.
4797  (<xref target="http.uri" />)
4798</t>
4799<t>
4800  Invalid whitespace around field-names is now required to be rejected,
4801  because accepting it represents a security vulnerability.
4802  (<xref target="header.fields"/>)
4803</t>
4804<t>
4805  The ABNF productions defining header fields now only list the field value.
4806  (<xref target="header.fields"/>)
4807</t>
4808<t>
4809  Rules about implicit linear whitespace between certain grammar productions
4810  have been removed; now whitespace is only allowed where specifically
4811  defined in the ABNF.
4812  (<xref target="whitespace"/>)
4813</t>
4814<t> 
4815  The NUL octet is no longer allowed in comment and quoted-string text, and
4816  handling of backslash-escaping in them has been clarified.
4817  (<xref target="field.components"/>)
4818</t> 
4819<t>
4820  The quoted-pair rule no longer allows escaping control characters other than
4821  HTAB.
4822  (<xref target="field.components"/>)
4823</t>
4824<t>
4825  Non-ASCII content in header fields and the reason phrase has been obsoleted
4826  and made opaque (the TEXT rule was removed).
4827  (<xref target="field.components"/>)
4828</t>
4829<t>
4830  Bogus "<x:ref>Content-Length</x:ref>" header fields are now required to be
4831  handled as errors by recipients.
4832  (<xref target="header.content-length"/>)
4833</t>
4834<t>
4835  The "identity" transfer coding token has been removed.
4836  (Sections <xref format="counter" target="message.body"/> and
4837  <xref format="counter" target="transfer.codings"/>)
4838</t>
4839<t>
4840  The algorithm for determining the message body length has been clarified
4841  to indicate all of the special cases (e.g., driven by methods or status
4842  codes) that affect it, and that new protocol elements cannot define such
4843  special cases.
4844  (<xref target="message.body.length"/>)
4845</t>
4846<t>
4847  "multipart/byteranges" is no longer a way of determining message body length
4848  detection.
4849  (<xref target="message.body.length"/>)
4850</t>
4851<t>
4852  CONNECT is a new, special case in determining message body length.
4853  (<xref target="message.body.length"/>)
4854</t>
4855<t>
4856  Chunk length does not include the count of the octets in the
4857  chunk header and trailer.
4858  (<xref target="chunked.encoding"/>)
4859</t>
4860<t>
4861  Use of chunk extensions is deprecated, and line folding in them is
4862  disallowed.
4863  (<xref target="chunked.encoding"/>)
4864</t>
4865<t>
4866  The segment + query components of RFC3986 have been used to define the
4867  request-target, instead of abs_path from RFC 1808.
4868  (<xref target="request-target"/>)
4869</t>
4870<t>
4871  The asterisk form of the request-target is only allowed in the OPTIONS
4872  method.
4873  (<xref target="request-target"/>)
4874</t>
4875<t>
4876  Exactly when "close" connection options have to be sent has been clarified.
4877  (<xref target="header.connection"/>)
4878</t>
4879<t> 
4880  "hop-by-hop" header fields are required to appear in the Connection header
4881  field; just because they're defined as hop-by-hop in this specification
4882  doesn't exempt them.
4883  (<xref target="header.connection"/>)
4884</t>
4885<t>
4886  The limit of two connections per server has been removed.
4887  (<xref target="persistent.connections"/>)
4888</t>
4889<t>
4890  An idempotent sequence of requests is no longer required to be retried.
4891  (<xref target="persistent.connections"/>)
4892</t>
4893<t>
4894  The requirement to retry requests under certain circumstances when the
4895  server prematurely closes the connection has been removed.
4896  (<xref target="persistent.connections"/>)
4897</t>
4898<t>
4899  Some extraneous requirements about when servers are allowed to close
4900  connections prematurely have been removed.
4901  (<xref target="persistent.connections"/>)
4902</t>
4903<t>
4904  The semantics of the <x:ref>Upgrade</x:ref> header field is now defined in
4905  responses other than 101 (this was incorporated from <xref
4906  target="RFC2817"/>).
4907  (<xref target="header.upgrade"/>)
4908</t>
4909<t>
4910  Registration of Transfer Codings now requires IETF Review
4911  (<xref target="transfer.coding.registry"/>)
4912</t>
4913<t>
4914  The meaning of the "deflate" content coding has been clarified.
4915  (<xref target="deflate.coding" />)
4916</t>
4917<t>
4918  This specification now defines the Upgrade Token Registry, previously
4919  defined in <xref target="RFC2817" x:fmt="of" x:sec="7.2"/>.
4920  (<xref target="upgrade.token.registry"/>)
4921</t>
4922<t>
4923  Empty list elements in list productions (e.g., a list header containing
4924  ", ,") have been deprecated.
4925  (<xref target="abnf.extension"/>)
4926</t>
4927<t>
4928  Issues with the Keep-Alive and Proxy-Connection headers in requests
4929  are pointed out, with use of the latter being discouraged altogether.
4930  (<xref target="compatibility.with.http.1.0.persistent.connections" />)
4931</t>
4932</section>
4933</section>
4934
4935<section title="ABNF list extension: #rule" anchor="abnf.extension">
4936<t>
4937  A #rule extension to the ABNF rules of <xref target="RFC5234"/> is used to
4938  improve readability in the definitions of some header field values.
4939</t>
4940<t>
4941  A construct "#" is defined, similar to "*", for defining comma-delimited
4942  lists of elements. The full form is "&lt;n&gt;#&lt;m&gt;element" indicating
4943  at least &lt;n&gt; and at most &lt;m&gt; elements, each separated by a single
4944  comma (",") and optional whitespace (OWS).   
4945</t>
4946<figure><preamble>
4947  Thus,
4948</preamble><artwork type="example">
4949  1#element =&gt; element *( OWS "," OWS element )
4950</artwork></figure>
4951<figure><preamble>
4952  and:
4953</preamble><artwork type="example">
4954  #element =&gt; [ 1#element ]
4955</artwork></figure>
4956<figure><preamble>
4957  and for n &gt;= 1 and m &gt; 1:
4958</preamble><artwork type="example">
4959  &lt;n&gt;#&lt;m&gt;element =&gt; element &lt;n-1&gt;*&lt;m-1&gt;( OWS "," OWS element )
4960</artwork></figure>
4961<t>
4962  For compatibility with legacy list rules, recipients &SHOULD; accept empty
4963  list elements. In other words, consumers would follow the list productions:
4964</t>
4965<figure><artwork type="example">
4966  #element =&gt; [ ( "," / element ) *( OWS "," [ OWS element ] ) ]
4967 
4968  1#element =&gt; *( "," OWS ) element *( OWS "," [ OWS element ] )
4969</artwork></figure>
4970<t>
4971  Note that empty elements do not contribute to the count of elements present,
4972  though.
4973</t>
4974<t>
4975  For example, given these ABNF productions:
4976</t>
4977<figure><artwork type="example">
4978  example-list      = 1#example-list-elmt
4979  example-list-elmt = token ; see <xref target="field.components"/>
4980</artwork></figure>
4981<t>
4982  Then these are valid values for example-list (not including the double
4983  quotes, which are present for delimitation only):
4984</t>
4985<figure><artwork type="example">
4986  "foo,bar"
4987  "foo ,bar,"
4988  "foo , ,bar,charlie   "
4989</artwork></figure>
4990<t>
4991  But these values would be invalid, as at least one non-empty element is
4992  required:
4993</t>
4994<figure><artwork type="example">
4995  ""
4996  ","
4997  ",   ,"
4998</artwork></figure>
4999<t>
5000  <xref target="collected.abnf"/> shows the collected ABNF, with the list rules
5001  expanded as explained above.
5002</t>
5003</section>
5004
5005<?BEGININC p1-messaging.abnf-appendix ?>
5006<section xmlns:x="http://purl.org/net/xml2rfc/ext" title="Collected ABNF" anchor="collected.abnf">
5007<figure>
5008<artwork type="abnf" name="p1-messaging.parsed-abnf">
5009<x:ref>BWS</x:ref> = OWS
5010
5011<x:ref>Connection</x:ref> = *( "," OWS ) connection-option *( OWS "," [ OWS
5012 connection-option ] )
5013<x:ref>Content-Length</x:ref> = 1*DIGIT
5014
5015<x:ref>HTTP-message</x:ref> = start-line *( header-field CRLF ) CRLF [ message-body
5016 ]
5017<x:ref>HTTP-name</x:ref> = %x48.54.54.50 ; HTTP
5018<x:ref>HTTP-version</x:ref> = HTTP-name "/" DIGIT "." DIGIT
5019<x:ref>Host</x:ref> = uri-host [ ":" port ]
5020
5021<x:ref>OWS</x:ref> = *( SP / HTAB )
5022
5023<x:ref>RWS</x:ref> = 1*( SP / HTAB )
5024
5025<x:ref>TE</x:ref> = [ ( "," / t-codings ) *( OWS "," [ OWS t-codings ] ) ]
5026<x:ref>Trailer</x:ref> = *( "," OWS ) field-name *( OWS "," [ OWS field-name ] )
5027<x:ref>Transfer-Encoding</x:ref> = *( "," OWS ) transfer-coding *( OWS "," [ OWS
5028 transfer-coding ] )
5029
5030<x:ref>URI-reference</x:ref> = &lt;URI-reference, defined in [RFC3986], Section 4.1&gt;
5031<x:ref>Upgrade</x:ref> = *( "," OWS ) protocol *( OWS "," [ OWS protocol ] )
5032
5033<x:ref>Via</x:ref> = *( "," OWS ) ( received-protocol RWS received-by [ RWS comment
5034 ] ) *( OWS "," [ OWS ( received-protocol RWS received-by [ RWS
5035 comment ] ) ] )
5036
5037<x:ref>absolute-URI</x:ref> = &lt;absolute-URI, defined in [RFC3986], Section 4.3&gt;
5038<x:ref>absolute-form</x:ref> = absolute-URI
5039<x:ref>absolute-path</x:ref> = 1*( "/" segment )
5040<x:ref>asterisk-form</x:ref> = "*"
5041<x:ref>attribute</x:ref> = token
5042<x:ref>authority</x:ref> = &lt;authority, defined in [RFC3986], Section 3.2&gt;
5043<x:ref>authority-form</x:ref> = authority
5044
5045<x:ref>chunk</x:ref> = chunk-size [ chunk-ext ] CRLF chunk-data CRLF
5046<x:ref>chunk-data</x:ref> = 1*OCTET
5047<x:ref>chunk-ext</x:ref> = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
5048<x:ref>chunk-ext-name</x:ref> = token
5049<x:ref>chunk-ext-val</x:ref> = token / quoted-str-nf
5050<x:ref>chunk-size</x:ref> = 1*HEXDIG
5051<x:ref>chunked-body</x:ref> = *chunk last-chunk trailer-part CRLF
5052<x:ref>comment</x:ref> = "(" *( ctext / quoted-cpair / comment ) ")"
5053<x:ref>connection-option</x:ref> = token
5054<x:ref>ctext</x:ref> = HTAB / SP / %x21-27 ; '!'-'''
5055 / %x2A-5B ; '*'-'['
5056 / %x5D-7E ; ']'-'~'
5057 / obs-text
5058
5059<x:ref>field-content</x:ref> = *( HTAB / SP / VCHAR / obs-text )
5060<x:ref>field-name</x:ref> = token
5061<x:ref>field-value</x:ref> = *( field-content / obs-fold )
5062
5063<x:ref>header-field</x:ref> = field-name ":" OWS field-value BWS
5064<x:ref>http-URI</x:ref> = "http://" authority path-abempty [ "?" query ]
5065<x:ref>https-URI</x:ref> = "https://" authority path-abempty [ "?" query ]
5066
5067<x:ref>last-chunk</x:ref> = 1*"0" [ chunk-ext ] CRLF
5068
5069<x:ref>message-body</x:ref> = *OCTET
5070<x:ref>method</x:ref> = token
5071
5072<x:ref>obs-fold</x:ref> = CRLF ( SP / HTAB )
5073<x:ref>obs-text</x:ref> = %x80-FF
5074<x:ref>origin-form</x:ref> = absolute-path [ "?" query ]
5075
5076<x:ref>partial-URI</x:ref> = relative-part [ "?" query ]
5077<x:ref>path-abempty</x:ref> = &lt;path-abempty, defined in [RFC3986], Section 3.3&gt;
5078<x:ref>port</x:ref> = &lt;port, defined in [RFC3986], Section 3.2.3&gt;
5079<x:ref>protocol</x:ref> = protocol-name [ "/" protocol-version ]
5080<x:ref>protocol-name</x:ref> = token
5081<x:ref>protocol-version</x:ref> = token
5082<x:ref>pseudonym</x:ref> = token
5083
5084<x:ref>qdtext</x:ref> = HTAB / SP / "!" / %x23-5B ; '#'-'['
5085 / %x5D-7E ; ']'-'~'
5086 / obs-text
5087<x:ref>qdtext-nf</x:ref> = HTAB / SP / "!" / %x23-5B ; '#'-'['
5088 / %x5D-7E ; ']'-'~'
5089 / obs-text
5090<x:ref>query</x:ref> = &lt;query, defined in [RFC3986], Section 3.4&gt;
5091<x:ref>quoted-cpair</x:ref> = "\" ( HTAB / SP / VCHAR / obs-text )
5092<x:ref>quoted-pair</x:ref> = "\" ( HTAB / SP / VCHAR / obs-text )
5093<x:ref>quoted-str-nf</x:ref> = DQUOTE *( qdtext-nf / quoted-pair ) DQUOTE
5094<x:ref>quoted-string</x:ref> = DQUOTE *( qdtext / quoted-pair ) DQUOTE
5095
5096<x:ref>rank</x:ref> = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] )
5097<x:ref>reason-phrase</x:ref> = *( HTAB / SP / VCHAR / obs-text )
5098<x:ref>received-by</x:ref> = ( uri-host [ ":" port ] ) / pseudonym
5099<x:ref>received-protocol</x:ref> = [ protocol-name "/" ] protocol-version
5100<x:ref>relative-part</x:ref> = &lt;relative-part, defined in [RFC3986], Section 4.2&gt;
5101<x:ref>request-line</x:ref> = method SP request-target SP HTTP-version CRLF
5102<x:ref>request-target</x:ref> = origin-form / absolute-form / authority-form /
5103 asterisk-form
5104
5105<x:ref>segment</x:ref> = &lt;segment, defined in [RFC3986], Section 3.3&gt;
5106<x:ref>special</x:ref> = "(" / ")" / "&lt;" / "&gt;" / "@" / "," / ";" / ":" / "\" /
5107 DQUOTE / "/" / "[" / "]" / "?" / "=" / "{" / "}"
5108<x:ref>start-line</x:ref> = request-line / status-line
5109<x:ref>status-code</x:ref> = 3DIGIT
5110<x:ref>status-line</x:ref> = HTTP-version SP status-code SP reason-phrase CRLF
5111
5112<x:ref>t-codings</x:ref> = "trailers" / ( transfer-coding [ t-ranking ] )
5113<x:ref>t-ranking</x:ref> = OWS ";" OWS "q=" rank
5114<x:ref>tchar</x:ref> = "!" / "#" / "$" / "%" / "&amp;" / "'" / "*" / "+" / "-" / "." /
5115 "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
5116<x:ref>token</x:ref> = 1*tchar
5117<x:ref>trailer-part</x:ref> = *( header-field CRLF )
5118<x:ref>transfer-coding</x:ref> = "chunked" / "compress" / "deflate" / "gzip" /
5119 transfer-extension
5120<x:ref>transfer-extension</x:ref> = token *( OWS ";" OWS transfer-parameter )
5121<x:ref>transfer-parameter</x:ref> = attribute BWS "=" BWS value
5122
5123<x:ref>uri-host</x:ref> = &lt;host, defined in [RFC3986], Section 3.2.2&gt;
5124
5125<x:ref>value</x:ref> = word
5126
5127<x:ref>word</x:ref> = token / quoted-string
5128</artwork>
5129</figure>
5130</section>
5131<?ENDINC p1-messaging.abnf-appendix ?>
5132
5133<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
5134
5135<section title="Since RFC 2616">
5136<t>
5137  Changes up to the first Working Group Last Call draft are summarized
5138  in <eref target="http://trac.tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-21#appendix-D"/>.
5139</t>
5140</section>
5141
5142<section title="Since draft-ietf-httpbis-p1-messaging-21" anchor="changes.since.21">
5143<t>
5144  Closed issues:
5145  <list style="symbols">
5146    <t>
5147      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/128"/>:
5148      "Cite HTTPS URI scheme definition" (the spec now includes the HTTPs
5149      scheme definition and thus updates RFC 2818)
5150    </t>
5151    <t>
5152      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/389"/>:
5153      "mention of 'proxies' in section about caches"
5154    </t>
5155    <t>
5156      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/390"/>:
5157      "use of ABNF terms from RFC 3986"
5158    </t>
5159    <t>
5160      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/392"/>:
5161      "editorial improvements to message length definition"
5162    </t>
5163    <t>
5164      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/395"/>:
5165      "Connection header field MUST vs SHOULD"
5166    </t>
5167    <t>
5168      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/396"/>:
5169      "editorial improvements to persistent connections section"
5170    </t>
5171    <t>
5172      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/397"/>:
5173      "URI normalization vs empty path"
5174    </t>
5175    <t>
5176      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/408"/>:
5177      "p1 feedback"
5178    </t>
5179    <t>
5180      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/409"/>:
5181      "is parsing OBS-FOLD mandatory?"
5182    </t>
5183    <t>
5184      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/410"/>:
5185      "HTTPS and Shared Caching"
5186    </t>
5187    <t>
5188      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/411"/>:
5189      "Requirements for recipients of ws between start-line and first header field"
5190    </t>
5191    <t>
5192      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/412"/>:
5193      "SP and HT when being tolerant"
5194    </t>
5195    <t>
5196      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/414"/>:
5197      "Message Parsing Strictness"
5198    </t>
5199    <t>
5200      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/415"/>:
5201      "'Render'"
5202    </t>
5203    <t>
5204      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/418"/>:
5205      "No-Transform"
5206    </t>
5207    <t>
5208      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/419"/>:
5209      "p2 editorial feedback"
5210    </t>
5211    <t>
5212      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/420"/>:
5213      "Content-Length SHOULD be sent"
5214    </t>
5215    <t>
5216      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/431"/>:
5217      "origin-form does not allow path starting with "//""
5218    </t>
5219    <t>
5220      <eref target="http://tools.ietf.org/wg/httpbis/trac/ticket/433"/>:
5221      "ambiguity in part 1 example"
5222    </t>
5223  </list>
5224</t>
5225</section>
5226
5227<section title="Since draft-ietf-httpbis-p1-messaging-22" anchor="changes.since.22">
5228<t>
5229  None yet.
5230</t>
5231</section>
5232</section>
5233
5234</back>
5235</rfc>
Note: See TracBrowser for help on using the repository browser.