idnits 2.17.1 draft-ietf-httpbis-messaging-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document obsoletes RFC7230, but the abstract doesn't seem to directly say this. It does mention RFC7230 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (July 8, 2019) is 1751 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC3986' is defined on line 2040, but no explicit reference was found in the text == Unused Reference: 'RFC7231' is defined on line 2123, but no explicit reference was found in the text == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-05 -- Possible downref: Normative reference to a draft: ref. 'Caching' ** Downref: Normative reference to an Informational RFC: RFC 1950 ** Downref: Normative reference to an Informational RFC: RFC 1951 ** Downref: Normative reference to an Informational RFC: RFC 1952 == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-semantics-05 -- Possible downref: Normative reference to a draft: ref. 'Semantics' -- Possible downref: Non-RFC (?) normative reference: ref. 'USASCII' -- Possible downref: Non-RFC (?) normative reference: ref. 'Welch' -- Obsolete informational reference (is this intentional?): RFC 7230 (ref. 'Err4667') (Obsoleted by RFC 9110, RFC 9112) -- Obsolete informational reference (is this intentional?): RFC 2068 (Obsoleted by RFC 2616) -- Duplicate reference: RFC7230, mentioned in 'RFC7230', was also mentioned in 'Err4667'. -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) Summary: 3 errors (**), 0 flaws (~~), 6 warnings (==), 11 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTP Working Group R. Fielding, Ed. 3 Internet-Draft Adobe 4 Obsoletes: 7230 (if approved) M. Nottingham, Ed. 5 Intended status: Standards Track Fastly 6 Expires: January 9, 2020 J. Reschke, Ed. 7 greenbytes 8 July 8, 2019 10 HTTP/1.1 Messaging 11 draft-ietf-httpbis-messaging-05 13 Abstract 15 The Hypertext Transfer Protocol (HTTP) is a stateless application- 16 level protocol for distributed, collaborative, hypertext information 17 systems. This document specifies the HTTP/1.1 message syntax, 18 message parsing, connection management, and related security 19 concerns. 21 This document obsoletes portions of RFC 7230. 23 Editorial Note 25 This note is to be removed before publishing as an RFC. 27 Discussion of this draft takes place on the HTTP working group 28 mailing list (ietf-http-wg@w3.org), which is archived at 29 . 31 Working Group information can be found at ; 32 source code and issues list for this draft can be found at 33 . 35 The changes in this draft are summarized in Appendix D.6. 37 Status of This Memo 39 This Internet-Draft is submitted in full conformance with the 40 provisions of BCP 78 and BCP 79. 42 Internet-Drafts are working documents of the Internet Engineering 43 Task Force (IETF). Note that other groups may also distribute 44 working documents as Internet-Drafts. The list of current Internet- 45 Drafts is at https://datatracker.ietf.org/drafts/current/. 47 Internet-Drafts are draft documents valid for a maximum of six months 48 and may be updated, replaced, or obsoleted by other documents at any 49 time. It is inappropriate to use Internet-Drafts as reference 50 material or to cite them other than as "work in progress." 52 This Internet-Draft will expire on January 9, 2020. 54 Copyright Notice 56 Copyright (c) 2019 IETF Trust and the persons identified as the 57 document authors. All rights reserved. 59 This document is subject to BCP 78 and the IETF Trust's Legal 60 Provisions Relating to IETF Documents 61 (https://trustee.ietf.org/license-info) in effect on the date of 62 publication of this document. Please review these documents 63 carefully, as they describe your rights and restrictions with respect 64 to this document. Code Components extracted from this document must 65 include Simplified BSD License text as described in Section 4.e of 66 the Trust Legal Provisions and are provided without warranty as 67 described in the Simplified BSD License. 69 This document may contain material from IETF Documents or IETF 70 Contributions published or made publicly available before November 71 10, 2008. The person(s) controlling the copyright in some of this 72 material may not have granted the IETF Trust the right to allow 73 modifications of such material outside the IETF Standards Process. 74 Without obtaining an adequate license from the person(s) controlling 75 the copyright in such materials, this document may not be modified 76 outside the IETF Standards Process, and derivative works of it may 77 not be created outside the IETF Standards Process, except to format 78 it for publication as an RFC or to translate it into languages other 79 than English. 81 Table of Contents 83 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 84 1.1. Requirements Notation . . . . . . . . . . . . . . . . . . 5 85 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 5 86 2. Message . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 87 2.1. Message Format . . . . . . . . . . . . . . . . . . . . . 6 88 2.2. HTTP Version . . . . . . . . . . . . . . . . . . . . . . 7 89 2.3. Message Parsing . . . . . . . . . . . . . . . . . . . . . 8 90 3. Request Line . . . . . . . . . . . . . . . . . . . . . . . . 9 91 3.1. Method . . . . . . . . . . . . . . . . . . . . . . . . . 9 92 3.2. Request Target . . . . . . . . . . . . . . . . . . . . . 10 93 3.2.1. origin-form . . . . . . . . . . . . . . . . . . . . . 10 94 3.2.2. absolute-form . . . . . . . . . . . . . . . . . . . . 11 95 3.2.3. authority-form . . . . . . . . . . . . . . . . . . . 11 96 3.2.4. asterisk-form . . . . . . . . . . . . . . . . . . . . 12 98 3.3. Effective Request URI . . . . . . . . . . . . . . . . . . 12 99 4. Status Line . . . . . . . . . . . . . . . . . . . . . . . . . 14 100 5. Header Fields . . . . . . . . . . . . . . . . . . . . . . . . 15 101 5.1. Header Field Parsing . . . . . . . . . . . . . . . . . . 15 102 5.2. Obsolete Line Folding . . . . . . . . . . . . . . . . . . 16 103 6. Message Body . . . . . . . . . . . . . . . . . . . . . . . . 17 104 6.1. Transfer-Encoding . . . . . . . . . . . . . . . . . . . . 17 105 6.2. Content-Length . . . . . . . . . . . . . . . . . . . . . 19 106 6.3. Message Body Length . . . . . . . . . . . . . . . . . . . 19 107 7. Transfer Codings . . . . . . . . . . . . . . . . . . . . . . 21 108 7.1. Chunked Transfer Coding . . . . . . . . . . . . . . . . . 22 109 7.1.1. Chunk Extensions . . . . . . . . . . . . . . . . . . 23 110 7.1.2. Chunked Trailer Part . . . . . . . . . . . . . . . . 24 111 7.1.3. Decoding Chunked . . . . . . . . . . . . . . . . . . 25 112 7.2. Transfer Codings for Compression . . . . . . . . . . . . 25 113 7.3. Transfer Coding Registry . . . . . . . . . . . . . . . . 26 114 7.4. TE . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 115 8. Handling Incomplete Messages . . . . . . . . . . . . . . . . 27 116 9. Connection Management . . . . . . . . . . . . . . . . . . . . 28 117 9.1. Connection . . . . . . . . . . . . . . . . . . . . . . . 29 118 9.2. Establishment . . . . . . . . . . . . . . . . . . . . . . 30 119 9.3. Associating a Response to a Request . . . . . . . . . . . 30 120 9.4. Persistence . . . . . . . . . . . . . . . . . . . . . . . 31 121 9.4.1. Retrying Requests . . . . . . . . . . . . . . . . . . 32 122 9.4.2. Pipelining . . . . . . . . . . . . . . . . . . . . . 32 123 9.5. Concurrency . . . . . . . . . . . . . . . . . . . . . . . 33 124 9.6. Failures and Timeouts . . . . . . . . . . . . . . . . . . 33 125 9.7. Tear-down . . . . . . . . . . . . . . . . . . . . . . . . 34 126 9.8. Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . 35 127 9.8.1. Upgrade Protocol Names . . . . . . . . . . . . . . . 37 128 9.8.2. Upgrade Token Registry . . . . . . . . . . . . . . . 38 129 10. Enclosing Messages as Data . . . . . . . . . . . . . . . . . 38 130 10.1. Media Type message/http . . . . . . . . . . . . . . . . 38 131 10.2. Media Type application/http . . . . . . . . . . . . . . 40 132 11. Security Considerations . . . . . . . . . . . . . . . . . . . 41 133 11.1. Response Splitting . . . . . . . . . . . . . . . . . . . 41 134 11.2. Request Smuggling . . . . . . . . . . . . . . . . . . . 42 135 11.3. Message Integrity . . . . . . . . . . . . . . . . . . . 42 136 11.4. Message Confidentiality . . . . . . . . . . . . . . . . 43 137 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 138 12.1. Header Field Registration . . . . . . . . . . . . . . . 43 139 12.2. Media Type Registration . . . . . . . . . . . . . . . . 43 140 12.3. Transfer Coding Registration . . . . . . . . . . . . . . 43 141 12.4. Upgrade Token Registration . . . . . . . . . . . . . . . 43 142 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 44 143 13.1. Normative References . . . . . . . . . . . . . . . . . . 44 144 13.2. Informative References . . . . . . . . . . . . . . . . . 45 145 Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 47 146 Appendix B. Differences between HTTP and MIME . . . . . . . . . 48 147 B.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . 49 148 B.2. Conversion to Canonical Form . . . . . . . . . . . . . . 49 149 B.3. Conversion of Date Formats . . . . . . . . . . . . . . . 49 150 B.4. Conversion of Content-Encoding . . . . . . . . . . . . . 50 151 B.5. Conversion of Content-Transfer-Encoding . . . . . . . . . 50 152 B.6. MHTML and Line Length Limitations . . . . . . . . . . . . 50 153 Appendix C. HTTP Version History . . . . . . . . . . . . . . . . 50 154 C.1. Changes from HTTP/1.0 . . . . . . . . . . . . . . . . . . 51 155 C.1.1. Multihomed Web Servers . . . . . . . . . . . . . . . 51 156 C.1.2. Keep-Alive Connections . . . . . . . . . . . . . . . 52 157 C.1.3. Introduction of Transfer-Encoding . . . . . . . . . . 52 158 C.2. Changes from RFC 7230 . . . . . . . . . . . . . . . . . . 52 159 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 53 160 D.1. Between RFC7230 and draft 00 . . . . . . . . . . . . . . 53 161 D.2. Since draft-ietf-httpbis-messaging-00 . . . . . . . . . . 53 162 D.3. Since draft-ietf-httpbis-messaging-01 . . . . . . . . . . 54 163 D.4. Since draft-ietf-httpbis-messaging-02 . . . . . . . . . . 54 164 D.5. Since draft-ietf-httpbis-messaging-03 . . . . . . . . . . 55 165 D.6. Since draft-ietf-httpbis-messaging-04 . . . . . . . . . . 55 166 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 167 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 57 168 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 57 170 1. Introduction 172 The Hypertext Transfer Protocol (HTTP) is a stateless application- 173 level request/response protocol that uses extensible semantics and 174 self-descriptive messages for flexible interaction with network-based 175 hypertext information systems. HTTP is defined by a series of 176 documents that collectively form the HTTP/1.1 specification: 178 o "HTTP Semantics" [Semantics] 180 o "HTTP Caching" [Caching] 182 o "HTTP/1.1 Messaging" (this document) 184 This document defines HTTP/1.1 message syntax and framing 185 requirements and their associated connection management. Our goal is 186 to define all of the mechanisms necessary for HTTP/1.1 message 187 handling that are independent of message semantics, thereby defining 188 the complete set of requirements for message parsers and message- 189 forwarding intermediaries. 191 This document obsoletes the portions of RFC 7230 related to HTTP/1.1 192 messaging and connection management, with the changes being 193 summarized in Appendix C.2. The other parts of RFC 7230 are 194 obsoleted by "HTTP Semantics" [Semantics]. 196 1.1. Requirements Notation 198 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 199 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 200 document are to be interpreted as described in [RFC2119]. 202 Conformance criteria and considerations regarding error handling are 203 defined in Section 3 of [Semantics]. 205 1.2. Syntax Notation 207 This specification uses the Augmented Backus-Naur Form (ABNF) 208 notation of [RFC5234], extended with the notation for case- 209 sensitivity in strings defined in [RFC7405]. 211 It also uses a list extension, defined in Section 11 of [Semantics], 212 that allows for compact definition of comma-separated lists using a 213 '#' operator (similar to how the '*' operator indicates repetition). 214 Appendix A shows the collected grammar with all list operators 215 expanded to standard ABNF notation. 217 As a convention, ABNF rule names prefixed with "obs-" denote 218 "obsolete" grammar rules that appear for historical reasons. 220 The following core rules are included by reference, as defined in 221 [RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF 222 (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), 223 HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line 224 feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR (any 225 visible [USASCII] character). 227 The rules below are defined in [Semantics]: 229 BWS = 230 OWS = 231 RWS = 232 absolute-URI = 233 absolute-path = 234 authority = 235 comment = 236 field-name = 237 field-value = 238 obs-text = 239 port = 240 query = 241 quoted-string = 242 token = 243 uri-host = 245 2. Message 247 2.1. Message Format 249 All HTTP/1.1 messages consist of a start-line followed by a sequence 250 of octets in a format similar to the Internet Message Format 251 [RFC5322]: zero or more header fields (collectively referred to as 252 the "headers" or the "header section"), an empty line indicating the 253 end of the header section, and an optional message body. 255 HTTP-message = start-line 256 *( header-field CRLF ) 257 CRLF 258 [ message-body ] 260 An HTTP message can be either a request from client to server or a 261 response from server to client. Syntactically, the two types of 262 message differ only in the start-line, which is either a request-line 263 (for requests) or a status-line (for responses), and in the algorithm 264 for determining the length of the message body (Section 6). 266 start-line = request-line / status-line 268 In theory, a client could receive requests and a server could receive 269 responses, distinguishing them by their different start-line formats. 270 In practice, servers are implemented to only expect a request (a 271 response is interpreted as an unknown or invalid request method) and 272 clients are implemented to only expect a response. 274 Although HTTP makes use of some protocol elements similar to the 275 Multipurpose Internet Mail Extensions (MIME) [RFC2045], see 276 Appendix B for the differences between HTTP and MIME messages. 278 2.2. HTTP Version 280 HTTP uses a "." numbering scheme to indicate versions 281 of the protocol. This specification defines version "1.1". 282 Section 3.5 of [Semantics] specifies the semantics of HTTP version 283 numbers. 285 The version of an HTTP/1.x message is indicated by an HTTP-version 286 field in the start-line. HTTP-version is case-sensitive. 288 HTTP-version = HTTP-name "/" DIGIT "." DIGIT 289 HTTP-name = %s"HTTP" 291 When an HTTP/1.1 message is sent to an HTTP/1.0 recipient [RFC1945] 292 or a recipient whose version is unknown, the HTTP/1.1 message is 293 constructed such that it can be interpreted as a valid HTTP/1.0 294 message if all of the newer features are ignored. This specification 295 places recipient-version requirements on some new features so that a 296 conformant sender will only use compatible features until it has 297 determined, through configuration or the receipt of a message, that 298 the recipient supports HTTP/1.1. 300 Intermediaries that process HTTP messages (i.e., all intermediaries 301 other than those acting as tunnels) MUST send their own HTTP-version 302 in forwarded messages. In other words, they are not allowed to 303 blindly forward the start-line without ensuring that the protocol 304 version in that message matches a version to which that intermediary 305 is conformant for both the receiving and sending of messages. 306 Forwarding an HTTP message without rewriting the HTTP-version might 307 result in communication errors when downstream recipients use the 308 message sender's version to determine what features are safe to use 309 for later communication with that sender. 311 A server MAY send an HTTP/1.0 response to an HTTP/1.1 request if it 312 is known or suspected that the client incorrectly implements the HTTP 313 specification and is incapable of correctly processing later version 314 responses, such as when a client fails to parse the version number 315 correctly or when an intermediary is known to blindly forward the 316 HTTP-version even when it doesn't conform to the given minor version 317 of the protocol. Such protocol downgrades SHOULD NOT be performed 318 unless triggered by specific client attributes, such as when one or 319 more of the request header fields (e.g., User-Agent) uniquely match 320 the values sent by a client known to be in error. 322 2.3. Message Parsing 324 The normal procedure for parsing an HTTP message is to read the 325 start-line into a structure, read each header field into a hash table 326 by field name until the empty line, and then use the parsed data to 327 determine if a message body is expected. If a message body has been 328 indicated, then it is read as a stream until an amount of octets 329 equal to the message body length is read or the connection is closed. 331 A recipient MUST parse an HTTP message as a sequence of octets in an 332 encoding that is a superset of US-ASCII [USASCII]. Parsing an HTTP 333 message as a stream of Unicode characters, without regard for the 334 specific encoding, creates security vulnerabilities due to the 335 varying ways that string processing libraries handle invalid 336 multibyte character sequences that contain the octet LF (%x0A). 337 String-based parsers can only be safely used within protocol elements 338 after the element has been extracted from the message, such as within 339 a header field-value after message parsing has delineated the 340 individual fields. 342 Although the line terminator for the start-line and header fields is 343 the sequence CRLF, a recipient MAY recognize a single LF as a line 344 terminator and ignore any preceding CR. 346 Older HTTP/1.0 user agent implementations might send an extra CRLF 347 after a POST request as a workaround for some early server 348 applications that failed to read message body content that was not 349 terminated by a line-ending. An HTTP/1.1 user agent MUST NOT preface 350 or follow a request with an extra CRLF. If terminating the request 351 message body with a line-ending is desired, then the user agent MUST 352 count the terminating CRLF octets as part of the message body length. 354 In the interest of robustness, a server that is expecting to receive 355 and parse a request-line SHOULD ignore at least one empty line (CRLF) 356 received prior to the request-line. 358 A sender MUST NOT send whitespace between the start-line and the 359 first header field. A recipient that receives whitespace between the 360 start-line and the first header field MUST either reject the message 361 as invalid or consume each whitespace-preceded line without further 362 processing of it (i.e., ignore the entire line, along with any 363 subsequent lines preceded by whitespace, until a properly formed 364 header field is received or the header section is terminated). 366 The presence of such whitespace in a request might be an attempt to 367 trick a server into ignoring that field or processing the line after 368 it as a new request, either of which might result in a security 369 vulnerability if other implementations within the request chain 370 interpret the same message differently. Likewise, the presence of 371 such whitespace in a response might be ignored by some clients or 372 cause others to cease parsing. 374 When a server listening only for HTTP request messages, or processing 375 what appears from the start-line to be an HTTP request message, 376 receives a sequence of octets that does not match the HTTP-message 377 grammar aside from the robustness exceptions listed above, the server 378 SHOULD respond with a 400 (Bad Request) response. 380 3. Request Line 382 A request-line begins with a method token, followed by a single space 383 (SP), the request-target, another single space (SP), the protocol 384 version, and ends with CRLF. 386 request-line = method SP request-target SP HTTP-version CRLF 388 Although the request-line grammar rule requires that each of the 389 component elements be separated by a single SP octet, recipients MAY 390 instead parse on whitespace-delimited word boundaries and, aside from 391 the CRLF terminator, treat any form of whitespace as the SP separator 392 while ignoring preceding or trailing whitespace; such whitespace 393 includes one or more of the following octets: SP, HTAB, VT (%x0B), FF 394 (%x0C), or bare CR. However, lenient parsing can result in request 395 smuggling security vulnerabilities if there are multiple recipients 396 of the message and each has its own unique interpretation of 397 robustness (see Section 11.2). 399 HTTP does not place a predefined limit on the length of a request- 400 line, as described in Section 3 of [Semantics]. A server that 401 receives a method longer than any that it implements SHOULD respond 402 with a 501 (Not Implemented) status code. A server that receives a 403 request-target longer than any URI it wishes to parse MUST respond 404 with a 414 (URI Too Long) status code (see Section 9.5.15 of 405 [Semantics]). 407 Various ad hoc limitations on request-line length are found in 408 practice. It is RECOMMENDED that all HTTP senders and recipients 409 support, at a minimum, request-line lengths of 8000 octets. 411 3.1. Method 413 The method token indicates the request method to be performed on the 414 target resource. The request method is case-sensitive. 416 method = token 418 The request methods defined by this specification can be found in 419 Section 7 of [Semantics], along with information regarding the HTTP 420 method registry and considerations for defining new methods. 422 3.2. Request Target 424 The request-target identifies the target resource upon which to apply 425 the request. The client derives a request-target from its desired 426 target URI. There are four distinct formats for the request-target, 427 depending on both the method being requested and whether the request 428 is to a proxy. 430 request-target = origin-form 431 / absolute-form 432 / authority-form 433 / asterisk-form 435 No whitespace is allowed in the request-target. Unfortunately, some 436 user agents fail to properly encode or exclude whitespace found in 437 hypertext references, resulting in those disallowed characters being 438 sent as the request-target in a malformed request-line. 440 Recipients of an invalid request-line SHOULD respond with either a 441 400 (Bad Request) error or a 301 (Moved Permanently) redirect with 442 the request-target properly encoded. A recipient SHOULD NOT attempt 443 to autocorrect and then process the request without a redirect, since 444 the invalid request-line might be deliberately crafted to bypass 445 security filters along the request chain. 447 3.2.1. origin-form 449 The most common form of request-target is the origin-form. 451 origin-form = absolute-path [ "?" query ] 453 When making a request directly to an origin server, other than a 454 CONNECT or server-wide OPTIONS request (as detailed below), a client 455 MUST send only the absolute path and query components of the target 456 URI as the request-target. If the target URI's path component is 457 empty, the client MUST send "/" as the path within the origin-form of 458 request-target. A Host header field is also sent, as defined in 459 Section 5.4 of [Semantics]. 461 For example, a client wishing to retrieve a representation of the 462 resource identified as 464 http://www.example.org/where?q=now 466 directly from the origin server would open (or reuse) a TCP 467 connection to port 80 of the host "www.example.org" and send the 468 lines: 470 GET /where?q=now HTTP/1.1 471 Host: www.example.org 473 followed by the remainder of the request message. 475 3.2.2. absolute-form 477 When making a request to a proxy, other than a CONNECT or server-wide 478 OPTIONS request (as detailed below), a client MUST send the target 479 URI in absolute-form as the request-target. 481 absolute-form = absolute-URI 483 The proxy is requested to either service that request from a valid 484 cache, if possible, or make the same request on the client's behalf 485 to either the next inbound proxy server or directly to the origin 486 server indicated by the request-target. Requirements on such 487 "forwarding" of messages are defined in Section 5.5 of [Semantics]. 489 An example absolute-form of request-line would be: 491 GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 493 To allow for transition to the absolute-form for all requests in some 494 future version of HTTP, a server MUST accept the absolute-form in 495 requests, even though HTTP/1.1 clients will only send them in 496 requests to proxies. 498 3.2.3. authority-form 500 The authority-form of request-target is only used for CONNECT 501 requests (Section 7.3.6 of [Semantics]). 503 authority-form = authority 505 When making a CONNECT request to establish a tunnel through one or 506 more proxies, a client MUST send only the target URI's authority 507 component (excluding any userinfo and its "@" delimiter) as the 508 request-target. For example, 510 CONNECT www.example.com:80 HTTP/1.1 512 3.2.4. asterisk-form 514 The asterisk-form of request-target is only used for a server-wide 515 OPTIONS request (Section 7.3.7 of [Semantics]). 517 asterisk-form = "*" 519 When a client wishes to request OPTIONS for the server as a whole, as 520 opposed to a specific named resource of that server, the client MUST 521 send only "*" (%x2A) as the request-target. For example, 523 OPTIONS * HTTP/1.1 525 If a proxy receives an OPTIONS request with an absolute-form of 526 request-target in which the URI has an empty path and no query 527 component, then the last proxy on the request chain MUST send a 528 request-target of "*" when it forwards the request to the indicated 529 origin server. 531 For example, the request 533 OPTIONS http://www.example.org:8001 HTTP/1.1 535 would be forwarded by the final proxy as 537 OPTIONS * HTTP/1.1 538 Host: www.example.org:8001 540 after connecting to port 8001 of host "www.example.org". 542 3.3. Effective Request URI 544 Since the request-target often contains only part of the user agent's 545 target URI, a server reconstructs the intended target as an effective 546 request URI to properly service the request (Section 5.3 of 547 [Semantics]). 549 If the request-target is in absolute-form, the effective request URI 550 is the same as the request-target. Otherwise, the effective request 551 URI is constructed as follows: 553 If the server's configuration (or outbound gateway) provides a 554 fixed URI scheme, that scheme is used for the effective request 555 URI. Otherwise, if the request is received over a TLS-secured TCP 556 connection, the effective request URI's scheme is "https"; if not, 557 the scheme is "http". 559 If the server's configuration (or outbound gateway) provides a 560 fixed URI authority component, that authority is used for the 561 effective request URI. If not, then if the request-target is in 562 authority-form, the effective request URI's authority component is 563 the same as the request-target. If not, then if a Host header 564 field is supplied with a non-empty field-value, the authority 565 component is the same as the Host field-value. Otherwise, the 566 authority component is assigned the default name configured for 567 the server and, if the connection's incoming TCP port number 568 differs from the default port for the effective request URI's 569 scheme, then a colon (":") and the incoming port number (in 570 decimal form) are appended to the authority component. 572 If the request-target is in authority-form or asterisk-form, the 573 effective request URI's combined path and query component is 574 empty. Otherwise, the combined path and query component is the 575 same as the request-target. 577 The components of the effective request URI, once determined as 578 above, can be combined into absolute-URI form by concatenating the 579 scheme, "://", authority, and combined path and query component. 581 Example 1: the following message received over an insecure TCP 582 connection 584 GET /pub/WWW/TheProject.html HTTP/1.1 585 Host: www.example.org:8080 587 has an effective request URI of 589 http://www.example.org:8080/pub/WWW/TheProject.html 591 Example 2: the following message received over a TLS-secured TCP 592 connection 594 OPTIONS * HTTP/1.1 595 Host: www.example.org 597 has an effective request URI of 599 https://www.example.org 601 Recipients of an HTTP/1.0 request that lacks a Host header field 602 might need to use heuristics (e.g., examination of the URI path for 603 something unique to a particular host) in order to guess the 604 effective request URI's authority component. 606 4. Status Line 608 The first line of a response message is the status-line, consisting 609 of the protocol version, a space (SP), the status code, another 610 space, an OPTIONAL textual phrase describing the status code, and 611 ending with CRLF. 613 status-line = HTTP-version SP status-code SP [reason-phrase] CRLF 615 Although the status-line grammar rule requires that each of the 616 component elements be separated by a single SP octet, recipients MAY 617 instead parse on whitespace-delimited word boundaries and, aside from 618 the line terminator, treat any form of whitespace as the SP separator 619 while ignoring preceding or trailing whitespace; such whitespace 620 includes one or more of the following octets: SP, HTAB, VT (%x0B), FF 621 (%x0C), or bare CR. However, lenient parsing can result in response 622 splitting security vulnerabilities if there are multiple recipients 623 of the message and each has its own unique interpretation of 624 robustness (see Section 11.1). 626 The status-code element is a 3-digit integer code describing the 627 result of the server's attempt to understand and satisfy the client's 628 corresponding request. The rest of the response message is to be 629 interpreted in light of the semantics defined for that status code. 630 See Section 9 of [Semantics] for information about the semantics of 631 status codes, including the classes of status code (indicated by the 632 first digit), the status codes defined by this specification, 633 considerations for the definition of new status codes, and the IANA 634 registry. 636 status-code = 3DIGIT 638 The reason-phrase element exists for the sole purpose of providing a 639 textual description associated with the numeric status code, mostly 640 out of deference to earlier Internet application protocols that were 641 more frequently used with interactive text clients. 643 reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) 645 A client SHOULD ignore the reason-phrase content because it is not a 646 reliable channel for information (it might be translated for a given 647 locale, overwritten by intermediaries, or discarded when the message 648 is forwarded via other versions of HTTP). A server MUST send the 649 space that separates status-code from the reason-phrase even when the 650 reason-phrase is absent (i.e., the status-line would end with the 651 three octets SP CR LF). 653 5. Header Fields 655 Each header field consists of a case-insensitive field name followed 656 by a colon (":"), optional leading whitespace, the field value, and 657 optional trailing whitespace. 659 header-field = field-name ":" OWS field-value OWS 661 Most HTTP field names and the rules for parsing within field values 662 are defined in Section 4 of [Semantics]. This section covers the 663 generic syntax for header field inclusion within, and extraction 664 from, HTTP/1.1 messages. In addition, the following header fields 665 are defined by this document because they are specific to HTTP/1.1 666 message processing: 668 +-------------------+----------+---------------+ 669 | Header Field Name | Status | Reference | 670 +-------------------+----------+---------------+ 671 | Connection | standard | Section 9.1 | 672 | MIME-Version | standard | Appendix B.1 | 673 | TE | standard | Section 7.4 | 674 | Transfer-Encoding | standard | Section 6.1 | 675 | Upgrade | standard | Section 9.8 | 676 +-------------------+----------+---------------+ 678 Table 1 680 Furthermore, the field name "Close" is reserved, since using that 681 name as an HTTP header field might conflict with the "close" 682 connection option of the Connection header field (Section 9.1). 684 +-------------------+----------+----------+------------+ 685 | Header Field Name | Protocol | Status | Reference | 686 +-------------------+----------+----------+------------+ 687 | Close | http | reserved | Section 5 | 688 +-------------------+----------+----------+------------+ 690 5.1. Header Field Parsing 692 Messages are parsed using a generic algorithm, independent of the 693 individual header field names. The contents within a given field 694 value are not parsed until a later stage of message interpretation 695 (usually after the message's entire header section has been 696 processed). 698 No whitespace is allowed between the header field-name and colon. In 699 the past, differences in the handling of such whitespace have led to 700 security vulnerabilities in request routing and response handling. A 701 server MUST reject any received request message that contains 702 whitespace between a header field-name and colon with a response 703 status code of 400 (Bad Request). A proxy MUST remove any such 704 whitespace from a response message before forwarding the message 705 downstream. 707 A field value might be preceded and/or followed by optional 708 whitespace (OWS); a single SP preceding the field-value is preferred 709 for consistent readability by humans. The field value does not 710 include any leading or trailing whitespace: OWS occurring before the 711 first non-whitespace octet of the field value or after the last non- 712 whitespace octet of the field value ought to be excluded by parsers 713 when extracting the field value from a header field. 715 5.2. Obsolete Line Folding 717 Historically, HTTP header field values could be extended over 718 multiple lines by preceding each extra line with at least one space 719 or horizontal tab (obs-fold). This specification deprecates such 720 line folding except within the message/http media type 721 (Section 10.1). 723 obs-fold = OWS CRLF RWS 724 ; obsolete line folding 726 A sender MUST NOT generate a message that includes line folding 727 (i.e., that has any field-value that contains a match to the obs-fold 728 rule) unless the message is intended for packaging within the 729 message/http media type. 731 A server that receives an obs-fold in a request message that is not 732 within a message/http container MUST either reject the message by 733 sending a 400 (Bad Request), preferably with a representation 734 explaining that obsolete line folding is unacceptable, or replace 735 each received obs-fold with one or more SP octets prior to 736 interpreting the field value or forwarding the message downstream. 738 A proxy or gateway that receives an obs-fold in a response message 739 that is not within a message/http container MUST either discard the 740 message and replace it with a 502 (Bad Gateway) response, preferably 741 with a representation explaining that unacceptable line folding was 742 received, or replace each received obs-fold with one or more SP 743 octets prior to interpreting the field value or forwarding the 744 message downstream. 746 A user agent that receives an obs-fold in a response message that is 747 not within a message/http container MUST replace each received obs- 748 fold with one or more SP octets prior to interpreting the field 749 value. 751 6. Message Body 753 The message body (if any) of an HTTP message is used to carry the 754 payload body of that request or response. The message body is 755 identical to the payload body unless a transfer coding has been 756 applied, as described in Section 6.1. 758 message-body = *OCTET 760 The rules for when a message body is allowed in a message differ for 761 requests and responses. 763 The presence of a message body in a request is signaled by a Content- 764 Length or Transfer-Encoding header field. Request message framing is 765 independent of method semantics, even if the method does not define 766 any use for a message body. 768 The presence of a message body in a response depends on both the 769 request method to which it is responding and the response status code 770 (Section 4). Responses to the HEAD request method (Section 7.3.2 of 771 [Semantics]) never include a message body because the associated 772 response header fields (e.g., Transfer-Encoding, Content-Length, 773 etc.), if present, indicate only what their values would have been if 774 the request method had been GET (Section 7.3.1 of [Semantics]). 2xx 775 (Successful) responses to a CONNECT request method (Section 7.3.6 of 776 [Semantics]) switch to tunnel mode instead of having a message body. 777 All 1xx (Informational), 204 (No Content), and 304 (Not Modified) 778 responses do not include a message body. All other responses do 779 include a message body, although the body might be of zero length. 781 6.1. Transfer-Encoding 783 The Transfer-Encoding header field lists the transfer coding names 784 corresponding to the sequence of transfer codings that have been (or 785 will be) applied to the payload body in order to form the message 786 body. Transfer codings are defined in Section 7. 788 Transfer-Encoding = 1#transfer-coding 790 Transfer-Encoding is analogous to the Content-Transfer-Encoding field 791 of MIME, which was designed to enable safe transport of binary data 792 over a 7-bit transport service ([RFC2045], Section 6). However, safe 793 transport has a different focus for an 8bit-clean transfer protocol. 794 In HTTP's case, Transfer-Encoding is primarily intended to accurately 795 delimit a dynamically generated payload and to distinguish payload 796 encodings that are only applied for transport efficiency or security 797 from those that are characteristics of the selected resource. 799 A recipient MUST be able to parse the chunked transfer coding 800 (Section 7.1) because it plays a crucial role in framing messages 801 when the payload body size is not known in advance. A sender MUST 802 NOT apply chunked more than once to a message body (i.e., chunking an 803 already chunked message is not allowed). If any transfer coding 804 other than chunked is applied to a request payload body, the sender 805 MUST apply chunked as the final transfer coding to ensure that the 806 message is properly framed. If any transfer coding other than 807 chunked is applied to a response payload body, the sender MUST either 808 apply chunked as the final transfer coding or terminate the message 809 by closing the connection. 811 For example, 813 Transfer-Encoding: gzip, chunked 815 indicates that the payload body has been compressed using the gzip 816 coding and then chunked using the chunked coding while forming the 817 message body. 819 Unlike Content-Encoding (Section 6.1.2 of [Semantics]), Transfer- 820 Encoding is a property of the message, not of the representation, and 821 any recipient along the request/response chain MAY decode the 822 received transfer coding(s) or apply additional transfer coding(s) to 823 the message body, assuming that corresponding changes are made to the 824 Transfer-Encoding field-value. Additional information about the 825 encoding parameters can be provided by other header fields not 826 defined by this specification. 828 Transfer-Encoding MAY be sent in a response to a HEAD request or in a 829 304 (Not Modified) response (Section 9.4.5 of [Semantics]) to a GET 830 request, neither of which includes a message body, to indicate that 831 the origin server would have applied a transfer coding to the message 832 body if the request had been an unconditional GET. This indication 833 is not required, however, because any recipient on the response chain 834 (including the origin server) can remove transfer codings when they 835 are not needed. 837 A server MUST NOT send a Transfer-Encoding header field in any 838 response with a status code of 1xx (Informational) or 204 (No 839 Content). A server MUST NOT send a Transfer-Encoding header field in 840 any 2xx (Successful) response to a CONNECT request (Section 7.3.6 of 841 [Semantics]). 843 Transfer-Encoding was added in HTTP/1.1. It is generally assumed 844 that implementations advertising only HTTP/1.0 support will not 845 understand how to process a transfer-encoded payload. A client MUST 846 NOT send a request containing Transfer-Encoding unless it knows the 847 server will handle HTTP/1.1 (or later) requests; such knowledge might 848 be in the form of specific user configuration or by remembering the 849 version of a prior received response. A server MUST NOT send a 850 response containing Transfer-Encoding unless the corresponding 851 request indicates HTTP/1.1 (or later). 853 A server that receives a request message with a transfer coding it 854 does not understand SHOULD respond with 501 (Not Implemented). 856 6.2. Content-Length 858 When a message does not have a Transfer-Encoding header field, a 859 Content-Length header field can provide the anticipated size, as a 860 decimal number of octets, for a potential payload body. For messages 861 that do include a payload body, the Content-Length field-value 862 provides the framing information necessary for determining where the 863 body (and message) ends. For messages that do not include a payload 864 body, the Content-Length indicates the size of the selected 865 representation (Section 6.2.4 of [Semantics]). 867 Note: HTTP's use of Content-Length for message framing differs 868 significantly from the same field's use in MIME, where it is an 869 optional field used only within the "message/external-body" media- 870 type. 872 6.3. Message Body Length 874 The length of a message body is determined by one of the following 875 (in order of precedence): 877 1. Any response to a HEAD request and any response with a 1xx 878 (Informational), 204 (No Content), or 304 (Not Modified) status 879 code is always terminated by the first empty line after the 880 header fields, regardless of the header fields present in the 881 message, and thus cannot contain a message body. 883 2. Any 2xx (Successful) response to a CONNECT request implies that 884 the connection will become a tunnel immediately after the empty 885 line that concludes the header fields. A client MUST ignore any 886 Content-Length or Transfer-Encoding header fields received in 887 such a message. 889 3. If a Transfer-Encoding header field is present and the chunked 890 transfer coding (Section 7.1) is the final encoding, the message 891 body length is determined by reading and decoding the chunked 892 data until the transfer coding indicates the data is complete. 894 If a Transfer-Encoding header field is present in a response and 895 the chunked transfer coding is not the final encoding, the 896 message body length is determined by reading the connection until 897 it is closed by the server. If a Transfer-Encoding header field 898 is present in a request and the chunked transfer coding is not 899 the final encoding, the message body length cannot be determined 900 reliably; the server MUST respond with the 400 (Bad Request) 901 status code and then close the connection. 903 If a message is received with both a Transfer-Encoding and a 904 Content-Length header field, the Transfer-Encoding overrides the 905 Content-Length. Such a message might indicate an attempt to 906 perform request smuggling (Section 11.2) or response splitting 907 (Section 11.1) and ought to be handled as an error. A sender 908 MUST remove the received Content-Length field prior to forwarding 909 such a message downstream. 911 4. If a message is received without Transfer-Encoding and with 912 either multiple Content-Length header fields having differing 913 field-values or a single Content-Length header field having an 914 invalid value, then the message framing is invalid and the 915 recipient MUST treat it as an unrecoverable error. If this is a 916 request message, the server MUST respond with a 400 (Bad Request) 917 status code and then close the connection. If this is a response 918 message received by a proxy, the proxy MUST close the connection 919 to the server, discard the received response, and send a 502 (Bad 920 Gateway) response to the client. If this is a response message 921 received by a user agent, the user agent MUST close the 922 connection to the server and discard the received response. 924 5. If a valid Content-Length header field is present without 925 Transfer-Encoding, its decimal value defines the expected message 926 body length in octets. If the sender closes the connection or 927 the recipient times out before the indicated number of octets are 928 received, the recipient MUST consider the message to be 929 incomplete and close the connection. 931 6. If this is a request message and none of the above are true, then 932 the message body length is zero (no message body is present). 934 7. Otherwise, this is a response message without a declared message 935 body length, so the message body length is determined by the 936 number of octets received prior to the server closing the 937 connection. 939 Since there is no way to distinguish a successfully completed, close- 940 delimited message from a partially received message interrupted by 941 network failure, a server SHOULD generate encoding or length- 942 delimited messages whenever possible. The close-delimiting feature 943 exists primarily for backwards compatibility with HTTP/1.0. 945 A server MAY reject a request that contains a message body but not a 946 Content-Length by responding with 411 (Length Required). 948 Unless a transfer coding other than chunked has been applied, a 949 client that sends a request containing a message body SHOULD use a 950 valid Content-Length header field if the message body length is known 951 in advance, rather than the chunked transfer coding, since some 952 existing services respond to chunked with a 411 (Length Required) 953 status code even though they understand the chunked transfer coding. 954 This is typically because such services are implemented via a gateway 955 that requires a content-length in advance of being called and the 956 server is unable or unwilling to buffer the entire request before 957 processing. 959 A user agent that sends a request containing a message body MUST send 960 a valid Content-Length header field if it does not know the server 961 will handle HTTP/1.1 (or later) requests; such knowledge can be in 962 the form of specific user configuration or by remembering the version 963 of a prior received response. 965 If the final response to the last request on a connection has been 966 completely received and there remains additional data to read, a user 967 agent MAY discard the remaining data or attempt to determine if that 968 data belongs as part of the prior response body, which might be the 969 case if the prior message's Content-Length value is incorrect. A 970 client MUST NOT process, cache, or forward such extra data as a 971 separate response, since such behavior would be vulnerable to cache 972 poisoning. 974 7. Transfer Codings 976 Transfer coding names are used to indicate an encoding transformation 977 that has been, can be, or might need to be applied to a payload body 978 in order to ensure "safe transport" through the network. This 979 differs from a content coding in that the transfer coding is a 980 property of the message rather than a property of the representation 981 that is being transferred. 983 transfer-coding = token *( OWS ";" OWS transfer-parameter ) 985 Parameters are in the form of a name=value pair. 987 transfer-parameter = token BWS "=" BWS ( token / quoted-string ) 989 All transfer-coding names are case-insensitive and ought to be 990 registered within the HTTP Transfer Coding registry, as defined in 991 Section 7.3. They are used in the TE (Section 7.4) and Transfer- 992 Encoding (Section 6.1) header fields. 994 +------------+------------------------------------------+-----------+ 995 | Name | Description | Reference | 996 +------------+------------------------------------------+-----------+ 997 | chunked | Transfer in a series of chunks | Section | 998 | | | 7.1 | 999 | compress | UNIX "compress" data format [Welch] | Section | 1000 | | | 7.2 | 1001 | deflate | "deflate" compressed data ([RFC1951]) | Section | 1002 | | inside the "zlib" data format | 7.2 | 1003 | | ([RFC1950]) | | 1004 | gzip | GZIP file format [RFC1952] | Section | 1005 | | | 7.2 | 1006 | trailers | (reserved) | Section 7 | 1007 | x-compress | Deprecated (alias for compress) | Section | 1008 | | | 7.2 | 1009 | x-gzip | Deprecated (alias for gzip) | Section | 1010 | | | 7.2 | 1011 +------------+------------------------------------------+-----------+ 1013 Table 2 1015 Note: the coding name "trailers" is reserved because it would 1016 clash with the use of the keyword "trailers" in the TE header 1017 field (Section 7.4). 1019 7.1. Chunked Transfer Coding 1021 The chunked transfer coding wraps the payload body in order to 1022 transfer it as a series of chunks, each with its own size indicator, 1023 followed by an OPTIONAL trailer containing header fields. Chunked 1024 enables content streams of unknown size to be transferred as a 1025 sequence of length-delimited buffers, which enables the sender to 1026 retain connection persistence and the recipient to know when it has 1027 received the entire message. 1029 chunked-body = *chunk 1030 last-chunk 1031 trailer-part 1032 CRLF 1034 chunk = chunk-size [ chunk-ext ] CRLF 1035 chunk-data CRLF 1036 chunk-size = 1*HEXDIG 1037 last-chunk = 1*("0") [ chunk-ext ] CRLF 1039 chunk-data = 1*OCTET ; a sequence of chunk-size octets 1041 The chunk-size field is a string of hex digits indicating the size of 1042 the chunk-data in octets. The chunked transfer coding is complete 1043 when a chunk with a chunk-size of zero is received, possibly followed 1044 by a trailer, and finally terminated by an empty line. 1046 A recipient MUST be able to parse and decode the chunked transfer 1047 coding. 1049 The chunked encoding does not define any parameters. Their presence 1050 SHOULD be treated as an error. 1052 7.1.1. Chunk Extensions 1054 The chunked encoding allows each chunk to include zero or more chunk 1055 extensions, immediately following the chunk-size, for the sake of 1056 supplying per-chunk metadata (such as a signature or hash), mid- 1057 message control information, or randomization of message body size. 1059 chunk-ext = *( BWS ";" BWS chunk-ext-name 1060 [ BWS "=" BWS chunk-ext-val ] ) 1062 chunk-ext-name = token 1063 chunk-ext-val = token / quoted-string 1065 The chunked encoding is specific to each connection and is likely to 1066 be removed or recoded by each recipient (including intermediaries) 1067 before any higher-level application would have a chance to inspect 1068 the extensions. Hence, use of chunk extensions is generally limited 1069 to specialized HTTP services such as "long polling" (where client and 1070 server can have shared expectations regarding the use of chunk 1071 extensions) or for padding within an end-to-end secured connection. 1073 A recipient MUST ignore unrecognized chunk extensions. A server 1074 ought to limit the total length of chunk extensions received in a 1075 request to an amount reasonable for the services provided, in the 1076 same way that it applies length limitations and timeouts for other 1077 parts of a message, and generate an appropriate 4xx (Client Error) 1078 response if that amount is exceeded. 1080 7.1.2. Chunked Trailer Part 1082 A trailer allows the sender to include additional fields at the end 1083 of a chunked message in order to supply metadata that might be 1084 dynamically generated while the message body is sent, such as a 1085 message integrity check, digital signature, or post-processing 1086 status. The trailer fields are identical to header fields, except 1087 they are sent in a chunked trailer instead of the message's header 1088 section. 1090 trailer-part = *( header-field CRLF ) 1092 A sender MUST NOT generate a trailer that contains a field necessary 1093 for message framing (e.g., Transfer-Encoding and Content-Length), 1094 routing (e.g., Host), request modifiers (e.g., controls and 1095 conditionals in Section 8 of [Semantics]), authentication (e.g., see 1096 Section 8.5 of [Semantics] and [RFC6265]), response control data 1097 (e.g., see Section 10.1 of [Semantics]), or determining how to 1098 process the payload (e.g., Content-Encoding, Content-Type, Content- 1099 Range, and Trailer). 1101 When a chunked message containing a non-empty trailer is received, 1102 the recipient MAY process the fields (aside from those forbidden 1103 above) as if they were appended to the message's header section. A 1104 recipient MUST ignore (or consider as an error) any fields that are 1105 forbidden to be sent in a trailer, since processing them as if they 1106 were present in the header section might bypass external security 1107 filters. 1109 Unless the request includes a TE header field indicating "trailers" 1110 is acceptable, as described in Section 7.4, a server SHOULD NOT 1111 generate trailer fields that it believes are necessary for the user 1112 agent to receive. Without a TE containing "trailers", the server 1113 ought to assume that the trailer fields might be silently discarded 1114 along the path to the user agent. This requirement allows 1115 intermediaries to forward a de-chunked message to an HTTP/1.0 1116 recipient without buffering the entire response. 1118 When a message includes a message body encoded with the chunked 1119 transfer coding and the sender desires to send metadata in the form 1120 of trailer fields at the end of the message, the sender SHOULD 1121 generate a Trailer header field before the message body to indicate 1122 which fields will be present in the trailers. This allows the 1123 recipient to prepare for receipt of that metadata before it starts 1124 processing the body, which is useful if the message is being streamed 1125 and the recipient wishes to confirm an integrity check on the fly. 1127 7.1.3. Decoding Chunked 1129 A process for decoding the chunked transfer coding can be represented 1130 in pseudo-code as: 1132 length := 0 1133 read chunk-size, chunk-ext (if any), and CRLF 1134 while (chunk-size > 0) { 1135 read chunk-data and CRLF 1136 append chunk-data to decoded-body 1137 length := length + chunk-size 1138 read chunk-size, chunk-ext (if any), and CRLF 1139 } 1140 read trailer field 1141 while (trailer field is not empty) { 1142 if (trailer field is allowed to be sent in a trailer) { 1143 append trailer field to existing header fields 1144 } 1145 read trailer-field 1146 } 1147 Content-Length := length 1148 Remove "chunked" from Transfer-Encoding 1149 Remove Trailer from existing header fields 1151 7.2. Transfer Codings for Compression 1153 The following transfer coding names for compression are defined by 1154 the same algorithm as their corresponding content coding: 1156 compress (and x-compress) 1157 See Section 6.1.2.1 of [Semantics]. 1159 deflate 1160 See Section 6.1.2.2 of [Semantics]. 1162 gzip (and x-gzip) 1163 See Section 6.1.2.3 of [Semantics]. 1165 The compression codings do not define any parameters. Their presence 1166 SHOULD be treated as an error. 1168 7.3. Transfer Coding Registry 1170 The "HTTP Transfer Coding Registry" defines the namespace for 1171 transfer coding names. It is maintained at 1172 . 1174 Registrations MUST include the following fields: 1176 o Name 1178 o Description 1180 o Pointer to specification text 1182 Names of transfer codings MUST NOT overlap with names of content 1183 codings (Section 6.1.2 of [Semantics]) unless the encoding 1184 transformation is identical, as is the case for the compression 1185 codings defined in Section 7.2. 1187 The TE header field (Section 7.4) uses a pseudo parameter named "q" 1188 as rank value when multiple transfer codings are acceptable. Future 1189 registrations of transfer codings SHOULD NOT define parameters called 1190 "q" (case-insensitively) in order to avoid ambiguities. 1192 Values to be added to this namespace require IETF Review (see 1193 Section 4.8 of [RFC8126]), and MUST conform to the purpose of 1194 transfer coding defined in this specification. 1196 Use of program names for the identification of encoding formats is 1197 not desirable and is discouraged for future encodings. 1199 7.4. TE 1201 The "TE" header field in a request indicates what transfer codings, 1202 besides chunked, the client is willing to accept in response, and 1203 whether or not the client is willing to accept trailer fields in a 1204 chunked transfer coding. 1206 The TE field-value consists of a comma-separated list of transfer 1207 coding names, each allowing for optional parameters (as described in 1208 Section 7), and/or the keyword "trailers". A client MUST NOT send 1209 the chunked transfer coding name in TE; chunked is always acceptable 1210 for HTTP/1.1 recipients. 1212 TE = #t-codings 1213 t-codings = "trailers" / ( transfer-coding [ t-ranking ] ) 1214 t-ranking = OWS ";" OWS "q=" rank 1215 rank = ( "0" [ "." 0*3DIGIT ] ) 1216 / ( "1" [ "." 0*3("0") ] ) 1218 Three examples of TE use are below. 1220 TE: deflate 1221 TE: 1222 TE: trailers, deflate;q=0.5 1224 The presence of the keyword "trailers" indicates that the client is 1225 willing to accept trailer fields in a chunked transfer coding, as 1226 defined in Section 7.1.2, on behalf of itself and any downstream 1227 clients. For requests from an intermediary, this implies that 1228 either: (a) all downstream clients are willing to accept trailer 1229 fields in the forwarded response; or, (b) the intermediary will 1230 attempt to buffer the response on behalf of downstream recipients. 1231 Note that HTTP/1.1 does not define any means to limit the size of a 1232 chunked response such that an intermediary can be assured of 1233 buffering the entire response. 1235 When multiple transfer codings are acceptable, the client MAY rank 1236 the codings by preference using a case-insensitive "q" parameter 1237 (similar to the qvalues used in content negotiation fields, 1238 Section 8.4.1 of [Semantics]). The rank value is a real number in 1239 the range 0 through 1, where 0.001 is the least preferred and 1 is 1240 the most preferred; a value of 0 means "not acceptable". 1242 If the TE field-value is empty or if no TE field is present, the only 1243 acceptable transfer coding is chunked. A message with no transfer 1244 coding is always acceptable. 1246 Since the TE header field only applies to the immediate connection, a 1247 sender of TE MUST also send a "TE" connection option within the 1248 Connection header field (Section 9.1) in order to prevent the TE 1249 field from being forwarded by intermediaries that do not support its 1250 semantics. 1252 8. Handling Incomplete Messages 1254 A server that receives an incomplete request message, usually due to 1255 a canceled request or a triggered timeout exception, MAY send an 1256 error response prior to closing the connection. 1258 A client that receives an incomplete response message, which can 1259 occur when a connection is closed prematurely or when decoding a 1260 supposedly chunked transfer coding fails, MUST record the message as 1261 incomplete. Cache requirements for incomplete responses are defined 1262 in Section 3 of [Caching]. 1264 If a response terminates in the middle of the header section (before 1265 the empty line is received) and the status code might rely on header 1266 fields to convey the full meaning of the response, then the client 1267 cannot assume that meaning has been conveyed; the client might need 1268 to repeat the request in order to determine what action to take next. 1270 A message body that uses the chunked transfer coding is incomplete if 1271 the zero-sized chunk that terminates the encoding has not been 1272 received. A message that uses a valid Content-Length is incomplete 1273 if the size of the message body received (in octets) is less than the 1274 value given by Content-Length. A response that has neither chunked 1275 transfer coding nor Content-Length is terminated by closure of the 1276 connection and, thus, is considered complete regardless of the number 1277 of message body octets received, provided that the header section was 1278 received intact. 1280 9. Connection Management 1282 HTTP messaging is independent of the underlying transport- or 1283 session-layer connection protocol(s). HTTP only presumes a reliable 1284 transport with in-order delivery of requests and the corresponding 1285 in-order delivery of responses. The mapping of HTTP request and 1286 response structures onto the data units of an underlying transport 1287 protocol is outside the scope of this specification. 1289 As described in Section 5.2 of [Semantics], the specific connection 1290 protocols to be used for an HTTP interaction are determined by client 1291 configuration and the target URI. For example, the "http" URI scheme 1292 (Section 2.5.1 of [Semantics]) indicates a default connection of TCP 1293 over IP, with a default TCP port of 80, but the client might be 1294 configured to use a proxy via some other connection, port, or 1295 protocol. 1297 HTTP implementations are expected to engage in connection management, 1298 which includes maintaining the state of current connections, 1299 establishing a new connection or reusing an existing connection, 1300 processing messages received on a connection, detecting connection 1301 failures, and closing each connection. Most clients maintain 1302 multiple connections in parallel, including more than one connection 1303 per server endpoint. Most servers are designed to maintain thousands 1304 of concurrent connections, while controlling request queues to enable 1305 fair use and detect denial-of-service attacks. 1307 9.1. Connection 1309 The "Connection" header field allows the sender to indicate desired 1310 control options for the current connection. In order to avoid 1311 confusing downstream recipients, a proxy or gateway MUST remove or 1312 replace any received connection options before forwarding the 1313 message. 1315 When a header field aside from Connection is used to supply control 1316 information for or about the current connection, the sender MUST list 1317 the corresponding field-name within the Connection header field. A 1318 proxy or gateway MUST parse a received Connection header field before 1319 a message is forwarded and, for each connection-option in this field, 1320 remove any header field(s) from the message with the same name as the 1321 connection-option, and then remove the Connection header field itself 1322 (or replace it with the intermediary's own connection options for the 1323 forwarded message). 1325 Hence, the Connection header field provides a declarative way of 1326 distinguishing header fields that are only intended for the immediate 1327 recipient ("hop-by-hop") from those fields that are intended for all 1328 recipients on the chain ("end-to-end"), enabling the message to be 1329 self-descriptive and allowing future connection-specific extensions 1330 to be deployed without fear that they will be blindly forwarded by 1331 older intermediaries. 1333 The Connection header field's value has the following grammar: 1335 Connection = 1#connection-option 1336 connection-option = token 1338 Connection options are case-insensitive. 1340 A sender MUST NOT send a connection option corresponding to a header 1341 field that is intended for all recipients of the payload. For 1342 example, Cache-Control is never appropriate as a connection option 1343 (Section 5.2 of [Caching]). 1345 The connection options do not always correspond to a header field 1346 present in the message, since a connection-specific header field 1347 might not be needed if there are no parameters associated with a 1348 connection option. In contrast, a connection-specific header field 1349 that is received without a corresponding connection option usually 1350 indicates that the field has been improperly forwarded by an 1351 intermediary and ought to be ignored by the recipient. 1353 When defining new connection options, specification authors ought to 1354 survey existing header field names and ensure that the new connection 1355 option does not share the same name as an already deployed header 1356 field. Defining a new connection option essentially reserves that 1357 potential field-name for carrying additional information related to 1358 the connection option, since it would be unwise for senders to use 1359 that field-name for anything else. 1361 The "close" connection option is defined for a sender to signal that 1362 this connection will be closed after completion of the response. For 1363 example, 1365 Connection: close 1367 in either the request or the response header fields indicates that 1368 the sender is going to close the connection after the current 1369 request/response is complete (Section 9.7). 1371 A client that does not support persistent connections MUST send the 1372 "close" connection option in every request message. 1374 A server that does not support persistent connections MUST send the 1375 "close" connection option in every response message that does not 1376 have a 1xx (Informational) status code. 1378 9.2. Establishment 1380 It is beyond the scope of this specification to describe how 1381 connections are established via various transport- or session-layer 1382 protocols. Each connection applies to only one transport link. 1384 9.3. Associating a Response to a Request 1386 HTTP/1.1 does not include a request identifier for associating a 1387 given request message with its corresponding one or more response 1388 messages. Hence, it relies on the order of response arrival to 1389 correspond exactly to the order in which requests are made on the 1390 same connection. More than one response message per request only 1391 occurs when one or more informational responses (1xx, see Section 9.2 1392 of [Semantics]) precede a final response to the same request. 1394 A client that has more than one outstanding request on a connection 1395 MUST maintain a list of outstanding requests in the order sent and 1396 MUST associate each received response message on that connection to 1397 the highest ordered request that has not yet received a final (non- 1398 1xx) response. 1400 If an HTTP/1.1 client receives data on a connection that doesn't have 1401 any outstanding requests, it MUST NOT consider them to be a response 1402 to a not-yet-issued request; it SHOULD close the connection, since 1403 message delimitation is now ambiguous, unless the data consists only 1404 of one or more CRLF (which can be discarded, as per Section 2.3). 1406 9.4. Persistence 1408 HTTP/1.1 defaults to the use of "persistent connections", allowing 1409 multiple requests and responses to be carried over a single 1410 connection. The "close" connection option is used to signal that a 1411 connection will not persist after the current request/response. HTTP 1412 implementations SHOULD support persistent connections. 1414 A recipient determines whether a connection is persistent or not 1415 based on the most recently received message's protocol version and 1416 Connection header field (if any): 1418 o If the "close" connection option is present, the connection will 1419 not persist after the current response; else, 1421 o If the received protocol is HTTP/1.1 (or later), the connection 1422 will persist after the current response; else, 1424 o If the received protocol is HTTP/1.0, the "keep-alive" connection 1425 option is present, either the recipient is not a proxy or the 1426 message is a response, and the recipient wishes to honor the 1427 HTTP/1.0 "keep-alive" mechanism, the connection will persist after 1428 the current response; otherwise, 1430 o The connection will close after the current response. 1432 A client MAY send additional requests on a persistent connection 1433 until it sends or receives a "close" connection option or receives an 1434 HTTP/1.0 response without a "keep-alive" connection option. 1436 In order to remain persistent, all messages on a connection need to 1437 have a self-defined message length (i.e., one not defined by closure 1438 of the connection), as described in Section 6. A server MUST read 1439 the entire request message body or close the connection after sending 1440 its response, since otherwise the remaining data on a persistent 1441 connection would be misinterpreted as the next request. Likewise, a 1442 client MUST read the entire response message body if it intends to 1443 reuse the same connection for a subsequent request. 1445 A proxy server MUST NOT maintain a persistent connection with an 1446 HTTP/1.0 client (see Section 19.7.1 of [RFC2068] for information and 1447 discussion of the problems with the Keep-Alive header field 1448 implemented by many HTTP/1.0 clients). 1450 See Appendix C.1.2 for more information on backwards compatibility 1451 with HTTP/1.0 clients. 1453 9.4.1. Retrying Requests 1455 Connections can be closed at any time, with or without intention. 1456 Implementations ought to anticipate the need to recover from 1457 asynchronous close events. 1459 When an inbound connection is closed prematurely, a client MAY open a 1460 new connection and automatically retransmit an aborted sequence of 1461 requests if all of those requests have idempotent methods 1462 (Section 7.2.2 of [Semantics]). 1464 9.4.2. Pipelining 1466 A client that supports persistent connections MAY "pipeline" its 1467 requests (i.e., send multiple requests without waiting for each 1468 response). A server MAY process a sequence of pipelined requests in 1469 parallel if they all have safe methods (Section 7.2.1 of 1470 [Semantics]), but it MUST send the corresponding responses in the 1471 same order that the requests were received. 1473 A client that pipelines requests SHOULD retry unanswered requests if 1474 the connection closes before it receives all of the corresponding 1475 responses. When retrying pipelined requests after a failed 1476 connection (a connection not explicitly closed by the server in its 1477 last complete response), a client MUST NOT pipeline immediately after 1478 connection establishment, since the first remaining request in the 1479 prior pipeline might have caused an error response that can be lost 1480 again if multiple requests are sent on a prematurely closed 1481 connection (see the TCP reset problem described in Section 9.7). 1483 Idempotent methods (Section 7.2.2 of [Semantics]) are significant to 1484 pipelining because they can be automatically retried after a 1485 connection failure. A user agent SHOULD NOT pipeline requests after 1486 a non-idempotent method, until the final response status code for 1487 that method has been received, unless the user agent has a means to 1488 detect and recover from partial failure conditions involving the 1489 pipelined sequence. 1491 An intermediary that receives pipelined requests MAY pipeline those 1492 requests when forwarding them inbound, since it can rely on the 1493 outbound user agent(s) to determine what requests can be safely 1494 pipelined. If the inbound connection fails before receiving a 1495 response, the pipelining intermediary MAY attempt to retry a sequence 1496 of requests that have yet to receive a response if the requests all 1497 have idempotent methods; otherwise, the pipelining intermediary 1498 SHOULD forward any received responses and then close the 1499 corresponding outbound connection(s) so that the outbound user 1500 agent(s) can recover accordingly. 1502 9.5. Concurrency 1504 A client ought to limit the number of simultaneous open connections 1505 that it maintains to a given server. 1507 Previous revisions of HTTP gave a specific number of connections as a 1508 ceiling, but this was found to be impractical for many applications. 1509 As a result, this specification does not mandate a particular maximum 1510 number of connections but, instead, encourages clients to be 1511 conservative when opening multiple connections. 1513 Multiple connections are typically used to avoid the "head-of-line 1514 blocking" problem, wherein a request that takes significant server- 1515 side processing and/or has a large payload blocks subsequent requests 1516 on the same connection. However, each connection consumes server 1517 resources. Furthermore, using multiple connections can cause 1518 undesirable side effects in congested networks. 1520 Note that a server might reject traffic that it deems abusive or 1521 characteristic of a denial-of-service attack, such as an excessive 1522 number of open connections from a single client. 1524 9.6. Failures and Timeouts 1526 Servers will usually have some timeout value beyond which they will 1527 no longer maintain an inactive connection. Proxy servers might make 1528 this a higher value since it is likely that the client will be making 1529 more connections through the same proxy server. The use of 1530 persistent connections places no requirements on the length (or 1531 existence) of this timeout for either the client or the server. 1533 A client or server that wishes to time out SHOULD issue a graceful 1534 close on the connection. Implementations SHOULD constantly monitor 1535 open connections for a received closure signal and respond to it as 1536 appropriate, since prompt closure of both sides of a connection 1537 enables allocated system resources to be reclaimed. 1539 A client, server, or proxy MAY close the transport connection at any 1540 time. For example, a client might have started to send a new request 1541 at the same time that the server has decided to close the "idle" 1542 connection. From the server's point of view, the connection is being 1543 closed while it was idle, but from the client's point of view, a 1544 request is in progress. 1546 A server SHOULD sustain persistent connections, when possible, and 1547 allow the underlying transport's flow-control mechanisms to resolve 1548 temporary overloads, rather than terminate connections with the 1549 expectation that clients will retry. The latter technique can 1550 exacerbate network congestion. 1552 A client sending a message body SHOULD monitor the network connection 1553 for an error response while it is transmitting the request. If the 1554 client sees a response that indicates the server does not wish to 1555 receive the message body and is closing the connection, the client 1556 SHOULD immediately cease transmitting the body and close its side of 1557 the connection. 1559 9.7. Tear-down 1561 The Connection header field (Section 9.1) provides a "close" 1562 connection option that a sender SHOULD send when it wishes to close 1563 the connection after the current request/response pair. 1565 A client that sends a "close" connection option MUST NOT send further 1566 requests on that connection (after the one containing "close") and 1567 MUST close the connection after reading the final response message 1568 corresponding to this request. 1570 A server that receives a "close" connection option MUST initiate a 1571 close of the connection (see below) after it sends the final response 1572 to the request that contained "close". The server SHOULD send a 1573 "close" connection option in its final response on that connection. 1574 The server MUST NOT process any further requests received on that 1575 connection. 1577 A server that sends a "close" connection option MUST initiate a close 1578 of the connection (see below) after it sends the response containing 1579 "close". The server MUST NOT process any further requests received 1580 on that connection. 1582 A client that receives a "close" connection option MUST cease sending 1583 requests on that connection and close the connection after reading 1584 the response message containing the "close"; if additional pipelined 1585 requests had been sent on the connection, the client SHOULD NOT 1586 assume that they will be processed by the server. 1588 If a server performs an immediate close of a TCP connection, there is 1589 a significant risk that the client will not be able to read the last 1590 HTTP response. If the server receives additional data from the 1591 client on a fully closed connection, such as another request that was 1592 sent by the client before receiving the server's response, the 1593 server's TCP stack will send a reset packet to the client; 1594 unfortunately, the reset packet might erase the client's 1595 unacknowledged input buffers before they can be read and interpreted 1596 by the client's HTTP parser. 1598 To avoid the TCP reset problem, servers typically close a connection 1599 in stages. First, the server performs a half-close by closing only 1600 the write side of the read/write connection. The server then 1601 continues to read from the connection until it receives a 1602 corresponding close by the client, or until the server is reasonably 1603 certain that its own TCP stack has received the client's 1604 acknowledgement of the packet(s) containing the server's last 1605 response. Finally, the server fully closes the connection. 1607 It is unknown whether the reset problem is exclusive to TCP or might 1608 also be found in other transport connection protocols. 1610 9.8. Upgrade 1612 The "Upgrade" header field is intended to provide a simple mechanism 1613 for transitioning from HTTP/1.1 to some other protocol on the same 1614 connection. 1616 A client MAY send a list of protocol names in the Upgrade header 1617 field of a request to invite the server to switch to one or more of 1618 the named protocols, in order of descending preference, before 1619 sending the final response. A server MAY ignore a received Upgrade 1620 header field if it wishes to continue using the current protocol on 1621 that connection. Upgrade cannot be used to insist on a protocol 1622 change. 1624 Upgrade = 1#protocol 1626 protocol = protocol-name ["/" protocol-version] 1627 protocol-name = token 1628 protocol-version = token 1630 Although protocol names are registered with a preferred case, 1631 recipients SHOULD use case-insensitive comparison when matching each 1632 protocol-name to supported protocols. 1634 A server that sends a 101 (Switching Protocols) response MUST send an 1635 Upgrade header field to indicate the new protocol(s) to which the 1636 connection is being switched; if multiple protocol layers are being 1637 switched, the sender MUST list the protocols in layer-ascending 1638 order. A server MUST NOT switch to a protocol that was not indicated 1639 by the client in the corresponding request's Upgrade header field. A 1640 server MAY choose to ignore the order of preference indicated by the 1641 client and select the new protocol(s) based on other factors, such as 1642 the nature of the request or the current load on the server. 1644 A server that sends a 426 (Upgrade Required) response MUST send an 1645 Upgrade header field to indicate the acceptable protocols, in order 1646 of descending preference. 1648 A server MAY send an Upgrade header field in any other response to 1649 advertise that it implements support for upgrading to the listed 1650 protocols, in order of descending preference, when appropriate for a 1651 future request. 1653 The following is a hypothetical example sent by a client: 1655 GET /hello.txt HTTP/1.1 1656 Host: www.example.com 1657 Connection: upgrade 1658 Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11 1660 The capabilities and nature of the application-level communication 1661 after the protocol change is entirely dependent upon the new 1662 protocol(s) chosen. However, immediately after sending the 101 1663 (Switching Protocols) response, the server is expected to continue 1664 responding to the original request as if it had received its 1665 equivalent within the new protocol (i.e., the server still has an 1666 outstanding request to satisfy after the protocol has been changed, 1667 and is expected to do so without requiring the request to be 1668 repeated). 1670 For example, if the Upgrade header field is received in a GET request 1671 and the server decides to switch protocols, it first responds with a 1672 101 (Switching Protocols) message in HTTP/1.1 and then immediately 1673 follows that with the new protocol's equivalent of a response to a 1674 GET on the target resource. This allows a connection to be upgraded 1675 to protocols with the same semantics as HTTP without the latency cost 1676 of an additional round trip. A server MUST NOT switch protocols 1677 unless the received message semantics can be honored by the new 1678 protocol; an OPTIONS request can be honored by any protocol. 1680 The following is an example response to the above hypothetical 1681 request: 1683 HTTP/1.1 101 Switching Protocols 1684 Connection: upgrade 1685 Upgrade: HTTP/2.0 1687 [... data stream switches to HTTP/2.0 with an appropriate response 1688 (as defined by new protocol) to the "GET /hello.txt" request ...] 1690 When Upgrade is sent, the sender MUST also send a Connection header 1691 field (Section 9.1) that contains an "upgrade" connection option, in 1692 order to prevent Upgrade from being accidentally forwarded by 1693 intermediaries that might not implement the listed protocols. A 1694 server MUST ignore an Upgrade header field that is received in an 1695 HTTP/1.0 request. 1697 A client cannot begin using an upgraded protocol on the connection 1698 until it has completely sent the request message (i.e., the client 1699 can't change the protocol it is sending in the middle of a message). 1700 If a server receives both an Upgrade and an Expect header field with 1701 the "100-continue" expectation (Section 8.1.1 of [Semantics]), the 1702 server MUST send a 100 (Continue) response before sending a 101 1703 (Switching Protocols) response. 1705 The Upgrade header field only applies to switching protocols on top 1706 of the existing connection; it cannot be used to switch the 1707 underlying connection (transport) protocol, nor to switch the 1708 existing communication to a different connection. For those 1709 purposes, it is more appropriate to use a 3xx (Redirection) response 1710 (Section 9.4 of [Semantics]). 1712 9.8.1. Upgrade Protocol Names 1714 This specification only defines the protocol name "HTTP" for use by 1715 the family of Hypertext Transfer Protocols, as defined by the HTTP 1716 version rules of Section 3.5 of [Semantics] and future updates to 1717 this specification. Additional protocol names ought to be registered 1718 using the registration procedure defined in Section 9.8.2. 1720 +------+-------------------+--------------------+-------------------+ 1721 | Name | Description | Expected Version | Reference | 1722 | | | Tokens | | 1723 +------+-------------------+--------------------+-------------------+ 1724 | HTTP | Hypertext | any DIGIT.DIGIT | Section 3.5 of | 1725 | | Transfer Protocol | (e.g, "2.0") | [Semantics] | 1726 +------+-------------------+--------------------+-------------------+ 1728 9.8.2. Upgrade Token Registry 1730 The "Hypertext Transfer Protocol (HTTP) Upgrade Token Registry" 1731 defines the namespace for protocol-name tokens used to identify 1732 protocols in the Upgrade header field. The registry is maintained at 1733 . 1735 Each registered protocol name is associated with contact information 1736 and an optional set of specifications that details how the connection 1737 will be processed after it has been upgraded. 1739 Registrations happen on a "First Come First Served" basis (see 1740 Section 4.4 of [RFC8126]) and are subject to the following rules: 1742 1. A protocol-name token, once registered, stays registered forever. 1744 2. A protocol-name token is case-insensitive and registered with the 1745 preferred case to be generated by senders. 1747 3. The registration MUST name a responsible party for the 1748 registration. 1750 4. The registration MUST name a point of contact. 1752 5. The registration MAY name a set of specifications associated with 1753 that token. Such specifications need not be publicly available. 1755 6. The registration SHOULD name a set of expected "protocol-version" 1756 tokens associated with that token at the time of registration. 1758 7. The responsible party MAY change the registration at any time. 1759 The IANA will keep a record of all such changes, and make them 1760 available upon request. 1762 8. The IESG MAY reassign responsibility for a protocol token. This 1763 will normally only be used in the case when a responsible party 1764 cannot be contacted. 1766 10. Enclosing Messages as Data 1768 10.1. Media Type message/http 1770 The message/http media type can be used to enclose a single HTTP 1771 request or response message, provided that it obeys the MIME 1772 restrictions for all "message" types regarding line length and 1773 encodings. 1775 Type name: message 1776 Subtype name: http 1778 Required parameters: N/A 1780 Optional parameters: version, msgtype 1782 version: The HTTP-version number of the enclosed message (e.g., 1783 "1.1"). If not present, the version can be determined from the 1784 first line of the body. 1786 msgtype: The message type -- "request" or "response". If not 1787 present, the type can be determined from the first line of the 1788 body. 1790 Encoding considerations: only "7bit", "8bit", or "binary" are 1791 permitted 1793 Security considerations: see Section 11 1795 Interoperability considerations: N/A 1797 Published specification: This specification (see Section 10.1). 1799 Applications that use this media type: N/A 1801 Fragment identifier considerations: N/A 1803 Additional information: 1805 Magic number(s): N/A 1807 Deprecated alias names for this type: N/A 1809 File extension(s): N/A 1811 Macintosh file type code(s): N/A 1813 Person and email address to contact for further information: 1814 See Authors' Addresses section. 1816 Intended usage: COMMON 1818 Restrictions on usage: N/A 1820 Author: See Authors' Addresses section. 1822 Change controller: IESG 1824 10.2. Media Type application/http 1826 The application/http media type can be used to enclose a pipeline of 1827 one or more HTTP request or response messages (not intermixed). 1829 Type name: application 1831 Subtype name: http 1833 Required parameters: N/A 1835 Optional parameters: version, msgtype 1837 version: The HTTP-version number of the enclosed messages (e.g., 1838 "1.1"). If not present, the version can be determined from the 1839 first line of the body. 1841 msgtype: The message type -- "request" or "response". If not 1842 present, the type can be determined from the first line of the 1843 body. 1845 Encoding considerations: HTTP messages enclosed by this type are in 1846 "binary" format; use of an appropriate Content-Transfer-Encoding 1847 is required when transmitted via email. 1849 Security considerations: see Section 11 1851 Interoperability considerations: N/A 1853 Published specification: This specification (see Section 10.2). 1855 Applications that use this media type: N/A 1857 Fragment identifier considerations: N/A 1859 Additional information: 1861 Deprecated alias names for this type: N/A 1863 Magic number(s): N/A 1865 File extension(s): N/A 1867 Macintosh file type code(s): N/A 1869 Person and email address to contact for further information: 1870 See Authors' Addresses section. 1872 Intended usage: COMMON 1874 Restrictions on usage: N/A 1876 Author: See Authors' Addresses section. 1878 Change controller: IESG 1880 11. Security Considerations 1882 This section is meant to inform developers, information providers, 1883 and users of known security considerations relevant to HTTP message 1884 syntax, parsing, and routing. Security considerations about HTTP 1885 semantics and payloads are addressed in [Semantics]. 1887 11.1. Response Splitting 1889 Response splitting (a.k.a, CRLF injection) is a common technique, 1890 used in various attacks on Web usage, that exploits the line-based 1891 nature of HTTP message framing and the ordered association of 1892 requests to responses on persistent connections [Klein]. This 1893 technique can be particularly damaging when the requests pass through 1894 a shared cache. 1896 Response splitting exploits a vulnerability in servers (usually 1897 within an application server) where an attacker can send encoded data 1898 within some parameter of the request that is later decoded and echoed 1899 within any of the response header fields of the response. If the 1900 decoded data is crafted to look like the response has ended and a 1901 subsequent response has begun, the response has been split and the 1902 content within the apparent second response is controlled by the 1903 attacker. The attacker can then make any other request on the same 1904 persistent connection and trick the recipients (including 1905 intermediaries) into believing that the second half of the split is 1906 an authoritative answer to the second request. 1908 For example, a parameter within the request-target might be read by 1909 an application server and reused within a redirect, resulting in the 1910 same parameter being echoed in the Location header field of the 1911 response. If the parameter is decoded by the application and not 1912 properly encoded when placed in the response field, the attacker can 1913 send encoded CRLF octets and other content that will make the 1914 application's single response look like two or more responses. 1916 A common defense against response splitting is to filter requests for 1917 data that looks like encoded CR and LF (e.g., "%0D" and "%0A"). 1918 However, that assumes the application server is only performing URI 1919 decoding, rather than more obscure data transformations like charset 1920 transcoding, XML entity translation, base64 decoding, sprintf 1921 reformatting, etc. A more effective mitigation is to prevent 1922 anything other than the server's core protocol libraries from sending 1923 a CR or LF within the header section, which means restricting the 1924 output of header fields to APIs that filter for bad octets and not 1925 allowing application servers to write directly to the protocol 1926 stream. 1928 11.2. Request Smuggling 1930 Request smuggling ([Linhart]) is a technique that exploits 1931 differences in protocol parsing among various recipients to hide 1932 additional requests (which might otherwise be blocked or disabled by 1933 policy) within an apparently harmless request. Like response 1934 splitting, request smuggling can lead to a variety of attacks on HTTP 1935 usage. 1937 This specification has introduced new requirements on request 1938 parsing, particularly with regard to message framing in Section 6.3, 1939 to reduce the effectiveness of request smuggling. 1941 11.3. Message Integrity 1943 HTTP does not define a specific mechanism for ensuring message 1944 integrity, instead relying on the error-detection ability of 1945 underlying transport protocols and the use of length or chunk- 1946 delimited framing to detect completeness. Additional integrity 1947 mechanisms, such as hash functions or digital signatures applied to 1948 the content, can be selectively added to messages via extensible 1949 metadata header fields. Historically, the lack of a single integrity 1950 mechanism has been justified by the informal nature of most HTTP 1951 communication. However, the prevalence of HTTP as an information 1952 access mechanism has resulted in its increasing use within 1953 environments where verification of message integrity is crucial. 1955 User agents are encouraged to implement configurable means for 1956 detecting and reporting failures of message integrity such that those 1957 means can be enabled within environments for which integrity is 1958 necessary. For example, a browser being used to view medical history 1959 or drug interaction information needs to indicate to the user when 1960 such information is detected by the protocol to be incomplete, 1961 expired, or corrupted during transfer. Such mechanisms might be 1962 selectively enabled via user agent extensions or the presence of 1963 message integrity metadata in a response. At a minimum, user agents 1964 ought to provide some indication that allows a user to distinguish 1965 between a complete and incomplete response message (Section 8) when 1966 such verification is desired. 1968 11.4. Message Confidentiality 1970 HTTP relies on underlying transport protocols to provide message 1971 confidentiality when that is desired. HTTP has been specifically 1972 designed to be independent of the transport protocol, such that it 1973 can be used over many different forms of encrypted connection, with 1974 the selection of such transports being identified by the choice of 1975 URI scheme or within user agent configuration. 1977 The "https" scheme can be used to identify resources that require a 1978 confidential connection, as described in Section 2.5.2 of 1979 [Semantics]. 1981 12. IANA Considerations 1983 The change controller for the following registrations is: "IETF 1984 (iesg@ietf.org) - Internet Engineering Task Force". 1986 12.1. Header Field Registration 1988 Please update the "Hypertext Transfer Protocol (HTTP) Header Field 1989 Registry" registry at 1990 with the header field names listed in the two tables of Section 5. 1992 12.2. Media Type Registration 1994 Please update the "Media Types" registry at 1995 with the registration 1996 information in Section 10.1 and Section 10.2 for the media types 1997 "message/http" and "application/http", respectively. 1999 12.3. Transfer Coding Registration 2001 Please update the "HTTP Transfer Coding Registry" at 2002 with the 2003 registration procedure of Section 7.3 and the content coding names 2004 summarized in the table of Section 7. 2006 12.4. Upgrade Token Registration 2008 Please update the "Hypertext Transfer Protocol (HTTP) Upgrade Token 2009 Registry" at 2010 with the registration procedure of Section 9.8.2 and the upgrade 2011 token names summarized in the table of Section 9.8.1. 2013 13. References 2015 13.1. Normative References 2017 [Caching] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 2018 Ed., "HTTP Caching", draft-ietf-httpbis-cache-05 (work in 2019 progress), July 2019. 2021 [RFC1950] Deutsch, L. and J-L. Gailly, "ZLIB Compressed Data Format 2022 Specification version 3.3", RFC 1950, 2023 DOI 10.17487/RFC1950, May 1996, 2024 . 2026 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 2027 version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996, 2028 . 2030 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. 2031 Randers-Pehrson, "GZIP file format specification version 2032 4.3", RFC 1952, DOI 10.17487/RFC1952, May 1996, 2033 . 2035 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2036 Requirement Levels", BCP 14, RFC 2119, 2037 DOI 10.17487/RFC2119, March 1997, 2038 . 2040 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2041 Resource Identifier (URI): Generic Syntax", STD 66, 2042 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2043 . 2045 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 2046 Specifications: ABNF", STD 68, RFC 5234, 2047 DOI 10.17487/RFC5234, January 2008, 2048 . 2050 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 2051 RFC 7405, DOI 10.17487/RFC7405, December 2014, 2052 . 2054 [Semantics] 2055 Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 2056 Ed., "HTTP Semantics", draft-ietf-httpbis-semantics-05 2057 (work in progress), July 2019. 2059 [USASCII] American National Standards Institute, "Coded Character 2060 Set -- 7-bit American Standard Code for Information 2061 Interchange", ANSI X3.4, 1986. 2063 [Welch] Welch, T., "A Technique for High-Performance Data 2064 Compression", IEEE Computer 17(6), June 1984. 2066 13.2. Informative References 2068 [Err4667] RFC Errata, Erratum ID 4667, RFC 7230, 2069 . 2071 [Klein] Klein, A., "Divide and Conquer - HTTP Response Splitting, 2072 Web Cache Poisoning Attacks, and Related Topics", March 2073 2004, . 2076 [Linhart] Linhart, C., Klein, A., Heled, R., and S. Orrin, "HTTP 2077 Request Smuggling", June 2005, 2078 . 2080 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, "Hypertext 2081 Transfer Protocol -- HTTP/1.0", RFC 1945, 2082 DOI 10.17487/RFC1945, May 1996, 2083 . 2085 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2086 Extensions (MIME) Part One: Format of Internet Message 2087 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 2088 . 2090 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2091 Extensions (MIME) Part Two: Media Types", RFC 2046, 2092 DOI 10.17487/RFC2046, November 1996, 2093 . 2095 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2096 Extensions (MIME) Part Five: Conformance Criteria and 2097 Examples", RFC 2049, DOI 10.17487/RFC2049, November 1996, 2098 . 2100 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 2101 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 2102 RFC 2068, DOI 10.17487/RFC2068, January 1997, 2103 . 2105 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 2106 "MIME Encapsulation of Aggregate Documents, such as HTML 2107 (MHTML)", RFC 2557, DOI 10.17487/RFC2557, March 1999, 2108 . 2110 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 2111 DOI 10.17487/RFC5322, October 2008, 2112 . 2114 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 2115 DOI 10.17487/RFC6265, April 2011, 2116 . 2118 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2119 Protocol (HTTP/1.1): Message Syntax and Routing", 2120 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2121 . 2123 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2124 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 2125 DOI 10.17487/RFC7231, June 2014, 2126 . 2128 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2129 Writing an IANA Considerations Section in RFCs", BCP 26, 2130 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2131 . 2133 Appendix A. Collected ABNF 2135 In the collected ABNF below, list rules are expanded as per 2136 Section 11 of [Semantics]. 2138 BWS = 2140 Connection = [ connection-option ] *( OWS "," OWS [ connection-option 2141 ] ) 2143 HTTP-message = start-line *( header-field CRLF ) CRLF [ message-body 2144 ] 2145 HTTP-name = %x48.54.54.50 ; HTTP 2146 HTTP-version = HTTP-name "/" DIGIT "." DIGIT 2148 OWS = 2150 RWS = 2152 TE = [ t-codings ] *( OWS "," OWS [ t-codings ] ) 2153 Transfer-Encoding = [ transfer-coding ] *( OWS "," OWS [ 2154 transfer-coding ] ) 2156 Upgrade = [ protocol ] *( OWS "," OWS [ protocol ] ) 2158 absolute-URI = 2159 absolute-form = absolute-URI 2160 absolute-path = 2161 asterisk-form = "*" 2162 authority = 2163 authority-form = authority 2165 chunk = chunk-size [ chunk-ext ] CRLF chunk-data CRLF 2166 chunk-data = 1*OCTET 2167 chunk-ext = *( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val 2168 ] ) 2169 chunk-ext-name = token 2170 chunk-ext-val = token / quoted-string 2171 chunk-size = 1*HEXDIG 2172 chunked-body = *chunk last-chunk trailer-part CRLF 2173 comment = 2174 connection-option = token 2176 field-name = 2177 field-value = 2179 header-field = field-name ":" OWS field-value OWS 2180 last-chunk = 1*"0" [ chunk-ext ] CRLF 2182 message-body = *OCTET 2183 method = token 2185 obs-fold = OWS CRLF RWS 2186 obs-text = 2187 origin-form = absolute-path [ "?" query ] 2189 port = 2190 protocol = protocol-name [ "/" protocol-version ] 2191 protocol-name = token 2192 protocol-version = token 2194 query = 2195 quoted-string = 2197 rank = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 2198 reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) 2199 request-line = method SP request-target SP HTTP-version CRLF 2200 request-target = origin-form / absolute-form / authority-form / 2201 asterisk-form 2203 start-line = request-line / status-line 2204 status-code = 3DIGIT 2205 status-line = HTTP-version SP status-code SP [ reason-phrase ] CRLF 2207 t-codings = "trailers" / ( transfer-coding [ t-ranking ] ) 2208 t-ranking = OWS ";" OWS "q=" rank 2209 token = 2210 trailer-part = *( header-field CRLF ) 2211 transfer-coding = token *( OWS ";" OWS transfer-parameter ) 2212 transfer-parameter = token BWS "=" BWS ( token / quoted-string ) 2214 uri-host = 2216 Appendix B. Differences between HTTP and MIME 2218 HTTP/1.1 uses many of the constructs defined for the Internet Message 2219 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 2220 [RFC2045] to allow a message body to be transmitted in an open 2221 variety of representations and with extensible header fields. 2222 However, RFC 2045 is focused only on email; applications of HTTP have 2223 many characteristics that differ from email; hence, HTTP has features 2224 that differ from MIME. These differences were carefully chosen to 2225 optimize performance over binary connections, to allow greater 2226 freedom in the use of new media types, to make date comparisons 2227 easier, and to acknowledge the practice of some early HTTP servers 2228 and clients. 2230 This appendix describes specific areas where HTTP differs from MIME. 2231 Proxies and gateways to and from strict MIME environments need to be 2232 aware of these differences and provide the appropriate conversions 2233 where necessary. 2235 B.1. MIME-Version 2237 HTTP is not a MIME-compliant protocol. However, messages can include 2238 a single MIME-Version header field to indicate what version of the 2239 MIME protocol was used to construct the message. Use of the MIME- 2240 Version header field indicates that the message is in full 2241 conformance with the MIME protocol (as defined in [RFC2045]). 2242 Senders are responsible for ensuring full conformance (where 2243 possible) when exporting HTTP messages to strict MIME environments. 2245 B.2. Conversion to Canonical Form 2247 MIME requires that an Internet mail body part be converted to 2248 canonical form prior to being transferred, as described in Section 4 2249 of [RFC2049]. Section 6.1.1.2 of [Semantics] describes the forms 2250 allowed for subtypes of the "text" media type when transmitted over 2251 HTTP. [RFC2046] requires that content with a type of "text" 2252 represent line breaks as CRLF and forbids the use of CR or LF outside 2253 of line break sequences. HTTP allows CRLF, bare CR, and bare LF to 2254 indicate a line break within text content. 2256 A proxy or gateway from HTTP to a strict MIME environment ought to 2257 translate all line breaks within text media types to the RFC 2049 2258 canonical form of CRLF. Note, however, this might be complicated by 2259 the presence of a Content-Encoding and by the fact that HTTP allows 2260 the use of some charsets that do not use octets 13 and 10 to 2261 represent CR and LF, respectively. 2263 Conversion will break any cryptographic checksums applied to the 2264 original content unless the original content is already in canonical 2265 form. Therefore, the canonical form is recommended for any content 2266 that uses such checksums in HTTP. 2268 B.3. Conversion of Date Formats 2270 HTTP/1.1 uses a restricted set of date formats (Section 10.1.1.1 of 2271 [Semantics]) to simplify the process of date comparison. Proxies and 2272 gateways from other protocols ought to ensure that any Date header 2273 field present in a message conforms to one of the HTTP/1.1 formats 2274 and rewrite the date if necessary. 2276 B.4. Conversion of Content-Encoding 2278 MIME does not include any concept equivalent to HTTP/1.1's Content- 2279 Encoding header field. Since this acts as a modifier on the media 2280 type, proxies and gateways from HTTP to MIME-compliant protocols 2281 ought to either change the value of the Content-Type header field or 2282 decode the representation before forwarding the message. (Some 2283 experimental applications of Content-Type for Internet mail have used 2284 a media-type parameter of ";conversions=" to perform 2285 a function equivalent to Content-Encoding. However, this parameter 2286 is not part of the MIME standards). 2288 B.5. Conversion of Content-Transfer-Encoding 2290 HTTP does not use the Content-Transfer-Encoding field of MIME. 2291 Proxies and gateways from MIME-compliant protocols to HTTP need to 2292 remove any Content-Transfer-Encoding prior to delivering the response 2293 message to an HTTP client. 2295 Proxies and gateways from HTTP to MIME-compliant protocols are 2296 responsible for ensuring that the message is in the correct format 2297 and encoding for safe transport on that protocol, where "safe 2298 transport" is defined by the limitations of the protocol being used. 2299 Such a proxy or gateway ought to transform and label the data with an 2300 appropriate Content-Transfer-Encoding if doing so will improve the 2301 likelihood of safe transport over the destination protocol. 2303 B.6. MHTML and Line Length Limitations 2305 HTTP implementations that share code with MHTML [RFC2557] 2306 implementations need to be aware of MIME line length limitations. 2307 Since HTTP does not have this limitation, HTTP does not fold long 2308 lines. MHTML messages being transported by HTTP follow all 2309 conventions of MHTML, including line length limitations and folding, 2310 canonicalization, etc., since HTTP transfers message-bodies as 2311 payload and, aside from the "multipart/byteranges" type 2312 (Section 6.3.4 of [Semantics]), does not interpret the content or any 2313 MIME header lines that might be contained therein. 2315 Appendix C. HTTP Version History 2317 HTTP has been in use since 1990. The first version, later referred 2318 to as HTTP/0.9, was a simple protocol for hypertext data transfer 2319 across the Internet, using only a single request method (GET) and no 2320 metadata. HTTP/1.0, as defined by [RFC1945], added a range of 2321 request methods and MIME-like messaging, allowing for metadata to be 2322 transferred and modifiers placed on the request/response semantics. 2323 However, HTTP/1.0 did not sufficiently take into consideration the 2324 effects of hierarchical proxies, caching, the need for persistent 2325 connections, or name-based virtual hosts. The proliferation of 2326 incompletely implemented applications calling themselves "HTTP/1.0" 2327 further necessitated a protocol version change in order for two 2328 communicating applications to determine each other's true 2329 capabilities. 2331 HTTP/1.1 remains compatible with HTTP/1.0 by including more stringent 2332 requirements that enable reliable implementations, adding only those 2333 features that can either be safely ignored by an HTTP/1.0 recipient 2334 or only be sent when communicating with a party advertising 2335 conformance with HTTP/1.1. 2337 HTTP/1.1 has been designed to make supporting previous versions easy. 2338 A general-purpose HTTP/1.1 server ought to be able to understand any 2339 valid request in the format of HTTP/1.0, responding appropriately 2340 with an HTTP/1.1 message that only uses features understood (or 2341 safely ignored) by HTTP/1.0 clients. Likewise, an HTTP/1.1 client 2342 can be expected to understand any valid HTTP/1.0 response. 2344 Since HTTP/0.9 did not support header fields in a request, there is 2345 no mechanism for it to support name-based virtual hosts (selection of 2346 resource by inspection of the Host header field). Any server that 2347 implements name-based virtual hosts ought to disable support for 2348 HTTP/0.9. Most requests that appear to be HTTP/0.9 are, in fact, 2349 badly constructed HTTP/1.x requests caused by a client failing to 2350 properly encode the request-target. 2352 C.1. Changes from HTTP/1.0 2354 This section summarizes major differences between versions HTTP/1.0 2355 and HTTP/1.1. 2357 C.1.1. Multihomed Web Servers 2359 The requirements that clients and servers support the Host header 2360 field (Section 5.4 of [Semantics]), report an error if it is missing 2361 from an HTTP/1.1 request, and accept absolute URIs (Section 3.2) are 2362 among the most important changes defined by HTTP/1.1. 2364 Older HTTP/1.0 clients assumed a one-to-one relationship of IP 2365 addresses and servers; there was no other established mechanism for 2366 distinguishing the intended server of a request than the IP address 2367 to which that request was directed. The Host header field was 2368 introduced during the development of HTTP/1.1 and, though it was 2369 quickly implemented by most HTTP/1.0 browsers, additional 2370 requirements were placed on all HTTP/1.1 requests in order to ensure 2371 complete adoption. At the time of this writing, most HTTP-based 2372 services are dependent upon the Host header field for targeting 2373 requests. 2375 C.1.2. Keep-Alive Connections 2377 In HTTP/1.0, each connection is established by the client prior to 2378 the request and closed by the server after sending the response. 2379 However, some implementations implement the explicitly negotiated 2380 ("Keep-Alive") version of persistent connections described in 2381 Section 19.7.1 of [RFC2068]. 2383 Some clients and servers might wish to be compatible with these 2384 previous approaches to persistent connections, by explicitly 2385 negotiating for them with a "Connection: keep-alive" request header 2386 field. However, some experimental implementations of HTTP/1.0 2387 persistent connections are faulty; for example, if an HTTP/1.0 proxy 2388 server doesn't understand Connection, it will erroneously forward 2389 that header field to the next inbound server, which would result in a 2390 hung connection. 2392 One attempted solution was the introduction of a Proxy-Connection 2393 header field, targeted specifically at proxies. In practice, this 2394 was also unworkable, because proxies are often deployed in multiple 2395 layers, bringing about the same problem discussed above. 2397 As a result, clients are encouraged not to send the Proxy-Connection 2398 header field in any requests. 2400 Clients are also encouraged to consider the use of Connection: keep- 2401 alive in requests carefully; while they can enable persistent 2402 connections with HTTP/1.0 servers, clients using them will need to 2403 monitor the connection for "hung" requests (which indicate that the 2404 client ought stop sending the header field), and this mechanism ought 2405 not be used by clients at all when a proxy is being used. 2407 C.1.3. Introduction of Transfer-Encoding 2409 HTTP/1.1 introduces the Transfer-Encoding header field (Section 6.1). 2410 Transfer codings need to be decoded prior to forwarding an HTTP 2411 message over a MIME-compliant protocol. 2413 C.2. Changes from RFC 7230 2415 Most of the sections introducing HTTP's design goals, history, 2416 architecture, conformance criteria, protocol versioning, URIs, 2417 message routing, and header field values have been moved to 2418 [Semantics]. This document has been reduced to just the messaging 2419 syntax and connection management requirements specific to HTTP/1.1. 2421 Furthermore: 2423 In the ABNF for chunked extensions, re-introduce (bad) whitespace 2424 around ";" and "=". Whitespace was removed in [RFC7230], but later 2425 this change was found to break existing implementations (see 2426 [Err4667]). (Section 7.1.1) 2428 Disallow transfer coding parameters called "q" in order to avoid 2429 conflicts with the use of ranks in the TE header field. 2430 (Section 7.3) 2432 Appendix D. Change Log 2434 This section is to be removed before publishing as an RFC. 2436 D.1. Between RFC7230 and draft 00 2438 The changes were purely editorial: 2440 o Change boilerplate and abstract to indicate the "draft" status, 2441 and update references to ancestor specifications. 2443 o Adjust historical notes. 2445 o Update links to sibling specifications. 2447 o Replace sections listing changes from RFC 2616 by new empty 2448 sections referring to RFC 723x. 2450 o Remove acknowledgements specific to RFC 723x. 2452 o Move "Acknowledgements" to the very end and make them unnumbered. 2454 D.2. Since draft-ietf-httpbis-messaging-00 2456 The changes in this draft are editorial, with respect to HTTP as a 2457 whole, to move all core HTTP semantics into [Semantics]: 2459 o Moved introduction, architecture, conformance, and ABNF extensions 2460 from RFC 7230 (Messaging) to semantics [Semantics]. 2462 o Moved discussion of MIME differences from RFC 7231 (Semantics) to 2463 Appendix B since they mostly cover transforming 1.1 messages. 2465 o Moved all extensibility tips, registration procedures, and 2466 registry tables from the IANA considerations to normative 2467 sections, reducing the IANA considerations to just instructions 2468 that will be removed prior to publication as an RFC. 2470 D.3. Since draft-ietf-httpbis-messaging-01 2472 o Cite RFC 8126 instead of RFC 5226 () 2475 o Resolved erratum 4779, no change needed here 2476 (, 2477 ) 2479 o In Section 7, fixed prose claiming transfer parameters allow bare 2480 names (, 2481 ) 2483 o Resolved erratum 4225, no change needed here 2484 (, 2485 ) 2487 o Replace "response code" with "response status code" 2488 (, 2489 ) 2491 o In Section 9.4, clarify statement about HTTP/1.0 keep-alive 2492 (, 2493 ) 2495 o In Section 7.1.1, re-introduce (bad) whitespace around ";" and "=" 2496 (, 2497 , ) 2500 o In Section 7.3, state that transfer codings should not use 2501 parameters named "q" (, ) 2504 o In Section 7, mark coding name "trailers" as reserved in the IANA 2505 registry () 2507 D.4. Since draft-ietf-httpbis-messaging-02 2509 o In Section 4, explain why the reason phrase should be ignored by 2510 clients (). 2512 o Add Section 9.3 to explain how request/response correlation is 2513 performed () 2515 D.5. Since draft-ietf-httpbis-messaging-03 2517 o In Section 9.3, caution against treating data on a connection as 2518 part of a not-yet-issued request () 2521 o In Section 7, remove the predefined codings from the ABNF and make 2522 it generic instead () 2525 o Use RFC 7405 ABNF notation for case-sensitive string constants 2526 () 2528 D.6. Since draft-ietf-httpbis-messaging-04 2530 o In Section 9.8, clarify that protocol-name is to be matched case- 2531 insensitively () 2533 o In Section 5.2, add leading optional whitespace to obs-fold ABNF 2534 (, 2535 ) 2537 o In Section 4, add clarifications about empty reason phrases 2538 () 2540 o Move discussion of retries from Section 9.4.1 into [Semantics] 2541 () 2543 Index 2545 A 2546 absolute-form (of request-target) 11 2547 application/http Media Type 40 2548 asterisk-form (of request-target) 12 2549 authority-form (of request-target) 11 2551 C 2552 Connection header field 29, 34 2553 Content-Length header field 19 2554 Content-Transfer-Encoding header field 50 2555 chunked (Coding Format) 17, 19 2556 chunked (transfer coding) 22 2557 close 29, 34 2558 compress (transfer coding) 25 2560 D 2561 deflate (transfer coding) 25 2563 E 2564 effective request URI 12 2566 G 2567 Grammar 2568 absolute-form 10-11 2569 ALPHA 5 2570 asterisk-form 10, 12 2571 authority-form 10-11 2572 chunk 23 2573 chunk-data 23 2574 chunk-ext 23 2575 chunk-ext-name 23 2576 chunk-ext-val 23 2577 chunk-size 23 2578 chunked-body 23 2579 Connection 29 2580 connection-option 29 2581 CR 5 2582 CRLF 5 2583 CTL 5 2584 DIGIT 5 2585 DQUOTE 5 2586 field-name 15 2587 field-value 15 2588 header-field 15, 24 2589 HEXDIG 5 2590 HTAB 5 2591 HTTP-message 6 2592 HTTP-name 7 2593 HTTP-version 7 2594 last-chunk 23 2595 LF 5 2596 message-body 17 2597 method 9 2598 obs-fold 16 2599 OCTET 5 2600 origin-form 10 2601 rank 27 2602 reason-phrase 14 2603 request-line 9 2604 request-target 10 2605 SP 5 2606 start-line 6 2607 status-code 14 2608 status-line 14 2609 t-codings 27 2610 t-ranking 27 2611 TE 27 2612 trailer-part 23-24 2613 transfer-coding 21 2614 Transfer-Encoding 17 2615 transfer-parameter 22 2616 Upgrade 35 2617 VCHAR 5 2618 gzip (transfer coding) 25 2620 H 2621 header field 6 2622 header section 6 2623 headers 6 2625 M 2626 MIME-Version header field 49 2627 Media Type 2628 application/http 40 2629 message/http 38 2630 message/http Media Type 38 2631 method 9 2633 O 2634 origin-form (of request-target) 10 2636 R 2637 request-target 10 2639 T 2640 TE header field 26 2641 Transfer-Encoding header field 17 2643 U 2644 Upgrade header field 35 2646 X 2647 x-compress (transfer coding) 25 2648 x-gzip (transfer coding) 25 2650 Acknowledgments 2652 See Appendix "Acknowledgments" of [Semantics]. 2654 Authors' Addresses 2655 Roy T. Fielding (editor) 2656 Adobe 2657 345 Park Ave 2658 San Jose, CA 95110 2659 USA 2661 EMail: fielding@gbiv.com 2662 URI: https://roy.gbiv.com/ 2664 Mark Nottingham (editor) 2665 Fastly 2667 EMail: mnot@mnot.net 2668 URI: https://www.mnot.net/ 2670 Julian F. Reschke (editor) 2671 greenbytes GmbH 2672 Hafenweg 16 2673 Muenster, NW 48155 2674 Germany 2676 EMail: julian.reschke@greenbytes.de 2677 URI: https://greenbytes.de/tech/webdav/