idnits 2.17.00 (12 Aug 2021) /tmp/idnits7920/draft-ietf-httpbis-messaging-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document obsoletes RFC7230, but the abstract doesn't seem to directly say this. It does mention RFC7230 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (November 4, 2019) is 928 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC3986' is defined on line 2056, but no explicit reference was found in the text == Unused Reference: 'RFC7231' is defined on line 2139, but no explicit reference was found in the text == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-06 -- Possible downref: Normative reference to a draft: ref. 'Caching' ** Downref: Normative reference to an Informational RFC: RFC 1950 ** Downref: Normative reference to an Informational RFC: RFC 1951 ** Downref: Normative reference to an Informational RFC: RFC 1952 == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-semantics-06 -- Possible downref: Normative reference to a draft: ref. 'Semantics' -- Possible downref: Non-RFC (?) normative reference: ref. 'USASCII' -- Possible downref: Non-RFC (?) normative reference: ref. 'Welch' -- Obsolete informational reference (is this intentional?): RFC 2068 (Obsoleted by RFC 2616) -- Duplicate reference: RFC7230, mentioned in 'RFC7230', was also mentioned in 'Err4667'. Summary: 3 errors (**), 0 flaws (~~), 6 warnings (==), 8 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: May 7, 2020 J. Reschke, Ed. 7 greenbytes 8 November 4, 2019 10 HTTP/1.1 Messaging 11 draft-ietf-httpbis-messaging-06 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.7. 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 May 7, 2020. 54 Copyright Notice 56 Copyright (c) 2019 IETF Trust and the persons identified as the 57 document authors. All rights reserved. 59 This document is subject to BCP 78 and the IETF Trust's Legal 60 Provisions Relating to IETF Documents 61 (https://trustee.ietf.org/license-info) in effect on the date of 62 publication of this document. Please review these documents 63 carefully, as they describe your rights and restrictions with respect 64 to this document. Code Components extracted from this document must 65 include Simplified BSD License text as described in Section 4.e of 66 the Trust Legal Provisions and are provided without warranty as 67 described in the Simplified BSD License. 69 This document may contain material from IETF Documents or IETF 70 Contributions published or made publicly available before November 71 10, 2008. The person(s) controlling the copyright in some of this 72 material may not have granted the IETF Trust the right to allow 73 modifications of such material outside the IETF Standards Process. 74 Without obtaining an adequate license from the person(s) controlling 75 the copyright in such materials, this document may not be modified 76 outside the IETF Standards Process, and derivative works of it may 77 not be created outside the IETF Standards Process, except to format 78 it for publication as an RFC or to translate it into languages other 79 than English. 81 Table of Contents 83 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 84 1.1. Requirements Notation . . . . . . . . . . . . . . . . . . 5 85 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 5 86 2. Message . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 87 2.1. Message Format . . . . . . . . . . . . . . . . . . . . . 6 88 2.2. Message Parsing . . . . . . . . . . . . . . . . . . . . . 7 89 2.3. HTTP Version . . . . . . . . . . . . . . . . . . . . . . 8 90 3. Request Line . . . . . . . . . . . . . . . . . . . . . . . . 9 91 3.1. Method . . . . . . . . . . . . . . . . . . . . . . . . . 9 92 3.2. Request Target . . . . . . . . . . . . . . . . . . . . . 10 93 3.2.1. origin-form . . . . . . . . . . . . . . . . . . . . . 10 94 3.2.2. absolute-form . . . . . . . . . . . . . . . . . . . . 11 95 3.2.3. authority-form . . . . . . . . . . . . . . . . . . . 11 96 3.2.4. asterisk-form . . . . . . . . . . . . . . . . . . . . 11 98 3.3. Effective Request URI . . . . . . . . . . . . . . . . . . 12 99 4. Status Line . . . . . . . . . . . . . . . . . . . . . . . . . 13 100 5. Header Field Syntax . . . . . . . . . . . . . . . . . . . . . 14 101 5.1. Header Field Parsing . . . . . . . . . . . . . . . . . . 15 102 5.2. Obsolete Line Folding . . . . . . . . . . . . . . . . . . 16 103 6. Message Body . . . . . . . . . . . . . . . . . . . . . . . . 16 104 6.1. Transfer-Encoding . . . . . . . . . . . . . . . . . . . . 17 105 6.2. Content-Length . . . . . . . . . . . . . . . . . . . . . 18 106 6.3. Message Body Length . . . . . . . . . . . . . . . . . . . 19 107 7. Transfer Codings . . . . . . . . . . . . . . . . . . . . . . 21 108 7.1. Chunked Transfer Coding . . . . . . . . . . . . . . . . . 22 109 7.1.1. Chunk Extensions . . . . . . . . . . . . . . . . . . 23 110 7.1.2. Chunked Trailer Section . . . . . . . . . . . . . . . 23 111 7.1.3. Decoding Chunked . . . . . . . . . . . . . . . . . . 24 112 7.2. Transfer Codings for Compression . . . . . . . . . . . . 24 113 7.3. Transfer Coding Registry . . . . . . . . . . . . . . . . 25 114 7.4. TE . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 115 8. Handling Incomplete Messages . . . . . . . . . . . . . . . . 27 116 9. Connection Management . . . . . . . . . . . . . . . . . . . . 27 117 9.1. Connection . . . . . . . . . . . . . . . . . . . . . . . 28 118 9.2. Establishment . . . . . . . . . . . . . . . . . . . . . . 29 119 9.3. Associating a Response to a Request . . . . . . . . . . . 29 120 9.4. Persistence . . . . . . . . . . . . . . . . . . . . . . . 30 121 9.4.1. Retrying Requests . . . . . . . . . . . . . . . . . . 31 122 9.4.2. Pipelining . . . . . . . . . . . . . . . . . . . . . 31 123 9.5. Concurrency . . . . . . . . . . . . . . . . . . . . . . . 32 124 9.6. Failures and Timeouts . . . . . . . . . . . . . . . . . . 32 125 9.7. Tear-down . . . . . . . . . . . . . . . . . . . . . . . . 33 126 9.8. TLS Connection Closure . . . . . . . . . . . . . . . . . 34 127 9.9. Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . 35 128 9.9.1. Upgrade Protocol Names . . . . . . . . . . . . . . . 37 129 9.9.2. Upgrade Token Registry . . . . . . . . . . . . . . . 38 130 10. Enclosing Messages as Data . . . . . . . . . . . . . . . . . 38 131 10.1. Media Type message/http . . . . . . . . . . . . . . . . 38 132 10.2. Media Type application/http . . . . . . . . . . . . . . 40 133 11. Security Considerations . . . . . . . . . . . . . . . . . . . 41 134 11.1. Response Splitting . . . . . . . . . . . . . . . . . . . 41 135 11.2. Request Smuggling . . . . . . . . . . . . . . . . . . . 42 136 11.3. Message Integrity . . . . . . . . . . . . . . . . . . . 42 137 11.4. Message Confidentiality . . . . . . . . . . . . . . . . 43 138 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 139 12.1. Header Field Registration . . . . . . . . . . . . . . . 43 140 12.2. Media Type Registration . . . . . . . . . . . . . . . . 43 141 12.3. Transfer Coding Registration . . . . . . . . . . . . . . 43 142 12.4. Upgrade Token Registration . . . . . . . . . . . . . . . 43 143 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 44 144 13.1. Normative References . . . . . . . . . . . . . . . . . . 44 145 13.2. Informative References . . . . . . . . . . . . . . . . . 45 147 Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 47 148 Appendix B. Differences between HTTP and MIME . . . . . . . . . 48 149 B.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . 49 150 B.2. Conversion to Canonical Form . . . . . . . . . . . . . . 49 151 B.3. Conversion of Date Formats . . . . . . . . . . . . . . . 49 152 B.4. Conversion of Content-Encoding . . . . . . . . . . . . . 50 153 B.5. Conversion of Content-Transfer-Encoding . . . . . . . . . 50 154 B.6. MHTML and Line Length Limitations . . . . . . . . . . . . 50 155 Appendix C. HTTP Version History . . . . . . . . . . . . . . . . 50 156 C.1. Changes from HTTP/1.0 . . . . . . . . . . . . . . . . . . 51 157 C.1.1. Multihomed Web Servers . . . . . . . . . . . . . . . 51 158 C.1.2. Keep-Alive Connections . . . . . . . . . . . . . . . 52 159 C.1.3. Introduction of Transfer-Encoding . . . . . . . . . . 52 160 C.2. Changes from RFC 7230 . . . . . . . . . . . . . . . . . . 52 161 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 53 162 D.1. Between RFC7230 and draft 00 . . . . . . . . . . . . . . 53 163 D.2. Since draft-ietf-httpbis-messaging-00 . . . . . . . . . . 53 164 D.3. Since draft-ietf-httpbis-messaging-01 . . . . . . . . . . 54 165 D.4. Since draft-ietf-httpbis-messaging-02 . . . . . . . . . . 55 166 D.5. Since draft-ietf-httpbis-messaging-03 . . . . . . . . . . 55 167 D.6. Since draft-ietf-httpbis-messaging-04 . . . . . . . . . . 55 168 D.7. Since draft-ietf-httpbis-messaging-05 . . . . . . . . . . 55 169 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 170 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 58 171 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 58 173 1. Introduction 175 The Hypertext Transfer Protocol (HTTP) is a stateless application- 176 level request/response protocol that uses extensible semantics and 177 self-descriptive messages for flexible interaction with network-based 178 hypertext information systems. HTTP is defined by a series of 179 documents that collectively form the HTTP/1.1 specification: 181 o "HTTP Semantics" [Semantics] 183 o "HTTP Caching" [Caching] 185 o "HTTP/1.1 Messaging" (this document) 187 This document defines HTTP/1.1 message syntax and framing 188 requirements and their associated connection management. Our goal is 189 to define all of the mechanisms necessary for HTTP/1.1 message 190 handling that are independent of message semantics, thereby defining 191 the complete set of requirements for message parsers and message- 192 forwarding intermediaries. 194 This document obsoletes the portions of RFC 7230 related to HTTP/1.1 195 messaging and connection management, with the changes being 196 summarized in Appendix C.2. The other parts of RFC 7230 are 197 obsoleted by "HTTP Semantics" [Semantics]. 199 1.1. Requirements Notation 201 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 202 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 203 document are to be interpreted as described in [RFC2119]. 205 Conformance criteria and considerations regarding error handling are 206 defined in Section 3 of [Semantics]. 208 1.2. Syntax Notation 210 This specification uses the Augmented Backus-Naur Form (ABNF) 211 notation of [RFC5234], extended with the notation for case- 212 sensitivity in strings defined in [RFC7405]. 214 It also uses a list extension, defined in Section 12 of [Semantics], 215 that allows for compact definition of comma-separated lists using a 216 '#' operator (similar to how the '*' operator indicates repetition). 217 Appendix A shows the collected grammar with all list operators 218 expanded to standard ABNF notation. 220 As a convention, ABNF rule names prefixed with "obs-" denote 221 "obsolete" grammar rules that appear for historical reasons. 223 The following core rules are included by reference, as defined in 224 [RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF 225 (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), 226 HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line 227 feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR (any 228 visible [USASCII] character). 230 The rules below are defined in [Semantics]: 232 BWS = 233 OWS = 234 RWS = 235 absolute-URI = 236 absolute-path = 237 authority = 238 comment = 239 field-name = 240 field-value = 241 obs-text = 242 port = 243 query = 244 quoted-string = 245 token = 246 uri-host = 248 2. Message 250 2.1. Message Format 252 An HTTP/1.1 message consists of a start-line followed by a CRLF and a 253 sequence of octets in a format similar to the Internet Message Format 254 [RFC5322]: zero or more header fields (collectively referred to as 255 the "headers" or the "header section"), an empty line indicating the 256 end of the header section, and an optional message body. 258 HTTP-message = start-line CRLF 259 *( header-field CRLF ) 260 CRLF 261 [ message-body ] 263 A message can be either a request from client to server or a response 264 from server to client. Syntactically, the two types of message 265 differ only in the start-line, which is either a request-line (for 266 requests) or a status-line (for responses), and in the algorithm for 267 determining the length of the message body (Section 6). 269 start-line = request-line / status-line 271 In theory, a client could receive requests and a server could receive 272 responses, distinguishing them by their different start-line formats. 273 In practice, servers are implemented to only expect a request (a 274 response is interpreted as an unknown or invalid request method) and 275 clients are implemented to only expect a response. 277 Although HTTP makes use of some protocol elements similar to the 278 Multipurpose Internet Mail Extensions (MIME) [RFC2045], see 279 Appendix B for the differences between HTTP and MIME messages. 281 2.2. Message Parsing 283 The normal procedure for parsing an HTTP message is to read the 284 start-line into a structure, read each header field into a hash table 285 by field name until the empty line, and then use the parsed data to 286 determine if a message body is expected. If a message body has been 287 indicated, then it is read as a stream until an amount of octets 288 equal to the message body length is read or the connection is closed. 290 A recipient MUST parse an HTTP message as a sequence of octets in an 291 encoding that is a superset of US-ASCII [USASCII]. Parsing an HTTP 292 message as a stream of Unicode characters, without regard for the 293 specific encoding, creates security vulnerabilities due to the 294 varying ways that string processing libraries handle invalid 295 multibyte character sequences that contain the octet LF (%x0A). 296 String-based parsers can only be safely used within protocol elements 297 after the element has been extracted from the message, such as within 298 a header field-value after message parsing has delineated the 299 individual fields. 301 Although the line terminator for the start-line and header fields is 302 the sequence CRLF, a recipient MAY recognize a single LF as a line 303 terminator and ignore any preceding CR. 305 Older HTTP/1.0 user agent implementations might send an extra CRLF 306 after a POST request as a workaround for some early server 307 applications that failed to read message body content that was not 308 terminated by a line-ending. An HTTP/1.1 user agent MUST NOT preface 309 or follow a request with an extra CRLF. If terminating the request 310 message body with a line-ending is desired, then the user agent MUST 311 count the terminating CRLF octets as part of the message body length. 313 In the interest of robustness, a server that is expecting to receive 314 and parse a request-line SHOULD ignore at least one empty line (CRLF) 315 received prior to the request-line. 317 A sender MUST NOT send whitespace between the start-line and the 318 first header field. A recipient that receives whitespace between the 319 start-line and the first header field MUST either reject the message 320 as invalid or consume each whitespace-preceded line without further 321 processing of it (i.e., ignore the entire line, along with any 322 subsequent lines preceded by whitespace, until a properly formed 323 header field is received or the header section is terminated). 325 The presence of such whitespace in a request might be an attempt to 326 trick a server into ignoring that field or processing the line after 327 it as a new request, either of which might result in a security 328 vulnerability if other implementations within the request chain 329 interpret the same message differently. Likewise, the presence of 330 such whitespace in a response might be ignored by some clients or 331 cause others to cease parsing. 333 When a server listening only for HTTP request messages, or processing 334 what appears from the start-line to be an HTTP request message, 335 receives a sequence of octets that does not match the HTTP-message 336 grammar aside from the robustness exceptions listed above, the server 337 SHOULD respond with a 400 (Bad Request) response. 339 2.3. HTTP Version 341 HTTP uses a "." numbering scheme to indicate versions 342 of the protocol. This specification defines version "1.1". 343 Section 3.5 of [Semantics] specifies the semantics of HTTP version 344 numbers. 346 The version of an HTTP/1.x message is indicated by an HTTP-version 347 field in the start-line. HTTP-version is case-sensitive. 349 HTTP-version = HTTP-name "/" DIGIT "." DIGIT 350 HTTP-name = %s"HTTP" 352 When an HTTP/1.1 message is sent to an HTTP/1.0 recipient [RFC1945] 353 or a recipient whose version is unknown, the HTTP/1.1 message is 354 constructed such that it can be interpreted as a valid HTTP/1.0 355 message if all of the newer features are ignored. This specification 356 places recipient-version requirements on some new features so that a 357 conformant sender will only use compatible features until it has 358 determined, through configuration or the receipt of a message, that 359 the recipient supports HTTP/1.1. 361 Intermediaries that process HTTP messages (i.e., all intermediaries 362 other than those acting as tunnels) MUST send their own HTTP-version 363 in forwarded messages. In other words, they are not allowed to 364 blindly forward the start-line without ensuring that the protocol 365 version in that message matches a version to which that intermediary 366 is conformant for both the receiving and sending of messages. 367 Forwarding an HTTP message without rewriting the HTTP-version might 368 result in communication errors when downstream recipients use the 369 message sender's version to determine what features are safe to use 370 for later communication with that sender. 372 A server MAY send an HTTP/1.0 response to an HTTP/1.1 request if it 373 is known or suspected that the client incorrectly implements the HTTP 374 specification and is incapable of correctly processing later version 375 responses, such as when a client fails to parse the version number 376 correctly or when an intermediary is known to blindly forward the 377 HTTP-version even when it doesn't conform to the given minor version 378 of the protocol. Such protocol downgrades SHOULD NOT be performed 379 unless triggered by specific client attributes, such as when one or 380 more of the request header fields (e.g., User-Agent) uniquely match 381 the values sent by a client known to be in error. 383 3. Request Line 385 A request-line begins with a method token, followed by a single space 386 (SP), the request-target, another single space (SP), and ends with 387 the protocol version. 389 request-line = method SP request-target SP HTTP-version 391 Although the request-line grammar rule requires that each of the 392 component elements be separated by a single SP octet, recipients MAY 393 instead parse on whitespace-delimited word boundaries and, aside from 394 the CRLF terminator, treat any form of whitespace as the SP separator 395 while ignoring preceding or trailing whitespace; such whitespace 396 includes one or more of the following octets: SP, HTAB, VT (%x0B), FF 397 (%x0C), or bare CR. However, lenient parsing can result in request 398 smuggling security vulnerabilities if there are multiple recipients 399 of the message and each has its own unique interpretation of 400 robustness (see Section 11.2). 402 HTTP does not place a predefined limit on the length of a request- 403 line, as described in Section 3 of [Semantics]. A server that 404 receives a method longer than any that it implements SHOULD respond 405 with a 501 (Not Implemented) status code. A server that receives a 406 request-target longer than any URI it wishes to parse MUST respond 407 with a 414 (URI Too Long) status code (see Section 9.5.15 of 408 [Semantics]). 410 Various ad hoc limitations on request-line length are found in 411 practice. It is RECOMMENDED that all HTTP senders and recipients 412 support, at a minimum, request-line lengths of 8000 octets. 414 3.1. Method 416 The method token indicates the request method to be performed on the 417 target resource. The request method is case-sensitive. 419 method = token 421 The request methods defined by this specification can be found in 422 Section 7 of [Semantics], along with information regarding the HTTP 423 method registry and considerations for defining new methods. 425 3.2. Request Target 427 The request-target identifies the target resource upon which to apply 428 the request. The client derives a request-target from its desired 429 target URI. There are four distinct formats for the request-target, 430 depending on both the method being requested and whether the request 431 is to a proxy. 433 request-target = origin-form 434 / absolute-form 435 / authority-form 436 / asterisk-form 438 No whitespace is allowed in the request-target. Unfortunately, some 439 user agents fail to properly encode or exclude whitespace found in 440 hypertext references, resulting in those disallowed characters being 441 sent as the request-target in a malformed request-line. 443 Recipients of an invalid request-line SHOULD respond with either a 444 400 (Bad Request) error or a 301 (Moved Permanently) redirect with 445 the request-target properly encoded. A recipient SHOULD NOT attempt 446 to autocorrect and then process the request without a redirect, since 447 the invalid request-line might be deliberately crafted to bypass 448 security filters along the request chain. 450 3.2.1. origin-form 452 The most common form of request-target is the origin-form. 454 origin-form = absolute-path [ "?" query ] 456 When making a request directly to an origin server, other than a 457 CONNECT or server-wide OPTIONS request (as detailed below), a client 458 MUST send only the absolute path and query components of the target 459 URI as the request-target. If the target URI's path component is 460 empty, the client MUST send "/" as the path within the origin-form of 461 request-target. A Host header field is also sent, as defined in 462 Section 5.4 of [Semantics]. 464 For example, a client wishing to retrieve a representation of the 465 resource identified as 467 http://www.example.org/where?q=now 469 directly from the origin server would open (or reuse) a TCP 470 connection to port 80 of the host "www.example.org" and send the 471 lines: 473 GET /where?q=now HTTP/1.1 474 Host: www.example.org 476 followed by the remainder of the request message. 478 3.2.2. absolute-form 480 When making a request to a proxy, other than a CONNECT or server-wide 481 OPTIONS request (as detailed below), a client MUST send the target 482 URI in absolute-form as the request-target. 484 absolute-form = absolute-URI 486 The proxy is requested to either service that request from a valid 487 cache, if possible, or make the same request on the client's behalf 488 to either the next inbound proxy server or directly to the origin 489 server indicated by the request-target. Requirements on such 490 "forwarding" of messages are defined in Section 5.5 of [Semantics]. 492 An example absolute-form of request-line would be: 494 GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 496 To allow for transition to the absolute-form for all requests in some 497 future version of HTTP, a server MUST accept the absolute-form in 498 requests, even though HTTP/1.1 clients will only send them in 499 requests to proxies. 501 3.2.3. authority-form 503 The authority-form of request-target is only used for CONNECT 504 requests (Section 7.3.6 of [Semantics]). 506 authority-form = authority 508 When making a CONNECT request to establish a tunnel through one or 509 more proxies, a client MUST send only the target URI's authority 510 component (excluding any userinfo and its "@" delimiter) as the 511 request-target. For example, 513 CONNECT www.example.com:80 HTTP/1.1 515 3.2.4. asterisk-form 517 The asterisk-form of request-target is only used for a server-wide 518 OPTIONS request (Section 7.3.7 of [Semantics]). 520 asterisk-form = "*" 522 When a client wishes to request OPTIONS for the server as a whole, as 523 opposed to a specific named resource of that server, the client MUST 524 send only "*" (%x2A) as the request-target. For example, 526 OPTIONS * HTTP/1.1 528 If a proxy receives an OPTIONS request with an absolute-form of 529 request-target in which the URI has an empty path and no query 530 component, then the last proxy on the request chain MUST send a 531 request-target of "*" when it forwards the request to the indicated 532 origin server. 534 For example, the request 536 OPTIONS http://www.example.org:8001 HTTP/1.1 538 would be forwarded by the final proxy as 540 OPTIONS * HTTP/1.1 541 Host: www.example.org:8001 543 after connecting to port 8001 of host "www.example.org". 545 3.3. Effective Request URI 547 Since the request-target often contains only part of the user agent's 548 target URI, a server reconstructs the intended target as an effective 549 request URI to properly service the request (Section 5.3 of 550 [Semantics]). 552 If the request-target is in absolute-form, the effective request URI 553 is the same as the request-target. Otherwise, the effective request 554 URI is constructed as follows: 556 If the server's configuration (or outbound gateway) provides a 557 fixed URI scheme, that scheme is used for the effective request 558 URI. Otherwise, if the request is received over a TLS-secured TCP 559 connection, the effective request URI's scheme is "https"; if not, 560 the scheme is "http". 562 If the server's configuration (or outbound gateway) provides a 563 fixed URI authority component, that authority is used for the 564 effective request URI. If not, then if the request-target is in 565 authority-form, the effective request URI's authority component is 566 the same as the request-target. If not, then if a Host header 567 field is supplied with a non-empty field-value, the authority 568 component is the same as the Host field-value. Otherwise, the 569 authority component is assigned the default name configured for 570 the server and, if the connection's incoming TCP port number 571 differs from the default port for the effective request URI's 572 scheme, then a colon (":") and the incoming port number (in 573 decimal form) are appended to the authority component. 575 If the request-target is in authority-form or asterisk-form, the 576 effective request URI's combined path and query component is 577 empty. Otherwise, the combined path and query component is the 578 same as the request-target. 580 The components of the effective request URI, once determined as 581 above, can be combined into absolute-URI form by concatenating the 582 scheme, "://", authority, and combined path and query component. 584 Example 1: the following message received over an insecure TCP 585 connection 587 GET /pub/WWW/TheProject.html HTTP/1.1 588 Host: www.example.org:8080 590 has an effective request URI of 592 http://www.example.org:8080/pub/WWW/TheProject.html 594 Example 2: the following message received over a TLS-secured TCP 595 connection 597 OPTIONS * HTTP/1.1 598 Host: www.example.org 600 has an effective request URI of 602 https://www.example.org 604 Recipients of an HTTP/1.0 request that lacks a Host header field 605 might need to use heuristics (e.g., examination of the URI path for 606 something unique to a particular host) in order to guess the 607 effective request URI's authority component. 609 4. Status Line 611 The first line of a response message is the status-line, consisting 612 of the protocol version, a space (SP), the status code, another 613 space, and ending with an OPTIONAL textual phrase describing the 614 status code. 616 status-line = HTTP-version SP status-code SP [reason-phrase] 618 Although the status-line grammar rule requires that each of the 619 component elements be separated by a single SP octet, recipients MAY 620 instead parse on whitespace-delimited word boundaries and, aside from 621 the line terminator, treat any form of whitespace as the SP separator 622 while ignoring preceding or trailing whitespace; such whitespace 623 includes one or more of the following octets: SP, HTAB, VT (%x0B), FF 624 (%x0C), or bare CR. However, lenient parsing can result in response 625 splitting security vulnerabilities if there are multiple recipients 626 of the message and each has its own unique interpretation of 627 robustness (see Section 11.1). 629 The status-code element is a 3-digit integer code describing the 630 result of the server's attempt to understand and satisfy the client's 631 corresponding request. The rest of the response message is to be 632 interpreted in light of the semantics defined for that status code. 633 See Section 9 of [Semantics] for information about the semantics of 634 status codes, including the classes of status code (indicated by the 635 first digit), the status codes defined by this specification, 636 considerations for the definition of new status codes, and the IANA 637 registry. 639 status-code = 3DIGIT 641 The reason-phrase element exists for the sole purpose of providing a 642 textual description associated with the numeric status code, mostly 643 out of deference to earlier Internet application protocols that were 644 more frequently used with interactive text clients. 646 reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) 648 A client SHOULD ignore the reason-phrase content because it is not a 649 reliable channel for information (it might be translated for a given 650 locale, overwritten by intermediaries, or discarded when the message 651 is forwarded via other versions of HTTP). A server MUST send the 652 space that separates status-code from the reason-phrase even when the 653 reason-phrase is absent (i.e., the status-line would end with the 654 three octets SP CR LF). 656 5. Header Field Syntax 658 Each header field consists of a case-insensitive field name followed 659 by a colon (":"), optional leading whitespace, the field value, and 660 optional trailing whitespace. 662 header-field = field-name ":" OWS field-value OWS 664 Most HTTP field names and the rules for parsing within field values 665 are defined in Section 4 of [Semantics]. This section covers the 666 generic syntax for header field inclusion within, and extraction 667 from, HTTP/1.1 messages. In addition, the following header fields 668 are defined by this document because they are specific to HTTP/1.1 669 message processing: 671 +-------------------+----------+---------------+ 672 | Header Field Name | Status | Reference | 673 +-------------------+----------+---------------+ 674 | Connection | standard | Section 9.1 | 675 | MIME-Version | standard | Appendix B.1 | 676 | TE | standard | Section 7.4 | 677 | Transfer-Encoding | standard | Section 6.1 | 678 | Upgrade | standard | Section 9.9 | 679 +-------------------+----------+---------------+ 681 Table 1 683 Furthermore, the field name "Close" is reserved, since using that 684 name as an HTTP header field might conflict with the "close" 685 connection option of the Connection header field (Section 9.1). 687 +-------------------+----------+----------+------------+ 688 | Header Field Name | Protocol | Status | Reference | 689 +-------------------+----------+----------+------------+ 690 | Close | http | reserved | Section 5 | 691 +-------------------+----------+----------+------------+ 693 5.1. Header Field Parsing 695 Messages are parsed using a generic algorithm, independent of the 696 individual header field names. The contents within a given field 697 value are not parsed until a later stage of message interpretation 698 (usually after the message's entire header section has been 699 processed). 701 No whitespace is allowed between the header field-name and colon. In 702 the past, differences in the handling of such whitespace have led to 703 security vulnerabilities in request routing and response handling. A 704 server MUST reject any received request message that contains 705 whitespace between a header field-name and colon with a response 706 status code of 400 (Bad Request). A proxy MUST remove any such 707 whitespace from a response message before forwarding the message 708 downstream. 710 A field value might be preceded and/or followed by optional 711 whitespace (OWS); a single SP preceding the field-value is preferred 712 for consistent readability by humans. The field value does not 713 include any leading or trailing whitespace: OWS occurring before the 714 first non-whitespace octet of the field value or after the last non- 715 whitespace octet of the field value ought to be excluded by parsers 716 when extracting the field value from a header field. 718 5.2. Obsolete Line Folding 720 Historically, HTTP header field values could be extended over 721 multiple lines by preceding each extra line with at least one space 722 or horizontal tab (obs-fold). This specification deprecates such 723 line folding except within the message/http media type 724 (Section 10.1). 726 obs-fold = OWS CRLF RWS 727 ; obsolete line folding 729 A sender MUST NOT generate a message that includes line folding 730 (i.e., that has any field-value that contains a match to the obs-fold 731 rule) unless the message is intended for packaging within the 732 message/http media type. 734 A server that receives an obs-fold in a request message that is not 735 within a message/http container MUST either reject the message by 736 sending a 400 (Bad Request), preferably with a representation 737 explaining that obsolete line folding is unacceptable, or replace 738 each received obs-fold with one or more SP octets prior to 739 interpreting the field value or forwarding the message downstream. 741 A proxy or gateway that receives an obs-fold in a response message 742 that is not within a message/http container MUST either discard the 743 message and replace it with a 502 (Bad Gateway) response, preferably 744 with a representation explaining that unacceptable line folding was 745 received, or replace each received obs-fold with one or more SP 746 octets prior to interpreting the field value or forwarding the 747 message downstream. 749 A user agent that receives an obs-fold in a response message that is 750 not within a message/http container MUST replace each received obs- 751 fold with one or more SP octets prior to interpreting the field 752 value. 754 6. Message Body 756 The message body (if any) of an HTTP message is used to carry the 757 payload body (Section 6.3.3 of [Semantics]) of that request or 758 response. The message body is identical to the payload body unless a 759 transfer coding has been applied, as described in Section 6.1. 761 message-body = *OCTET 763 The rules for determining when a message body is present in an 764 HTTP/1.1 message differ for requests and responses. 766 The presence of a message body in a request is signaled by a Content- 767 Length or Transfer-Encoding header field. Request message framing is 768 independent of method semantics, even if the method does not define 769 any use for a message body. 771 The presence of a message body in a response depends on both the 772 request method to which it is responding and the response status code 773 (Section 4), and corresponds to when a payload body is allowed; see 774 Section 6.3.3 of [Semantics]. 776 6.1. Transfer-Encoding 778 The Transfer-Encoding header field lists the transfer coding names 779 corresponding to the sequence of transfer codings that have been (or 780 will be) applied to the payload body in order to form the message 781 body. Transfer codings are defined in Section 7. 783 Transfer-Encoding = 1#transfer-coding 785 Transfer-Encoding is analogous to the Content-Transfer-Encoding field 786 of MIME, which was designed to enable safe transport of binary data 787 over a 7-bit transport service ([RFC2045], Section 6). However, safe 788 transport has a different focus for an 8bit-clean transfer protocol. 789 In HTTP's case, Transfer-Encoding is primarily intended to accurately 790 delimit a dynamically generated payload and to distinguish payload 791 encodings that are only applied for transport efficiency or security 792 from those that are characteristics of the selected resource. 794 A recipient MUST be able to parse the chunked transfer coding 795 (Section 7.1) because it plays a crucial role in framing messages 796 when the payload body size is not known in advance. A sender MUST 797 NOT apply chunked more than once to a message body (i.e., chunking an 798 already chunked message is not allowed). If any transfer coding 799 other than chunked is applied to a request payload body, the sender 800 MUST apply chunked as the final transfer coding to ensure that the 801 message is properly framed. If any transfer coding other than 802 chunked is applied to a response payload body, the sender MUST either 803 apply chunked as the final transfer coding or terminate the message 804 by closing the connection. 806 For example, 808 Transfer-Encoding: gzip, chunked 810 indicates that the payload body has been compressed using the gzip 811 coding and then chunked using the chunked coding while forming the 812 message body. 814 Unlike Content-Encoding (Section 6.1.2 of [Semantics]), Transfer- 815 Encoding is a property of the message, not of the representation, and 816 any recipient along the request/response chain MAY decode the 817 received transfer coding(s) or apply additional transfer coding(s) to 818 the message body, assuming that corresponding changes are made to the 819 Transfer-Encoding field-value. Additional information about the 820 encoding parameters can be provided by other header fields not 821 defined by this specification. 823 Transfer-Encoding MAY be sent in a response to a HEAD request or in a 824 304 (Not Modified) response (Section 9.4.5 of [Semantics]) to a GET 825 request, neither of which includes a message body, to indicate that 826 the origin server would have applied a transfer coding to the message 827 body if the request had been an unconditional GET. This indication 828 is not required, however, because any recipient on the response chain 829 (including the origin server) can remove transfer codings when they 830 are not needed. 832 A server MUST NOT send a Transfer-Encoding header field in any 833 response with a status code of 1xx (Informational) or 204 (No 834 Content). A server MUST NOT send a Transfer-Encoding header field in 835 any 2xx (Successful) response to a CONNECT request (Section 7.3.6 of 836 [Semantics]). 838 Transfer-Encoding was added in HTTP/1.1. It is generally assumed 839 that implementations advertising only HTTP/1.0 support will not 840 understand how to process a transfer-encoded payload. A client MUST 841 NOT send a request containing Transfer-Encoding unless it knows the 842 server will handle HTTP/1.1 (or later) requests; such knowledge might 843 be in the form of specific user configuration or by remembering the 844 version of a prior received response. A server MUST NOT send a 845 response containing Transfer-Encoding unless the corresponding 846 request indicates HTTP/1.1 (or later). 848 A server that receives a request message with a transfer coding it 849 does not understand SHOULD respond with 501 (Not Implemented). 851 6.2. Content-Length 853 When a message does not have a Transfer-Encoding header field, a 854 Content-Length header field can provide the anticipated size, as a 855 decimal number of octets, for a potential payload body. For messages 856 that do include a payload body, the Content-Length field-value 857 provides the framing information necessary for determining where the 858 body (and message) ends. For messages that do not include a payload 859 body, the Content-Length indicates the size of the selected 860 representation (Section 6.2.4 of [Semantics]). 862 Note: HTTP's use of Content-Length for message framing differs 863 significantly from the same field's use in MIME, where it is an 864 optional field used only within the "message/external-body" media- 865 type. 867 6.3. Message Body Length 869 The length of a message body is determined by one of the following 870 (in order of precedence): 872 1. Any response to a HEAD request and any response with a 1xx 873 (Informational), 204 (No Content), or 304 (Not Modified) status 874 code is always terminated by the first empty line after the 875 header fields, regardless of the header fields present in the 876 message, and thus cannot contain a message body. 878 2. Any 2xx (Successful) response to a CONNECT request implies that 879 the connection will become a tunnel immediately after the empty 880 line that concludes the header fields. A client MUST ignore any 881 Content-Length or Transfer-Encoding header fields received in 882 such a message. 884 3. If a Transfer-Encoding header field is present and the chunked 885 transfer coding (Section 7.1) is the final encoding, the message 886 body length is determined by reading and decoding the chunked 887 data until the transfer coding indicates the data is complete. 889 If a Transfer-Encoding header field is present in a response and 890 the chunked transfer coding is not the final encoding, the 891 message body length is determined by reading the connection until 892 it is closed by the server. If a Transfer-Encoding header field 893 is present in a request and the chunked transfer coding is not 894 the final encoding, the message body length cannot be determined 895 reliably; the server MUST respond with the 400 (Bad Request) 896 status code and then close the connection. 898 If a message is received with both a Transfer-Encoding and a 899 Content-Length header field, the Transfer-Encoding overrides the 900 Content-Length. Such a message might indicate an attempt to 901 perform request smuggling (Section 11.2) or response splitting 902 (Section 11.1) and ought to be handled as an error. A sender 903 MUST remove the received Content-Length field prior to forwarding 904 such a message downstream. 906 4. If a message is received without Transfer-Encoding and with 907 either multiple Content-Length header fields having differing 908 field-values or a single Content-Length header field having an 909 invalid value, then the message framing is invalid and the 910 recipient MUST treat it as an unrecoverable error. If this is a 911 request message, the server MUST respond with a 400 (Bad Request) 912 status code and then close the connection. If this is a response 913 message received by a proxy, the proxy MUST close the connection 914 to the server, discard the received response, and send a 502 (Bad 915 Gateway) response to the client. If this is a response message 916 received by a user agent, the user agent MUST close the 917 connection to the server and discard the received response. 919 5. If a valid Content-Length header field is present without 920 Transfer-Encoding, its decimal value defines the expected message 921 body length in octets. If the sender closes the connection or 922 the recipient times out before the indicated number of octets are 923 received, the recipient MUST consider the message to be 924 incomplete and close the connection. 926 6. If this is a request message and none of the above are true, then 927 the message body length is zero (no message body is present). 929 7. Otherwise, this is a response message without a declared message 930 body length, so the message body length is determined by the 931 number of octets received prior to the server closing the 932 connection. 934 Since there is no way to distinguish a successfully completed, close- 935 delimited message from a partially received message interrupted by 936 network failure, a server SHOULD generate encoding or length- 937 delimited messages whenever possible. The close-delimiting feature 938 exists primarily for backwards compatibility with HTTP/1.0. 940 A server MAY reject a request that contains a message body but not a 941 Content-Length by responding with 411 (Length Required). 943 Unless a transfer coding other than chunked has been applied, a 944 client that sends a request containing a message body SHOULD use a 945 valid Content-Length header field if the message body length is known 946 in advance, rather than the chunked transfer coding, since some 947 existing services respond to chunked with a 411 (Length Required) 948 status code even though they understand the chunked transfer coding. 949 This is typically because such services are implemented via a gateway 950 that requires a content-length in advance of being called and the 951 server is unable or unwilling to buffer the entire request before 952 processing. 954 A user agent that sends a request containing a message body MUST send 955 a valid Content-Length header field if it does not know the server 956 will handle HTTP/1.1 (or later) requests; such knowledge can be in 957 the form of specific user configuration or by remembering the version 958 of a prior received response. 960 If the final response to the last request on a connection has been 961 completely received and there remains additional data to read, a user 962 agent MAY discard the remaining data or attempt to determine if that 963 data belongs as part of the prior response body, which might be the 964 case if the prior message's Content-Length value is incorrect. A 965 client MUST NOT process, cache, or forward such extra data as a 966 separate response, since such behavior would be vulnerable to cache 967 poisoning. 969 7. Transfer Codings 971 Transfer coding names are used to indicate an encoding transformation 972 that has been, can be, or might need to be applied to a payload body 973 in order to ensure "safe transport" through the network. This 974 differs from a content coding in that the transfer coding is a 975 property of the message rather than a property of the representation 976 that is being transferred. 978 transfer-coding = token *( OWS ";" OWS transfer-parameter ) 980 Parameters are in the form of a name=value pair. 982 transfer-parameter = token BWS "=" BWS ( token / quoted-string ) 984 All transfer-coding names are case-insensitive and ought to be 985 registered within the HTTP Transfer Coding registry, as defined in 986 Section 7.3. They are used in the TE (Section 7.4) and Transfer- 987 Encoding (Section 6.1) header fields. 989 +------------+------------------------------------------+-----------+ 990 | Name | Description | Reference | 991 +------------+------------------------------------------+-----------+ 992 | chunked | Transfer in a series of chunks | Section 7 | 993 | | | .1 | 994 | compress | UNIX "compress" data format [Welch] | Section 7 | 995 | | | .2 | 996 | deflate | "deflate" compressed data ([RFC1951]) | Section 7 | 997 | | inside the "zlib" data format | .2 | 998 | | ([RFC1950]) | | 999 | gzip | GZIP file format [RFC1952] | Section 7 | 1000 | | | .2 | 1001 | trailers | (reserved) | Section 7 | 1002 | x-compress | Deprecated (alias for compress) | Section 7 | 1003 | | | .2 | 1004 | x-gzip | Deprecated (alias for gzip) | Section 7 | 1005 | | | .2 | 1006 +------------+------------------------------------------+-----------+ 1008 Table 2 1010 Note: the coding name "trailers" is reserved because its use would 1011 conflict with the keyword "trailers" in the TE header field 1012 (Section 7.4). 1014 7.1. Chunked Transfer Coding 1016 The chunked transfer coding wraps the payload body in order to 1017 transfer it as a series of chunks, each with its own size indicator, 1018 followed by an OPTIONAL trailer section containing trailer fields. 1019 Chunked enables content streams of unknown size to be transferred as 1020 a sequence of length-delimited buffers, which enables the sender to 1021 retain connection persistence and the recipient to know when it has 1022 received the entire message. 1024 chunked-body = *chunk 1025 last-chunk 1026 trailer-section 1027 CRLF 1029 chunk = chunk-size [ chunk-ext ] CRLF 1030 chunk-data CRLF 1031 chunk-size = 1*HEXDIG 1032 last-chunk = 1*("0") [ chunk-ext ] CRLF 1034 chunk-data = 1*OCTET ; a sequence of chunk-size octets 1036 The chunk-size field is a string of hex digits indicating the size of 1037 the chunk-data in octets. The chunked transfer coding is complete 1038 when a chunk with a chunk-size of zero is received, possibly followed 1039 by a trailer section, and finally terminated by an empty line. 1041 A recipient MUST be able to parse and decode the chunked transfer 1042 coding. 1044 The chunked encoding does not define any parameters. Their presence 1045 SHOULD be treated as an error. 1047 7.1.1. Chunk Extensions 1049 The chunked encoding allows each chunk to include zero or more chunk 1050 extensions, immediately following the chunk-size, for the sake of 1051 supplying per-chunk metadata (such as a signature or hash), mid- 1052 message control information, or randomization of message body size. 1054 chunk-ext = *( BWS ";" BWS chunk-ext-name 1055 [ BWS "=" BWS chunk-ext-val ] ) 1057 chunk-ext-name = token 1058 chunk-ext-val = token / quoted-string 1060 The chunked encoding is specific to each connection and is likely to 1061 be removed or recoded by each recipient (including intermediaries) 1062 before any higher-level application would have a chance to inspect 1063 the extensions. Hence, use of chunk extensions is generally limited 1064 to specialized HTTP services such as "long polling" (where client and 1065 server can have shared expectations regarding the use of chunk 1066 extensions) or for padding within an end-to-end secured connection. 1068 A recipient MUST ignore unrecognized chunk extensions. A server 1069 ought to limit the total length of chunk extensions received in a 1070 request to an amount reasonable for the services provided, in the 1071 same way that it applies length limitations and timeouts for other 1072 parts of a message, and generate an appropriate 4xx (Client Error) 1073 response if that amount is exceeded. 1075 7.1.2. Chunked Trailer Section 1077 A trailer section allows the sender to include additional fields at 1078 the end of a chunked message in order to supply metadata that might 1079 be dynamically generated while the message body is sent, such as a 1080 message integrity check, digital signature, or post-processing 1081 status. The proper use and limitations of trailer fields are defined 1082 in Section 4.3 of [Semantics]. 1084 trailer-section = *( header-field CRLF ) 1086 A recipient that decodes and removes the chunked encoding from a 1087 message (e.g., for storage or forwarding to a non-HTTP/1.1 peer) MUST 1088 discard any received trailer fields, store/forward them separately 1089 from the header fields, or selectively merge into the header section 1090 only those trailer fields corresponding to header field definitions 1091 that are understood by the recipient to explicitly permit and define 1092 how their corresponding trailer field value can be safely merged. 1094 7.1.3. Decoding Chunked 1096 A process for decoding the chunked transfer coding can be represented 1097 in pseudo-code as: 1099 length := 0 1100 read chunk-size, chunk-ext (if any), and CRLF 1101 while (chunk-size > 0) { 1102 read chunk-data and CRLF 1103 append chunk-data to decoded-body 1104 length := length + chunk-size 1105 read chunk-size, chunk-ext (if any), and CRLF 1106 } 1107 read trailer field 1108 while (trailer field is not empty) { 1109 if (trailer fields are stored/forwarded separately) { 1110 append trailer field to existing trailer fields 1111 } 1112 else if (trailer field is understood and defined as mergeable) { 1113 merge trailer field with existing header fields 1114 } 1115 else { 1116 discard trailer field 1117 } 1118 read trailer field 1119 } 1120 Content-Length := length 1121 Remove "chunked" from Transfer-Encoding 1122 Remove Trailer from existing header fields 1124 7.2. Transfer Codings for Compression 1126 The following transfer coding names for compression are defined by 1127 the same algorithm as their corresponding content coding: 1129 compress (and x-compress) 1130 See Section 6.1.2.1 of [Semantics]. 1132 deflate 1133 See Section 6.1.2.2 of [Semantics]. 1135 gzip (and x-gzip) 1136 See Section 6.1.2.3 of [Semantics]. 1138 The compression codings do not define any parameters. Their presence 1139 SHOULD be treated as an error. 1141 7.3. Transfer Coding Registry 1143 The "HTTP Transfer Coding Registry" defines the namespace for 1144 transfer coding names. It is maintained at 1145 . 1147 Registrations MUST include the following fields: 1149 o Name 1151 o Description 1153 o Pointer to specification text 1155 Names of transfer codings MUST NOT overlap with names of content 1156 codings (Section 6.1.2 of [Semantics]) unless the encoding 1157 transformation is identical, as is the case for the compression 1158 codings defined in Section 7.2. 1160 The TE header field (Section 7.4) uses a pseudo parameter named "q" 1161 as rank value when multiple transfer codings are acceptable. Future 1162 registrations of transfer codings SHOULD NOT define parameters called 1163 "q" (case-insensitively) in order to avoid ambiguities. 1165 Values to be added to this namespace require IETF Review (see 1166 Section 4.8 of [RFC8126]), and MUST conform to the purpose of 1167 transfer coding defined in this specification. 1169 Use of program names for the identification of encoding formats is 1170 not desirable and is discouraged for future encodings. 1172 7.4. TE 1174 The "TE" header field in a request indicates what transfer codings, 1175 besides chunked, the client is willing to accept in response, and 1176 whether or not the client is willing to accept trailer fields in a 1177 chunked transfer coding. 1179 The TE field-value consists of a comma-separated list of transfer 1180 coding names, each allowing for optional parameters (as described in 1181 Section 7), and/or the keyword "trailers". A client MUST NOT send 1182 the chunked transfer coding name in TE; chunked is always acceptable 1183 for HTTP/1.1 recipients. 1185 TE = #t-codings 1186 t-codings = "trailers" / ( transfer-coding [ t-ranking ] ) 1187 t-ranking = OWS ";" OWS "q=" rank 1188 rank = ( "0" [ "." 0*3DIGIT ] ) 1189 / ( "1" [ "." 0*3("0") ] ) 1191 Three examples of TE use are below. 1193 TE: deflate 1194 TE: 1195 TE: trailers, deflate;q=0.5 1197 The presence of the keyword "trailers" indicates that the client is 1198 willing to accept trailer fields in a chunked transfer coding, as 1199 defined in Section 7.1.2, on behalf of itself and any downstream 1200 clients. For requests from an intermediary, this implies that 1201 either: (a) all downstream clients are willing to accept trailer 1202 fields in the forwarded response; or, (b) the intermediary will 1203 attempt to buffer the response on behalf of downstream recipients. 1204 Note that HTTP/1.1 does not define any means to limit the size of a 1205 chunked response such that an intermediary can be assured of 1206 buffering the entire response. 1208 When multiple transfer codings are acceptable, the client MAY rank 1209 the codings by preference using a case-insensitive "q" parameter 1210 (similar to the qvalues used in content negotiation fields, 1211 Section 8.4.1 of [Semantics]). The rank value is a real number in 1212 the range 0 through 1, where 0.001 is the least preferred and 1 is 1213 the most preferred; a value of 0 means "not acceptable". 1215 If the TE field-value is empty or if no TE field is present, the only 1216 acceptable transfer coding is chunked. A message with no transfer 1217 coding is always acceptable. 1219 Since the TE header field only applies to the immediate connection, a 1220 sender of TE MUST also send a "TE" connection option within the 1221 Connection header field (Section 9.1) in order to prevent the TE 1222 field from being forwarded by intermediaries that do not support its 1223 semantics. 1225 8. Handling Incomplete Messages 1227 A server that receives an incomplete request message, usually due to 1228 a canceled request or a triggered timeout exception, MAY send an 1229 error response prior to closing the connection. 1231 A client that receives an incomplete response message, which can 1232 occur when a connection is closed prematurely or when decoding a 1233 supposedly chunked transfer coding fails, MUST record the message as 1234 incomplete. Cache requirements for incomplete responses are defined 1235 in Section 3 of [Caching]. 1237 If a response terminates in the middle of the header section (before 1238 the empty line is received) and the status code might rely on header 1239 fields to convey the full meaning of the response, then the client 1240 cannot assume that meaning has been conveyed; the client might need 1241 to repeat the request in order to determine what action to take next. 1243 A message body that uses the chunked transfer coding is incomplete if 1244 the zero-sized chunk that terminates the encoding has not been 1245 received. A message that uses a valid Content-Length is incomplete 1246 if the size of the message body received (in octets) is less than the 1247 value given by Content-Length. A response that has neither chunked 1248 transfer coding nor Content-Length is terminated by closure of the 1249 connection and, thus, is considered complete regardless of the number 1250 of message body octets received, provided that the header section was 1251 received intact. 1253 9. Connection Management 1255 HTTP messaging is independent of the underlying transport- or 1256 session-layer connection protocol(s). HTTP only presumes a reliable 1257 transport with in-order delivery of requests and the corresponding 1258 in-order delivery of responses. The mapping of HTTP request and 1259 response structures onto the data units of an underlying transport 1260 protocol is outside the scope of this specification. 1262 As described in Section 5.2 of [Semantics], the specific connection 1263 protocols to be used for an HTTP interaction are determined by client 1264 configuration and the target URI. For example, the "http" URI scheme 1265 (Section 2.5.1 of [Semantics]) indicates a default connection of TCP 1266 over IP, with a default TCP port of 80, but the client might be 1267 configured to use a proxy via some other connection, port, or 1268 protocol. 1270 HTTP implementations are expected to engage in connection management, 1271 which includes maintaining the state of current connections, 1272 establishing a new connection or reusing an existing connection, 1273 processing messages received on a connection, detecting connection 1274 failures, and closing each connection. Most clients maintain 1275 multiple connections in parallel, including more than one connection 1276 per server endpoint. Most servers are designed to maintain thousands 1277 of concurrent connections, while controlling request queues to enable 1278 fair use and detect denial-of-service attacks. 1280 9.1. Connection 1282 The "Connection" header field allows the sender to indicate desired 1283 control options for the current connection. In order to avoid 1284 confusing downstream recipients, a proxy or gateway MUST remove or 1285 replace any received connection options before forwarding the 1286 message. 1288 When a header field aside from Connection is used to supply control 1289 information for or about the current connection, the sender MUST list 1290 the corresponding field-name within the Connection header field. A 1291 proxy or gateway MUST parse a received Connection header field before 1292 a message is forwarded and, for each connection-option in this field, 1293 remove any header field(s) from the message with the same name as the 1294 connection-option, and then remove the Connection header field itself 1295 (or replace it with the intermediary's own connection options for the 1296 forwarded message). 1298 Hence, the Connection header field provides a declarative way of 1299 distinguishing header fields that are only intended for the immediate 1300 recipient ("hop-by-hop") from those fields that are intended for all 1301 recipients on the chain ("end-to-end"), enabling the message to be 1302 self-descriptive and allowing future connection-specific extensions 1303 to be deployed without fear that they will be blindly forwarded by 1304 older intermediaries. 1306 The Connection header field's value has the following grammar: 1308 Connection = 1#connection-option 1309 connection-option = token 1311 Connection options are case-insensitive. 1313 A sender MUST NOT send a connection option corresponding to a header 1314 field that is intended for all recipients of the payload. For 1315 example, Cache-Control is never appropriate as a connection option 1316 (Section 5.2 of [Caching]). 1318 The connection options do not always correspond to a header field 1319 present in the message, since a connection-specific header field 1320 might not be needed if there are no parameters associated with a 1321 connection option. In contrast, a connection-specific header field 1322 that is received without a corresponding connection option usually 1323 indicates that the field has been improperly forwarded by an 1324 intermediary and ought to be ignored by the recipient. 1326 When defining new connection options, specification authors ought to 1327 survey existing header field names and ensure that the new connection 1328 option does not share the same name as an already deployed header 1329 field. Defining a new connection option essentially reserves that 1330 potential field-name for carrying additional information related to 1331 the connection option, since it would be unwise for senders to use 1332 that field-name for anything else. 1334 The "close" connection option is defined for a sender to signal that 1335 this connection will be closed after completion of the response. For 1336 example, 1338 Connection: close 1340 in either the request or the response header fields indicates that 1341 the sender is going to close the connection after the current 1342 request/response is complete (Section 9.7). 1344 A client that does not support persistent connections MUST send the 1345 "close" connection option in every request message. 1347 A server that does not support persistent connections MUST send the 1348 "close" connection option in every response message that does not 1349 have a 1xx (Informational) status code. 1351 9.2. Establishment 1353 It is beyond the scope of this specification to describe how 1354 connections are established via various transport- or session-layer 1355 protocols. Each connection applies to only one transport link. 1357 9.3. Associating a Response to a Request 1359 HTTP/1.1 does not include a request identifier for associating a 1360 given request message with its corresponding one or more response 1361 messages. Hence, it relies on the order of response arrival to 1362 correspond exactly to the order in which requests are made on the 1363 same connection. More than one response message per request only 1364 occurs when one or more informational responses (1xx, see Section 9.2 1365 of [Semantics]) precede a final response to the same request. 1367 A client that has more than one outstanding request on a connection 1368 MUST maintain a list of outstanding requests in the order sent and 1369 MUST associate each received response message on that connection to 1370 the highest ordered request that has not yet received a final (non- 1371 1xx) response. 1373 If an HTTP/1.1 client receives data on a connection that doesn't have 1374 any outstanding requests, it MUST NOT consider them to be a response 1375 to a not-yet-issued request; it SHOULD close the connection, since 1376 message delimitation is now ambiguous, unless the data consists only 1377 of one or more CRLF (which can be discarded, as per Section 2.2). 1379 9.4. Persistence 1381 HTTP/1.1 defaults to the use of "persistent connections", allowing 1382 multiple requests and responses to be carried over a single 1383 connection. The "close" connection option is used to signal that a 1384 connection will not persist after the current request/response. HTTP 1385 implementations SHOULD support persistent connections. 1387 A recipient determines whether a connection is persistent or not 1388 based on the most recently received message's protocol version and 1389 Connection header field (if any): 1391 o If the "close" connection option is present, the connection will 1392 not persist after the current response; else, 1394 o If the received protocol is HTTP/1.1 (or later), the connection 1395 will persist after the current response; else, 1397 o If the received protocol is HTTP/1.0, the "keep-alive" connection 1398 option is present, either the recipient is not a proxy or the 1399 message is a response, and the recipient wishes to honor the 1400 HTTP/1.0 "keep-alive" mechanism, the connection will persist after 1401 the current response; otherwise, 1403 o The connection will close after the current response. 1405 A client MAY send additional requests on a persistent connection 1406 until it sends or receives a "close" connection option or receives an 1407 HTTP/1.0 response without a "keep-alive" connection option. 1409 In order to remain persistent, all messages on a connection need to 1410 have a self-defined message length (i.e., one not defined by closure 1411 of the connection), as described in Section 6. A server MUST read 1412 the entire request message body or close the connection after sending 1413 its response, since otherwise the remaining data on a persistent 1414 connection would be misinterpreted as the next request. Likewise, a 1415 client MUST read the entire response message body if it intends to 1416 reuse the same connection for a subsequent request. 1418 A proxy server MUST NOT maintain a persistent connection with an 1419 HTTP/1.0 client (see Section 19.7.1 of [RFC2068] for information and 1420 discussion of the problems with the Keep-Alive header field 1421 implemented by many HTTP/1.0 clients). 1423 See Appendix C.1.2 for more information on backwards compatibility 1424 with HTTP/1.0 clients. 1426 9.4.1. Retrying Requests 1428 Connections can be closed at any time, with or without intention. 1429 Implementations ought to anticipate the need to recover from 1430 asynchronous close events. The conditions under which a client can 1431 automatically retry a sequence of outstanding requests are defined in 1432 Section 7.2.2 of [Semantics]. 1434 9.4.2. Pipelining 1436 A client that supports persistent connections MAY "pipeline" its 1437 requests (i.e., send multiple requests without waiting for each 1438 response). A server MAY process a sequence of pipelined requests in 1439 parallel if they all have safe methods (Section 7.2.1 of 1440 [Semantics]), but it MUST send the corresponding responses in the 1441 same order that the requests were received. 1443 A client that pipelines requests SHOULD retry unanswered requests if 1444 the connection closes before it receives all of the corresponding 1445 responses. When retrying pipelined requests after a failed 1446 connection (a connection not explicitly closed by the server in its 1447 last complete response), a client MUST NOT pipeline immediately after 1448 connection establishment, since the first remaining request in the 1449 prior pipeline might have caused an error response that can be lost 1450 again if multiple requests are sent on a prematurely closed 1451 connection (see the TCP reset problem described in Section 9.7). 1453 Idempotent methods (Section 7.2.2 of [Semantics]) are significant to 1454 pipelining because they can be automatically retried after a 1455 connection failure. A user agent SHOULD NOT pipeline requests after 1456 a non-idempotent method, until the final response status code for 1457 that method has been received, unless the user agent has a means to 1458 detect and recover from partial failure conditions involving the 1459 pipelined sequence. 1461 An intermediary that receives pipelined requests MAY pipeline those 1462 requests when forwarding them inbound, since it can rely on the 1463 outbound user agent(s) to determine what requests can be safely 1464 pipelined. If the inbound connection fails before receiving a 1465 response, the pipelining intermediary MAY attempt to retry a sequence 1466 of requests that have yet to receive a response if the requests all 1467 have idempotent methods; otherwise, the pipelining intermediary 1468 SHOULD forward any received responses and then close the 1469 corresponding outbound connection(s) so that the outbound user 1470 agent(s) can recover accordingly. 1472 9.5. Concurrency 1474 A client ought to limit the number of simultaneous open connections 1475 that it maintains to a given server. 1477 Previous revisions of HTTP gave a specific number of connections as a 1478 ceiling, but this was found to be impractical for many applications. 1479 As a result, this specification does not mandate a particular maximum 1480 number of connections but, instead, encourages clients to be 1481 conservative when opening multiple connections. 1483 Multiple connections are typically used to avoid the "head-of-line 1484 blocking" problem, wherein a request that takes significant server- 1485 side processing and/or has a large payload blocks subsequent requests 1486 on the same connection. However, each connection consumes server 1487 resources. Furthermore, using multiple connections can cause 1488 undesirable side effects in congested networks. 1490 Note that a server might reject traffic that it deems abusive or 1491 characteristic of a denial-of-service attack, such as an excessive 1492 number of open connections from a single client. 1494 9.6. Failures and Timeouts 1496 Servers will usually have some timeout value beyond which they will 1497 no longer maintain an inactive connection. Proxy servers might make 1498 this a higher value since it is likely that the client will be making 1499 more connections through the same proxy server. The use of 1500 persistent connections places no requirements on the length (or 1501 existence) of this timeout for either the client or the server. 1503 A client or server that wishes to time out SHOULD issue a graceful 1504 close on the connection. Implementations SHOULD constantly monitor 1505 open connections for a received closure signal and respond to it as 1506 appropriate, since prompt closure of both sides of a connection 1507 enables allocated system resources to be reclaimed. 1509 A client, server, or proxy MAY close the transport connection at any 1510 time. For example, a client might have started to send a new request 1511 at the same time that the server has decided to close the "idle" 1512 connection. From the server's point of view, the connection is being 1513 closed while it was idle, but from the client's point of view, a 1514 request is in progress. 1516 A server SHOULD sustain persistent connections, when possible, and 1517 allow the underlying transport's flow-control mechanisms to resolve 1518 temporary overloads, rather than terminate connections with the 1519 expectation that clients will retry. The latter technique can 1520 exacerbate network congestion. 1522 A client sending a message body SHOULD monitor the network connection 1523 for an error response while it is transmitting the request. If the 1524 client sees a response that indicates the server does not wish to 1525 receive the message body and is closing the connection, the client 1526 SHOULD immediately cease transmitting the body and close its side of 1527 the connection. 1529 9.7. Tear-down 1531 The Connection header field (Section 9.1) provides a "close" 1532 connection option that a sender SHOULD send when it wishes to close 1533 the connection after the current request/response pair. 1535 A client that sends a "close" connection option MUST NOT send further 1536 requests on that connection (after the one containing "close") and 1537 MUST close the connection after reading the final response message 1538 corresponding to this request. 1540 A server that receives a "close" connection option MUST initiate a 1541 close of the connection (see below) after it sends the final response 1542 to the request that contained "close". The server SHOULD send a 1543 "close" connection option in its final response on that connection. 1544 The server MUST NOT process any further requests received on that 1545 connection. 1547 A server that sends a "close" connection option MUST initiate a close 1548 of the connection (see below) after it sends the response containing 1549 "close". The server MUST NOT process any further requests received 1550 on that connection. 1552 A client that receives a "close" connection option MUST cease sending 1553 requests on that connection and close the connection after reading 1554 the response message containing the "close"; if additional pipelined 1555 requests had been sent on the connection, the client SHOULD NOT 1556 assume that they will be processed by the server. 1558 If a server performs an immediate close of a TCP connection, there is 1559 a significant risk that the client will not be able to read the last 1560 HTTP response. If the server receives additional data from the 1561 client on a fully closed connection, such as another request that was 1562 sent by the client before receiving the server's response, the 1563 server's TCP stack will send a reset packet to the client; 1564 unfortunately, the reset packet might erase the client's 1565 unacknowledged input buffers before they can be read and interpreted 1566 by the client's HTTP parser. 1568 To avoid the TCP reset problem, servers typically close a connection 1569 in stages. First, the server performs a half-close by closing only 1570 the write side of the read/write connection. The server then 1571 continues to read from the connection until it receives a 1572 corresponding close by the client, or until the server is reasonably 1573 certain that its own TCP stack has received the client's 1574 acknowledgement of the packet(s) containing the server's last 1575 response. Finally, the server fully closes the connection. 1577 It is unknown whether the reset problem is exclusive to TCP or might 1578 also be found in other transport connection protocols. 1580 9.8. TLS Connection Closure 1582 TLS provides a facility for secure connection closure. When a valid 1583 closure alert is received, an implementation can be assured that no 1584 further data will be received on that connection. TLS 1585 implementations MUST initiate an exchange of closure alerts before 1586 closing a connection. A TLS implementation MAY, after sending a 1587 closure alert, close the connection without waiting for the peer to 1588 send its closure alert, generating an "incomplete close". Note that 1589 an implementation which does this MAY choose to reuse the session. 1590 This SHOULD only be done when the application knows (typically 1591 through detecting HTTP message boundaries) that it has received all 1592 the message data that it cares about. 1594 As specified in [RFC8446], any implementation which receives a 1595 connection close without first receiving a valid closure alert (a 1596 "premature close") MUST NOT reuse that session. Note that a 1597 premature close does not call into question the security of the data 1598 already received, but simply indicates that subsequent data might 1599 have been truncated. Because TLS is oblivious to HTTP request/ 1600 response boundaries, it is necessary to examine the HTTP data itself 1601 (specifically the Content-Length header) to determine whether the 1602 truncation occurred inside a message or between messages. 1604 When encountering a premature close, a client SHOULD treat as 1605 completed all requests for which it has received as much data as 1606 specified in the Content-Length header. 1608 A client detecting an incomplete close SHOULD recover gracefully. It 1609 MAY resume a TLS session closed in this fashion. 1611 Clients MUST send a closure alert before closing the connection. 1612 Clients which are unprepared to receive any more data MAY choose not 1613 to wait for the server's closure alert and simply close the 1614 connection, thus generating an incomplete close on the server side. 1616 Servers SHOULD be prepared to receive an incomplete close from the 1617 client, since the client can often determine when the end of server 1618 data is. Servers SHOULD be willing to resume TLS sessions closed in 1619 this fashion. 1621 Servers MUST attempt to initiate an exchange of closure alerts with 1622 the client before closing the connection. Servers MAY close the 1623 connection after sending the closure alert, thus generating an 1624 incomplete close on the client side. 1626 9.9. Upgrade 1628 The "Upgrade" header field is intended to provide a simple mechanism 1629 for transitioning from HTTP/1.1 to some other protocol on the same 1630 connection. 1632 A client MAY send a list of protocol names in the Upgrade header 1633 field of a request to invite the server to switch to one or more of 1634 the named protocols, in order of descending preference, before 1635 sending the final response. A server MAY ignore a received Upgrade 1636 header field if it wishes to continue using the current protocol on 1637 that connection. Upgrade cannot be used to insist on a protocol 1638 change. 1640 Upgrade = 1#protocol 1642 protocol = protocol-name ["/" protocol-version] 1643 protocol-name = token 1644 protocol-version = token 1646 Although protocol names are registered with a preferred case, 1647 recipients SHOULD use case-insensitive comparison when matching each 1648 protocol-name to supported protocols. 1650 A server that sends a 101 (Switching Protocols) response MUST send an 1651 Upgrade header field to indicate the new protocol(s) to which the 1652 connection is being switched; if multiple protocol layers are being 1653 switched, the sender MUST list the protocols in layer-ascending 1654 order. A server MUST NOT switch to a protocol that was not indicated 1655 by the client in the corresponding request's Upgrade header field. A 1656 server MAY choose to ignore the order of preference indicated by the 1657 client and select the new protocol(s) based on other factors, such as 1658 the nature of the request or the current load on the server. 1660 A server that sends a 426 (Upgrade Required) response MUST send an 1661 Upgrade header field to indicate the acceptable protocols, in order 1662 of descending preference. 1664 A server MAY send an Upgrade header field in any other response to 1665 advertise that it implements support for upgrading to the listed 1666 protocols, in order of descending preference, when appropriate for a 1667 future request. 1669 The following is a hypothetical example sent by a client: 1671 GET /hello HTTP/1.1 1672 Host: www.example.com 1673 Connection: upgrade 1674 Upgrade: websocket, IRC/6.9, RTA/x11 1676 The capabilities and nature of the application-level communication 1677 after the protocol change is entirely dependent upon the new 1678 protocol(s) chosen. However, immediately after sending the 101 1679 (Switching Protocols) response, the server is expected to continue 1680 responding to the original request as if it had received its 1681 equivalent within the new protocol (i.e., the server still has an 1682 outstanding request to satisfy after the protocol has been changed, 1683 and is expected to do so without requiring the request to be 1684 repeated). 1686 For example, if the Upgrade header field is received in a GET request 1687 and the server decides to switch protocols, it first responds with a 1688 101 (Switching Protocols) message in HTTP/1.1 and then immediately 1689 follows that with the new protocol's equivalent of a response to a 1690 GET on the target resource. This allows a connection to be upgraded 1691 to protocols with the same semantics as HTTP without the latency cost 1692 of an additional round trip. A server MUST NOT switch protocols 1693 unless the received message semantics can be honored by the new 1694 protocol; an OPTIONS request can be honored by any protocol. 1696 The following is an example response to the above hypothetical 1697 request: 1699 HTTP/1.1 101 Switching Protocols 1700 Connection: upgrade 1701 Upgrade: websocket 1703 [... data stream switches to websocket with an appropriate response 1704 (as defined by new protocol) to the "GET /hello" request ...] 1706 When Upgrade is sent, the sender MUST also send a Connection header 1707 field (Section 9.1) that contains an "upgrade" connection option, in 1708 order to prevent Upgrade from being accidentally forwarded by 1709 intermediaries that might not implement the listed protocols. A 1710 server MUST ignore an Upgrade header field that is received in an 1711 HTTP/1.0 request. 1713 A client cannot begin using an upgraded protocol on the connection 1714 until it has completely sent the request message (i.e., the client 1715 can't change the protocol it is sending in the middle of a message). 1716 If a server receives both an Upgrade and an Expect header field with 1717 the "100-continue" expectation (Section 8.1.1 of [Semantics]), the 1718 server MUST send a 100 (Continue) response before sending a 101 1719 (Switching Protocols) response. 1721 The Upgrade header field only applies to switching protocols on top 1722 of the existing connection; it cannot be used to switch the 1723 underlying connection (transport) protocol, nor to switch the 1724 existing communication to a different connection. For those 1725 purposes, it is more appropriate to use a 3xx (Redirection) response 1726 (Section 9.4 of [Semantics]). 1728 9.9.1. Upgrade Protocol Names 1730 This specification only defines the protocol name "HTTP" for use by 1731 the family of Hypertext Transfer Protocols, as defined by the HTTP 1732 version rules of Section 3.5 of [Semantics] and future updates to 1733 this specification. Additional protocol names ought to be registered 1734 using the registration procedure defined in Section 9.9.2. 1736 +------+-------------------+--------------------+-------------------+ 1737 | Name | Description | Expected Version | Reference | 1738 | | | Tokens | | 1739 +------+-------------------+--------------------+-------------------+ 1740 | HTTP | Hypertext | any DIGIT.DIGIT | Section 3.5 of | 1741 | | Transfer Protocol | (e.g, "2.0") | [Semantics] | 1742 +------+-------------------+--------------------+-------------------+ 1744 9.9.2. Upgrade Token Registry 1746 The "Hypertext Transfer Protocol (HTTP) Upgrade Token Registry" 1747 defines the namespace for protocol-name tokens used to identify 1748 protocols in the Upgrade header field. The registry is maintained at 1749 . 1751 Each registered protocol name is associated with contact information 1752 and an optional set of specifications that details how the connection 1753 will be processed after it has been upgraded. 1755 Registrations happen on a "First Come First Served" basis (see 1756 Section 4.4 of [RFC8126]) and are subject to the following rules: 1758 1. A protocol-name token, once registered, stays registered forever. 1760 2. A protocol-name token is case-insensitive and registered with the 1761 preferred case to be generated by senders. 1763 3. The registration MUST name a responsible party for the 1764 registration. 1766 4. The registration MUST name a point of contact. 1768 5. The registration MAY name a set of specifications associated with 1769 that token. Such specifications need not be publicly available. 1771 6. The registration SHOULD name a set of expected "protocol-version" 1772 tokens associated with that token at the time of registration. 1774 7. The responsible party MAY change the registration at any time. 1775 The IANA will keep a record of all such changes, and make them 1776 available upon request. 1778 8. The IESG MAY reassign responsibility for a protocol token. This 1779 will normally only be used in the case when a responsible party 1780 cannot be contacted. 1782 10. Enclosing Messages as Data 1784 10.1. Media Type message/http 1786 The message/http media type can be used to enclose a single HTTP 1787 request or response message, provided that it obeys the MIME 1788 restrictions for all "message" types regarding line length and 1789 encodings. 1791 Type name: message 1792 Subtype name: http 1794 Required parameters: N/A 1796 Optional parameters: version, msgtype 1798 version: The HTTP-version number of the enclosed message (e.g., 1799 "1.1"). If not present, the version can be determined from the 1800 first line of the body. 1802 msgtype: The message type -- "request" or "response". If not 1803 present, the type can be determined from the first line of the 1804 body. 1806 Encoding considerations: only "7bit", "8bit", or "binary" are 1807 permitted 1809 Security considerations: see Section 11 1811 Interoperability considerations: N/A 1813 Published specification: This specification (see Section 10.1). 1815 Applications that use this media type: N/A 1817 Fragment identifier considerations: N/A 1819 Additional information: 1821 Magic number(s): N/A 1823 Deprecated alias names for this type: N/A 1825 File extension(s): N/A 1827 Macintosh file type code(s): N/A 1829 Person and email address to contact for further information: 1830 See Authors' Addresses section. 1832 Intended usage: COMMON 1834 Restrictions on usage: N/A 1836 Author: See Authors' Addresses section. 1838 Change controller: IESG 1840 10.2. Media Type application/http 1842 The application/http media type can be used to enclose a pipeline of 1843 one or more HTTP request or response messages (not intermixed). 1845 Type name: application 1847 Subtype name: http 1849 Required parameters: N/A 1851 Optional parameters: version, msgtype 1853 version: The HTTP-version number of the enclosed messages (e.g., 1854 "1.1"). If not present, the version can be determined from the 1855 first line of the body. 1857 msgtype: The message type -- "request" or "response". If not 1858 present, the type can be determined from the first line of the 1859 body. 1861 Encoding considerations: HTTP messages enclosed by this type are in 1862 "binary" format; use of an appropriate Content-Transfer-Encoding 1863 is required when transmitted via email. 1865 Security considerations: see Section 11 1867 Interoperability considerations: N/A 1869 Published specification: This specification (see Section 10.2). 1871 Applications that use this media type: N/A 1873 Fragment identifier considerations: N/A 1875 Additional information: 1877 Deprecated alias names for this type: N/A 1879 Magic number(s): N/A 1881 File extension(s): N/A 1883 Macintosh file type code(s): N/A 1885 Person and email address to contact for further information: 1886 See Authors' Addresses section. 1888 Intended usage: COMMON 1890 Restrictions on usage: N/A 1892 Author: See Authors' Addresses section. 1894 Change controller: IESG 1896 11. Security Considerations 1898 This section is meant to inform developers, information providers, 1899 and users of known security considerations relevant to HTTP message 1900 syntax, parsing, and routing. Security considerations about HTTP 1901 semantics and payloads are addressed in [Semantics]. 1903 11.1. Response Splitting 1905 Response splitting (a.k.a, CRLF injection) is a common technique, 1906 used in various attacks on Web usage, that exploits the line-based 1907 nature of HTTP message framing and the ordered association of 1908 requests to responses on persistent connections [Klein]. This 1909 technique can be particularly damaging when the requests pass through 1910 a shared cache. 1912 Response splitting exploits a vulnerability in servers (usually 1913 within an application server) where an attacker can send encoded data 1914 within some parameter of the request that is later decoded and echoed 1915 within any of the response header fields of the response. If the 1916 decoded data is crafted to look like the response has ended and a 1917 subsequent response has begun, the response has been split and the 1918 content within the apparent second response is controlled by the 1919 attacker. The attacker can then make any other request on the same 1920 persistent connection and trick the recipients (including 1921 intermediaries) into believing that the second half of the split is 1922 an authoritative answer to the second request. 1924 For example, a parameter within the request-target might be read by 1925 an application server and reused within a redirect, resulting in the 1926 same parameter being echoed in the Location header field of the 1927 response. If the parameter is decoded by the application and not 1928 properly encoded when placed in the response field, the attacker can 1929 send encoded CRLF octets and other content that will make the 1930 application's single response look like two or more responses. 1932 A common defense against response splitting is to filter requests for 1933 data that looks like encoded CR and LF (e.g., "%0D" and "%0A"). 1934 However, that assumes the application server is only performing URI 1935 decoding, rather than more obscure data transformations like charset 1936 transcoding, XML entity translation, base64 decoding, sprintf 1937 reformatting, etc. A more effective mitigation is to prevent 1938 anything other than the server's core protocol libraries from sending 1939 a CR or LF within the header section, which means restricting the 1940 output of header fields to APIs that filter for bad octets and not 1941 allowing application servers to write directly to the protocol 1942 stream. 1944 11.2. Request Smuggling 1946 Request smuggling ([Linhart]) is a technique that exploits 1947 differences in protocol parsing among various recipients to hide 1948 additional requests (which might otherwise be blocked or disabled by 1949 policy) within an apparently harmless request. Like response 1950 splitting, request smuggling can lead to a variety of attacks on HTTP 1951 usage. 1953 This specification has introduced new requirements on request 1954 parsing, particularly with regard to message framing in Section 6.3, 1955 to reduce the effectiveness of request smuggling. 1957 11.3. Message Integrity 1959 HTTP does not define a specific mechanism for ensuring message 1960 integrity, instead relying on the error-detection ability of 1961 underlying transport protocols and the use of length or chunk- 1962 delimited framing to detect completeness. Additional integrity 1963 mechanisms, such as hash functions or digital signatures applied to 1964 the content, can be selectively added to messages via extensible 1965 metadata header fields. Historically, the lack of a single integrity 1966 mechanism has been justified by the informal nature of most HTTP 1967 communication. However, the prevalence of HTTP as an information 1968 access mechanism has resulted in its increasing use within 1969 environments where verification of message integrity is crucial. 1971 User agents are encouraged to implement configurable means for 1972 detecting and reporting failures of message integrity such that those 1973 means can be enabled within environments for which integrity is 1974 necessary. For example, a browser being used to view medical history 1975 or drug interaction information needs to indicate to the user when 1976 such information is detected by the protocol to be incomplete, 1977 expired, or corrupted during transfer. Such mechanisms might be 1978 selectively enabled via user agent extensions or the presence of 1979 message integrity metadata in a response. At a minimum, user agents 1980 ought to provide some indication that allows a user to distinguish 1981 between a complete and incomplete response message (Section 8) when 1982 such verification is desired. 1984 11.4. Message Confidentiality 1986 HTTP relies on underlying transport protocols to provide message 1987 confidentiality when that is desired. HTTP has been specifically 1988 designed to be independent of the transport protocol, such that it 1989 can be used over many different forms of encrypted connection, with 1990 the selection of such transports being identified by the choice of 1991 URI scheme or within user agent configuration. 1993 The "https" scheme can be used to identify resources that require a 1994 confidential connection, as described in Section 2.5.2 of 1995 [Semantics]. 1997 12. IANA Considerations 1999 The change controller for the following registrations is: "IETF 2000 (iesg@ietf.org) - Internet Engineering Task Force". 2002 12.1. Header Field Registration 2004 Please update the "Hypertext Transfer Protocol (HTTP) Header Field 2005 Registry" registry at 2006 with the header field names listed in the two tables of Section 5. 2008 12.2. Media Type Registration 2010 Please update the "Media Types" registry at 2011 with the registration 2012 information in Section 10.1 and Section 10.2 for the media types 2013 "message/http" and "application/http", respectively. 2015 12.3. Transfer Coding Registration 2017 Please update the "HTTP Transfer Coding Registry" at 2018 with the 2019 registration procedure of Section 7.3 and the content coding names 2020 summarized in the table of Section 7. 2022 12.4. Upgrade Token Registration 2024 Please update the "Hypertext Transfer Protocol (HTTP) Upgrade Token 2025 Registry" at 2026 with the registration procedure of Section 9.9.2 and the upgrade 2027 token names summarized in the table of Section 9.9.1. 2029 13. References 2031 13.1. Normative References 2033 [Caching] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 2034 Ed., "HTTP Caching", draft-ietf-httpbis-cache-06 (work in 2035 progress), November 2019. 2037 [RFC1950] Deutsch, L. and J-L. Gailly, "ZLIB Compressed Data Format 2038 Specification version 3.3", RFC 1950, 2039 DOI 10.17487/RFC1950, May 1996, 2040 . 2042 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 2043 version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996, 2044 . 2046 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. 2047 Randers-Pehrson, "GZIP file format specification version 2048 4.3", RFC 1952, DOI 10.17487/RFC1952, May 1996, 2049 . 2051 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2052 Requirement Levels", BCP 14, RFC 2119, 2053 DOI 10.17487/RFC2119, March 1997, 2054 . 2056 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2057 Resource Identifier (URI): Generic Syntax", STD 66, 2058 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2059 . 2061 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 2062 Specifications: ABNF", STD 68, RFC 5234, 2063 DOI 10.17487/RFC5234, January 2008, 2064 . 2066 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 2067 RFC 7405, DOI 10.17487/RFC7405, December 2014, 2068 . 2070 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 2071 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 2072 . 2074 [Semantics] 2075 Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 2076 Ed., "HTTP Semantics", draft-ietf-httpbis-semantics-06 2077 (work in progress), November 2019. 2079 [USASCII] American National Standards Institute, "Coded Character 2080 Set -- 7-bit American Standard Code for Information 2081 Interchange", ANSI X3.4, 1986. 2083 [Welch] Welch, T., "A Technique for High-Performance Data 2084 Compression", IEEE Computer 17(6), June 1984. 2086 13.2. Informative References 2088 [Err4667] RFC Errata, Erratum ID 4667, RFC 7230, 2089 . 2091 [Klein] Klein, A., "Divide and Conquer - HTTP Response Splitting, 2092 Web Cache Poisoning Attacks, and Related Topics", March 2093 2004, . 2096 [Linhart] Linhart, C., Klein, A., Heled, R., and S. Orrin, "HTTP 2097 Request Smuggling", June 2005, 2098 . 2100 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, "Hypertext 2101 Transfer Protocol -- HTTP/1.0", RFC 1945, 2102 DOI 10.17487/RFC1945, May 1996, 2103 . 2105 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2106 Extensions (MIME) Part One: Format of Internet Message 2107 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 2108 . 2110 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2111 Extensions (MIME) Part Two: Media Types", RFC 2046, 2112 DOI 10.17487/RFC2046, November 1996, 2113 . 2115 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2116 Extensions (MIME) Part Five: Conformance Criteria and 2117 Examples", RFC 2049, DOI 10.17487/RFC2049, November 1996, 2118 . 2120 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 2121 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 2122 RFC 2068, DOI 10.17487/RFC2068, January 1997, 2123 . 2125 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 2126 "MIME Encapsulation of Aggregate Documents, such as HTML 2127 (MHTML)", RFC 2557, DOI 10.17487/RFC2557, March 1999, 2128 . 2130 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 2131 DOI 10.17487/RFC5322, October 2008, 2132 . 2134 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2135 Protocol (HTTP/1.1): Message Syntax and Routing", 2136 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2137 . 2139 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2140 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 2141 DOI 10.17487/RFC7231, June 2014, 2142 . 2144 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2145 Writing an IANA Considerations Section in RFCs", BCP 26, 2146 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2147 . 2149 Appendix A. Collected ABNF 2151 In the collected ABNF below, list rules are expanded as per 2152 Section 12 of [Semantics]. 2154 BWS = 2156 Connection = [ connection-option ] *( OWS "," OWS [ connection-option 2157 ] ) 2159 HTTP-message = start-line CRLF *( header-field CRLF ) CRLF [ 2160 message-body ] 2161 HTTP-name = %x48.54.54.50 ; HTTP 2162 HTTP-version = HTTP-name "/" DIGIT "." DIGIT 2164 OWS = 2166 RWS = 2168 TE = [ t-codings ] *( OWS "," OWS [ t-codings ] ) 2169 Transfer-Encoding = [ transfer-coding ] *( OWS "," OWS [ 2170 transfer-coding ] ) 2172 Upgrade = [ protocol ] *( OWS "," OWS [ protocol ] ) 2174 absolute-URI = 2175 absolute-form = absolute-URI 2176 absolute-path = 2177 asterisk-form = "*" 2178 authority = 2179 authority-form = authority 2181 chunk = chunk-size [ chunk-ext ] CRLF chunk-data CRLF 2182 chunk-data = 1*OCTET 2183 chunk-ext = *( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val 2184 ] ) 2185 chunk-ext-name = token 2186 chunk-ext-val = token / quoted-string 2187 chunk-size = 1*HEXDIG 2188 chunked-body = *chunk last-chunk trailer-section CRLF 2189 comment = 2190 connection-option = token 2192 field-name = 2193 field-value = 2195 header-field = field-name ":" OWS field-value OWS 2196 last-chunk = 1*"0" [ chunk-ext ] CRLF 2198 message-body = *OCTET 2199 method = token 2201 obs-fold = OWS CRLF RWS 2202 obs-text = 2203 origin-form = absolute-path [ "?" query ] 2205 port = 2206 protocol = protocol-name [ "/" protocol-version ] 2207 protocol-name = token 2208 protocol-version = token 2210 query = 2211 quoted-string = 2213 rank = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 2214 reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) 2215 request-line = method SP request-target SP HTTP-version 2216 request-target = origin-form / absolute-form / authority-form / 2217 asterisk-form 2219 start-line = request-line / status-line 2220 status-code = 3DIGIT 2221 status-line = HTTP-version SP status-code SP [ reason-phrase ] 2223 t-codings = "trailers" / ( transfer-coding [ t-ranking ] ) 2224 t-ranking = OWS ";" OWS "q=" rank 2225 token = 2226 trailer-section = *( header-field CRLF ) 2227 transfer-coding = token *( OWS ";" OWS transfer-parameter ) 2228 transfer-parameter = token BWS "=" BWS ( token / quoted-string ) 2230 uri-host = 2232 Appendix B. Differences between HTTP and MIME 2234 HTTP/1.1 uses many of the constructs defined for the Internet Message 2235 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 2236 [RFC2045] to allow a message body to be transmitted in an open 2237 variety of representations and with extensible header fields. 2238 However, RFC 2045 is focused only on email; applications of HTTP have 2239 many characteristics that differ from email; hence, HTTP has features 2240 that differ from MIME. These differences were carefully chosen to 2241 optimize performance over binary connections, to allow greater 2242 freedom in the use of new media types, to make date comparisons 2243 easier, and to acknowledge the practice of some early HTTP servers 2244 and clients. 2246 This appendix describes specific areas where HTTP differs from MIME. 2247 Proxies and gateways to and from strict MIME environments need to be 2248 aware of these differences and provide the appropriate conversions 2249 where necessary. 2251 B.1. MIME-Version 2253 HTTP is not a MIME-compliant protocol. However, messages can include 2254 a single MIME-Version header field to indicate what version of the 2255 MIME protocol was used to construct the message. Use of the MIME- 2256 Version header field indicates that the message is in full 2257 conformance with the MIME protocol (as defined in [RFC2045]). 2258 Senders are responsible for ensuring full conformance (where 2259 possible) when exporting HTTP messages to strict MIME environments. 2261 B.2. Conversion to Canonical Form 2263 MIME requires that an Internet mail body part be converted to 2264 canonical form prior to being transferred, as described in Section 4 2265 of [RFC2049]. Section 6.1.1.2 of [Semantics] describes the forms 2266 allowed for subtypes of the "text" media type when transmitted over 2267 HTTP. [RFC2046] requires that content with a type of "text" 2268 represent line breaks as CRLF and forbids the use of CR or LF outside 2269 of line break sequences. HTTP allows CRLF, bare CR, and bare LF to 2270 indicate a line break within text content. 2272 A proxy or gateway from HTTP to a strict MIME environment ought to 2273 translate all line breaks within text media types to the RFC 2049 2274 canonical form of CRLF. Note, however, this might be complicated by 2275 the presence of a Content-Encoding and by the fact that HTTP allows 2276 the use of some charsets that do not use octets 13 and 10 to 2277 represent CR and LF, respectively. 2279 Conversion will break any cryptographic checksums applied to the 2280 original content unless the original content is already in canonical 2281 form. Therefore, the canonical form is recommended for any content 2282 that uses such checksums in HTTP. 2284 B.3. Conversion of Date Formats 2286 HTTP/1.1 uses a restricted set of date formats (Section 10.1.1.1 of 2287 [Semantics]) to simplify the process of date comparison. Proxies and 2288 gateways from other protocols ought to ensure that any Date header 2289 field present in a message conforms to one of the HTTP/1.1 formats 2290 and rewrite the date if necessary. 2292 B.4. Conversion of Content-Encoding 2294 MIME does not include any concept equivalent to HTTP/1.1's Content- 2295 Encoding header field. Since this acts as a modifier on the media 2296 type, proxies and gateways from HTTP to MIME-compliant protocols 2297 ought to either change the value of the Content-Type header field or 2298 decode the representation before forwarding the message. (Some 2299 experimental applications of Content-Type for Internet mail have used 2300 a media-type parameter of ";conversions=" to perform 2301 a function equivalent to Content-Encoding. However, this parameter 2302 is not part of the MIME standards). 2304 B.5. Conversion of Content-Transfer-Encoding 2306 HTTP does not use the Content-Transfer-Encoding field of MIME. 2307 Proxies and gateways from MIME-compliant protocols to HTTP need to 2308 remove any Content-Transfer-Encoding prior to delivering the response 2309 message to an HTTP client. 2311 Proxies and gateways from HTTP to MIME-compliant protocols are 2312 responsible for ensuring that the message is in the correct format 2313 and encoding for safe transport on that protocol, where "safe 2314 transport" is defined by the limitations of the protocol being used. 2315 Such a proxy or gateway ought to transform and label the data with an 2316 appropriate Content-Transfer-Encoding if doing so will improve the 2317 likelihood of safe transport over the destination protocol. 2319 B.6. MHTML and Line Length Limitations 2321 HTTP implementations that share code with MHTML [RFC2557] 2322 implementations need to be aware of MIME line length limitations. 2323 Since HTTP does not have this limitation, HTTP does not fold long 2324 lines. MHTML messages being transported by HTTP follow all 2325 conventions of MHTML, including line length limitations and folding, 2326 canonicalization, etc., since HTTP transfers message-bodies as 2327 payload and, aside from the "multipart/byteranges" type 2328 (Section 6.3.5 of [Semantics]), does not interpret the content or any 2329 MIME header lines that might be contained therein. 2331 Appendix C. HTTP Version History 2333 HTTP has been in use since 1990. The first version, later referred 2334 to as HTTP/0.9, was a simple protocol for hypertext data transfer 2335 across the Internet, using only a single request method (GET) and no 2336 metadata. HTTP/1.0, as defined by [RFC1945], added a range of 2337 request methods and MIME-like messaging, allowing for metadata to be 2338 transferred and modifiers placed on the request/response semantics. 2339 However, HTTP/1.0 did not sufficiently take into consideration the 2340 effects of hierarchical proxies, caching, the need for persistent 2341 connections, or name-based virtual hosts. The proliferation of 2342 incompletely implemented applications calling themselves "HTTP/1.0" 2343 further necessitated a protocol version change in order for two 2344 communicating applications to determine each other's true 2345 capabilities. 2347 HTTP/1.1 remains compatible with HTTP/1.0 by including more stringent 2348 requirements that enable reliable implementations, adding only those 2349 features that can either be safely ignored by an HTTP/1.0 recipient 2350 or only be sent when communicating with a party advertising 2351 conformance with HTTP/1.1. 2353 HTTP/1.1 has been designed to make supporting previous versions easy. 2354 A general-purpose HTTP/1.1 server ought to be able to understand any 2355 valid request in the format of HTTP/1.0, responding appropriately 2356 with an HTTP/1.1 message that only uses features understood (or 2357 safely ignored) by HTTP/1.0 clients. Likewise, an HTTP/1.1 client 2358 can be expected to understand any valid HTTP/1.0 response. 2360 Since HTTP/0.9 did not support header fields in a request, there is 2361 no mechanism for it to support name-based virtual hosts (selection of 2362 resource by inspection of the Host header field). Any server that 2363 implements name-based virtual hosts ought to disable support for 2364 HTTP/0.9. Most requests that appear to be HTTP/0.9 are, in fact, 2365 badly constructed HTTP/1.x requests caused by a client failing to 2366 properly encode the request-target. 2368 C.1. Changes from HTTP/1.0 2370 This section summarizes major differences between versions HTTP/1.0 2371 and HTTP/1.1. 2373 C.1.1. Multihomed Web Servers 2375 The requirements that clients and servers support the Host header 2376 field (Section 5.4 of [Semantics]), report an error if it is missing 2377 from an HTTP/1.1 request, and accept absolute URIs (Section 3.2) are 2378 among the most important changes defined by HTTP/1.1. 2380 Older HTTP/1.0 clients assumed a one-to-one relationship of IP 2381 addresses and servers; there was no other established mechanism for 2382 distinguishing the intended server of a request than the IP address 2383 to which that request was directed. The Host header field was 2384 introduced during the development of HTTP/1.1 and, though it was 2385 quickly implemented by most HTTP/1.0 browsers, additional 2386 requirements were placed on all HTTP/1.1 requests in order to ensure 2387 complete adoption. At the time of this writing, most HTTP-based 2388 services are dependent upon the Host header field for targeting 2389 requests. 2391 C.1.2. Keep-Alive Connections 2393 In HTTP/1.0, each connection is established by the client prior to 2394 the request and closed by the server after sending the response. 2395 However, some implementations implement the explicitly negotiated 2396 ("Keep-Alive") version of persistent connections described in 2397 Section 19.7.1 of [RFC2068]. 2399 Some clients and servers might wish to be compatible with these 2400 previous approaches to persistent connections, by explicitly 2401 negotiating for them with a "Connection: keep-alive" request header 2402 field. However, some experimental implementations of HTTP/1.0 2403 persistent connections are faulty; for example, if an HTTP/1.0 proxy 2404 server doesn't understand Connection, it will erroneously forward 2405 that header field to the next inbound server, which would result in a 2406 hung connection. 2408 One attempted solution was the introduction of a Proxy-Connection 2409 header field, targeted specifically at proxies. In practice, this 2410 was also unworkable, because proxies are often deployed in multiple 2411 layers, bringing about the same problem discussed above. 2413 As a result, clients are encouraged not to send the Proxy-Connection 2414 header field in any requests. 2416 Clients are also encouraged to consider the use of Connection: keep- 2417 alive in requests carefully; while they can enable persistent 2418 connections with HTTP/1.0 servers, clients using them will need to 2419 monitor the connection for "hung" requests (which indicate that the 2420 client ought stop sending the header field), and this mechanism ought 2421 not be used by clients at all when a proxy is being used. 2423 C.1.3. Introduction of Transfer-Encoding 2425 HTTP/1.1 introduces the Transfer-Encoding header field (Section 6.1). 2426 Transfer codings need to be decoded prior to forwarding an HTTP 2427 message over a MIME-compliant protocol. 2429 C.2. Changes from RFC 7230 2431 Most of the sections introducing HTTP's design goals, history, 2432 architecture, conformance criteria, protocol versioning, URIs, 2433 message routing, and header fields have been moved to [Semantics]. 2434 This document has been reduced to just the messaging syntax and 2435 connection management requirements specific to HTTP/1.1. 2437 Trailer field semantics now transcend the specifics of chunked 2438 encoding. The decoding algorithm for chunked (Section 7.1.3) has 2439 been updated to encourage storage/forwarding of trailer fields 2440 separately from the header section, to only allow merging into the 2441 header section if the recipient knows the corresponding field 2442 definition permits and defines how to merge, and otherwise to discard 2443 the trailer fields instead of merging. The trailer part is now 2444 called the trailer section to be more consistent with the header 2445 section and more distinct from a body part (Section 7.1.2). 2447 In the ABNF for chunked extensions, re-introduced (bad) whitespace 2448 around ";" and "=" (Section 7.1.1). Whitespace was removed in 2449 [RFC7230], but that change was found to break existing 2450 implementations (see [Err4667]). 2452 Disallowed transfer coding parameters called "q" in order to avoid 2453 conflicts with the use of ranks in the TE header field (Section 7.3). 2455 Appendix D. Change Log 2457 This section is to be removed before publishing as an RFC. 2459 D.1. Between RFC7230 and draft 00 2461 The changes were purely editorial: 2463 o Change boilerplate and abstract to indicate the "draft" status, 2464 and update references to ancestor specifications. 2466 o Adjust historical notes. 2468 o Update links to sibling specifications. 2470 o Replace sections listing changes from RFC 2616 by new empty 2471 sections referring to RFC 723x. 2473 o Remove acknowledgements specific to RFC 723x. 2475 o Move "Acknowledgements" to the very end and make them unnumbered. 2477 D.2. Since draft-ietf-httpbis-messaging-00 2479 The changes in this draft are editorial, with respect to HTTP as a 2480 whole, to move all core HTTP semantics into [Semantics]: 2482 o Moved introduction, architecture, conformance, and ABNF extensions 2483 from RFC 7230 (Messaging) to semantics [Semantics]. 2485 o Moved discussion of MIME differences from RFC 7231 (Semantics) to 2486 Appendix B since they mostly cover transforming 1.1 messages. 2488 o Moved all extensibility tips, registration procedures, and 2489 registry tables from the IANA considerations to normative 2490 sections, reducing the IANA considerations to just instructions 2491 that will be removed prior to publication as an RFC. 2493 D.3. Since draft-ietf-httpbis-messaging-01 2495 o Cite RFC 8126 instead of RFC 5226 () 2498 o Resolved erratum 4779, no change needed here 2499 (, 2500 ) 2502 o In Section 7, fixed prose claiming transfer parameters allow bare 2503 names (, 2504 ) 2506 o Resolved erratum 4225, no change needed here 2507 (, 2508 ) 2510 o Replace "response code" with "response status code" 2511 (, 2512 ) 2514 o In Section 9.4, clarify statement about HTTP/1.0 keep-alive 2515 (, 2516 ) 2518 o In Section 7.1.1, re-introduce (bad) whitespace around ";" and "=" 2519 (, 2520 , ) 2523 o In Section 7.3, state that transfer codings should not use 2524 parameters named "q" (, ) 2527 o In Section 7, mark coding name "trailers" as reserved in the IANA 2528 registry () 2530 D.4. Since draft-ietf-httpbis-messaging-02 2532 o In Section 4, explain why the reason phrase should be ignored by 2533 clients (). 2535 o Add Section 9.3 to explain how request/response correlation is 2536 performed () 2538 D.5. Since draft-ietf-httpbis-messaging-03 2540 o In Section 9.3, caution against treating data on a connection as 2541 part of a not-yet-issued request () 2544 o In Section 7, remove the predefined codings from the ABNF and make 2545 it generic instead () 2548 o Use RFC 7405 ABNF notation for case-sensitive string constants 2549 () 2551 D.6. Since draft-ietf-httpbis-messaging-04 2553 o In Section 9.9, clarify that protocol-name is to be matched case- 2554 insensitively () 2556 o In Section 5.2, add leading optional whitespace to obs-fold ABNF 2557 (, 2558 ) 2560 o In Section 4, add clarifications about empty reason phrases 2561 () 2563 o Move discussion of retries from Section 9.4.1 into [Semantics] 2564 () 2566 D.7. Since draft-ietf-httpbis-messaging-05 2568 o In Section 7.1.2, the trailer part has been renamed the trailer 2569 section (for consistency with the header section) and trailers are 2570 no longer merged as header fields by default, but rather can be 2571 discarded, kept separate from header fields, or merged with header 2572 fields only if understood and defined as being mergeable 2573 () 2575 o In Section 2.1 and related Sections, move the trailing CRLF from 2576 the line grammars into the message format 2577 () 2579 o Moved Section 2.3 down () 2582 o In Section 9.9, use 'websocket' instead of 'HTTP/2.0' in examples 2583 () 2585 o Move version non-specific text from Section 6 into semantics as 2586 "payload body" () 2588 o In Section 9.8, add text from RFC 2818 2589 () 2591 Index 2593 A 2594 absolute-form (of request-target) 11 2595 application/http Media Type 40 2596 asterisk-form (of request-target) 11 2597 authority-form (of request-target) 11 2599 C 2600 Connection header field 28, 33 2601 Content-Length header field 18 2602 Content-Transfer-Encoding header field 50 2603 chunked (Coding Format) 17, 19 2604 chunked (transfer coding) 22 2605 close 28, 33 2606 compress (transfer coding) 24 2608 D 2609 deflate (transfer coding) 24 2611 E 2612 effective request URI 12 2614 G 2615 Grammar 2616 absolute-form 10-11 2617 ALPHA 5 2618 asterisk-form 10-11 2619 authority-form 10-11 2620 chunk 22 2621 chunk-data 22 2622 chunk-ext 22-23 2623 chunk-ext-name 23 2624 chunk-ext-val 23 2625 chunk-size 22 2626 chunked-body 22 2627 Connection 28 2628 connection-option 28 2629 CR 5 2630 CRLF 5 2631 CTL 5 2632 DIGIT 5 2633 DQUOTE 5 2634 field-name 14 2635 field-value 14 2636 header-field 14, 24 2637 HEXDIG 5 2638 HTAB 5 2639 HTTP-message 6 2640 HTTP-name 8 2641 HTTP-version 8 2642 last-chunk 22 2643 LF 5 2644 message-body 16 2645 method 9 2646 obs-fold 16 2647 OCTET 5 2648 origin-form 10 2649 rank 26 2650 reason-phrase 14 2651 request-line 9 2652 request-target 10 2653 SP 5 2654 start-line 6 2655 status-code 14 2656 status-line 13 2657 t-codings 26 2658 t-ranking 26 2659 TE 26 2660 trailer-section 22, 24 2661 transfer-coding 21 2662 Transfer-Encoding 17 2663 transfer-parameter 21 2664 Upgrade 35 2665 VCHAR 5 2666 gzip (transfer coding) 24 2668 H 2669 header field 6 2670 header section 6 2671 headers 6 2673 M 2674 MIME-Version header field 49 2675 Media Type 2676 application/http 40 2677 message/http 38 2678 message/http Media Type 38 2679 method 9 2681 O 2682 origin-form (of request-target) 10 2684 R 2685 request-target 10 2687 T 2688 TE header field 25 2689 Transfer-Encoding header field 17 2691 U 2692 Upgrade header field 35 2694 X 2695 x-compress (transfer coding) 24 2696 x-gzip (transfer coding) 24 2698 Acknowledgments 2700 See Appendix "Acknowledgments" of [Semantics]. 2702 Authors' Addresses 2704 Roy T. Fielding (editor) 2705 Adobe 2706 345 Park Ave 2707 San Jose, CA 95110 2708 United States of America 2710 EMail: fielding@gbiv.com 2711 URI: https://roy.gbiv.com/ 2713 Mark Nottingham (editor) 2714 Fastly 2716 EMail: mnot@mnot.net 2717 URI: https://www.mnot.net/ 2718 Julian F. Reschke (editor) 2719 greenbytes GmbH 2720 Hafenweg 16 2721 Muenster 48155 2722 Germany 2724 EMail: julian.reschke@greenbytes.de 2725 URI: https://greenbytes.de/tech/webdav/