idnits 2.17.1 draft-ietf-httpbis-messaging-19.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: ---------------------------------------------------------------------------- == There is 1 instance of lines with non-ascii characters in the document. 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 (10 September 2021) is 957 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) -- Possible downref: Normative reference to a draft: ref. 'CACHING' -- Possible downref: Normative reference to a draft: ref. 'HTTP' ** 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 -- 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) Summary: 3 errors (**), 0 flaws (~~), 3 warnings (==), 10 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: 14 March 2022 J. Reschke, Ed. 7 greenbytes 8 10 September 2021 10 HTTP/1.1 11 draft-ietf-httpbis-messaging-19 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.20. 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 14 March 2022. 54 Copyright Notice 56 Copyright (c) 2021 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 (https://trustee.ietf.org/ 61 license-info) in effect on the date of publication of this document. 62 Please review these documents carefully, as they describe your rights 63 and restrictions with respect to this document. Code Components 64 extracted from this document must include Simplified BSD License text 65 as described in Section 4.e of the Trust Legal Provisions and are 66 provided without warranty as described in the Simplified BSD License. 68 This document may contain material from IETF Documents or IETF 69 Contributions published or made publicly available before November 70 10, 2008. The person(s) controlling the copyright in some of this 71 material may not have granted the IETF Trust the right to allow 72 modifications of such material outside the IETF Standards Process. 73 Without obtaining an adequate license from the person(s) controlling 74 the copyright in such materials, this document may not be modified 75 outside the IETF Standards Process, and derivative works of it may 76 not be created outside the IETF Standards Process, except to format 77 it for publication as an RFC or to translate it into languages other 78 than English. 80 Table of Contents 82 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 83 1.1. Requirements Notation . . . . . . . . . . . . . . . . . . 5 84 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 5 85 2. Message . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 86 2.1. Message Format . . . . . . . . . . . . . . . . . . . . . 6 87 2.2. Message Parsing . . . . . . . . . . . . . . . . . . . . . 7 88 2.3. HTTP Version . . . . . . . . . . . . . . . . . . . . . . 8 89 3. Request Line . . . . . . . . . . . . . . . . . . . . . . . . 9 90 3.1. Method . . . . . . . . . . . . . . . . . . . . . . . . . 10 91 3.2. Request Target . . . . . . . . . . . . . . . . . . . . . 10 92 3.2.1. origin-form . . . . . . . . . . . . . . . . . . . . . 11 93 3.2.2. absolute-form . . . . . . . . . . . . . . . . . . . . 11 94 3.2.3. authority-form . . . . . . . . . . . . . . . . . . . 12 95 3.2.4. asterisk-form . . . . . . . . . . . . . . . . . . . . 12 96 3.3. Reconstructing the Target URI . . . . . . . . . . . . . . 13 97 4. Status Line . . . . . . . . . . . . . . . . . . . . . . . . . 15 98 5. Field Syntax . . . . . . . . . . . . . . . . . . . . . . . . 16 99 5.1. Field Line Parsing . . . . . . . . . . . . . . . . . . . 16 100 5.2. Obsolete Line Folding . . . . . . . . . . . . . . . . . . 17 101 6. Message Body . . . . . . . . . . . . . . . . . . . . . . . . 17 102 6.1. Transfer-Encoding . . . . . . . . . . . . . . . . . . . . 18 103 6.2. Content-Length . . . . . . . . . . . . . . . . . . . . . 20 104 6.3. Message Body Length . . . . . . . . . . . . . . . . . . . 20 105 7. Transfer Codings . . . . . . . . . . . . . . . . . . . . . . 23 106 7.1. Chunked Transfer Coding . . . . . . . . . . . . . . . . . 23 107 7.1.1. Chunk Extensions . . . . . . . . . . . . . . . . . . 24 108 7.1.2. Chunked Trailer Section . . . . . . . . . . . . . . . 25 109 7.1.3. Decoding Chunked . . . . . . . . . . . . . . . . . . 25 110 7.2. Transfer Codings for Compression . . . . . . . . . . . . 26 111 7.3. Transfer Coding Registry . . . . . . . . . . . . . . . . 26 112 7.4. Negotiating Transfer Codings . . . . . . . . . . . . . . 27 113 8. Handling Incomplete Messages . . . . . . . . . . . . . . . . 28 114 9. Connection Management . . . . . . . . . . . . . . . . . . . . 29 115 9.1. Establishment . . . . . . . . . . . . . . . . . . . . . . 29 116 9.2. Associating a Response to a Request . . . . . . . . . . . 29 117 9.3. Persistence . . . . . . . . . . . . . . . . . . . . . . . 30 118 9.3.1. Retrying Requests . . . . . . . . . . . . . . . . . . 31 119 9.3.2. Pipelining . . . . . . . . . . . . . . . . . . . . . 31 120 9.4. Concurrency . . . . . . . . . . . . . . . . . . . . . . . 32 121 9.5. Failures and Timeouts . . . . . . . . . . . . . . . . . . 32 122 9.6. Tear-down . . . . . . . . . . . . . . . . . . . . . . . . 33 123 9.7. TLS Connection Initiation . . . . . . . . . . . . . . . . 35 124 9.8. TLS Connection Closure . . . . . . . . . . . . . . . . . 35 125 10. Enclosing Messages as Data . . . . . . . . . . . . . . . . . 36 126 10.1. Media Type message/http . . . . . . . . . . . . . . . . 36 127 10.2. Media Type application/http . . . . . . . . . . . . . . 37 128 11. Security Considerations . . . . . . . . . . . . . . . . . . . 38 129 11.1. Response Splitting . . . . . . . . . . . . . . . . . . . 38 130 11.2. Request Smuggling . . . . . . . . . . . . . . . . . . . 39 131 11.3. Message Integrity . . . . . . . . . . . . . . . . . . . 40 132 11.4. Message Confidentiality . . . . . . . . . . . . . . . . 40 133 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 41 134 12.1. Field Name Registration . . . . . . . . . . . . . . . . 41 135 12.2. Media Type Registration . . . . . . . . . . . . . . . . 41 136 12.3. Transfer Coding Registration . . . . . . . . . . . . . . 41 137 12.4. ALPN Protocol ID Registration . . . . . . . . . . . . . 42 138 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 43 139 13.1. Normative References . . . . . . . . . . . . . . . . . . 43 140 13.2. Informative References . . . . . . . . . . . . . . . . . 44 141 Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 45 142 Appendix B. Differences between HTTP and MIME . . . . . . . . . 47 143 B.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . 47 144 B.2. Conversion to Canonical Form . . . . . . . . . . . . . . 47 145 B.3. Conversion of Date Formats . . . . . . . . . . . . . . . 48 146 B.4. Conversion of Content-Encoding . . . . . . . . . . . . . 48 147 B.5. Conversion of Content-Transfer-Encoding . . . . . . . . . 48 148 B.6. MHTML and Line Length Limitations . . . . . . . . . . . . 48 149 Appendix C. Changes from previous RFCs . . . . . . . . . . . . . 49 150 C.1. Changes from HTTP/0.9 . . . . . . . . . . . . . . . . . . 49 151 C.2. Changes from HTTP/1.0 . . . . . . . . . . . . . . . . . . 49 152 C.2.1. Multihomed Web Servers . . . . . . . . . . . . . . . 49 153 C.2.2. Keep-Alive Connections . . . . . . . . . . . . . . . 49 154 C.2.3. Introduction of Transfer-Encoding . . . . . . . . . . 50 155 C.3. Changes from RFC 7230 . . . . . . . . . . . . . . . . . . 50 156 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 51 157 D.1. Between RFC7230 and draft 00 . . . . . . . . . . . . . . 51 158 D.2. Since draft-ietf-httpbis-messaging-00 . . . . . . . . . . 51 159 D.3. Since draft-ietf-httpbis-messaging-01 . . . . . . . . . . 52 160 D.4. Since draft-ietf-httpbis-messaging-02 . . . . . . . . . . 52 161 D.5. Since draft-ietf-httpbis-messaging-03 . . . . . . . . . . 53 162 D.6. Since draft-ietf-httpbis-messaging-04 . . . . . . . . . . 53 163 D.7. Since draft-ietf-httpbis-messaging-05 . . . . . . . . . . 53 164 D.8. Since draft-ietf-httpbis-messaging-06 . . . . . . . . . . 54 165 D.9. Since draft-ietf-httpbis-messaging-07 . . . . . . . . . . 54 166 D.10. Since draft-ietf-httpbis-messaging-08 . . . . . . . . . . 54 167 D.11. Since draft-ietf-httpbis-messaging-09 . . . . . . . . . . 55 168 D.12. Since draft-ietf-httpbis-messaging-10 . . . . . . . . . . 55 169 D.13. Since draft-ietf-httpbis-messaging-11 . . . . . . . . . . 55 170 D.14. Since draft-ietf-httpbis-messaging-12 . . . . . . . . . . 55 171 D.15. Since draft-ietf-httpbis-messaging-13 . . . . . . . . . . 56 172 D.16. Since draft-ietf-httpbis-messaging-14 . . . . . . . . . . 56 173 D.17. Since draft-ietf-httpbis-messaging-15 . . . . . . . . . . 57 174 D.18. Since draft-ietf-httpbis-messaging-16 . . . . . . . . . . 57 175 D.19. Since draft-ietf-httpbis-messaging-17 . . . . . . . . . . 57 176 D.20. Since draft-ietf-httpbis-messaging-18 . . . . . . . . . . 57 177 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 58 178 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 179 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 60 181 1. Introduction 183 The Hypertext Transfer Protocol (HTTP) is a stateless application- 184 level request/response protocol that uses extensible semantics and 185 self-descriptive messages for flexible interaction with network-based 186 hypertext information systems. HTTP/1.1 is defined by: 188 * This document 190 * "HTTP Semantics" [HTTP] 191 * "HTTP Caching" [CACHING] 193 This document specifies how HTTP semantics are conveyed using the 194 HTTP/1.1 message syntax, framing and connection management 195 mechanisms. Its goal is to define the complete set of requirements 196 for HTTP/1.1 message parsers and message-forwarding intermediaries. 198 This document obsoletes the portions of RFC 7230 related to HTTP/1.1 199 messaging and connection management, with the changes being 200 summarized in Appendix C.3. The other parts of RFC 7230 are 201 obsoleted by "HTTP Semantics" [HTTP]. 203 1.1. Requirements Notation 205 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 206 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 207 "OPTIONAL" in this document are to be interpreted as described in BCP 208 14 [RFC2119] [RFC8174] when, and only when, they appear in all 209 capitals, as shown here. 211 Conformance criteria and considerations regarding error handling are 212 defined in Section 2 of [HTTP]. 214 1.2. Syntax Notation 216 This specification uses the Augmented Backus-Naur Form (ABNF) 217 notation of [RFC5234], extended with the notation for case- 218 sensitivity in strings defined in [RFC7405]. 220 It also uses a list extension, defined in Section 5.6.1 of [HTTP], 221 that allows for compact definition of comma-separated lists using a 222 '#' operator (similar to how the '*' operator indicates repetition). 223 Appendix A shows the collected grammar with all list operators 224 expanded to standard ABNF notation. 226 As a convention, ABNF rule names prefixed with "obs-" denote 227 "obsolete" grammar rules that appear for historical reasons. 229 The following core rules are included by reference, as defined in 230 [RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF 231 (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), 232 HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line 233 feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR (any 234 visible [USASCII] character). 236 The rules below are defined in [HTTP]: 238 BWS = 239 OWS = 240 RWS = 241 absolute-path = 242 field-name = 243 field-value = 244 obs-text = 245 quoted-string = 246 token = 247 transfer-coding = 248 250 The rules below are defined in [URI]: 252 absolute-URI = 253 authority = 254 uri-host = 255 port = 256 query = 258 2. Message 260 HTTP/1.1 clients and servers communicate by sending messages. See 261 Section 3 of [HTTP] for the general terminology and core concepts of 262 HTTP. 264 2.1. Message Format 266 An HTTP/1.1 message consists of a start-line followed by a CRLF and a 267 sequence of octets in a format similar to the Internet Message Format 268 [RFC5322]: zero or more header field lines (collectively referred to 269 as the "headers" or the "header section"), an empty line indicating 270 the end of the header section, and an optional message body. 272 HTTP-message = start-line CRLF 273 *( field-line CRLF ) 274 CRLF 275 [ message-body ] 277 A message can be either a request from client to server or a response 278 from server to client. Syntactically, the two types of message 279 differ only in the start-line, which is either a request-line (for 280 requests) or a status-line (for responses), and in the algorithm for 281 determining the length of the message body (Section 6). 283 start-line = request-line / status-line 285 In theory, a client could receive requests and a server could receive 286 responses, distinguishing them by their different start-line formats. 287 In practice, servers are implemented to only expect a request (a 288 response is interpreted as an unknown or invalid request method) and 289 clients are implemented to only expect a response. 291 HTTP makes use of some protocol elements similar to the Multipurpose 292 Internet Mail Extensions (MIME) [RFC2045]. See Appendix B for the 293 differences between HTTP and MIME messages. 295 2.2. Message Parsing 297 The normal procedure for parsing an HTTP message is to read the 298 start-line into a structure, read each header field line into a hash 299 table by field name until the empty line, and then use the parsed 300 data to determine if a message body is expected. If a message body 301 has been indicated, then it is read as a stream until an amount of 302 octets equal to the message body length is read or the connection is 303 closed. 305 A recipient MUST parse an HTTP message as a sequence of octets in an 306 encoding that is a superset of US-ASCII [USASCII]. Parsing an HTTP 307 message as a stream of Unicode characters, without regard for the 308 specific encoding, creates security vulnerabilities due to the 309 varying ways that string processing libraries handle invalid 310 multibyte character sequences that contain the octet LF (%x0A). 311 String-based parsers can only be safely used within protocol elements 312 after the element has been extracted from the message, such as within 313 a header field line value after message parsing has delineated the 314 individual field lines. 316 Although the line terminator for the start-line and fields is the 317 sequence CRLF, a recipient MAY recognize a single LF as a line 318 terminator and ignore any preceding CR. 320 A sender MUST NOT generate a bare CR (a CR character not immediately 321 followed by LF) within any protocol elements other than the content. 322 A recipient of such a bare CR MUST consider that element to be 323 invalid or replace each bare CR with SP before processing the element 324 or forwarding the message. 326 Older HTTP/1.0 user agent implementations might send an extra CRLF 327 after a POST request as a workaround for some early server 328 applications that failed to read message body content that was not 329 terminated by a line-ending. An HTTP/1.1 user agent MUST NOT preface 330 or follow a request with an extra CRLF. If terminating the request 331 message body with a line-ending is desired, then the user agent MUST 332 count the terminating CRLF octets as part of the message body length. 334 In the interest of robustness, a server that is expecting to receive 335 and parse a request-line SHOULD ignore at least one empty line (CRLF) 336 received prior to the request-line. 338 A sender MUST NOT send whitespace between the start-line and the 339 first header field. 341 A recipient that receives whitespace between the start-line and the 342 first header field MUST either reject the message as invalid or 343 consume each whitespace-preceded line without further processing of 344 it (i.e., ignore the entire line, along with any subsequent lines 345 preceded by whitespace, until a properly formed header field is 346 received or the header section is terminated). Rejection or removal 347 of invalid whitespace-preceded lines is necessary to prevent their 348 misinterpretation by downstream recipients that might be vulnerable 349 to request smuggling (Section 11.2) or response splitting 350 (Section 11.1) attacks. 352 When a server listening only for HTTP request messages, or processing 353 what appears from the start-line to be an HTTP request message, 354 receives a sequence of octets that does not match the HTTP-message 355 grammar aside from the robustness exceptions listed above, the server 356 SHOULD respond with a 400 (Bad Request) response and close the 357 connection. 359 2.3. HTTP Version 361 HTTP uses a "." numbering scheme to indicate versions 362 of the protocol. This specification defines version "1.1". 363 Section 2.5 of [HTTP] specifies the semantics of HTTP version 364 numbers. 366 The version of an HTTP/1.x message is indicated by an HTTP-version 367 field in the start-line. HTTP-version is case-sensitive. 369 HTTP-version = HTTP-name "/" DIGIT "." DIGIT 370 HTTP-name = %s"HTTP" 372 When an HTTP/1.1 message is sent to an HTTP/1.0 recipient [HTTP/1.0] 373 or a recipient whose version is unknown, the HTTP/1.1 message is 374 constructed such that it can be interpreted as a valid HTTP/1.0 375 message if all of the newer features are ignored. This specification 376 places recipient-version requirements on some new features so that a 377 conformant sender will only use compatible features until it has 378 determined, through configuration or the receipt of a message, that 379 the recipient supports HTTP/1.1. 381 Intermediaries that process HTTP messages (i.e., all intermediaries 382 other than those acting as tunnels) MUST send their own HTTP-version 383 in forwarded messages, unless it is purposefully downgraded as a 384 workaround for an upstream issue. In other words, an intermediary is 385 not allowed to blindly forward the start-line without ensuring that 386 the protocol version in that message matches a version to which that 387 intermediary is conformant for both the receiving and sending of 388 messages. Forwarding an HTTP message without rewriting the HTTP- 389 version might result in communication errors when downstream 390 recipients use the message sender's version to determine what 391 features are safe to use for later communication with that sender. 393 A server MAY send an HTTP/1.0 response to an HTTP/1.1 request if it 394 is known or suspected that the client incorrectly implements the HTTP 395 specification and is incapable of correctly processing later version 396 responses, such as when a client fails to parse the version number 397 correctly or when an intermediary is known to blindly forward the 398 HTTP-version even when it doesn't conform to the given minor version 399 of the protocol. Such protocol downgrades SHOULD NOT be performed 400 unless triggered by specific client attributes, such as when one or 401 more of the request header fields (e.g., User-Agent) uniquely match 402 the values sent by a client known to be in error. 404 3. Request Line 406 A request-line begins with a method token, followed by a single space 407 (SP), the request-target, another single space (SP), and ends with 408 the protocol version. 410 request-line = method SP request-target SP HTTP-version 412 Although the request-line grammar rule requires that each of the 413 component elements be separated by a single SP octet, recipients MAY 414 instead parse on whitespace-delimited word boundaries and, aside from 415 the CRLF terminator, treat any form of whitespace as the SP separator 416 while ignoring preceding or trailing whitespace; such whitespace 417 includes one or more of the following octets: SP, HTAB, VT (%x0B), FF 418 (%x0C), or bare CR. However, lenient parsing can result in request 419 smuggling security vulnerabilities if there are multiple recipients 420 of the message and each has its own unique interpretation of 421 robustness (see Section 11.2). 423 HTTP does not place a predefined limit on the length of a request- 424 line, as described in Section 2.3 of [HTTP]. A server that receives 425 a method longer than any that it implements SHOULD respond with a 501 426 (Not Implemented) status code. A server that receives a request- 427 target longer than any URI it wishes to parse MUST respond with a 414 428 (URI Too Long) status code (see Section 15.5.15 of [HTTP]). 430 Various ad hoc limitations on request-line length are found in 431 practice. It is RECOMMENDED that all HTTP senders and recipients 432 support, at a minimum, request-line lengths of 8000 octets. 434 3.1. Method 436 The method token indicates the request method to be performed on the 437 target resource. The request method is case-sensitive. 439 method = token 441 The request methods defined by this specification can be found in 442 Section 9 of [HTTP], along with information regarding the HTTP method 443 registry and considerations for defining new methods. 445 3.2. Request Target 447 The request-target identifies the target resource upon which to apply 448 the request. The client derives a request-target from its desired 449 target URI. There are four distinct formats for the request-target, 450 depending on both the method being requested and whether the request 451 is to a proxy. 453 request-target = origin-form 454 / absolute-form 455 / authority-form 456 / asterisk-form 458 No whitespace is allowed in the request-target. Unfortunately, some 459 user agents fail to properly encode or exclude whitespace found in 460 hypertext references, resulting in those disallowed characters being 461 sent as the request-target in a malformed request-line. 463 Recipients of an invalid request-line SHOULD respond with either a 464 400 (Bad Request) error or a 301 (Moved Permanently) redirect with 465 the request-target properly encoded. A recipient SHOULD NOT attempt 466 to autocorrect and then process the request without a redirect, since 467 the invalid request-line might be deliberately crafted to bypass 468 security filters along the request chain. 470 A client MUST send a Host header field (Section 7.2 of [HTTP]) in all 471 HTTP/1.1 request messages. If the target URI includes an authority 472 component, then a client MUST send a field value for Host that is 473 identical to that authority component, excluding any userinfo 474 subcomponent and its "@" delimiter (Section 4.2.1 of [HTTP]). If the 475 authority component is missing or undefined for the target URI, then 476 a client MUST send a Host header field with an empty field value. 478 A server MUST respond with a 400 (Bad Request) status code to any 479 HTTP/1.1 request message that lacks a Host header field and to any 480 request message that contains more than one Host header field line or 481 a Host header field with an invalid field value. 483 3.2.1. origin-form 485 The most common form of request-target is the _origin-form_. 487 origin-form = absolute-path [ "?" query ] 489 When making a request directly to an origin server, other than a 490 CONNECT or server-wide OPTIONS request (as detailed below), a client 491 MUST send only the absolute path and query components of the target 492 URI as the request-target. If the target URI's path component is 493 empty, the client MUST send "/" as the path within the origin-form of 494 request-target. A Host header field is also sent, as defined in 495 Section 7.2 of [HTTP]. 497 For example, a client wishing to retrieve a representation of the 498 resource identified as 500 http://www.example.org/where?q=now 502 directly from the origin server would open (or reuse) a TCP 503 connection to port 80 of the host "www.example.org" and send the 504 lines: 506 GET /where?q=now HTTP/1.1 507 Host: www.example.org 509 followed by the remainder of the request message. 511 3.2.2. absolute-form 513 When making a request to a proxy, other than a CONNECT or server-wide 514 OPTIONS request (as detailed below), a client MUST send the target 515 URI in _absolute-form_ as the request-target. 517 absolute-form = absolute-URI 519 The proxy is requested to either service that request from a valid 520 cache, if possible, or make the same request on the client's behalf 521 to either the next inbound proxy server or directly to the origin 522 server indicated by the request-target. Requirements on such 523 "forwarding" of messages are defined in Section 7.6 of [HTTP]. 525 An example absolute-form of request-line would be: 527 GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 529 A client MUST send a Host header field in an HTTP/1.1 request even if 530 the request-target is in the absolute-form, since this allows the 531 Host information to be forwarded through ancient HTTP/1.0 proxies 532 that might not have implemented Host. 534 When a proxy receives a request with an absolute-form of request- 535 target, the proxy MUST ignore the received Host header field (if any) 536 and instead replace it with the host information of the request- 537 target. A proxy that forwards such a request MUST generate a new 538 Host field value based on the received request-target rather than 539 forward the received Host field value. 541 When an origin server receives a request with an absolute-form of 542 request-target, the origin server MUST ignore the received Host 543 header field (if any) and instead use the host information of the 544 request-target. Note that if the request-target does not have an 545 authority component, an empty Host header field will be sent in this 546 case. 548 A server MUST accept the absolute-form in requests even though most 549 HTTP/1.1 clients will only send the absolute-form to a proxy. 551 3.2.3. authority-form 553 The _authority-form_ of request-target is only used for CONNECT 554 requests (Section 9.3.6 of [HTTP]). It consists of only the uri-host 555 and port number of the tunnel destination, separated by a colon 556 (":"). 558 authority-form = uri-host ":" port 560 When making a CONNECT request to establish a tunnel through one or 561 more proxies, a client MUST send only the host and port of the tunnel 562 destination as the request-target. The client obtains the host and 563 port from the target URI's authority component, except that it sends 564 the scheme's default port if the target URI elides the port. For 565 example, a CONNECT request to "http://www.example.com" looks like 567 CONNECT www.example.com:80 HTTP/1.1 568 Host: www.example.com 570 3.2.4. asterisk-form 572 The _asterisk-form_ of request-target is only used for a server-wide 573 OPTIONS request (Section 9.3.7 of [HTTP]). 575 asterisk-form = "*" 577 When a client wishes to request OPTIONS for the server as a whole, as 578 opposed to a specific named resource of that server, the client MUST 579 send only "*" (%x2A) as the request-target. For example, 581 OPTIONS * HTTP/1.1 583 If a proxy receives an OPTIONS request with an absolute-form of 584 request-target in which the URI has an empty path and no query 585 component, then the last proxy on the request chain MUST send a 586 request-target of "*" when it forwards the request to the indicated 587 origin server. 589 For example, the request 591 OPTIONS http://www.example.org:8001 HTTP/1.1 593 would be forwarded by the final proxy as 595 OPTIONS * HTTP/1.1 596 Host: www.example.org:8001 598 after connecting to port 8001 of host "www.example.org". 600 3.3. Reconstructing the Target URI 602 The target URI is the request-target when the request-target is in 603 absolute-form. In that case, a server will parse the URI into its 604 generic components for further evaluation. 606 Otherwise, the server reconstructs the target URI from the connection 607 context and various parts of the request message in order to identify 608 the target resource (Section 7.1 of [HTTP]): 610 * If the server's configuration provides for a fixed URI scheme, or 611 a scheme is provided by a trusted outbound gateway, that scheme is 612 used for the target URI. This is common in large-scale 613 deployments because a gateway server will receive the client's 614 connection context and replace that with their own connection to 615 the inbound server. Otherwise, if the request is received over a 616 secured connection, the target URI's scheme is "https"; if not, 617 the scheme is "http". 619 * If the request-target is in authority-form, the target URI's 620 authority component is the request-target. Otherwise, the target 621 URI's authority component is the field value of the Host header 622 field. If there is no Host header field or if its field value is 623 empty or invalid, the target URI's authority component is empty. 625 * If the request-target is in authority-form or asterisk-form, the 626 target URI's combined path and query component is empty. 627 Otherwise, the target URI's combined path and query component is 628 the request-target. 630 * The components of a reconstructed target URI, once determined as 631 above, can be recombined into absolute-URI form by concatenating 632 the scheme, "://", authority, and combined path and query 633 component. 635 Example 1: the following message received over a secure connection 637 GET /pub/WWW/TheProject.html HTTP/1.1 638 Host: www.example.org 640 has a target URI of 642 https://www.example.org/pub/WWW/TheProject.html 644 Example 2: the following message received over an insecure connection 646 OPTIONS * HTTP/1.1 647 Host: www.example.org:8080 649 has a target URI of 651 http://www.example.org:8080 653 If the target URI's authority component is empty and its URI scheme 654 requires a non-empty authority (as is the case for "http" and 655 "https"), the server can reject the request or determine whether a 656 configured default applies that is consistent with the incoming 657 connection's context. Context might include connection details like 658 address and port, what security has been applied, and locally-defined 659 information specific to that server's configuration. An empty 660 authority is replaced with the configured default before further 661 processing of the request. 663 Supplying a default name for authority within the context of a 664 secured connection is inherently unsafe if there is any chance that 665 the user agent's intended authority might differ from the default. A 666 server that can uniquely identify an authority from the request 667 context MAY use that identity as a default without this risk. 668 Alternatively, it might be better to redirect the request to a safe 669 resource that explains how to obtain a new client. 671 Note that reconstructing the client's target URI is only half of the 672 process for identifying a target resource. The other half is 673 determining whether that target URI identifies a resource for which 674 the server is willing and able to send a response, as defined in 675 Section 7.4 of [HTTP]. 677 4. Status Line 679 The first line of a response message is the status-line, consisting 680 of the protocol version, a space (SP), the status code, another 681 space, and ending with an OPTIONAL textual phrase describing the 682 status code. 684 status-line = HTTP-version SP status-code SP [reason-phrase] 686 Although the status-line grammar rule requires that each of the 687 component elements be separated by a single SP octet, recipients MAY 688 instead parse on whitespace-delimited word boundaries and, aside from 689 the line terminator, treat any form of whitespace as the SP separator 690 while ignoring preceding or trailing whitespace; such whitespace 691 includes one or more of the following octets: SP, HTAB, VT (%x0B), FF 692 (%x0C), or bare CR. However, lenient parsing can result in response 693 splitting security vulnerabilities if there are multiple recipients 694 of the message and each has its own unique interpretation of 695 robustness (see Section 11.1). 697 The status-code element is a 3-digit integer code describing the 698 result of the server's attempt to understand and satisfy the client's 699 corresponding request. A recipient parses and interprets the 700 remainder of the response message in light of the semantics defined 701 for that status code, if the status code is recognized by that 702 recipient, or in accordance with the class of that status code when 703 the specific code is unrecognized. 705 status-code = 3DIGIT 707 HTTP's core status codes are defined in Section 15 of [HTTP], along 708 with the classes of status codes, considerations for the definition 709 of new status codes, and the IANA registry for collecting such 710 definitions. 712 The reason-phrase element exists for the sole purpose of providing a 713 textual description associated with the numeric status code, mostly 714 out of deference to earlier Internet application protocols that were 715 more frequently used with interactive text clients. 717 reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) 719 A client SHOULD ignore the reason-phrase content because it is not a 720 reliable channel for information (it might be translated for a given 721 locale, overwritten by intermediaries, or discarded when the message 722 is forwarded via other versions of HTTP). A server MUST send the 723 space that separates status-code from the reason-phrase even when the 724 reason-phrase is absent (i.e., the status-line would end with the 725 three octets SP CR LF). 727 5. Field Syntax 729 Each field line consists of a case-insensitive field name followed by 730 a colon (":"), optional leading whitespace, the field line value, and 731 optional trailing whitespace. 733 field-line = field-name ":" OWS field-value OWS 735 Most HTTP field names and the rules for parsing within field values 736 are defined in Section 6.3 of [HTTP]. This section covers the 737 generic syntax for header field inclusion within, and extraction 738 from, HTTP/1.1 messages. 740 5.1. Field Line Parsing 742 Messages are parsed using a generic algorithm, independent of the 743 individual field names. The contents within a given field line value 744 are not parsed until a later stage of message interpretation (usually 745 after the message's entire field section has been processed). 747 No whitespace is allowed between the field name and colon. In the 748 past, differences in the handling of such whitespace have led to 749 security vulnerabilities in request routing and response handling. A 750 server MUST reject, with a response status code of 400 (Bad Request), 751 any received request message that contains whitespace between a 752 header field name and colon. A proxy MUST remove any such whitespace 753 from a response message before forwarding the message downstream. 755 A field line value might be preceded and/or followed by optional 756 whitespace (OWS); a single SP preceding the field line value is 757 preferred for consistent readability by humans. The field line value 758 does not include that leading or trailing whitespace: OWS occurring 759 before the first non-whitespace octet of the field line value, or 760 after the last non-whitespace octet of the field line value, is 761 excluded by parsers when extracting the field line value from a field 762 line. 764 5.2. Obsolete Line Folding 766 Historically, HTTP/1.x field values could be extended over multiple 767 lines by preceding each extra line with at least one space or 768 horizontal tab (obs-fold). This specification deprecates such line 769 folding except within the message/http media type (Section 10.1). 771 obs-fold = OWS CRLF RWS 772 ; obsolete line folding 774 A sender MUST NOT generate a message that includes line folding 775 (i.e., that has any field line value that contains a match to the 776 obs-fold rule) unless the message is intended for packaging within 777 the message/http media type. 779 A server that receives an obs-fold in a request message that is not 780 within a message/http container MUST either reject the message by 781 sending a 400 (Bad Request), preferably with a representation 782 explaining that obsolete line folding is unacceptable, or replace 783 each received obs-fold with one or more SP octets prior to 784 interpreting the field value or forwarding the message downstream. 786 A proxy or gateway that receives an obs-fold in a response message 787 that is not within a message/http container MUST either discard the 788 message and replace it with a 502 (Bad Gateway) response, preferably 789 with a representation explaining that unacceptable line folding was 790 received, or replace each received obs-fold with one or more SP 791 octets prior to interpreting the field value or forwarding the 792 message downstream. 794 A user agent that receives an obs-fold in a response message that is 795 not within a message/http container MUST replace each received 796 obs-fold with one or more SP octets prior to interpreting the field 797 value. 799 6. Message Body 801 The message body (if any) of an HTTP/1.1 message is used to carry 802 content (Section 6.4 of [HTTP]) for the request or response. The 803 message body is identical to the content unless a transfer coding has 804 been applied, as described in Section 6.1. 806 message-body = *OCTET 808 The rules for determining when a message body is present in an 809 HTTP/1.1 message differ for requests and responses. 811 The presence of a message body in a request is signaled by a 812 Content-Length or Transfer-Encoding header field. Request message 813 framing is independent of method semantics. 815 The presence of a message body in a response depends on both the 816 request method to which it is responding and the response status code 817 (Section 4), and corresponds to when content is allowed; see 818 Section 6.4 of [HTTP]. 820 6.1. Transfer-Encoding 822 The Transfer-Encoding header field lists the transfer coding names 823 corresponding to the sequence of transfer codings that have been (or 824 will be) applied to the content in order to form the message body. 825 Transfer codings are defined in Section 7. 827 Transfer-Encoding = #transfer-coding 828 ; defined in [HTTP], Section 10.1.4 830 Transfer-Encoding is analogous to the Content-Transfer-Encoding field 831 of MIME, which was designed to enable safe transport of binary data 832 over a 7-bit transport service ([RFC2045], Section 6). However, safe 833 transport has a different focus for an 8bit-clean transfer protocol. 834 In HTTP's case, Transfer-Encoding is primarily intended to accurately 835 delimit dynamically generated content. It also serves to distinguish 836 encodings that are only applied in transit from the encodings that 837 are a characteristic of the selected representation. 839 A recipient MUST be able to parse the chunked transfer coding 840 (Section 7.1) because it plays a crucial role in framing messages 841 when the content size is not known in advance. A sender MUST NOT 842 apply the chunked transfer coding more than once to a message body 843 (i.e., chunking an already chunked message is not allowed). If any 844 transfer coding other than chunked is applied to a request's content, 845 the sender MUST apply chunked as the final transfer coding to ensure 846 that the message is properly framed. If any transfer coding other 847 than chunked is applied to a response's content, the sender MUST 848 either apply chunked as the final transfer coding or terminate the 849 message by closing the connection. 851 For example, 853 Transfer-Encoding: gzip, chunked 854 indicates that the content has been compressed using the gzip coding 855 and then chunked using the chunked coding while forming the message 856 body. 858 Unlike Content-Encoding (Section 8.4.1 of [HTTP]), Transfer-Encoding 859 is a property of the message, not of the representation, and any 860 recipient along the request/response chain MAY decode the received 861 transfer coding(s) or apply additional transfer coding(s) to the 862 message body, assuming that corresponding changes are made to the 863 Transfer-Encoding field value. Additional information about the 864 encoding parameters can be provided by other header fields not 865 defined by this specification. 867 Transfer-Encoding MAY be sent in a response to a HEAD request or in a 868 304 (Not Modified) response (Section 15.4.5 of [HTTP]) to a GET 869 request, neither of which includes a message body, to indicate that 870 the origin server would have applied a transfer coding to the message 871 body if the request had been an unconditional GET. This indication 872 is not required, however, because any recipient on the response chain 873 (including the origin server) can remove transfer codings when they 874 are not needed. 876 A server MUST NOT send a Transfer-Encoding header field in any 877 response with a status code of 1xx (Informational) or 204 (No 878 Content). A server MUST NOT send a Transfer-Encoding header field in 879 any 2xx (Successful) response to a CONNECT request (Section 9.3.6 of 880 [HTTP]). 882 A server that receives a request message with a transfer coding it 883 does not understand SHOULD respond with 501 (Not Implemented). 885 Transfer-Encoding was added in HTTP/1.1. It is generally assumed 886 that implementations advertising only HTTP/1.0 support will not 887 understand how to process transfer-encoded content, and that an 888 HTTP/1.0 message received with a Transfer-Encoding is likely to have 889 been forwarded without proper handling of the chunked encoding in 890 transit. 892 A client MUST NOT send a request containing Transfer-Encoding unless 893 it knows the server will handle HTTP/1.1 requests (or later minor 894 revisions); such knowledge might be in the form of specific user 895 configuration or by remembering the version of a prior received 896 response. A server MUST NOT send a response containing Transfer- 897 Encoding unless the corresponding request indicates HTTP/1.1 (or 898 later minor revisions). 900 Early implementations of Transfer-Encoding would occasionally send 901 both a chunked encoding for message framing and an estimated Content- 902 Length header field for use by progress bars. This is why Transfer- 903 Encoding is defined as overriding Content-Length, as opposed to them 904 being mutually incompatible. Unfortunately, forwarding such a 905 message can lead to vulnerabilities regarding request smuggling 906 (Section 11.2) or response splitting (Section 11.1) attacks if any 907 downstream recipient fails to parse the message according to this 908 specification, particularly when a downstream recipient only 909 implements HTTP/1.0. 911 A server MAY reject a request that contains both Content-Length and 912 Transfer-Encoding or process such a request in accordance with the 913 Transfer-Encoding alone. Regardless, the server MUST close the 914 connection after responding to such a request to avoid the potential 915 attacks. 917 A server or client that receives an HTTP/1.0 message containing a 918 Transfer-Encoding header field MUST treat the message as if the 919 framing is faulty, even if a Content-Length is present, and close the 920 connection after processing the message. The message sender might 921 have retained a portion of the message, in buffer, that could be 922 misinterpreted by further use of the connection. 924 6.2. Content-Length 926 When a message does not have a Transfer-Encoding header field, a 927 Content-Length header field (Section 8.6 of [HTTP]) can provide the 928 anticipated size, as a decimal number of octets, for potential 929 content. For messages that do include content, the Content-Length 930 field value provides the framing information necessary for 931 determining where the data (and message) ends. For messages that do 932 not include content, the Content-Length indicates the size of the 933 selected representation (Section 8.6 of [HTTP]). 935 A sender MUST NOT send a Content-Length header field in any message 936 that contains a Transfer-Encoding header field. 938 | *Note:* HTTP's use of Content-Length for message framing 939 | differs significantly from the same field's use in MIME, where 940 | it is an optional field used only within the "message/external- 941 | body" media-type. 943 6.3. Message Body Length 945 The length of a message body is determined by one of the following 946 (in order of precedence): 948 1. Any response to a HEAD request and any response with a 1xx 949 (Informational), 204 (No Content), or 304 (Not Modified) status 950 code is always terminated by the first empty line after the 951 header fields, regardless of the header fields present in the 952 message, and thus cannot contain a message body or trailer 953 section. 955 2. Any 2xx (Successful) response to a CONNECT request implies that 956 the connection will become a tunnel immediately after the empty 957 line that concludes the header fields. A client MUST ignore any 958 Content-Length or Transfer-Encoding header fields received in 959 such a message. 961 3. If a message is received with both a Transfer-Encoding and a 962 Content-Length header field, the Transfer-Encoding overrides the 963 Content-Length. Such a message might indicate an attempt to 964 perform request smuggling (Section 11.2) or response splitting 965 (Section 11.1) and ought to be handled as an error. An 966 intermediary that chooses to forward the message MUST first 967 remove the received Content-Length field and process the 968 Transfer-Encoding (as described below) prior to forwarding the 969 message downstream. 971 4. If a Transfer-Encoding header field is present and the chunked 972 transfer coding (Section 7.1) is the final encoding, the message 973 body length is determined by reading and decoding the chunked 974 data until the transfer coding indicates the data is complete. 976 If a Transfer-Encoding header field is present in a response and 977 the chunked transfer coding is not the final encoding, the 978 message body length is determined by reading the connection until 979 it is closed by the server. 981 If a Transfer-Encoding header field is present in a request and 982 the chunked transfer coding is not the final encoding, the 983 message body length cannot be determined reliably; the server 984 MUST respond with the 400 (Bad Request) status code and then 985 close the connection. 987 5. If a message is received without Transfer-Encoding and with an 988 invalid Content-Length header field, then the message framing is 989 invalid and the recipient MUST treat it as an unrecoverable 990 error, unless the field value can be successfully parsed as a 991 comma-separated list (Section 5.6.1 of [HTTP]), all values in the 992 list are valid, and all values in the list are the same (in which 993 case the message is processed with that single value used as the 994 Content-Length field value). If the unrecoverable error is in a 995 request message, the server MUST respond with a 400 (Bad Request) 996 status code and then close the connection. If it is in a 997 response message received by a proxy, the proxy MUST close the 998 connection to the server, discard the received response, and send 999 a 502 (Bad Gateway) response to the client. If it is in a 1000 response message received by a user agent, the user agent MUST 1001 close the connection to the server and discard the received 1002 response. 1004 6. If a valid Content-Length header field is present without 1005 Transfer-Encoding, its decimal value defines the expected message 1006 body length in octets. If the sender closes the connection or 1007 the recipient times out before the indicated number of octets are 1008 received, the recipient MUST consider the message to be 1009 incomplete and close the connection. 1011 7. If this is a request message and none of the above are true, then 1012 the message body length is zero (no message body is present). 1014 8. Otherwise, this is a response message without a declared message 1015 body length, so the message body length is determined by the 1016 number of octets received prior to the server closing the 1017 connection. 1019 Since there is no way to distinguish a successfully completed, close- 1020 delimited response message from a partially received message 1021 interrupted by network failure, a server SHOULD generate encoding or 1022 length-delimited messages whenever possible. The close-delimiting 1023 feature exists primarily for backwards compatibility with HTTP/1.0. 1025 | *Note:* Request messages are never close-delimited because they 1026 | are always explicitly framed by length or transfer coding, with 1027 | the absence of both implying the request ends immediately after 1028 | the header section. 1030 A server MAY reject a request that contains a message body but not a 1031 Content-Length by responding with 411 (Length Required). 1033 Unless a transfer coding other than chunked has been applied, a 1034 client that sends a request containing a message body SHOULD use a 1035 valid Content-Length header field if the message body length is known 1036 in advance, rather than the chunked transfer coding, since some 1037 existing services respond to chunked with a 411 (Length Required) 1038 status code even though they understand the chunked transfer coding. 1039 This is typically because such services are implemented via a gateway 1040 that requires a content-length in advance of being called and the 1041 server is unable or unwilling to buffer the entire request before 1042 processing. 1044 A user agent that sends a request that contains a message body MUST 1045 send either a valid Content-Length header field or use the chunked 1046 transfer coding. A client MUST NOT use the chunked transfer encoding 1047 unless it knows the server will handle HTTP/1.1 (or later) requests; 1048 such knowledge can be in the form of specific user configuration or 1049 by remembering the version of a prior received response. 1051 If the final response to the last request on a connection has been 1052 completely received and there remains additional data to read, a user 1053 agent MAY discard the remaining data or attempt to determine if that 1054 data belongs as part of the prior message body, which might be the 1055 case if the prior message's Content-Length value is incorrect. A 1056 client MUST NOT process, cache, or forward such extra data as a 1057 separate response, since such behavior would be vulnerable to cache 1058 poisoning. 1060 7. Transfer Codings 1062 Transfer coding names are used to indicate an encoding transformation 1063 that has been, can be, or might need to be applied to a message's 1064 content in order to ensure "safe transport" through the network. 1065 This differs from a content coding in that the transfer coding is a 1066 property of the message rather than a property of the representation 1067 that is being transferred. 1069 All transfer-coding names are case-insensitive and ought to be 1070 registered within the HTTP Transfer Coding registry, as defined in 1071 Section 7.3. They are used in the Transfer-Encoding (Section 6.1) 1072 and TE (Section 10.1.4 of [HTTP]) header fields (the latter also 1073 defining the "transfer-coding" grammar). 1075 7.1. Chunked Transfer Coding 1077 The chunked transfer coding wraps content in order to transfer it as 1078 a series of chunks, each with its own size indicator, followed by an 1079 OPTIONAL trailer section containing trailer fields. Chunked enables 1080 content streams of unknown size to be transferred as a sequence of 1081 length-delimited buffers, which enables the sender to retain 1082 connection persistence and the recipient to know when it has received 1083 the entire message. 1085 chunked-body = *chunk 1086 last-chunk 1087 trailer-section 1088 CRLF 1090 chunk = chunk-size [ chunk-ext ] CRLF 1091 chunk-data CRLF 1092 chunk-size = 1*HEXDIG 1093 last-chunk = 1*("0") [ chunk-ext ] CRLF 1095 chunk-data = 1*OCTET ; a sequence of chunk-size octets 1097 The chunk-size field is a string of hex digits indicating the size of 1098 the chunk-data in octets. The chunked transfer coding is complete 1099 when a chunk with a chunk-size of zero is received, possibly followed 1100 by a trailer section, and finally terminated by an empty line. 1102 A recipient MUST be able to parse and decode the chunked transfer 1103 coding. 1105 HTTP/1.1 does not define any means to limit the size of a chunked 1106 response such that an intermediary can be assured of buffering the 1107 entire response. Additionally, very large chunk sizes may cause 1108 overflows or loss of precision if their values are not represented 1109 accurately in a receiving implementation. Therefore, recipients MUST 1110 anticipate potentially large hexadecimal numerals and prevent parsing 1111 errors due to integer conversion overflows or precision loss due to 1112 integer representation. 1114 The chunked encoding does not define any parameters. Their presence 1115 SHOULD be treated as an error. 1117 7.1.1. Chunk Extensions 1119 The chunked encoding allows each chunk to include zero or more chunk 1120 extensions, immediately following the chunk-size, for the sake of 1121 supplying per-chunk metadata (such as a signature or hash), mid- 1122 message control information, or randomization of message body size. 1124 chunk-ext = *( BWS ";" BWS chunk-ext-name 1125 [ BWS "=" BWS chunk-ext-val ] ) 1127 chunk-ext-name = token 1128 chunk-ext-val = token / quoted-string 1130 The chunked encoding is specific to each connection and is likely to 1131 be removed or recoded by each recipient (including intermediaries) 1132 before any higher-level application would have a chance to inspect 1133 the extensions. Hence, use of chunk extensions is generally limited 1134 to specialized HTTP services such as "long polling" (where client and 1135 server can have shared expectations regarding the use of chunk 1136 extensions) or for padding within an end-to-end secured connection. 1138 A recipient MUST ignore unrecognized chunk extensions. A server 1139 ought to limit the total length of chunk extensions received in a 1140 request to an amount reasonable for the services provided, in the 1141 same way that it applies length limitations and timeouts for other 1142 parts of a message, and generate an appropriate 4xx (Client Error) 1143 response if that amount is exceeded. 1145 7.1.2. Chunked Trailer Section 1147 A trailer section allows the sender to include additional fields at 1148 the end of a chunked message in order to supply metadata that might 1149 be dynamically generated while the content is sent, such as a message 1150 integrity check, digital signature, or post-processing status. The 1151 proper use and limitations of trailer fields are defined in 1152 Section 6.5 of [HTTP]. 1154 trailer-section = *( field-line CRLF ) 1156 A recipient that removes the chunked encoding from a message MAY 1157 selectively retain or discard the received trailer fields. A 1158 recipient that retains a received trailer field MUST either store/ 1159 forward the trailer field separately from the received header fields 1160 or merge the received trailer field into the header section. A 1161 recipient MUST NOT merge a received trailer field into the header 1162 section unless its corresponding header field definition explicitly 1163 permits and instructs how the trailer field value can be safely 1164 merged. 1166 7.1.3. Decoding Chunked 1168 A process for decoding the chunked transfer coding can be represented 1169 in pseudo-code as: 1171 length := 0 1172 read chunk-size, chunk-ext (if any), and CRLF 1173 while (chunk-size > 0) { 1174 read chunk-data and CRLF 1175 append chunk-data to content 1176 length := length + chunk-size 1177 read chunk-size, chunk-ext (if any), and CRLF 1178 } 1179 read trailer field 1180 while (trailer field is not empty) { 1181 if (trailer fields are stored/forwarded separately) { 1182 append trailer field to existing trailer fields 1183 } 1184 else if (trailer field is understood and defined as mergeable) { 1185 merge trailer field with existing header fields 1186 } 1187 else { 1188 discard trailer field 1189 } 1190 read trailer field 1191 } 1192 Content-Length := length 1193 Remove "chunked" from Transfer-Encoding 1195 7.2. Transfer Codings for Compression 1197 The following transfer coding names for compression are defined by 1198 the same algorithm as their corresponding content coding: 1200 compress (and x-compress) 1201 See Section 8.4.1.1 of [HTTP]. 1203 deflate 1204 See Section 8.4.1.2 of [HTTP]. 1206 gzip (and x-gzip) 1207 See Section 8.4.1.3 of [HTTP]. 1209 The compression codings do not define any parameters. The presence 1210 of parameters with any of these compression codings SHOULD be treated 1211 as an error. 1213 7.3. Transfer Coding Registry 1215 The "HTTP Transfer Coding Registry" defines the namespace for 1216 transfer coding names. It is maintained at 1217 . 1219 Registrations MUST include the following fields: 1221 * Name 1223 * Description 1225 * Pointer to specification text 1227 Names of transfer codings MUST NOT overlap with names of content 1228 codings (Section 8.4.1 of [HTTP]) unless the encoding transformation 1229 is identical, as is the case for the compression codings defined in 1230 Section 7.2. 1232 The TE header field (Section 10.1.4 of [HTTP]) uses a pseudo 1233 parameter named "q" as rank value when multiple transfer codings are 1234 acceptable. Future registrations of transfer codings SHOULD NOT 1235 define parameters called "q" (case-insensitively) in order to avoid 1236 ambiguities. 1238 Values to be added to this namespace require IETF Review (see 1239 Section 4.8 of [RFC8126]), and MUST conform to the purpose of 1240 transfer coding defined in this specification. 1242 Use of program names for the identification of encoding formats is 1243 not desirable and is discouraged for future encodings. 1245 7.4. Negotiating Transfer Codings 1247 The TE field (Section 10.1.4 of [HTTP]) is used in HTTP/1.1 to 1248 indicate what transfer-codings, besides chunked, the client is 1249 willing to accept in the response, and whether the client is willing 1250 to preserve trailer fields in a chunked transfer coding. 1252 A client MUST NOT send the chunked transfer coding name in TE; 1253 chunked is always acceptable for HTTP/1.1 recipients. 1255 Three examples of TE use are below. 1257 TE: deflate 1258 TE: 1259 TE: trailers, deflate;q=0.5 1261 When multiple transfer codings are acceptable, the client MAY rank 1262 the codings by preference using a case-insensitive "q" parameter 1263 (similar to the qvalues used in content negotiation fields, 1264 Section 12.4.2 of [HTTP]). The rank value is a real number in the 1265 range 0 through 1, where 0.001 is the least preferred and 1 is the 1266 most preferred; a value of 0 means "not acceptable". 1268 If the TE field value is empty or if no TE field is present, the only 1269 acceptable transfer coding is chunked. A message with no transfer 1270 coding is always acceptable. 1272 The keyword "trailers" indicates that the sender will not discard 1273 trailer fields, as described in Section 6.5 of [HTTP]. 1275 Since the TE header field only applies to the immediate connection, a 1276 sender of TE MUST also send a "TE" connection option within the 1277 Connection header field (Section 7.6.1 of [HTTP]) in order to prevent 1278 the TE header field from being forwarded by intermediaries that do 1279 not support its semantics. 1281 8. Handling Incomplete Messages 1283 A server that receives an incomplete request message, usually due to 1284 a canceled request or a triggered timeout exception, MAY send an 1285 error response prior to closing the connection. 1287 A client that receives an incomplete response message, which can 1288 occur when a connection is closed prematurely or when decoding a 1289 supposedly chunked transfer coding fails, MUST record the message as 1290 incomplete. Cache requirements for incomplete responses are defined 1291 in Section 3 of [CACHING]. 1293 If a response terminates in the middle of the header section (before 1294 the empty line is received) and the status code might rely on header 1295 fields to convey the full meaning of the response, then the client 1296 cannot assume that meaning has been conveyed; the client might need 1297 to repeat the request in order to determine what action to take next. 1299 A message body that uses the chunked transfer coding is incomplete if 1300 the zero-sized chunk that terminates the encoding has not been 1301 received. A message that uses a valid Content-Length is incomplete 1302 if the size of the message body received (in octets) is less than the 1303 value given by Content-Length. A response that has neither chunked 1304 transfer coding nor Content-Length is terminated by closure of the 1305 connection and, if the header section was received intact, is 1306 considered complete unless an error was indicated by the underlying 1307 connection (e.g., an "incomplete close" in TLS would leave the 1308 response incomplete, as described in Section 9.8). 1310 9. Connection Management 1312 HTTP messaging is independent of the underlying transport- or 1313 session-layer connection protocol(s). HTTP only presumes a reliable 1314 transport with in-order delivery of requests and the corresponding 1315 in-order delivery of responses. The mapping of HTTP request and 1316 response structures onto the data units of an underlying transport 1317 protocol is outside the scope of this specification. 1319 As described in Section 7.3 of [HTTP], the specific connection 1320 protocols to be used for an HTTP interaction are determined by client 1321 configuration and the target URI. For example, the "http" URI scheme 1322 (Section 4.2.1 of [HTTP]) indicates a default connection of TCP over 1323 IP, with a default TCP port of 80, but the client might be configured 1324 to use a proxy via some other connection, port, or protocol. 1326 HTTP implementations are expected to engage in connection management, 1327 which includes maintaining the state of current connections, 1328 establishing a new connection or reusing an existing connection, 1329 processing messages received on a connection, detecting connection 1330 failures, and closing each connection. Most clients maintain 1331 multiple connections in parallel, including more than one connection 1332 per server endpoint. Most servers are designed to maintain thousands 1333 of concurrent connections, while controlling request queues to enable 1334 fair use and detect denial-of-service attacks. 1336 9.1. Establishment 1338 It is beyond the scope of this specification to describe how 1339 connections are established via various transport- or session-layer 1340 protocols. Each HTTP connection maps to one underlying transport 1341 connection. 1343 9.2. Associating a Response to a Request 1345 HTTP/1.1 does not include a request identifier for associating a 1346 given request message with its corresponding one or more response 1347 messages. Hence, it relies on the order of response arrival to 1348 correspond exactly to the order in which requests are made on the 1349 same connection. More than one response message per request only 1350 occurs when one or more informational responses (1xx, see 1351 Section 15.2 of [HTTP]) precede a final response to the same request. 1353 A client that has more than one outstanding request on a connection 1354 MUST maintain a list of outstanding requests in the order sent and 1355 MUST associate each received response message on that connection to 1356 the first outstanding request that has not yet received a final (non- 1357 1xx) response. 1359 If a client receives data on a connection that doesn't have 1360 outstanding requests, the client MUST NOT consider that data to be a 1361 valid response; the client SHOULD close the connection, since message 1362 delimitation is now ambiguous, unless the data consists only of one 1363 or more CRLF (which can be discarded, as per Section 2.2). 1365 9.3. Persistence 1367 HTTP/1.1 defaults to the use of _persistent connections_, allowing 1368 multiple requests and responses to be carried over a single 1369 connection. HTTP implementations SHOULD support persistent 1370 connections. 1372 A recipient determines whether a connection is persistent or not 1373 based on the protocol version and Connection header field 1374 (Section 7.6.1 of [HTTP]) in the most recently received message, if 1375 any: 1377 * If the close connection option is present (Section 9.6), the 1378 connection will not persist after the current response; else, 1380 * If the received protocol is HTTP/1.1 (or later), the connection 1381 will persist after the current response; else, 1383 * If the received protocol is HTTP/1.0, the "keep-alive" connection 1384 option is present, either the recipient is not a proxy or the 1385 message is a response, and the recipient wishes to honor the 1386 HTTP/1.0 "keep-alive" mechanism, the connection will persist after 1387 the current response; otherwise, 1389 * The connection will close after the current response. 1391 A client that does not support persistent connections MUST send the 1392 close connection option in every request message. 1394 A server that does not support persistent connections MUST send the 1395 close connection option in every response message that does not have 1396 a 1xx (Informational) status code. 1398 A client MAY send additional requests on a persistent connection 1399 until it sends or receives a close connection option or receives an 1400 HTTP/1.0 response without a "keep-alive" connection option. 1402 In order to remain persistent, all messages on a connection need to 1403 have a self-defined message length (i.e., one not defined by closure 1404 of the connection), as described in Section 6. A server MUST read 1405 the entire request message body or close the connection after sending 1406 its response, since otherwise the remaining data on a persistent 1407 connection would be misinterpreted as the next request. Likewise, a 1408 client MUST read the entire response message body if it intends to 1409 reuse the same connection for a subsequent request. 1411 A proxy server MUST NOT maintain a persistent connection with an 1412 HTTP/1.0 client (see Section 19.7.1 of [RFC2068] for information and 1413 discussion of the problems with the Keep-Alive header field 1414 implemented by many HTTP/1.0 clients). 1416 See Appendix C.2.2 for more information on backwards compatibility 1417 with HTTP/1.0 clients. 1419 9.3.1. Retrying Requests 1421 Connections can be closed at any time, with or without intention. 1422 Implementations ought to anticipate the need to recover from 1423 asynchronous close events. The conditions under which a client can 1424 automatically retry a sequence of outstanding requests are defined in 1425 Section 9.2.2 of [HTTP]. 1427 9.3.2. Pipelining 1429 A client that supports persistent connections MAY _pipeline_ its 1430 requests (i.e., send multiple requests without waiting for each 1431 response). A server MAY process a sequence of pipelined requests in 1432 parallel if they all have safe methods (Section 9.2.1 of [HTTP]), but 1433 it MUST send the corresponding responses in the same order that the 1434 requests were received. 1436 A client that pipelines requests SHOULD retry unanswered requests if 1437 the connection closes before it receives all of the corresponding 1438 responses. When retrying pipelined requests after a failed 1439 connection (a connection not explicitly closed by the server in its 1440 last complete response), a client MUST NOT pipeline immediately after 1441 connection establishment, since the first remaining request in the 1442 prior pipeline might have caused an error response that can be lost 1443 again if multiple requests are sent on a prematurely closed 1444 connection (see the TCP reset problem described in Section 9.6). 1446 Idempotent methods (Section 9.2.2 of [HTTP]) are significant to 1447 pipelining because they can be automatically retried after a 1448 connection failure. A user agent SHOULD NOT pipeline requests after 1449 a non-idempotent method, until the final response status code for 1450 that method has been received, unless the user agent has a means to 1451 detect and recover from partial failure conditions involving the 1452 pipelined sequence. 1454 An intermediary that receives pipelined requests MAY pipeline those 1455 requests when forwarding them inbound, since it can rely on the 1456 outbound user agent(s) to determine what requests can be safely 1457 pipelined. If the inbound connection fails before receiving a 1458 response, the pipelining intermediary MAY attempt to retry a sequence 1459 of requests that have yet to receive a response if the requests all 1460 have idempotent methods; otherwise, the pipelining intermediary 1461 SHOULD forward any received responses and then close the 1462 corresponding outbound connection(s) so that the outbound user 1463 agent(s) can recover accordingly. 1465 9.4. Concurrency 1467 A client ought to limit the number of simultaneous open connections 1468 that it maintains to a given server. 1470 Previous revisions of HTTP gave a specific number of connections as a 1471 ceiling, but this was found to be impractical for many applications. 1472 As a result, this specification does not mandate a particular maximum 1473 number of connections but, instead, encourages clients to be 1474 conservative when opening multiple connections. 1476 Multiple connections are typically used to avoid the "head-of-line 1477 blocking" problem, wherein a request that takes significant server- 1478 side processing and/or transfers very large content would block 1479 subsequent requests on the same connection. However, each connection 1480 consumes server resources. 1482 Furthermore, using multiple connections can cause undesirable side 1483 effects in congested networks. Using larger numbers of connections 1484 can also cause side effects in otherwise uncongested networks, 1485 because their aggregate and initially synchronized sending behavior 1486 can cause congestion that would not have been present if fewer 1487 parallel connections had been used. 1489 Note that a server might reject traffic that it deems abusive or 1490 characteristic of a denial-of-service attack, such as an excessive 1491 number of open connections from a single client. 1493 9.5. Failures and Timeouts 1495 Servers will usually have some timeout value beyond which they will 1496 no longer maintain an inactive connection. Proxy servers might make 1497 this a higher value since it is likely that the client will be making 1498 more connections through the same proxy server. The use of 1499 persistent connections places no requirements on the length (or 1500 existence) of this timeout for either the client or the server. 1502 A client or server that wishes to time out SHOULD issue a graceful 1503 close on the connection. Implementations SHOULD constantly monitor 1504 open connections for a received closure signal and respond to it as 1505 appropriate, since prompt closure of both sides of a connection 1506 enables allocated system resources to be reclaimed. 1508 A client, server, or proxy MAY close the transport connection at any 1509 time. For example, a client might have started to send a new request 1510 at the same time that the server has decided to close the "idle" 1511 connection. From the server's point of view, the connection is being 1512 closed while it was idle, but from the client's point of view, a 1513 request is in progress. 1515 A server SHOULD sustain persistent connections, when possible, and 1516 allow the underlying transport's flow-control mechanisms to resolve 1517 temporary overloads, rather than terminate connections with the 1518 expectation that clients will retry. The latter technique can 1519 exacerbate network congestion or server load. 1521 A client sending a message body SHOULD monitor the network connection 1522 for an error response while it is transmitting the request. If the 1523 client sees a response that indicates the server does not wish to 1524 receive the message body and is closing the connection, the client 1525 SHOULD immediately cease transmitting the body and close its side of 1526 the connection. 1528 9.6. Tear-down 1530 The "close" connection option is defined as a signal that the sender 1531 will close this connection after completion of the response. A 1532 sender SHOULD send a Connection header field (Section 7.6.1 of 1533 [HTTP]) containing the close connection option when it intends to 1534 close a connection. For example, 1536 Connection: close 1538 as a request header field indicates that this is the last request 1539 that the client will send on this connection, while in a response the 1540 same field indicates that the server is going to close this 1541 connection after the response message is complete. 1543 Note that the field name "Close" is reserved, since using that name 1544 as a header field might conflict with the close connection option. 1546 A client that sends a close connection option MUST NOT send further 1547 requests on that connection (after the one containing the close) and 1548 MUST close the connection after reading the final response message 1549 corresponding to this request. 1551 A server that receives a close connection option MUST initiate 1552 closure of the connection (see below) after it sends the final 1553 response to the request that contained the close connection option. 1554 The server SHOULD send a close connection option in its final 1555 response on that connection. The server MUST NOT process any further 1556 requests received on that connection. 1558 A server that sends a close connection option MUST initiate closure 1559 of the connection (see below) after it sends the response containing 1560 the close connection option. The server MUST NOT process any further 1561 requests received on that connection. 1563 A client that receives a close connection option MUST cease sending 1564 requests on that connection and close the connection after reading 1565 the response message containing the close connection option; if 1566 additional pipelined requests had been sent on the connection, the 1567 client SHOULD NOT assume that they will be processed by the server. 1569 If a server performs an immediate close of a TCP connection, there is 1570 a significant risk that the client will not be able to read the last 1571 HTTP response. If the server receives additional data from the 1572 client on a fully closed connection, such as another request sent by 1573 the client before receiving the server's response, the server's TCP 1574 stack will send a reset packet to the client; unfortunately, the 1575 reset packet might erase the client's unacknowledged input buffers 1576 before they can be read and interpreted by the client's HTTP parser. 1578 To avoid the TCP reset problem, servers typically close a connection 1579 in stages. First, the server performs a half-close by closing only 1580 the write side of the read/write connection. The server then 1581 continues to read from the connection until it receives a 1582 corresponding close by the client, or until the server is reasonably 1583 certain that its own TCP stack has received the client's 1584 acknowledgement of the packet(s) containing the server's last 1585 response. Finally, the server fully closes the connection. 1587 It is unknown whether the reset problem is exclusive to TCP or might 1588 also be found in other transport connection protocols. 1590 Note that a TCP connection that is half-closed by the client does not 1591 delimit a request message, nor does it imply that the client is no 1592 longer interested in a response. In general, transport signals 1593 cannot be relied upon to signal edge cases, since HTTP/1.1 is 1594 independent of transport. 1596 9.7. TLS Connection Initiation 1598 Conceptually, HTTP/TLS is simply sending HTTP messages over a 1599 connection secured via TLS [TLS13]. 1601 The HTTP client also acts as the TLS client. It initiates a 1602 connection to the server on the appropriate port and sends the TLS 1603 ClientHello to begin the TLS handshake. When the TLS handshake has 1604 finished, the client may then initiate the first HTTP request. All 1605 HTTP data MUST be sent as TLS "application data", but is otherwise 1606 treated like a normal connection for HTTP (including potential reuse 1607 as a persistent connection). 1609 9.8. TLS Connection Closure 1611 TLS uses an exchange of closure alerts prior to (non-error) 1612 connection closure to provide secure connection closure; see 1613 Section 6.1 of [TLS13]. When a valid closure alert is received, an 1614 implementation can be assured that no further data will be received 1615 on that connection. 1617 When an implementation knows that it has sent or received all the 1618 message data that it cares about, typically by detecting HTTP message 1619 boundaries, it might generate an "incomplete close" by sending a 1620 closure alert and then closing the connection without waiting to 1621 receive the corresponding closure alert from its peer. 1623 An incomplete close does not call into question the security of the 1624 data already received, but it could indicate that subsequent data 1625 might have been truncated. As TLS is not directly aware of HTTP 1626 message framing, it is necessary to examine the HTTP data itself to 1627 determine whether messages were complete. Handling of incomplete 1628 messages is defined in Section 8. 1630 When encountering an incomplete close, a client SHOULD treat as 1631 completed all requests for which it has received as much data as 1632 specified in the Content-Length header or, when a Transfer-Encoding 1633 of chunked is used, for which the terminal zero-length chunk has been 1634 received. A response that has neither chunked transfer coding nor 1635 Content-Length is complete only if a valid closure alert has been 1636 received. Treating an incomplete message as complete could expose 1637 implementations to attack. 1639 A client detecting an incomplete close SHOULD recover gracefully. 1641 Clients MUST send a closure alert before closing the connection. 1642 Clients that do not expect to receive any more data MAY choose not to 1643 wait for the server's closure alert and simply close the connection, 1644 thus generating an incomplete close on the server side. 1646 Servers SHOULD be prepared to receive an incomplete close from the 1647 client, since the client can often determine when the end of server 1648 data is. 1650 Servers MUST attempt to initiate an exchange of closure alerts with 1651 the client before closing the connection. Servers MAY close the 1652 connection after sending the closure alert, thus generating an 1653 incomplete close on the client side. 1655 10. Enclosing Messages as Data 1657 10.1. Media Type message/http 1659 The message/http media type can be used to enclose a single HTTP 1660 request or response message, provided that it obeys the MIME 1661 restrictions for all "message" types regarding line length and 1662 encodings. Because of the line length limitations, field values 1663 within message/http are allowed to use line folding (obs-fold), as 1664 described in Section 5.2, to convey the field value over multiple 1665 lines. A recipient of message/http data MUST replace any obsolete 1666 line folding with one or more SP characters when the message is 1667 consumed. 1669 Type name: message 1671 Subtype name: http 1673 Required parameters: N/A 1675 Optional parameters: version, msgtype 1677 version: The HTTP-version number of the enclosed message (e.g., 1678 "1.1"). If not present, the version can be determined from the 1679 first line of the body. 1681 msgtype: The message type - "request" or "response". If not 1682 present, the type can be determined from the first line of the 1683 body. 1685 Encoding considerations: only "7bit", "8bit", or "binary" are 1686 permitted 1688 Security considerations: see Section 11 1689 Interoperability considerations: N/A 1691 Published specification: This specification (see Section 10.1). 1693 Applications that use this media type: N/A 1695 Fragment identifier considerations: N/A 1697 Additional information: Magic number(s): N/A 1699 Deprecated alias names for this type: N/A 1701 File extension(s): N/A 1703 Macintosh file type code(s): N/A 1705 Person and email address to contact for further information: See Aut 1706 hors' Addresses section. 1708 Intended usage: COMMON 1710 Restrictions on usage: N/A 1712 Author: See Authors' Addresses section. 1714 Change controller: IESG 1716 10.2. Media Type application/http 1718 The application/http media type can be used to enclose a pipeline of 1719 one or more HTTP request or response messages (not intermixed). 1721 Type name: application 1723 Subtype name: http 1725 Required parameters: N/A 1727 Optional parameters: version, msgtype 1729 version: The HTTP-version number of the enclosed messages (e.g., 1730 "1.1"). If not present, the version can be determined from the 1731 first line of the body. 1733 msgtype: The message type - "request" or "response". If not 1734 present, the type can be determined from the first line of the 1735 body. 1737 Encoding considerations: HTTP messages enclosed by this type are in 1738 "binary" format; use of an appropriate Content-Transfer-Encoding 1739 is required when transmitted via email. 1741 Security considerations: see Section 11 1743 Interoperability considerations: N/A 1745 Published specification: This specification (see Section 10.2). 1747 Applications that use this media type: N/A 1749 Fragment identifier considerations: N/A 1751 Additional information: Deprecated alias names for this type: N/A 1753 Magic number(s): N/A 1755 File extension(s): N/A 1757 Macintosh file type code(s): N/A 1759 Person and email address to contact for further information: See Aut 1760 hors' Addresses section. 1762 Intended usage: COMMON 1764 Restrictions on usage: N/A 1766 Author: See Authors' Addresses section. 1768 Change controller: IESG 1770 11. Security Considerations 1772 This section is meant to inform developers, information providers, 1773 and users about known security considerations relevant to HTTP 1774 message syntax and parsing. Security considerations about HTTP 1775 semantics, content, and routing are addressed in [HTTP]. 1777 11.1. Response Splitting 1779 Response splitting (a.k.a., CRLF injection) is a common technique, 1780 used in various attacks on Web usage, that exploits the line-based 1781 nature of HTTP message framing and the ordered association of 1782 requests to responses on persistent connections [Klein]. This 1783 technique can be particularly damaging when the requests pass through 1784 a shared cache. 1786 Response splitting exploits a vulnerability in servers (usually 1787 within an application server) where an attacker can send encoded data 1788 within some parameter of the request that is later decoded and echoed 1789 within any of the response header fields of the response. If the 1790 decoded data is crafted to look like the response has ended and a 1791 subsequent response has begun, the response has been split and the 1792 content within the apparent second response is controlled by the 1793 attacker. The attacker can then make any other request on the same 1794 persistent connection and trick the recipients (including 1795 intermediaries) into believing that the second half of the split is 1796 an authoritative answer to the second request. 1798 For example, a parameter within the request-target might be read by 1799 an application server and reused within a redirect, resulting in the 1800 same parameter being echoed in the Location header field of the 1801 response. If the parameter is decoded by the application and not 1802 properly encoded when placed in the response field, the attacker can 1803 send encoded CRLF octets and other content that will make the 1804 application's single response look like two or more responses. 1806 A common defense against response splitting is to filter requests for 1807 data that looks like encoded CR and LF (e.g., "%0D" and "%0A"). 1808 However, that assumes the application server is only performing URI 1809 decoding, rather than more obscure data transformations like charset 1810 transcoding, XML entity translation, base64 decoding, sprintf 1811 reformatting, etc. A more effective mitigation is to prevent 1812 anything other than the server's core protocol libraries from sending 1813 a CR or LF within the header section, which means restricting the 1814 output of header fields to APIs that filter for bad octets and not 1815 allowing application servers to write directly to the protocol 1816 stream. 1818 11.2. Request Smuggling 1820 Request smuggling ([Linhart]) is a technique that exploits 1821 differences in protocol parsing among various recipients to hide 1822 additional requests (which might otherwise be blocked or disabled by 1823 policy) within an apparently harmless request. Like response 1824 splitting, request smuggling can lead to a variety of attacks on HTTP 1825 usage. 1827 This specification has introduced new requirements on request 1828 parsing, particularly with regard to message framing in Section 6.3, 1829 to reduce the effectiveness of request smuggling. 1831 11.3. Message Integrity 1833 HTTP does not define a specific mechanism for ensuring message 1834 integrity, instead relying on the error-detection ability of 1835 underlying transport protocols and the use of length or chunk- 1836 delimited framing to detect completeness. Historically, the lack of 1837 a single integrity mechanism has been justified by the informal 1838 nature of most HTTP communication. However, the prevalence of HTTP 1839 as an information access mechanism has resulted in its increasing use 1840 within environments where verification of message integrity is 1841 crucial. 1843 The mechanisms provided with the "https" scheme, such as 1844 authenticated encryption, provide protection against modification of 1845 messages. Care is needed however to ensure that connection closure 1846 cannot be used to truncate messages (see Section 9.8). User agents 1847 might refuse to accept incomplete messages or treat them specially. 1848 For example, a browser being used to view medical history or drug 1849 interaction information needs to indicate to the user when such 1850 information is detected by the protocol to be incomplete, expired, or 1851 corrupted during transfer. Such mechanisms might be selectively 1852 enabled via user agent extensions or the presence of message 1853 integrity metadata in a response. 1855 The "http" scheme provides no protection against accidental or 1856 malicious modification of messages. 1858 Extensions to the protocol might be used to mitigate the risk of 1859 unwanted modification of messages by intermediaries, even when the 1860 "https" scheme is used. Integrity might be assured by using message 1861 authentication codes or digital signatures that are selectively added 1862 to messages via extensible metadata fields. 1864 11.4. Message Confidentiality 1866 HTTP relies on underlying transport protocols to provide message 1867 confidentiality when that is desired. HTTP has been specifically 1868 designed to be independent of the transport protocol, such that it 1869 can be used over many forms of encrypted connection, with the 1870 selection of such transports being identified by the choice of URI 1871 scheme or within user agent configuration. 1873 The "https" scheme can be used to identify resources that require a 1874 confidential connection, as described in Section 4.2.2 of [HTTP]. 1876 12. IANA Considerations 1878 The change controller for the following registrations is: "IETF 1879 (iesg@ietf.org) - Internet Engineering Task Force". 1881 12.1. Field Name Registration 1883 First, introduce the new "Hypertext Transfer Protocol (HTTP) Field 1884 Name Registry" at as 1885 described in Section 18.4 of [HTTP]. 1887 Then, please update the registry with the field names listed in the 1888 table below: 1890 +===================+==========+======+============+ 1891 | Field Name | Status | Ref. | Comments | 1892 +===================+==========+======+============+ 1893 | Close | standard | 9.6 | (reserved) | 1894 +-------------------+----------+------+------------+ 1895 | MIME-Version | standard | B.1 | | 1896 +-------------------+----------+------+------------+ 1897 | Transfer-Encoding | standard | 6.1 | | 1898 +-------------------+----------+------+------------+ 1900 Table 1 1902 12.2. Media Type Registration 1904 Please update the "Media Types" registry at 1905 with the registration 1906 information in Section 10.1 and Section 10.2 for the media types 1907 "message/http" and "application/http", respectively. 1909 12.3. Transfer Coding Registration 1911 Please update the "HTTP Transfer Coding Registry" at 1912 with the 1913 registration procedure of Section 7.3 and the content coding names 1914 summarized in the table below. 1916 +============+===============================+===========+ 1917 | Name | Description | Reference | 1918 +============+===============================+===========+ 1919 | chunked | Transfer in a series of | Section | 1920 | | chunks | 7.1 | 1921 +------------+-------------------------------+-----------+ 1922 | compress | UNIX "compress" data format | Section | 1923 | | [Welch] | 7.2 | 1924 +------------+-------------------------------+-----------+ 1925 | deflate | "deflate" compressed data | Section | 1926 | | ([RFC1951]) inside the "zlib" | 7.2 | 1927 | | data format ([RFC1950]) | | 1928 +------------+-------------------------------+-----------+ 1929 | gzip | GZIP file format [RFC1952] | Section | 1930 | | | 7.2 | 1931 +------------+-------------------------------+-----------+ 1932 | trailers | (reserved) | Section | 1933 | | | 12.3 | 1934 +------------+-------------------------------+-----------+ 1935 | x-compress | Deprecated (alias for | Section | 1936 | | compress) | 7.2 | 1937 +------------+-------------------------------+-----------+ 1938 | x-gzip | Deprecated (alias for gzip) | Section | 1939 | | | 7.2 | 1940 +------------+-------------------------------+-----------+ 1942 Table 2 1944 | *Note:* the coding name "trailers" is reserved because its use 1945 | would conflict with the keyword "trailers" in the TE header 1946 | field (Section 10.1.4 of [HTTP]). 1948 12.4. ALPN Protocol ID Registration 1950 Please update the "TLS Application-Layer Protocol Negotiation (ALPN) 1951 Protocol IDs" registry at with the 1953 registration below: 1955 +==========+=============================+================+ 1956 | Protocol | Identification Sequence | Reference | 1957 +==========+=============================+================+ 1958 | HTTP/1.1 | 0x68 0x74 0x74 0x70 0x2f | (this | 1959 | | 0x31 0x2e 0x31 ("http/1.1") | specification) | 1960 +----------+-----------------------------+----------------+ 1962 Table 3 1964 13. References 1966 13.1. Normative References 1968 [CACHING] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1969 Ed., "HTTP Caching", Work in Progress, Internet-Draft, 1970 draft-ietf-httpbis-cache-19, 10 September 2021, 1971 . 1974 [HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1975 Ed., "HTTP Semantics", Work in Progress, Internet-Draft, 1976 draft-ietf-httpbis-semantics-19, 10 September 2021, 1977 . 1980 [RFC1950] Deutsch, L.P. and J-L. Gailly, "ZLIB Compressed Data 1981 Format Specification version 3.3", RFC 1950, 1982 DOI 10.17487/RFC1950, May 1996, 1983 . 1985 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 1986 version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996, 1987 . 1989 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L.P., and 1990 G. Randers-Pehrson, "GZIP file format specification 1991 version 4.3", RFC 1952, DOI 10.17487/RFC1952, May 1996, 1992 . 1994 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1995 Requirement Levels", BCP 14, RFC 2119, 1996 DOI 10.17487/RFC2119, March 1997, 1997 . 1999 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 2000 Specifications: ABNF", STD 68, RFC 5234, 2001 DOI 10.17487/RFC5234, January 2008, 2002 . 2004 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 2005 RFC 7405, DOI 10.17487/RFC7405, December 2014, 2006 . 2008 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2009 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2010 May 2017, . 2012 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 2013 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 2014 . 2016 [URI] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2017 Resource Identifier (URI): Generic Syntax", STD 66, 2018 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2019 . 2021 [USASCII] American National Standards Institute, "Coded Character 2022 Set -- 7-bit American Standard Code for Information 2023 Interchange", ANSI X3.4, 1986. 2025 [Welch] Welch, T. A., "A Technique for High-Performance Data 2026 Compression", IEEE Computer 17(6), June 1984. 2028 13.2. Informative References 2030 [Err4667] RFC Errata, Erratum ID 4667, RFC 7230, 2031 . 2033 [HTTP/1.0] Berners-Lee, T., Fielding, R.T., and H.F. Nielsen, 2034 "Hypertext Transfer Protocol -- HTTP/1.0", RFC 1945, 2035 DOI 10.17487/RFC1945, May 1996, 2036 . 2038 [Klein] Klein, A., "Divide and Conquer - HTTP Response Splitting, 2039 Web Cache Poisoning Attacks, and Related Topics", March 2040 2004, . 2043 [Linhart] Linhart, C., Klein, A., Heled, R., and S. Orrin, "HTTP 2044 Request Smuggling", June 2005, 2045 . 2048 [RFC2045] Freed, N. and N.S. Borenstein, "Multipurpose Internet Mail 2049 Extensions (MIME) Part One: Format of Internet Message 2050 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 2051 . 2053 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2054 Extensions (MIME) Part Two: Media Types", RFC 2046, 2055 DOI 10.17487/RFC2046, November 1996, 2056 . 2058 [RFC2049] Freed, N. and N.S. Borenstein, "Multipurpose Internet Mail 2059 Extensions (MIME) Part Five: Conformance Criteria and 2060 Examples", RFC 2049, DOI 10.17487/RFC2049, November 1996, 2061 . 2063 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 2064 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 2065 RFC 2068, DOI 10.17487/RFC2068, January 1997, 2066 . 2068 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 2069 "MIME Encapsulation of Aggregate Documents, such as HTML 2070 (MHTML)", RFC 2557, DOI 10.17487/RFC2557, March 1999, 2071 . 2073 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 2074 DOI 10.17487/RFC5322, October 2008, 2075 . 2077 [RFC7230] Fielding, R., Ed. and J. F. Reschke, Ed., "Hypertext 2078 Transfer Protocol (HTTP/1.1): Message Syntax and Routing", 2079 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2080 . 2082 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2083 Writing an IANA Considerations Section in RFCs", BCP 26, 2084 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2085 . 2087 Appendix A. Collected ABNF 2089 In the collected ABNF below, list rules are expanded as per 2090 Section 5.6.1 of [HTTP]. 2092 BWS = 2094 HTTP-message = start-line CRLF *( field-line CRLF ) CRLF [ 2095 message-body ] 2096 HTTP-name = %x48.54.54.50 ; HTTP 2097 HTTP-version = HTTP-name "/" DIGIT "." DIGIT 2099 OWS = 2101 RWS = 2103 Transfer-Encoding = [ transfer-coding *( OWS "," OWS transfer-coding 2104 ) ] 2106 absolute-URI = 2107 absolute-form = absolute-URI 2108 absolute-path = 2109 asterisk-form = "*" 2110 authority = 2111 authority-form = uri-host ":" port 2113 chunk = chunk-size [ chunk-ext ] CRLF chunk-data CRLF 2114 chunk-data = 1*OCTET 2115 chunk-ext = *( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val 2116 ] ) 2117 chunk-ext-name = token 2118 chunk-ext-val = token / quoted-string 2119 chunk-size = 1*HEXDIG 2120 chunked-body = *chunk last-chunk trailer-section CRLF 2122 field-line = field-name ":" OWS field-value OWS 2123 field-name = 2124 field-value = 2126 last-chunk = 1*"0" [ chunk-ext ] CRLF 2128 message-body = *OCTET 2129 method = token 2131 obs-fold = OWS CRLF RWS 2132 obs-text = 2133 origin-form = absolute-path [ "?" query ] 2135 port = 2137 query = 2138 quoted-string = 2140 reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) 2141 request-line = method SP request-target SP HTTP-version 2142 request-target = origin-form / absolute-form / authority-form / 2143 asterisk-form 2145 start-line = request-line / status-line 2146 status-code = 3DIGIT 2147 status-line = HTTP-version SP status-code SP [ reason-phrase ] 2149 token = 2150 trailer-section = *( field-line CRLF ) 2151 transfer-coding = 2153 uri-host = 2155 Appendix B. Differences between HTTP and MIME 2157 HTTP/1.1 uses many of the constructs defined for the Internet Message 2158 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 2159 [RFC2045] to allow a message body to be transmitted in an open 2160 variety of representations and with extensible fields. However, RFC 2161 2045 is focused only on email; applications of HTTP have many 2162 characteristics that differ from email; hence, HTTP has features that 2163 differ from MIME. These differences were carefully chosen to 2164 optimize performance over binary connections, to allow greater 2165 freedom in the use of new media types, to make date comparisons 2166 easier, and to acknowledge the practice of some early HTTP servers 2167 and clients. 2169 This appendix describes specific areas where HTTP differs from MIME. 2170 Proxies and gateways to and from strict MIME environments need to be 2171 aware of these differences and provide the appropriate conversions 2172 where necessary. 2174 B.1. MIME-Version 2176 HTTP is not a MIME-compliant protocol. However, messages can include 2177 a single MIME-Version header field to indicate what version of the 2178 MIME protocol was used to construct the message. Use of the MIME- 2179 Version header field indicates that the message is in full 2180 conformance with the MIME protocol (as defined in [RFC2045]). 2181 Senders are responsible for ensuring full conformance (where 2182 possible) when exporting HTTP messages to strict MIME environments. 2184 B.2. Conversion to Canonical Form 2186 MIME requires that an Internet mail body part be converted to 2187 canonical form prior to being transferred, as described in Section 4 2188 of [RFC2049], and that content with a type of "text" represent line 2189 breaks as CRLF, forbidding the use of CR or LF outside of line break 2190 sequences [RFC2046]. In contrast, HTTP does not care whether CRLF, 2191 bare CR, or bare LF are used to indicate a line break within content. 2193 A proxy or gateway from HTTP to a strict MIME environment ought to 2194 translate all line breaks within text media types to the RFC 2049 2195 canonical form of CRLF. Note, however, this might be complicated by 2196 the presence of a Content-Encoding and by the fact that HTTP allows 2197 the use of some charsets that do not use octets 13 and 10 to 2198 represent CR and LF, respectively. 2200 Conversion will break any cryptographic checksums applied to the 2201 original content unless the original content is already in canonical 2202 form. Therefore, the canonical form is recommended for any content 2203 that uses such checksums in HTTP. 2205 B.3. Conversion of Date Formats 2207 HTTP/1.1 uses a restricted set of date formats (Section 5.6.7 of 2208 [HTTP]) to simplify the process of date comparison. Proxies and 2209 gateways from other protocols ought to ensure that any Date header 2210 field present in a message conforms to one of the HTTP/1.1 formats 2211 and rewrite the date if necessary. 2213 B.4. Conversion of Content-Encoding 2215 MIME does not include any concept equivalent to HTTP/1.1's Content- 2216 Encoding header field. Since this acts as a modifier on the media 2217 type, proxies and gateways from HTTP to MIME-compliant protocols 2218 ought to either change the value of the Content-Type header field or 2219 decode the representation before forwarding the message. (Some 2220 experimental applications of Content-Type for Internet mail have used 2221 a media-type parameter of ";conversions=" to perform 2222 a function equivalent to Content-Encoding. However, this parameter 2223 is not part of the MIME standards). 2225 B.5. Conversion of Content-Transfer-Encoding 2227 HTTP does not use the Content-Transfer-Encoding field of MIME. 2228 Proxies and gateways from MIME-compliant protocols to HTTP need to 2229 remove any Content-Transfer-Encoding prior to delivering the response 2230 message to an HTTP client. 2232 Proxies and gateways from HTTP to MIME-compliant protocols are 2233 responsible for ensuring that the message is in the correct format 2234 and encoding for safe transport on that protocol, where "safe 2235 transport" is defined by the limitations of the protocol being used. 2236 Such a proxy or gateway ought to transform and label the data with an 2237 appropriate Content-Transfer-Encoding if doing so will improve the 2238 likelihood of safe transport over the destination protocol. 2240 B.6. MHTML and Line Length Limitations 2242 HTTP implementations that share code with MHTML [RFC2557] 2243 implementations need to be aware of MIME line length limitations. 2244 Since HTTP does not have this limitation, HTTP does not fold long 2245 lines. MHTML messages being transported by HTTP follow all 2246 conventions of MHTML, including line length limitations and folding, 2247 canonicalization, etc., since HTTP transfers message-bodies without 2248 modification and, aside from the "multipart/byteranges" type 2249 (Section 14.6 of [HTTP]), does not interpret the content or any MIME 2250 header lines that might be contained therein. 2252 Appendix C. Changes from previous RFCs 2254 C.1. Changes from HTTP/0.9 2256 Since HTTP/0.9 did not support header fields in a request, there is 2257 no mechanism for it to support name-based virtual hosts (selection of 2258 resource by inspection of the Host header field). Any server that 2259 implements name-based virtual hosts ought to disable support for 2260 HTTP/0.9. Most requests that appear to be HTTP/0.9 are, in fact, 2261 badly constructed HTTP/1.x requests caused by a client failing to 2262 properly encode the request-target. 2264 C.2. Changes from HTTP/1.0 2266 C.2.1. Multihomed Web Servers 2268 The requirements that clients and servers support the Host header 2269 field (Section 7.2 of [HTTP]), report an error if it is missing from 2270 an HTTP/1.1 request, and accept absolute URIs (Section 3.2) are among 2271 the most important changes defined by HTTP/1.1. 2273 Older HTTP/1.0 clients assumed a one-to-one relationship of IP 2274 addresses and servers; there was no other established mechanism for 2275 distinguishing the intended server of a request than the IP address 2276 to which that request was directed. The Host header field was 2277 introduced during the development of HTTP/1.1 and, though it was 2278 quickly implemented by most HTTP/1.0 browsers, additional 2279 requirements were placed on all HTTP/1.1 requests in order to ensure 2280 complete adoption. At the time of this writing, most HTTP-based 2281 services are dependent upon the Host header field for targeting 2282 requests. 2284 C.2.2. Keep-Alive Connections 2286 In HTTP/1.0, each connection is established by the client prior to 2287 the request and closed by the server after sending the response. 2288 However, some implementations implement the explicitly negotiated 2289 ("Keep-Alive") version of persistent connections described in 2290 Section 19.7.1 of [RFC2068]. 2292 Some clients and servers might wish to be compatible with these 2293 previous approaches to persistent connections, by explicitly 2294 negotiating for them with a "Connection: keep-alive" request header 2295 field. However, some experimental implementations of HTTP/1.0 2296 persistent connections are faulty; for example, if an HTTP/1.0 proxy 2297 server doesn't understand Connection, it will erroneously forward 2298 that header field to the next inbound server, which would result in a 2299 hung connection. 2301 One attempted solution was the introduction of a Proxy-Connection 2302 header field, targeted specifically at proxies. In practice, this 2303 was also unworkable, because proxies are often deployed in multiple 2304 layers, bringing about the same problem discussed above. 2306 As a result, clients are encouraged not to send the Proxy-Connection 2307 header field in any requests. 2309 Clients are also encouraged to consider the use of Connection: keep- 2310 alive in requests carefully; while they can enable persistent 2311 connections with HTTP/1.0 servers, clients using them will need to 2312 monitor the connection for "hung" requests (which indicate that the 2313 client ought to stop sending the header field), and this mechanism 2314 ought not be used by clients at all when a proxy is being used. 2316 C.2.3. Introduction of Transfer-Encoding 2318 HTTP/1.1 introduces the Transfer-Encoding header field (Section 6.1). 2319 Transfer codings need to be decoded prior to forwarding an HTTP 2320 message over a MIME-compliant protocol. 2322 C.3. Changes from RFC 7230 2324 Most of the sections introducing HTTP's design goals, history, 2325 architecture, conformance criteria, protocol versioning, URIs, 2326 message routing, and header fields have been moved to [HTTP]. This 2327 document has been reduced to just the messaging syntax and connection 2328 management requirements specific to HTTP/1.1. 2330 Bare CRs have been prohibited outside of content. (Section 2.2) 2332 The ABNF definition of authority-form has changed from the more 2333 general authority component of a URI (in which port is optional) to 2334 the specific host:port format that is required by CONNECT. 2335 (Section 3.2.3) 2337 Required recipients to avoid smuggling/splitting attacks when 2338 processing an ambiguous message framing. (Section 6.1) 2340 In the ABNF for chunked extensions, re-introduced (bad) whitespace 2341 around ";" and "=". Whitespace was removed in [RFC7230], but that 2342 change was found to break existing implementations (see [Err4667]). 2343 (Section 7.1.1) 2344 Trailer field semantics now transcend the specifics of chunked 2345 encoding. The decoding algorithm for chunked (Section 7.1.3) has 2346 been updated to encourage storage/forwarding of trailer fields 2347 separately from the header section, to only allow merging into the 2348 header section if the recipient knows the corresponding field 2349 definition permits and defines how to merge, and otherwise to discard 2350 the trailer fields instead of merging. The trailer part is now 2351 called the trailer section to be more consistent with the header 2352 section and more distinct from a body part. (Section 7.1.2) 2354 Disallowed transfer coding parameters called "q" in order to avoid 2355 conflicts with the use of ranks in the TE header field. 2356 (Section 7.3) 2358 Appendix D. Change Log 2360 This section is to be removed before publishing as an RFC. 2362 D.1. Between RFC7230 and draft 00 2364 The changes were purely editorial: 2366 * Change boilerplate and abstract to indicate the "draft" status, 2367 and update references to ancestor specifications. 2369 * Adjust historical notes. 2371 * Update links to sibling specifications. 2373 * Replace sections listing changes from RFC 2616 by new empty 2374 sections referring to RFC 723x. 2376 * Remove acknowledgements specific to RFC 723x. 2378 * Move "Acknowledgements" to the very end and make them unnumbered. 2380 D.2. Since draft-ietf-httpbis-messaging-00 2382 The changes in this draft are editorial, with respect to HTTP as a 2383 whole, to move all core HTTP semantics into [HTTP]: 2385 * Moved introduction, architecture, conformance, and ABNF extensions 2386 from RFC 7230 (Messaging) to semantics [HTTP]. 2388 * Moved discussion of MIME differences from RFC 7231 (Semantics) to 2389 Appendix B since they mostly cover transforming 1.1 messages. 2391 * Moved all extensibility tips, registration procedures, and 2392 registry tables from the IANA considerations to normative 2393 sections, reducing the IANA considerations to just instructions 2394 that will be removed prior to publication as an RFC. 2396 D.3. Since draft-ietf-httpbis-messaging-01 2398 * Cite RFC 8126 instead of RFC 5226 () 2401 * Resolved erratum 4779, no change needed here 2402 (, 2403 ) 2405 * In Section 7, fixed prose claiming transfer parameters allow bare 2406 names (, 2407 ) 2409 * Resolved erratum 4225, no change needed here 2410 (, 2411 ) 2413 * Replace "response code" with "response status code" 2414 (, 2415 ) 2417 * In Section 9.3, clarify statement about HTTP/1.0 keep-alive 2418 (, 2419 ) 2421 * In Section 7.1.1, re-introduce (bad) whitespace around ";" and "=" 2422 (, 2423 , ) 2426 * In Section 7.3, state that transfer codings should not use 2427 parameters named "q" (, ) 2430 * In Section 7, mark coding name "trailers" as reserved in the IANA 2431 registry () 2433 D.4. Since draft-ietf-httpbis-messaging-02 2435 * In Section 4, explain why the reason phrase should be ignored by 2436 clients (). 2438 * Add Section 9.2 to explain how request/response correlation is 2439 performed () 2441 D.5. Since draft-ietf-httpbis-messaging-03 2443 * In Section 9.2, caution against treating data on a connection as 2444 part of a not-yet-issued request () 2447 * In Section 7, remove the predefined codings from the ABNF and make 2448 it generic instead () 2451 * Use RFC 7405 ABNF notation for case-sensitive string constants 2452 () 2454 D.6. Since draft-ietf-httpbis-messaging-04 2456 * In Section 7.8 of [HTTP], clarify that protocol-name is to be 2457 matched case-insensitively () 2460 * In Section 5.2, add leading optional whitespace to obs-fold ABNF 2461 (, 2462 ) 2464 * In Section 4, add clarifications about empty reason phrases 2465 () 2467 * Move discussion of retries from Section 9.3.1 into [HTTP] 2468 () 2470 D.7. Since draft-ietf-httpbis-messaging-05 2472 * In Section 7.1.2, the trailer part has been renamed the trailer 2473 section (for consistency with the header section) and trailers are 2474 no longer merged as header fields by default, but rather can be 2475 discarded, kept separate from header fields, or merged with header 2476 fields only if understood and defined as being mergeable 2477 () 2479 * In Section 2.1 and related Sections, move the trailing CRLF from 2480 the line grammars into the message format 2481 () 2483 * Moved Section 2.3 down () 2486 * In Section 7.8 of [HTTP], use 'websocket' instead of 'HTTP/2.0' in 2487 examples () 2489 * Move version non-specific text from Section 6 into semantics as 2490 "payload" () 2492 * In Section 9.8, add text from RFC 2818 2493 () 2495 D.8. Since draft-ietf-httpbis-messaging-06 2497 * In Section 12.4, update the ALPN protocol ID for HTTP/1.1 2498 () 2500 * In Section 5, align with updates to field terminology in semantics 2501 () 2503 * In Section 7.6.1 of [HTTP], clarify that new connection options 2504 indeed need to be registered () 2507 * In Section 1.1, reference RFC 8174 as well 2508 () 2510 D.9. Since draft-ietf-httpbis-messaging-07 2512 * Move TE: trailers into [HTTP] () 2515 * In Section 6.3, adjust requirements for handling multiple content- 2516 length values () 2518 * Throughout, replace "effective request URI" with "target URI" 2519 () 2521 * In Section 6.1, don't claim Transfer-Encoding is supported by 2522 HTTP/2 or later () 2524 D.10. Since draft-ietf-httpbis-messaging-08 2526 * In Section 2.2, disallow bare CRs () 2529 * Appendix A now uses the sender variant of the "#" list expansion 2530 () 2532 * In Section 5, adjust IANA "Close" entry for new registry format 2533 () 2535 D.11. Since draft-ietf-httpbis-messaging-09 2537 * Switch to xml2rfc v3 mode for draft generation 2538 () 2540 D.12. Since draft-ietf-httpbis-messaging-10 2542 * In Section 6.3, note that TCP half-close does not delimit a 2543 request; talk about corresponding server-side behaviour in 2544 Section 9.6 () 2546 * Moved requirements specific to HTTP/1.1 from [HTTP] into 2547 Section 3.2 () 2549 * In Section 6.1 (Transfer-Encoding), adjust ABNF to allow empty 2550 lists () 2552 * In Section 9.7, add text from RFC 2818 2553 () 2555 * Moved definitions of "TE" and "Upgrade" into [HTTP] 2556 () 2558 * Moved definition of "Connection" into [HTTP] 2559 () 2561 D.13. Since draft-ietf-httpbis-messaging-11 2563 * Move IANA Upgrade Token Registry instructions to [HTTP] 2564 () 2566 D.14. Since draft-ietf-httpbis-messaging-12 2568 * Moved content of history appendix to Semantics 2569 () 2571 * Moved note about "close" being reserved as field name to 2572 Section 9.3 () 2574 * Moved table of transfer codings into Section 12.3 2575 () 2577 * In Section 13.2, updated the URI for the [Linhart] paper 2578 () 2580 * Changed document title to just "HTTP/1.1" 2581 () 2583 * In Section 7, moved transfer-coding ABNF to Section 10.1.4 of 2584 [HTTP] () 2586 * Changed to using "payload data" when defining requirements about 2587 the data being conveyed within a message, instead of the terms 2588 "payload body" or "response body" or "representation body", since 2589 they often get confused with the HTTP/1.1 message body (which 2590 includes transfer coding) () 2593 D.15. Since draft-ietf-httpbis-messaging-13 2595 * In Section 6.3, clarify that a message needs to be checked for 2596 both Content-Length and Transfer-Encoding, before processing 2597 Transfer-Encoding, and that ought to be treated as an error, but 2598 an intermediary can choose to forward the message downstream after 2599 removing the Content-Length and processing the Transfer-Encoding 2600 () 2602 * Changed to using "content" instead of "payload" or "payload data" 2603 to avoid confusion with the payload of version-specific messaging 2604 frames () 2606 D.16. Since draft-ietf-httpbis-messaging-14 2608 * In Section 9.6, define the close connection option, since its 2609 definition was removed from the Connection header field for being 2610 specific to 1.1 () 2612 * In Section 3.3, clarify how the target URI is reconstructed when 2613 the request-target is not in absolute-form and highlight risk in 2614 selecting a default host () 2617 * In Section 7.1, clarify large chunk handling issues 2618 () 2620 * In Section 2.2, explicitly close the connection after sending a 2621 400 () 2623 * In Section 2.3, refine version requirements for intermediaries 2624 () 2626 * In Section 7.1.3, don't remove the Trailer header field 2627 () 2629 * In Section 3.2.3, changed the ABNF definition of authority-form 2630 from the authority component (in which port is optional) to the 2631 host:port format that has always been required by CONNECT 2632 () 2634 D.17. Since draft-ietf-httpbis-messaging-15 2636 * None. 2638 D.18. Since draft-ietf-httpbis-messaging-16 2640 This draft addresses mostly editorial issues raised during or past 2641 IETF Last Call; see for a summary. 2644 Furthermore: 2646 * In Section 6.1, require recipients to avoid smuggling/splitting 2647 attacks when processing an ambiguous message framing 2648 () 2650 D.19. Since draft-ietf-httpbis-messaging-17 2652 * In Section 4, rephrase text about status code definitions in 2653 [HTTP] () 2655 * In Section 9.2, clarify how to match responses to requests 2656 () 2658 * Made reference to [RFC5322] normative, as it is referenced from 2659 the ABNF (for "From" header field) () 2662 * In Section 5.2, include text about message/http that previously 2663 was in [HTTP] () 2665 * Throughout, disambiguate "selected representation" and "selected 2666 response" (now "chosen response") () 2669 D.20. Since draft-ietf-httpbis-messaging-18 2671 * Improve a few crossrefs into [HTTP] () 2674 * In Section 7.1.2, improve readability of formerly overlong 2675 sentence () 2677 * Slightly rephrase Section 9.8 () 2680 Acknowledgements 2682 See Appendix "Acknowledgements" of [HTTP]. 2684 Index 2686 A C D F G H M O R T X 2688 A 2690 absolute-form (of request-target) Section 3.2.2 2691 application/http Media Type Section 10.2 2692 asterisk-form (of request-target) Section 3.2.4 2693 authority-form (of request-target) Section 3.2.3 2695 C 2697 Connection header field Section 9.6 2698 Content-Length header field Section 6.2 2699 Content-Transfer-Encoding header field Appendix B.5 2700 chunked (Coding Format) Section 6.1; Section 6.3 2701 chunked (transfer coding) Section 7.1 2702 close Section 9.3; Section 9.6 2703 compress (transfer coding) Section 7.2 2705 D 2707 deflate (transfer coding) Section 7.2 2709 F 2711 Fields 2712 Close Section 9.6, Paragraph 4 2713 MIME-Version Appendix B.1 2714 Transfer-Encoding Section 6.1 2716 G 2718 Grammar 2719 ALPHA Section 1.2 2720 CR Section 1.2 2721 CRLF Section 1.2 2722 CTL Section 1.2 2723 DIGIT Section 1.2 2724 DQUOTE Section 1.2 2725 HEXDIG Section 1.2 2726 HTAB Section 1.2 2727 HTTP-message Section 2.1 2728 HTTP-name Section 2.3 2729 HTTP-version Section 2.3 2730 LF Section 1.2 2731 OCTET Section 1.2 2732 SP Section 1.2 2733 Transfer-Encoding Section 6.1 2734 VCHAR Section 1.2 2735 absolute-form Section 3.2; Section 3.2.2 2736 asterisk-form Section 3.2; Section 3.2.4 2737 authority-form Section 3.2; Section 3.2.3 2738 chunk Section 7.1 2739 chunk-data Section 7.1 2740 chunk-ext Section 7.1; Section 7.1.1 2741 chunk-ext-name Section 7.1.1 2742 chunk-ext-val Section 7.1.1 2743 chunk-size Section 7.1 2744 chunked-body Section 7.1 2745 field-line Section 5; Section 7.1.2 2746 field-name Section 5 2747 field-value Section 5 2748 last-chunk Section 7.1 2749 message-body Section 6 2750 method Section 3.1 2751 obs-fold Section 5.2 2752 origin-form Section 3.2; Section 3.2.1 2753 reason-phrase Section 4 2754 request-line Section 3 2755 request-target Section 3.2 2756 start-line Section 2.1 2757 status-code Section 4 2758 status-line Section 4 2759 trailer-section Section 7.1; Section 7.1.2 2760 gzip (transfer coding) Section 7.2 2762 H 2764 Header Fields 2765 MIME-Version Appendix B.1 2766 Transfer-Encoding Section 6.1 2767 header line Section 2.1 2768 header section Section 2.1 2769 headers Section 2.1 2771 M 2773 MIME-Version header field Appendix B.1 2774 Media Type 2775 application/http Section 10.2 2776 message/http Section 10.1 2777 message/http Media Type Section 10.1 2778 method Section 3.1 2780 O 2782 origin-form (of request-target) Section 3.2.1 2784 R 2786 request-target Section 3.2 2788 T 2790 Transfer-Encoding header field Section 6.1 2792 X 2794 x-compress (transfer coding) Section 7.2 2795 x-gzip (transfer coding) Section 7.2 2797 Authors' Addresses 2799 Roy T. Fielding (editor) 2800 Adobe 2801 345 Park Ave 2802 San Jose, CA 95110 2803 United States of America 2805 Email: fielding@gbiv.com 2806 URI: https://roy.gbiv.com/ 2808 Mark Nottingham (editor) 2809 Fastly 2810 Prahran VIC 2811 Australia 2813 Email: mnot@mnot.net 2814 URI: https://www.mnot.net/ 2815 Julian Reschke (editor) 2816 greenbytes GmbH 2817 Hafenweg 16 2818 48155 Münster 2819 Germany 2821 Email: julian.reschke@greenbytes.de 2822 URI: https://greenbytes.de/tech/webdav/