source: draft-ietf-httpbis/latest/auth48/rfc7230-to-be.xml @ 2653

Last change on this file since 2653 was 2631, checked in by julian.reschke@…, 6 years ago

add subproject for auth48 checks (#553)

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