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

Last change on this file since 2257 was 2257, checked in by fielding@…, 7 years ago

(editorial) #441: clarify handling of whitspace in request-line; clarify how a server initiates a close and remove the Apache-ism of "lingering close" that might be confused with SO_LINGER; fix the pseudo-code example explaining chunk parsing

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