idnits 2.17.1 draft-ietf-httpbis-http2bis-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document obsoletes RFC8740, but the abstract doesn't seem to directly say this. It does mention RFC8740 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 date (26 September 2021) is 937 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) == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-18 -- Possible downref: Normative reference to a draft: ref. 'CACHE' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS186' == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-semantics-18 -- Possible downref: Normative reference to a draft: ref. 'HTTP' ** Obsolete normative reference: RFC 793 (ref. 'TCP') (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 5246 (ref. 'TLS12') (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 8499 (ref. 'DNS-TERMS') (Obsoleted by RFC 9499) == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-messaging-18 == Outdated reference: A later version (-12) exists of draft-ietf-httpbis-priority-04 -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) -- Obsolete informational reference (is this intentional?): RFC 8740 (Obsoleted by RFC 9113) -- Obsolete informational reference (is this intentional?): RFC 7525 (ref. 'TLSBCP') (Obsoleted by RFC 9325) Summary: 2 errors (**), 0 flaws (~~), 5 warnings (==), 9 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPbis M. Thomson, Ed. 3 Internet-Draft Mozilla 4 Obsoletes: 7540, 8740 (if approved) C. Benfield, Ed. 5 Intended status: Standards Track Apple Inc. 6 Expires: 30 March 2022 26 September 2021 8 Hypertext Transfer Protocol Version 2 (HTTP/2) 9 draft-ietf-httpbis-http2bis-05 11 Abstract 13 This specification describes an optimized expression of the semantics 14 of the Hypertext Transfer Protocol (HTTP), referred to as HTTP 15 version 2 (HTTP/2). HTTP/2 enables a more efficient use of network 16 resources and a reduced latency by introducing field compression and 17 allowing multiple concurrent exchanges on the same connection. 19 This document obsoletes RFC 7540 and RFC 8740. 21 Discussion Venues 23 This note is to be removed before publishing as an RFC. 25 Discussion of this document takes place on the HTTPBIS Working Group 26 mailing list (ietf-http-wg@w3.org), which is archived at 27 https://lists.w3.org/Archives/Public/ietf-http-wg/. 29 Source for this draft and an issue tracker can be found at 30 https://github.com/httpwg/http2-spec. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at https://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on 30 March 2022. 49 Copyright Notice 51 Copyright (c) 2021 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 56 license-info) in effect on the date of publication of this document. 57 Please review these documents carefully, as they describe your rights 58 and restrictions with respect to this document. Code Components 59 extracted from this document must include Simplified BSD License text 60 as described in Section 4.e of the Trust Legal Provisions and are 61 provided without warranty as described in the Simplified BSD License. 63 Table of Contents 65 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 66 2. HTTP/2 Protocol Overview . . . . . . . . . . . . . . . . . . 5 67 2.1. Document Organization . . . . . . . . . . . . . . . . . . 6 68 2.2. Conventions and Terminology . . . . . . . . . . . . . . . 6 69 3. Starting HTTP/2 . . . . . . . . . . . . . . . . . . . . . . . 7 70 3.1. HTTP/2 Version Identification . . . . . . . . . . . . . . 8 71 3.2. Starting HTTP/2 for "https" URIs . . . . . . . . . . . . 8 72 3.3. Starting HTTP/2 with Prior Knowledge . . . . . . . . . . 9 73 3.4. HTTP/2 Connection Preface . . . . . . . . . . . . . . . . 9 74 4. HTTP Frames . . . . . . . . . . . . . . . . . . . . . . . . . 10 75 4.1. Frame Format . . . . . . . . . . . . . . . . . . . . . . 10 76 4.2. Frame Size . . . . . . . . . . . . . . . . . . . . . . . 11 77 4.3. Field Section Compression and Decompression . . . . . . . 12 78 5. Streams and Multiplexing . . . . . . . . . . . . . . . . . . 13 79 5.1. Stream States . . . . . . . . . . . . . . . . . . . . . . 14 80 5.1.1. Stream Identifiers . . . . . . . . . . . . . . . . . 19 81 5.1.2. Stream Concurrency . . . . . . . . . . . . . . . . . 20 82 5.2. Flow Control . . . . . . . . . . . . . . . . . . . . . . 20 83 5.2.1. Flow-Control Principles . . . . . . . . . . . . . . . 20 84 5.2.2. Appropriate Use of Flow Control . . . . . . . . . . . 22 85 5.2.3. Flow Control Performance . . . . . . . . . . . . . . 22 86 5.3. Prioritization . . . . . . . . . . . . . . . . . . . . . 22 87 5.3.1. Background of Priority in HTTP/2 . . . . . . . . . . 23 88 5.3.2. Priority Signaling in this Document . . . . . . . . . 23 89 5.4. Error Handling . . . . . . . . . . . . . . . . . . . . . 24 90 5.4.1. Connection Error Handling . . . . . . . . . . . . . . 24 91 5.4.2. Stream Error Handling . . . . . . . . . . . . . . . . 25 92 5.4.3. Connection Termination . . . . . . . . . . . . . . . 25 93 5.5. Extending HTTP/2 . . . . . . . . . . . . . . . . . . . . 26 94 6. Frame Definitions . . . . . . . . . . . . . . . . . . . . . . 27 95 6.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . . . 27 96 6.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . . . 29 97 6.3. PRIORITY . . . . . . . . . . . . . . . . . . . . . . . . 31 98 6.4. RST_STREAM . . . . . . . . . . . . . . . . . . . . . . . 32 99 6.5. SETTINGS . . . . . . . . . . . . . . . . . . . . . . . . 33 100 6.5.1. SETTINGS Format . . . . . . . . . . . . . . . . . . . 34 101 6.5.2. Defined Settings . . . . . . . . . . . . . . . . . . 35 102 6.5.3. Settings Synchronization . . . . . . . . . . . . . . 36 103 6.6. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . . . 37 104 6.7. PING . . . . . . . . . . . . . . . . . . . . . . . . . . 39 105 6.8. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . . . 41 106 6.9. WINDOW_UPDATE . . . . . . . . . . . . . . . . . . . . . . 44 107 6.9.1. The Flow-Control Window . . . . . . . . . . . . . . . 45 108 6.9.2. Initial Flow-Control Window Size . . . . . . . . . . 46 109 6.9.3. Reducing the Stream Window Size . . . . . . . . . . . 47 110 6.10. CONTINUATION . . . . . . . . . . . . . . . . . . . . . . 47 111 7. Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . 48 112 8. Expressing HTTP Semantics in HTTP/2 . . . . . . . . . . . . . 50 113 8.1. HTTP Message Framing . . . . . . . . . . . . . . . . . . 50 114 8.1.1. Malformed Messages . . . . . . . . . . . . . . . . . 51 115 8.2. HTTP Fields . . . . . . . . . . . . . . . . . . . . . . . 52 116 8.2.1. Field Validity . . . . . . . . . . . . . . . . . . . 53 117 8.2.2. Connection-Specific Header Fields . . . . . . . . . . 54 118 8.2.3. Compressing the Cookie Header Field . . . . . . . . . 54 119 8.3. HTTP Control Data . . . . . . . . . . . . . . . . . . . . 55 120 8.3.1. Request Pseudo-Header Fields . . . . . . . . . . . . 55 121 8.3.2. Response Pseudo-Header Fields . . . . . . . . . . . . 57 122 8.4. Server Push . . . . . . . . . . . . . . . . . . . . . . . 57 123 8.4.1. Push Requests . . . . . . . . . . . . . . . . . . . . 59 124 8.4.2. Push Responses . . . . . . . . . . . . . . . . . . . 60 125 8.5. The CONNECT Method . . . . . . . . . . . . . . . . . . . 61 126 8.6. The Upgrade Header Field . . . . . . . . . . . . . . . . 62 127 8.7. Request Reliability . . . . . . . . . . . . . . . . . . . 62 128 8.8. Examples . . . . . . . . . . . . . . . . . . . . . . . . 63 129 8.8.1. Simple Request . . . . . . . . . . . . . . . . . . . 63 130 8.8.2. Simple Response . . . . . . . . . . . . . . . . . . . 64 131 8.8.3. Complex Request . . . . . . . . . . . . . . . . . . . 64 132 8.8.4. Response with Body . . . . . . . . . . . . . . . . . 65 133 8.8.5. Informational Responses . . . . . . . . . . . . . . . 65 134 9. HTTP/2 Connections . . . . . . . . . . . . . . . . . . . . . 66 135 9.1. Connection Management . . . . . . . . . . . . . . . . . . 66 136 9.1.1. Connection Reuse . . . . . . . . . . . . . . . . . . 67 137 9.2. Use of TLS Features . . . . . . . . . . . . . . . . . . . 68 138 9.2.1. TLS 1.2 Features . . . . . . . . . . . . . . . . . . 68 139 9.2.2. TLS 1.2 Cipher Suites . . . . . . . . . . . . . . . . 69 140 9.2.3. TLS 1.3 Features . . . . . . . . . . . . . . . . . . 70 141 10. Security Considerations . . . . . . . . . . . . . . . . . . . 70 142 10.1. Server Authority . . . . . . . . . . . . . . . . . . . . 70 143 10.2. Cross-Protocol Attacks . . . . . . . . . . . . . . . . . 71 144 10.3. Intermediary Encapsulation Attacks . . . . . . . . . . . 71 145 10.4. Cacheability of Pushed Responses . . . . . . . . . . . . 72 146 10.5. Denial-of-Service Considerations . . . . . . . . . . . . 72 147 10.5.1. Limits on Field Block Size . . . . . . . . . . . . . 74 148 10.5.2. CONNECT Issues . . . . . . . . . . . . . . . . . . . 74 149 10.6. Use of Compression . . . . . . . . . . . . . . . . . . . 74 150 10.7. Use of Padding . . . . . . . . . . . . . . . . . . . . . 75 151 10.8. Privacy Considerations . . . . . . . . . . . . . . . . . 76 152 10.9. Remote Timing Attacks . . . . . . . . . . . . . . . . . 76 153 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 76 154 11.1. HTTP2-Settings Header Field Registration . . . . . . . . 77 155 11.2. The h2c Upgrade Token . . . . . . . . . . . . . . . . . 77 156 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 77 157 12.1. Normative References . . . . . . . . . . . . . . . . . . 77 158 12.2. Informative References . . . . . . . . . . . . . . . . . 79 159 Appendix A. Prohibited TLS 1.2 Cipher Suites . . . . . . . . . . 81 160 Appendix B. Changes from RFC 7540 . . . . . . . . . . . . . . . 87 161 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 87 162 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 88 163 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 88 165 1. Introduction 167 The performance of applications using the Hypertext Transfer Protocol 168 (HTTP, [HTTP]) is linked to how each version of HTTP uses the 169 underlying transport, and the conditions under which the transport 170 operates. 172 Making multiple concurrent requests can reduce latency and improve 173 application performance. HTTP/1.0 allowed only one request to be 174 outstanding at a time on a given TCP [TCP] connection. HTTP/1.1 175 ([HTTP11]) added request pipelining, but this only partially 176 addressed request concurrency and still suffers from application- 177 layer head-of-line blocking. Therefore, HTTP/1.0 and HTTP/1.1 178 clients use multiple connections to a server to make concurrent 179 requests. 181 Furthermore, HTTP fields are often repetitive and verbose, causing 182 unnecessary network traffic as well as causing the initial TCP 183 congestion window to quickly fill. This can result in excessive 184 latency when multiple requests are made on a new TCP connection. 186 HTTP/2 addresses these issues by defining an optimized mapping of 187 HTTP's semantics to an underlying connection. Specifically, it 188 allows interleaving of messages on the same connection and uses an 189 efficient coding for HTTP fields. It also allows prioritization of 190 requests, letting more important requests complete more quickly, 191 further improving performance. 193 The resulting protocol is more friendly to the network because fewer 194 TCP connections can be used in comparison to HTTP/1.x. This means 195 less competition with other flows and longer-lived connections, which 196 in turn lead to better utilization of available network capacity. 197 Note, however, that TCP head-of-line blocking is not addressed by 198 this protocol. 200 Finally, HTTP/2 also enables more efficient processing of messages 201 through use of binary message framing. 203 This document obsoletes RFC 7540 [RFC7540] and RFC 8740 [RFC8740]. 205 2. HTTP/2 Protocol Overview 207 HTTP/2 provides an optimized transport for HTTP semantics. HTTP/2 208 supports all of the core features of HTTP but aims to be more 209 efficient than HTTP/1.1. 211 The basic protocol unit in HTTP/2 is a frame (Section 4.1). Each 212 frame type serves a different purpose. For example, HEADERS and DATA 213 frames form the basis of HTTP requests and responses (Section 8.1); 214 other frame types like SETTINGS, WINDOW_UPDATE, and PUSH_PROMISE are 215 used in support of other HTTP/2 features. 217 Multiplexing of requests is achieved by having each HTTP request/ 218 response exchange associated with its own stream (Section 5). 219 Streams are largely independent of each other, so a blocked or 220 stalled request or response does not prevent progress on other 221 streams. 223 Effective use of multiplexing depends on flow control and 224 prioritization. Flow control (Section 5.2) ensures that it is 225 possible to efficiently use multiplexed streams by restricting data 226 that is transmitted to what the receiver is able to handle. 227 Prioritization (Section 5.3) ensures that limited resources are used 228 most effectively. This revision of HTTP/2 deprecates the priority 229 signaling scheme from [RFC7540]. 231 Because HTTP fields used in a connection can contain large amounts of 232 redundant data, frames that contain them are compressed 233 (Section 4.3). This has especially advantageous impact upon request 234 sizes in the common case, allowing many requests to be compressed 235 into one packet. 237 Finally, HTTP/2 adds a new, optional interaction mode whereby a 238 server can push responses to a client (Section 8.4). This is 239 intended to allow a server to speculatively send data to a client 240 that the server anticipates the client will need, trading off some 241 network usage against a potential latency gain. The server does this 242 by synthesizing a request, which it sends as a PUSH_PROMISE frame. 243 The server is then able to send a response to the synthetic request 244 on a separate stream. 246 2.1. Document Organization 248 The HTTP/2 specification is split into four parts: 250 * Starting HTTP/2 (Section 3) covers how an HTTP/2 connection is 251 initiated. 253 * The frame (Section 4) and stream (Section 5) layers describe the 254 way HTTP/2 frames are structured and formed into multiplexed 255 streams. 257 * Frame (Section 6) and error (Section 7) definitions include 258 details of the frame and error types used in HTTP/2. 260 * HTTP mappings (Section 8) and additional requirements (Section 9) 261 describe how HTTP semantics are expressed using frames and 262 streams. 264 While some of the frame and stream layer concepts are isolated from 265 HTTP, this specification does not define a completely generic frame 266 layer. The frame and stream layers are tailored to the needs of the 267 HTTP protocol and server push. 269 2.2. Conventions and Terminology 271 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 272 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 273 "OPTIONAL" in this document are to be interpreted as described in 274 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 275 capitals, as shown here. 277 All numeric values are in network byte order. Values are unsigned 278 unless otherwise indicated. Literal values are provided in decimal 279 or hexadecimal as appropriate. Hexadecimal literals are prefixed 280 with 0x to distinguish them from decimal literals. 282 This specification describes binary formats using the convention 283 described in Section 1.3 of RFC 9000 [QUIC]. Note that this format 284 uses network byte order and high-valued bits are listed before low- 285 valued bits. 287 The following terms are used: 289 client: The endpoint that initiates an HTTP/2 connection. Clients 290 send HTTP requests and receive HTTP responses. 292 connection: A transport-layer connection between two endpoints. 294 connection error: An error that affects the entire HTTP/2 295 connection. 297 endpoint: Either the client or server of the connection. 299 frame: The smallest unit of communication within an HTTP/2 300 connection, consisting of a header and a variable-length sequence 301 of octets structured according to the frame type. 303 peer: An endpoint. When discussing a particular endpoint, "peer" 304 refers to the endpoint that is remote to the primary subject of 305 discussion. 307 receiver: An endpoint that is receiving frames. 309 sender: An endpoint that is transmitting frames. 311 server: The endpoint that accepts an HTTP/2 connection. Servers 312 receive HTTP requests and send HTTP responses. 314 stream: A bidirectional flow of frames within the HTTP/2 connection. 316 stream error: An error on the individual HTTP/2 stream. 318 Finally, the terms "gateway", "intermediary", "proxy", and "tunnel" 319 are defined in Section 3.7 of [HTTP]. Intermediaries act as both 320 client and server at different times. 322 The term "content" as it applies to message bodies is defined in 323 Section 6.4 of [HTTP]. 325 3. Starting HTTP/2 327 An HTTP/2 connection is an application-layer protocol running on top 328 of a TCP connection ([TCP]). The client is the TCP connection 329 initiator. 331 HTTP/2 uses the "http" and "https" URI schemes defined in Section 4.2 332 of [HTTP], with the same default port numbers. As a result, 333 implementations processing requests for target resource URIs like 334 http://example.org/foo or https://example.com/bar are required to 335 first discover whether the upstream server (the immediate peer to 336 which the client wishes to establish a connection) supports HTTP/2. 338 The means by which support for HTTP/2 is determined is different for 339 "http" and "https" URIs. Discovery for "https" URIs is described in 340 Section 3.2. HTTP/2 support for "http" URIs can only be discovered 341 by out-of-band means, and requires prior knowledge of the support as 342 described in Section 3.3. 344 3.1. HTTP/2 Version Identification 346 The protocol defined in this document has two identifiers. Creating 347 a connection based on either implies the use of the transport, 348 framing, and message semantics described in this document. 350 * The string "h2" identifies the protocol where HTTP/2 uses 351 Transport Layer Security (TLS); see Section 9.2. This identifier 352 is used in the TLS application-layer protocol negotiation (ALPN) 353 extension [TLS-ALPN] field and in any place where HTTP/2 over TLS 354 is identified. 356 The "h2" string is serialized into an ALPN protocol identifier as 357 the two-octet sequence: 0x68, 0x32. 359 * The string "h2c" identifies the protocol where HTTP/2 is run over 360 cleartext TCP. This identifier is used in any place where HTTP/2 361 over TCP is identified. 363 The "h2c" string is reserved from the ALPN identifier space but 364 describes a protocol that does not use TLS. The security 365 properties of this protocol do not hold unless TLS is used; see 366 Section 10. 368 The "h2c" string was previously used as a token for use in the 369 HTTP Upgrade mechanism's Upgrade header field (Section 7.8 of 370 [HTTP]). This usage was never widely deployed, and is no longer 371 specified in this document. 373 3.2. Starting HTTP/2 for "https" URIs 375 A client that makes a request to an "https" URI uses TLS [TLS13] with 376 the application-layer protocol negotiation (ALPN) extension 377 [TLS-ALPN]. 379 HTTP/2 over TLS uses the "h2" protocol identifier. The "h2c" 380 protocol identifier MUST NOT be sent by a client or selected by a 381 server; the "h2c" protocol identifier describes a protocol that does 382 not use TLS. 384 Once TLS negotiation is complete, both the client and the server MUST 385 send a connection preface (Section 3.4). 387 3.3. Starting HTTP/2 with Prior Knowledge 389 A client can learn that a particular server supports HTTP/2 by other 390 means. For example, a client could be configured with knowledge that 391 a server supports HTTP/2. 393 A client that knows that a server supports HTTP/2 can establish a TCP 394 connection and send the connection preface (Section 3.4) followed by 395 HTTP/2 frames. Servers can identify these connections by the 396 presence of the connection preface. This only affects the 397 establishment of HTTP/2 connections over cleartext TCP; HTTP/2 398 connections over TLS MUST use protocol negotiation in TLS [TLS-ALPN]. 400 Likewise, the server MUST send a connection preface (Section 3.4). 402 Without additional information, prior support for HTTP/2 is not a 403 strong signal that a given server will support HTTP/2 for future 404 connections. For example, it is possible for server configurations 405 to change, for configurations to differ between instances in 406 clustered servers, or for network conditions to change. 408 3.4. HTTP/2 Connection Preface 410 In HTTP/2, each endpoint is required to send a connection preface as 411 a final confirmation of the protocol in use and to establish the 412 initial settings for the HTTP/2 connection. The client and server 413 each send a different connection preface. 415 The client connection preface starts with a sequence of 24 octets, 416 which in hex notation is: 418 0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a 420 That is, the connection preface starts with the string PRI * 421 HTTP/2.0\r\n\r\nSM\r\n\r\n. This sequence MUST be followed by a 422 SETTINGS frame (Section 6.5), which MAY be empty. The client sends 423 the client connection preface as the first application data octets of 424 a connection. 426 | Note: The client connection preface is selected so that a large 427 | proportion of HTTP/1.1 or HTTP/1.0 servers and intermediaries 428 | do not attempt to process further frames. Note that this does 429 | not address the concerns raised in [TALKING]. 431 The server connection preface consists of a potentially empty 432 SETTINGS frame (Section 6.5) that MUST be the first frame the server 433 sends in the HTTP/2 connection. 435 The SETTINGS frames received from a peer as part of the connection 436 preface MUST be acknowledged (see Section 6.5.3) after sending the 437 connection preface. 439 To avoid unnecessary latency, clients are permitted to send 440 additional frames to the server immediately after sending the client 441 connection preface, without waiting to receive the server connection 442 preface. It is important to note, however, that the server 443 connection preface SETTINGS frame might include settings that 444 necessarily alter how a client is expected to communicate with the 445 server. Upon receiving the SETTINGS frame, the client is expected to 446 honor any settings established. In some configurations, it is 447 possible for the server to transmit SETTINGS before the client sends 448 additional frames, providing an opportunity to avoid this issue. 450 Clients and servers MUST treat an invalid connection preface as a 451 connection error (Section 5.4.1) of type PROTOCOL_ERROR. A GOAWAY 452 frame (Section 6.8) MAY be omitted in this case, since an invalid 453 preface indicates that the peer is not using HTTP/2. 455 4. HTTP Frames 457 Once the HTTP/2 connection is established, endpoints can begin 458 exchanging frames. 460 4.1. Frame Format 462 All frames begin with a fixed 9-octet header followed by a variable- 463 length frame payload. 465 HTTP Frame { 466 Length (24), 467 Type (8), 469 Flags (8), 471 Reserved (1), 472 Stream Identifier (31), 474 Frame Payload (..), 475 } 477 Figure 1: Frame Layout 479 The fields of the frame header are defined as: 481 Length: The length of the frame payload expressed as an unsigned 482 24-bit integer. Values greater than 2^14 (16,384) MUST NOT be 483 sent unless the receiver has set a larger value for 484 SETTINGS_MAX_FRAME_SIZE. 486 The 9 octets of the frame header are not included in this value. 488 Type: The 8-bit type of the frame. The frame type determines the 489 format and semantics of the frame. Implementations MUST ignore 490 and discard any frame that has a type that is unknown. 492 Flags: An 8-bit field reserved for boolean flags specific to the 493 frame type. 495 Flags are assigned semantics specific to the indicated frame type. 496 Unused flags are those that have no defined semantics for a 497 particular frame type, and MUST be ignored and MUST be left unset 498 (0x0) when sending. 500 Reserved: A reserved 1-bit field. The semantics of this bit are 501 undefined, and the bit MUST remain unset (0x0) when sending and 502 MUST be ignored when receiving. 504 Stream Identifier: A stream identifier (see Section 5.1.1) expressed 505 as an unsigned 31-bit integer. The value 0x0 is reserved for 506 frames that are associated with the connection as a whole as 507 opposed to an individual stream. 509 The structure and content of the frame payload is dependent entirely 510 on the frame type. 512 4.2. Frame Size 514 The size of a frame payload is limited by the maximum size that a 515 receiver advertises in the SETTINGS_MAX_FRAME_SIZE setting. This 516 setting can have any value between 2^14 (16,384) and 2^24-1 517 (16,777,215) octets, inclusive. 519 All implementations MUST be capable of receiving and minimally 520 processing frames up to 2^14 octets in length, plus the 9-octet frame 521 header (Section 4.1). The size of the frame header is not included 522 when describing frame sizes. 524 | Note: Certain frame types, such as PING (Section 6.7), impose 525 | additional limits on the amount of frame payload data allowed. 527 An endpoint MUST send an error code of FRAME_SIZE_ERROR if a frame 528 exceeds the size defined in SETTINGS_MAX_FRAME_SIZE, exceeds any 529 limit defined for the frame type, or is too small to contain 530 mandatory frame data. A frame size error in a frame that could alter 531 the state of the entire connection MUST be treated as a connection 532 error (Section 5.4.1); this includes any frame carrying a field block 533 (Section 4.3) (that is, HEADERS, PUSH_PROMISE, and CONTINUATION), 534 SETTINGS, and any frame with a stream identifier of 0. 536 Endpoints are not obligated to use all available space in a frame. 537 Responsiveness can be improved by using frames that are smaller than 538 the permitted maximum size. Sending large frames can result in 539 delays in sending time-sensitive frames (such as RST_STREAM, 540 WINDOW_UPDATE, or PRIORITY), which, if blocked by the transmission of 541 a large frame, could affect performance. 543 4.3. Field Section Compression and Decompression 545 Field section compression is the process of compressing a set of 546 field lines (Section 5.2 of [HTTP]) to form a field block. Field 547 section decompression is the process of decoding a field block into a 548 set of field lines. Details of HTTP/2 field section compression and 549 decompression is defined in [COMPRESSION], which, for historical 550 reasons, refers to these processes as header compression and 551 decompression. 553 Field blocks carry the compressed bytes of a field section, with 554 header sections also carrying control data associated with the 555 message in the form of pseudo-header fields (Section 8.3) that use 556 the same format as a field line. 558 | Note: RFC 7540 [RFC7540] used the term "header block" in place 559 | of the more generic "field block". 561 Field blocks carry control data and header sections for requests, 562 responses, promised requests, and pushed responses (see Section 8.4). 563 All these messages, except for interim responses and requests 564 contained in PUSH_PROMISE (Section 6.6) frames, can optionally 565 include a field block that carries a trailer section. 567 A field section is a collection of field lines. Each of the field 568 lines in a field block carry a single value. The serialized field 569 block is then divided into one or more octet sequences, called field 570 block fragments, and transmitted within the frame payload of HEADERS 571 (Section 6.2) or PUSH_PROMISE (Section 6.6), each of which could be 572 followed by CONTINUATION (Section 6.10) frames. 574 The Cookie header field [COOKIE] is treated specially by the HTTP 575 mapping (see Section 8.2.3). 577 A receiving endpoint reassembles the field block by concatenating its 578 fragments and then decompresses the block to reconstruct the field 579 section. 581 A complete field section consists of either: 583 * a single HEADERS or PUSH_PROMISE frame, with the END_HEADERS flag 584 set, or 586 * a HEADERS or PUSH_PROMISE frame with the END_HEADERS flag cleared 587 and one or more CONTINUATION frames, where the last CONTINUATION 588 frame has the END_HEADERS flag set. 590 Field compression is stateful. One compression context and one 591 decompression context are used for the entire connection. A decoding 592 error in a field block MUST be treated as a connection error 593 (Section 5.4.1) of type COMPRESSION_ERROR. 595 Each field block is processed as a discrete unit. Field blocks MUST 596 be transmitted as a contiguous sequence of frames, with no 597 interleaved frames of any other type or from any other stream. The 598 last frame in a sequence of HEADERS or CONTINUATION frames has the 599 END_HEADERS flag set. The last frame in a sequence of PUSH_PROMISE 600 or CONTINUATION frames has the END_HEADERS flag set. This allows a 601 field block to be logically equivalent to a single frame. 603 Field block fragments can only be sent as the frame payload of 604 HEADERS, PUSH_PROMISE, or CONTINUATION frames because these frames 605 carry data that can modify the compression context maintained by a 606 receiver. An endpoint receiving HEADERS, PUSH_PROMISE, or 607 CONTINUATION frames needs to reassemble field blocks and perform 608 decompression even if the frames are to be discarded. A receiver 609 MUST terminate the connection with a connection error (Section 5.4.1) 610 of type COMPRESSION_ERROR if it does not decompress a field block. 612 5. Streams and Multiplexing 614 A "stream" is an independent, bidirectional sequence of frames 615 exchanged between the client and server within an HTTP/2 connection. 616 Streams have several important characteristics: 618 * A single HTTP/2 connection can contain multiple concurrently open 619 streams, with either endpoint interleaving frames from multiple 620 streams. 622 * Streams can be established and used unilaterally or shared by 623 either the client or server. 625 * Streams can be closed by either endpoint. 627 * The order in which frames are sent is significant. Recipients 628 process frames in the order they are received. In particular, the 629 order of HEADERS and DATA frames is semantically significant. 631 * Streams are identified by an integer. Stream identifiers are 632 assigned to streams by the endpoint initiating the stream. 634 5.1. Stream States 636 The lifecycle of a stream is shown in Figure 2. 638 +--------+ 639 send PP | | recv PP 640 ,--------| idle |--------. 641 / | | \ 642 v +--------+ v 643 +----------+ | +----------+ 644 | | | send H / | | 645 ,------| reserved | | recv H | reserved |------. 646 | | (local) | | | (remote) | | 647 | +----------+ v +----------+ | 648 | | +--------+ | | 649 | | recv ES | | send ES | | 650 | send H | ,-------| open |-------. | recv H | 651 | | / | | \ | | 652 | v v +--------+ v v | 653 | +----------+ | +----------+ | 654 | | half | | | half | | 655 | | closed | | send R / | closed | | 656 | | (remote) | | recv R | (local) | | 657 | +----------+ | +----------+ | 658 | | | | | 659 | | send ES / | recv ES / | | 660 | | send R / v send R / | | 661 | | recv R +--------+ recv R | | 662 | send R / `----------->| |<-----------' send R / | 663 | recv R | closed | recv R | 664 `----------------------->| |<----------------------' 665 +--------+ 667 Figure 2: Stream States 669 send: endpoint sends this frame 670 recv: endpoint receives this frame 671 H: HEADERS frame (with implied CONTINUATION frames) 672 ES: END_STREAM flag 673 R: RST_STREAM frame 674 PP: PUSH_PROMISE frame (with implied CONTINUATION frames); state 675 transitions are for the promised stream 677 Note that this diagram shows stream state transitions and the frames 678 and flags that affect those transitions only. In this regard, 679 CONTINUATION frames do not result in state transitions; they are 680 effectively part of the HEADERS or PUSH_PROMISE that they follow. 681 For the purpose of state transitions, the END_STREAM flag is 682 processed as a separate event to the frame that bears it; a HEADERS 683 frame with the END_STREAM flag set can cause two state transitions. 685 Both endpoints have a subjective view of the state of a stream that 686 could be different when frames are in transit. Endpoints do not 687 coordinate the creation of streams; they are created unilaterally by 688 either endpoint. The negative consequences of a mismatch in states 689 are limited to the "closed" state after sending RST_STREAM, where 690 frames might be received for some time after closing. 692 Streams have the following states: 694 idle: All streams start in the "idle" state. 696 The following transitions are valid from this state: 698 * Sending a HEADERS frame as a client, or receiving a HEADERS 699 frame as a server, causes the stream to become "open". The 700 stream identifier is selected as described in Section 5.1.1. 701 The same HEADERS frame can also cause a stream to immediately 702 become "half-closed". 704 * Sending a PUSH_PROMISE frame on another stream reserves the 705 idle stream that is identified for later use. The stream state 706 for the reserved stream transitions to "reserved (local)". 707 Only a server may send PUSH_PROMISE frames. 709 * Receiving a PUSH_PROMISE frame on another stream reserves an 710 idle stream that is identified for later use. The stream state 711 for the reserved stream transitions to "reserved (remote)". 712 Only a client may receive PUSH_PROMISE frames. 714 * Note that the PUSH_PROMISE frame is not sent on the idle stream 715 but references the newly reserved stream in the Promised Stream 716 ID field. 718 Receiving any frame other than HEADERS or PRIORITY on a stream in 719 this state MUST be treated as a connection error (Section 5.4.1) 720 of type PROTOCOL_ERROR. If this stream is server-initiated, as 721 described in Section 5.1.1, then receiving a HEADERS frame MUST 722 also be treated as a connection error (Section 5.4.1) of type 723 PROTOCOL_ERROR. 725 reserved (local): A stream in the "reserved (local)" state is one 726 that has been promised by sending a PUSH_PROMISE frame. A 727 PUSH_PROMISE frame reserves an idle stream by associating the 728 stream with an open stream that was initiated by the remote peer 729 (see Section 8.4). 731 In this state, only the following transitions are possible: 733 * The endpoint can send a HEADERS frame. This causes the stream 734 to open in a "half-closed (remote)" state. 736 * Either endpoint can send a RST_STREAM frame to cause the stream 737 to become "closed". This releases the stream reservation. 739 An endpoint MUST NOT send any type of frame other than HEADERS, 740 RST_STREAM, or PRIORITY in this state. 742 A PRIORITY or WINDOW_UPDATE frame MAY be received in this state. 743 Receiving any type of frame other than RST_STREAM, PRIORITY, or 744 WINDOW_UPDATE on a stream in this state MUST be treated as a 745 connection error (Section 5.4.1) of type PROTOCOL_ERROR. 747 reserved (remote): A stream in the "reserved (remote)" state has 748 been reserved by a remote peer. 750 In this state, only the following transitions are possible: 752 * Receiving a HEADERS frame causes the stream to transition to 753 "half-closed (local)". 755 * Either endpoint can send a RST_STREAM frame to cause the stream 756 to become "closed". This releases the stream reservation. 758 An endpoint MUST NOT send any type of frame other than RST_STREAM, 759 WINDOW_UPDATE, or PRIORITY in this state. 761 Receiving any type of frame other than HEADERS, RST_STREAM, or 762 PRIORITY on a stream in this state MUST be treated as a connection 763 error (Section 5.4.1) of type PROTOCOL_ERROR. 765 open: A stream in the "open" state may be used by both peers to send 766 frames of any type. In this state, sending peers observe 767 advertised stream-level flow-control limits (Section 5.2). 769 From this state, either endpoint can send a frame with an 770 END_STREAM flag set, which causes the stream to transition into 771 one of the "half-closed" states. An endpoint sending an 772 END_STREAM flag causes the stream state to become "half-closed 773 (local)"; an endpoint receiving an END_STREAM flag causes the 774 stream state to become "half-closed (remote)". 776 Either endpoint can send a RST_STREAM frame from this state, 777 causing it to transition immediately to "closed". 779 half-closed (local): A stream that is in the "half-closed (local)" 780 state cannot be used for sending frames other than WINDOW_UPDATE, 781 PRIORITY, and RST_STREAM. 783 A stream transitions from this state to "closed" when a frame is 784 received with the END_STREAM flag set or when either peer sends a 785 RST_STREAM frame. 787 An endpoint can receive any type of frame in this state. 788 Providing flow-control credit using WINDOW_UPDATE frames is 789 necessary to continue receiving flow-controlled frames. In this 790 state, a receiver can ignore WINDOW_UPDATE frames, which might 791 arrive for a short period after a frame with the END_STREAM flag 792 set is sent. 794 PRIORITY frames can be received in this state. 796 half-closed (remote): A stream that is "half-closed (remote)" is no 797 longer being used by the peer to send frames. In this state, an 798 endpoint is no longer obligated to maintain a receiver flow- 799 control window. 801 If an endpoint receives additional frames, other than 802 WINDOW_UPDATE, PRIORITY, or RST_STREAM, for a stream that is in 803 this state, it MUST respond with a stream error (Section 5.4.2) of 804 type STREAM_CLOSED. 806 A stream that is "half-closed (remote)" can be used by the 807 endpoint to send frames of any type. In this state, the endpoint 808 continues to observe advertised stream-level flow-control limits 809 (Section 5.2). 811 A stream can transition from this state to "closed" by sending a 812 frame with the END_STREAM flag set or when either peer sends a 813 RST_STREAM frame. 815 closed: The "closed" state is the terminal state. 817 A stream enters the "closed" state after an endpoint both sends 818 and receives a frame with an END_STREAM flag set. A stream also 819 enters the "closed" state after an endpoint either sends or 820 receives a RST_STREAM frame. 822 An endpoint MUST NOT send frames other than PRIORITY on a closed 823 stream. An endpoint MAY treat receipt of any other type of frame 824 on a closed stream as a connection error (Section 5.4.1) of type 825 STREAM_CLOSED, except as noted below. 827 An endpoint that sends a frame with the END_STREAM flag set or a 828 RST_STREAM frame might receive a WINDOW_UPDATE or RST_STREAM frame 829 from its peer in the time before the peer receives and processes 830 the frame that closes the stream. 832 An endpoint that sends a RST_STREAM frame on a stream that is in 833 the "open" state could receive any type of frame. The peer might 834 have sent or enqueued for sending these frames before processing 835 the RST_STREAM frame. An endpoint MUST minimally process and then 836 discard any frames it receives in this state. This means updating 837 header compression state for HEADERS and PUSH_PROMISE frames; 838 PUSH_PROMISE frames also cause the promised stream to become 839 "reserved", even when the PUSH_PROMISE frame is received on a 840 closed stream; and, the content of DATA frames counts toward the 841 connection flow-control window. 843 An endpoint can perform this minimal processing for all streams 844 that are in the "closed" state. Endpoints MAY use other signals 845 to detect that a peer has received the frames that caused the 846 stream to enter the "closed" state and treat receipt of any frame 847 other than PRIORITY as a connection error (Section 5.4.1) of type 848 PROTOCOL_ERROR. Endpoints can use frames that indicate that the 849 peer has received the closing signal to drive this. Endpoints 850 SHOULD NOT use timers for this purpose. For example, an endpoint 851 that sends a SETTINGS frame after closing a stream can safely 852 treat receipt of a DATA frame on that stream as an error after 853 receiving an acknowledgement of the settings. Other things that 854 might be used are PING frames, receiving data on streams that were 855 created after closing the stream, or responses to requests created 856 after closing the stream. 858 In the absence of more specific rules, implementations SHOULD treat 859 the receipt of a frame that is not expressly permitted in the 860 description of a state as a connection error (Section 5.4.1) of type 861 PROTOCOL_ERROR. Note that PRIORITY can be sent and received in any 862 stream state. 864 The rules in this section only apply to frames defined in this 865 document. Receipt of frames for which the semantics are unknown 866 cannot be treated as an error as the conditions for sending and 867 receiving those frames are also unknown; see Section 5.5. 869 An example of the state transitions for an HTTP request/response 870 exchange can be found in Section 8.8. An example of the state 871 transitions for server push can be found in Sections 8.4.1 and 8.4.2. 873 5.1.1. Stream Identifiers 875 Streams are identified with an unsigned 31-bit integer. Streams 876 initiated by a client MUST use odd-numbered stream identifiers; those 877 initiated by the server MUST use even-numbered stream identifiers. A 878 stream identifier of zero (0x0) is used for connection control 879 messages; the stream identifier of zero cannot be used to establish a 880 new stream. 882 The identifier of a newly established stream MUST be numerically 883 greater than all streams that the initiating endpoint has opened or 884 reserved. This governs streams that are opened using a HEADERS frame 885 and streams that are reserved using PUSH_PROMISE. An endpoint that 886 receives an unexpected stream identifier MUST respond with a 887 connection error (Section 5.4.1) of type PROTOCOL_ERROR. 889 A HEADERS frame will transition the client-initiated stream 890 identified by the stream identifier in the frame header from "idle" 891 to "open". A PUSH_PROMISE frame will transition the server-initiated 892 stream identified by the "Promised Stream ID" field in the frame 893 payload from "idle" to "reserved". When a stream transitions out of 894 the "idle" state, all streams that might have been initiated by that 895 peer with a lower-valued stream identifier are implicitly 896 transitioned to "closed". That is, an endpoint may skip a stream 897 identifier, with the effect being that the skipped stream is 898 immediately closed. 900 Stream identifiers cannot be reused. Long-lived connections can 901 result in an endpoint exhausting the available range of stream 902 identifiers. A client that is unable to establish a new stream 903 identifier can establish a new connection for new streams. A server 904 that is unable to establish a new stream identifier can send a GOAWAY 905 frame so that the client is forced to open a new connection for new 906 streams. 908 5.1.2. Stream Concurrency 910 A peer can limit the number of concurrently active streams using the 911 SETTINGS_MAX_CONCURRENT_STREAMS parameter (see Section 6.5.2) within 912 a SETTINGS frame. The maximum concurrent streams setting is specific 913 to each endpoint and applies only to the peer that receives the 914 setting. That is, clients specify the maximum number of concurrent 915 streams the server can initiate, and servers specify the maximum 916 number of concurrent streams the client can initiate. 918 Streams that are in the "open" state or in either of the "half- 919 closed" states count toward the maximum number of streams that an 920 endpoint is permitted to open. Streams in any of these three states 921 count toward the limit advertised in the 922 SETTINGS_MAX_CONCURRENT_STREAMS setting. Streams in either of the 923 "reserved" states do not count toward the stream limit. 925 Endpoints MUST NOT exceed the limit set by their peer. An endpoint 926 that receives a HEADERS frame that causes its advertised concurrent 927 stream limit to be exceeded MUST treat this as a stream error 928 (Section 5.4.2) of type PROTOCOL_ERROR or REFUSED_STREAM. The choice 929 of error code determines whether the endpoint wishes to enable 930 automatic retry (see Section 8.7 for details). 932 An endpoint that wishes to reduce the value of 933 SETTINGS_MAX_CONCURRENT_STREAMS to a value that is below the current 934 number of open streams can either close streams that exceed the new 935 value or allow streams to complete. 937 5.2. Flow Control 939 Using streams for multiplexing introduces contention over use of the 940 TCP connection, resulting in blocked streams. A flow-control scheme 941 ensures that streams on the same connection do not destructively 942 interfere with each other. Flow control is used for both individual 943 streams and for the connection as a whole. 945 HTTP/2 provides for flow control through use of the WINDOW_UPDATE 946 frame (Section 6.9). 948 5.2.1. Flow-Control Principles 950 HTTP/2 stream flow control aims to allow a variety of flow-control 951 algorithms to be used without requiring protocol changes. Flow 952 control in HTTP/2 has the following characteristics: 954 1. Flow control is specific to a connection. Both types of flow 955 control are between the endpoints of a single hop and not over 956 the entire end-to-end path. 958 2. Flow control is based on WINDOW_UPDATE frames. Receivers 959 advertise how many octets they are prepared to receive on a 960 stream and for the entire connection. This is a credit-based 961 scheme. 963 3. Flow control is directional with overall control provided by the 964 receiver. A receiver MAY choose to set any window size that it 965 desires for each stream and for the entire connection. A sender 966 MUST respect flow-control limits imposed by a receiver. Clients, 967 servers, and intermediaries all independently advertise their 968 flow-control window as a receiver and abide by the flow-control 969 limits set by their peer when sending. 971 4. The initial value for the flow-control window is 65,535 octets 972 for both new streams and the overall connection. 974 5. The frame type determines whether flow control applies to a 975 frame. Of the frames specified in this document, only DATA 976 frames are subject to flow control; all other frame types do not 977 consume space in the advertised flow-control window. This 978 ensures that important control frames are not blocked by flow 979 control. 981 6. Flow control cannot be disabled. 983 7. HTTP/2 defines only the format and semantics of the WINDOW_UPDATE 984 frame (Section 6.9). This document does not stipulate how a 985 receiver decides when to send this frame or the value that it 986 sends, nor does it specify how a sender chooses to send packets. 987 Implementations are able to select any algorithm that suits their 988 needs. 990 Implementations are also responsible for prioritizing the sending of 991 requests and responses, choosing how to avoid head-of-line blocking 992 for requests, and managing the creation of new streams. Algorithm 993 choices for these could interact with any flow-control algorithm. 995 5.2.2. Appropriate Use of Flow Control 997 Flow control is defined to protect endpoints that are operating under 998 resource constraints. For example, a proxy needs to share memory 999 between many connections and also might have a slow upstream 1000 connection and a fast downstream one. Flow-control addresses cases 1001 where the receiver is unable to process data on one stream yet wants 1002 to continue to process other streams in the same connection. 1004 Deployments that do not require this capability can advertise a flow- 1005 control window of the maximum size (2^31-1) and can maintain this 1006 window by sending a WINDOW_UPDATE frame when any data is received. 1007 This effectively disables flow control for that receiver. 1008 Conversely, a sender is always subject to the flow-control window 1009 advertised by the receiver. 1011 Deployments with constrained resources (for example, memory) can 1012 employ flow control to limit the amount of memory a peer can consume. 1013 Note, however, that this can lead to suboptimal use of available 1014 network resources if flow control is enabled without knowledge of the 1015 bandwidth-delay product (see [RFC7323]). 1017 Even with full awareness of the current bandwidth-delay product, 1018 implementation of flow control can be difficult. When using flow 1019 control, the receiver MUST read from the TCP receive buffer in a 1020 timely fashion. Failure to do so could lead to a deadlock when 1021 critical frames, such as WINDOW_UPDATE, are not read and acted upon. 1023 5.2.3. Flow Control Performance 1025 If an endpoint cannot ensure that its peer always has available flow 1026 control window space that is greater than the peer's bandwidth-delay 1027 product on this connection, its receive throughput will be limited by 1028 HTTP/2 flow control. This will result in degraded performance. 1030 Sending timely WINDOW_UPDATE frames can improve performance. 1031 Endpoints will want to balance the need to improve receive throughput 1032 with the need to manage resource exhaustion risks, and should take 1033 careful note of Section 10.5 in defining their strategy to manage 1034 window sizes. 1036 5.3. Prioritization 1038 In a multiplexed protocol like HTTP/2, prioritizing allocation of 1039 bandwidth and computation resources to streams can be critical to 1040 attaining good performance. A poor prioritization scheme can result 1041 in HTTP/2 providing poor performance. With no parallelism at the TCP 1042 layer, performance could be significantly worse than HTTP/1.1. 1044 A good prioritization scheme benefits from the application of 1045 contextual knowledge such as the content of resources, how resources 1046 are interrelated, and how those resources will be used by a peer. In 1047 particular, clients can possess knowledge about the priority of 1048 requests that is relevant to server prioritization. In those cases, 1049 having clients provide priority information can improve performance. 1051 5.3.1. Background of Priority in HTTP/2 1053 HTTP/2 included a rich system for signaling priority of requests. 1054 However, this system proved to be complex and it was not uniformly 1055 implemented. 1057 The flexible scheme meant that it was possible for clients to express 1058 priorities in very different ways, with little consistency in the 1059 approaches that were adopted. For servers, implementing generic 1060 support for the scheme was complex. Implementation of priorities was 1061 uneven in both clients and servers. Many server deployments ignored 1062 client signals when prioritizing their handling of requests. 1064 In short, the prioritization signaling in RFC7540 [RFC7540] was not 1065 successful. 1067 5.3.2. Priority Signaling in this Document 1069 This update to HTTP/2 deprecates the priority signaling defined in 1070 RFC 7540 [RFC7540]. The bulk of the text related to priority signals 1071 is not included in this document. The description of frame fields 1072 and some of the mandatory handling is retained to ensure that 1073 implementations of this document remain interoperable with 1074 implementations that use the priority signaling described in RFC 1075 7540. 1077 A thorough description of the RFC 7540 priority scheme remains in 1078 Section 5.3 of [RFC7540]. 1080 Signaling priority information is necessary to attain good 1081 performance in many cases. Where signaling priority information is 1082 important, endpoints are encouraged to use an alternative scheme, 1083 such as [I-D.ietf-httpbis-priority]. 1085 Though the priority signaling from RFC 7540 was not widely adopted, 1086 the information it provides can still be useful in the absence of 1087 better information. Endpoints that receive priority signals in 1088 HEADERS or PRIORITY frames can benefit from applying that 1089 information. In particular, implementations that consume these 1090 signals would not benefit from discarding these priority signals in 1091 the absence of alternatives. 1093 Servers SHOULD use other contextual information in determining 1094 priority of requests in the absence of any priority signals. Servers 1095 MAY interpret the complete absence of signals as an indication that 1096 the client has not implemented the feature. The defaults described 1097 in Section 5.3.5 of [RFC7540] are known to have poor performance 1098 under most conditions and their use is unlikely to be deliberate. 1100 5.4. Error Handling 1102 HTTP/2 framing permits two classes of error: 1104 * An error condition that renders the entire connection unusable is 1105 a connection error. 1107 * An error in an individual stream is a stream error. 1109 A list of error codes is included in Section 7. 1111 It is possible that an endpoint will encounter frames that would 1112 cause multiple errors. Implementations MAY discover multiple errors 1113 during processing, but they SHOULD report at most one stream and one 1114 connection error as a result. 1116 The first stream error reported for a given stream prevents any other 1117 errors on that stream from being reported. In comparison, the 1118 protocol permits multiple GOAWAY frames, though an endpoint SHOULD 1119 report just one type of connection error unless an error is 1120 encountered during graceful shutdown. If this occurs, an endpoint 1121 MAY send an additional GOAWAY frame with the new error code, in 1122 addition to any prior GOAWAY that contained NO_ERROR. 1124 If an endpoint detects multiple different errors, it MAY choose to 1125 report any one of those errors. If a frame causes a connection 1126 error, that error MUST be reported. Additionally, an endpoint MAY 1127 use any applicable error code when it detects an error condition; a 1128 generic error code (such as PROTOCOL_ERROR or INTERNAL_ERROR) can 1129 always be used in place of more specific error codes. 1131 5.4.1. Connection Error Handling 1133 A connection error is any error that prevents further processing of 1134 the frame layer or corrupts any connection state. 1136 An endpoint that encounters a connection error SHOULD first send a 1137 GOAWAY frame (Section 6.8) with the stream identifier of the last 1138 stream that it successfully received from its peer. The GOAWAY frame 1139 includes an error code that indicates why the connection is 1140 terminating. After sending the GOAWAY frame for an error condition, 1141 the endpoint MUST close the TCP connection. 1143 It is possible that the GOAWAY will not be reliably received by the 1144 receiving endpoint. In the event of a connection error, GOAWAY only 1145 provides a best-effort attempt to communicate with the peer about why 1146 the connection is being terminated. 1148 An endpoint can end a connection at any time. In particular, an 1149 endpoint MAY choose to treat a stream error as a connection error. 1150 Endpoints SHOULD send a GOAWAY frame when ending a connection, 1151 providing that circumstances permit it. 1153 5.4.2. Stream Error Handling 1155 A stream error is an error related to a specific stream that does not 1156 affect processing of other streams. 1158 An endpoint that detects a stream error sends a RST_STREAM frame 1159 (Section 6.4) that contains the stream identifier of the stream where 1160 the error occurred. The RST_STREAM frame includes an error code that 1161 indicates the type of error. 1163 A RST_STREAM is the last frame that an endpoint can send on a stream. 1164 The peer that sends the RST_STREAM frame MUST be prepared to receive 1165 any frames that were sent or enqueued for sending by the remote peer. 1166 These frames can be ignored, except where they modify connection 1167 state (such as the state maintained for field section compression 1168 (Section 4.3) or flow control). 1170 Normally, an endpoint SHOULD NOT send more than one RST_STREAM frame 1171 for any stream. However, an endpoint MAY send additional RST_STREAM 1172 frames if it receives frames on a closed stream after more than a 1173 round-trip time. This behavior is permitted to deal with misbehaving 1174 implementations. 1176 To avoid looping, an endpoint MUST NOT send a RST_STREAM in response 1177 to a RST_STREAM frame. 1179 5.4.3. Connection Termination 1181 If the TCP connection is closed or reset while streams remain in the 1182 "open" or "half-closed" states, then the affected streams cannot be 1183 automatically retried (see Section 8.7 for details). 1185 5.5. Extending HTTP/2 1187 HTTP/2 permits extension of the protocol. Within the limitations 1188 described in this section, protocol extensions can be used to provide 1189 additional services or alter any aspect of the protocol. Extensions 1190 are effective only within the scope of a single HTTP/2 connection. 1192 This applies to the protocol elements defined in this document. This 1193 does not affect the existing options for extending HTTP, such as 1194 defining new methods, status codes, or fields (see Section 16 of 1195 [HTTP]). 1197 Extensions are permitted to use new frame types (Section 4.1), new 1198 settings (Section 6.5), or new error codes (Section 7). Registries 1199 for managing these extension points are defined in Section 11 of 1200 [RFC7540]. 1202 Implementations MUST ignore unknown or unsupported values in all 1203 extensible protocol elements. Implementations MUST discard frames 1204 that have unknown or unsupported types. This means that any of these 1205 extension points can be safely used by extensions without prior 1206 arrangement or negotiation. However, extension frames that appear in 1207 the middle of a field block (Section 4.3) are not permitted; these 1208 MUST be treated as a connection error (Section 5.4.1) of type 1209 PROTOCOL_ERROR. 1211 Extensions SHOULD avoid changing protocol elements defined in this 1212 document or elements for which no extension mechanism is defined. 1213 This includes changes to the layout of frames, additions or changes 1214 to the way that frames are composed into HTTP messages (Section 8.1), 1215 the definition of pseudo-header fields, or changes to any protocol 1216 element that a compliant endpoint might treat as a connection error 1217 (Section 5.4.1). 1219 An extension that changes existing elements MUST be negotiated before 1220 being used. For example, an extension that changes the layout of the 1221 HEADERS frame cannot be used until the peer has given a positive 1222 signal that this is acceptable. In this case, it could also be 1223 necessary to coordinate when the revised layout comes into effect. 1224 For example, treating frames other than DATA frames as flow 1225 controlled requires a change in semantics that both endpoints need to 1226 understand, so this can only be done through negotiation. 1228 This document doesn't mandate a specific method for negotiating the 1229 use of an extension but notes that a setting (Section 6.5.2) could be 1230 used for that purpose. If both peers set a value that indicates 1231 willingness to use the extension, then the extension can be used. If 1232 a setting is used for extension negotiation, the initial value MUST 1233 be defined in such a fashion that the extension is initially 1234 disabled. 1236 6. Frame Definitions 1238 This specification defines a number of frame types, each identified 1239 by a unique 8-bit type code. Each frame type serves a distinct 1240 purpose in the establishment and management either of the connection 1241 as a whole or of individual streams. 1243 The transmission of specific frame types can alter the state of a 1244 connection. If endpoints fail to maintain a synchronized view of the 1245 connection state, successful communication within the connection will 1246 no longer be possible. Therefore, it is important that endpoints 1247 have a shared comprehension of how the state is affected by the use 1248 of any given frame. 1250 6.1. DATA 1252 DATA frames (type=0x0) convey arbitrary, variable-length sequences of 1253 octets associated with a stream. One or more DATA frames are used, 1254 for instance, to carry HTTP request or response message contents. 1256 DATA frames MAY also contain padding. Padding can be added to DATA 1257 frames to obscure the size of messages. Padding is a security 1258 feature; see Section 10.7. 1260 DATA Frame { 1261 Length (24), 1262 Type (8) = 0, 1264 Unused Flags (4), 1265 PADDED Flag (1), 1266 Unused Flags (2), 1267 END_STREAM Flag (1), 1269 Reserved (1), 1270 Stream Identifier (31), 1272 [Pad Length (8)], 1273 Data (..), 1274 Padding (..), 1275 } 1276 Figure 3: DATA Frame Format 1278 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1279 fields are described in Section 4. The DATA frame contains the 1280 following additional fields: 1282 Pad Length: An 8-bit field containing the length of the frame 1283 padding in units of octets. This field is conditional and is only 1284 present if the PADDED flag is set. 1286 Data: Application data. The amount of data is the remainder of the 1287 frame payload after subtracting the length of the other fields 1288 that are present. 1290 Padding: Padding octets that contain no application semantic value. 1291 Padding octets MUST be set to zero when sending. A receiver is 1292 not obligated to verify padding but MAY treat non-zero padding as 1293 a connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1295 The DATA frame defines the following flags: 1297 PADDED (0x8): When set, the PADDED flag indicates that the Pad 1298 Length field and any padding that it describes are present. 1300 END_STREAM (0x1): When set, the END_STREAM flag indicates that this 1301 frame is the last that the endpoint will send for the identified 1302 stream. Setting this flag causes the stream to enter one of the 1303 "half-closed" states or the "closed" state (Section 5.1). 1305 DATA frames MUST be associated with a stream. If a DATA frame is 1306 received whose stream identifier field is 0x0, the recipient MUST 1307 respond with a connection error (Section 5.4.1) of type 1308 PROTOCOL_ERROR. 1310 DATA frames are subject to flow control and can only be sent when a 1311 stream is in the "open" or "half-closed (remote)" state. The entire 1312 DATA frame payload is included in flow control, including the Pad 1313 Length and Padding fields if present. If a DATA frame is received 1314 whose stream is not in "open" or "half-closed (local)" state, the 1315 recipient MUST respond with a stream error (Section 5.4.2) of type 1316 STREAM_CLOSED. 1318 The total number of padding octets is determined by the value of the 1319 Pad Length field. If the length of the padding is the length of the 1320 frame payload or greater, the recipient MUST treat this as a 1321 connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1323 | Note: A frame can be increased in size by one octet by 1324 | including a Pad Length field with a value of zero. 1326 6.2. HEADERS 1328 The HEADERS frame (type=0x1) is used to open a stream (Section 5.1), 1329 and additionally carries a field block fragment. Despite the name, a 1330 HEADERS frame can carry a header section or a trailer section. 1331 HEADERS frames can be sent on a stream in the "idle", "reserved 1332 (local)", "open", or "half-closed (remote)" state. 1334 HEADERS Frame { 1335 Length (24), 1336 Type (8) = 1, 1338 Unused Flags (2), 1339 PRIORITY Flag (1), 1340 Unused Flag (1), 1341 PADDED Flag (1), 1342 END_HEADERS Flag (1), 1343 Unused Flag (1), 1344 END_STREAM Flag (1), 1346 Reserved (1), 1347 Stream Identifier (31), 1349 [Pad Length (8)], 1350 [Exclusive (1)], 1351 [Stream Dependency (31)], 1352 [Weight (8)], 1353 Field Block Fragment (..), 1354 Padding (..), 1355 } 1357 Figure 4: HEADERS Frame Format 1359 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1360 fields are described in Section 4. The HEADERS frame payload has the 1361 following additional fields: 1363 Pad Length: An 8-bit field containing the length of the frame 1364 padding in units of octets. This field is only present if the 1365 PADDED flag is set. 1367 Exclusive: A single-bit flag. This field is only present if the 1368 PRIORITY flag is set. 1370 Stream Dependency: A 31-bit stream identifier. This field is only 1371 present if the PRIORITY flag is set. 1373 Weight: An unsigned 8-bit integer. This field is only present if 1374 the PRIORITY flag is set. 1376 Field Block Fragment: A field block fragment (Section 4.3). 1378 Padding: Padding octets that contain no application semantic value. 1379 Padding octets MUST be set to zero when sending. A receiver is 1380 not obligated to verify padding but MAY treat non-zero padding as 1381 a connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1383 The HEADERS frame defines the following flags: 1385 PRIORITY (0x20): When set, the PRIORITY flag indicates that the 1386 Exclusive, Stream Dependency, and Weight fields are present. 1388 PADDED (0x8): When set, the PADDED flag indicates that the Pad 1389 Length field and any padding that it describes are present. 1391 END_HEADERS (0x4): When set, the END_HEADERS flag indicates that 1392 this frame contains an entire field block (Section 4.3) and is not 1393 followed by any CONTINUATION frames. 1395 A HEADERS frame without the END_HEADERS flag set MUST be followed 1396 by a CONTINUATION frame for the same stream. A receiver MUST 1397 treat the receipt of any other type of frame or a frame on a 1398 different stream as a connection error (Section 5.4.1) of type 1399 PROTOCOL_ERROR. 1401 END_STREAM (0x1): When set, the END_STREAM flag indicates that the 1402 field block (Section 4.3) is the last that the endpoint will send 1403 for the identified stream. 1405 A HEADERS frame with the END_STREAM flag set signals the end of a 1406 stream. However, a HEADERS frame with the END_STREAM flag set can 1407 be followed by CONTINUATION frames on the same stream. Logically, 1408 the CONTINUATION frames are part of the HEADERS frame. 1410 The frame payload of a HEADERS frame contains a field block fragment 1411 (Section 4.3). A field block that does not fit within a HEADERS 1412 frame is continued in a CONTINUATION frame (Section 6.10). 1414 HEADERS frames MUST be associated with a stream. If a HEADERS frame 1415 is received whose stream identifier field is 0x0, the recipient MUST 1416 respond with a connection error (Section 5.4.1) of type 1417 PROTOCOL_ERROR. 1419 The HEADERS frame changes the connection state as described in 1420 Section 4.3. 1422 The total number of padding octets is determined by the value of the 1423 Pad Length field. If the length of the padding is the length of the 1424 frame payload or greater, the recipient MUST treat this as a 1425 connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1427 | Note: A frame can be increased in size by one octet by 1428 | including a Pad Length field with a value of zero. 1430 6.3. PRIORITY 1432 The PRIORITY frame (type=0x2) is deprecated; see Section 5.3.2. A 1433 PRIORITY frame can be sent in any stream state, including idle or 1434 closed streams. 1436 PRIORITY Frame { 1437 Length (24), 1438 Type (8) = 2, 1440 Unused Flags (8), 1442 Reserved (1), 1443 Stream Identifier (31), 1445 Exclusive (1), 1446 Stream Dependency (31), 1447 Weight (8), 1448 } 1450 Figure 5: PRIORITY Frame Format 1452 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1453 fields are described in Section 4. The frame payload of a PRIORITY 1454 frame contains the following additional fields: 1456 Exclusive: A single-bit flag. 1458 Stream Dependency: A 31-bit stream identifier. 1460 Weight: An unsigned 8-bit integer. 1462 The PRIORITY frame does not define any flags. 1464 The PRIORITY frame always identifies a stream. If a PRIORITY frame 1465 is received with a stream identifier of 0x0, the recipient MUST 1466 respond with a connection error (Section 5.4.1) of type 1467 PROTOCOL_ERROR. 1469 Sending or receiving a PRIORITY frame does not affect the state of 1470 any stream (Section 5.1). The PRIORITY frame can be sent on a stream 1471 in any state, including "idle" or "closed". A PRIORITY frame cannot 1472 be sent between consecutive frames that comprise a single field block 1473 (Section 4.3). 1475 A PRIORITY frame with a length other than 5 octets MUST be treated as 1476 a stream error (Section 5.4.2) of type FRAME_SIZE_ERROR. 1478 6.4. RST_STREAM 1480 The RST_STREAM frame (type=0x3) allows for immediate termination of a 1481 stream. RST_STREAM is sent to request cancellation of a stream or to 1482 indicate that an error condition has occurred. 1484 RST_STREAM Frame { 1485 Length (24), 1486 Type (8) = 3, 1488 Unused Flags (8), 1490 Reserved (1), 1491 Stream Identifier (31), 1493 Error Code (32), 1494 } 1496 Figure 6: RST_STREAM Frame Format 1498 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1499 fields are described in Section 4. Additionally, the RST_STREAM 1500 frame contains a single unsigned, 32-bit integer identifying the 1501 error code (Section 7). The error code indicates why the stream is 1502 being terminated. 1504 The RST_STREAM frame does not define any flags. 1506 The RST_STREAM frame fully terminates the referenced stream and 1507 causes it to enter the "closed" state. After receiving a RST_STREAM 1508 on a stream, the receiver MUST NOT send additional frames for that 1509 stream, with the exception of PRIORITY. However, after sending the 1510 RST_STREAM, the sending endpoint MUST be prepared to receive and 1511 process additional frames sent on the stream that might have been 1512 sent by the peer prior to the arrival of the RST_STREAM. 1514 RST_STREAM frames MUST be associated with a stream. If a RST_STREAM 1515 frame is received with a stream identifier of 0x0, the recipient MUST 1516 treat this as a connection error (Section 5.4.1) of type 1517 PROTOCOL_ERROR. 1519 RST_STREAM frames MUST NOT be sent for a stream in the "idle" state. 1520 If a RST_STREAM frame identifying an idle stream is received, the 1521 recipient MUST treat this as a connection error (Section 5.4.1) of 1522 type PROTOCOL_ERROR. 1524 A RST_STREAM frame with a length other than 4 octets MUST be treated 1525 as a connection error (Section 5.4.1) of type FRAME_SIZE_ERROR. 1527 6.5. SETTINGS 1529 The SETTINGS frame (type=0x4) conveys configuration parameters that 1530 affect how endpoints communicate, such as preferences and constraints 1531 on peer behavior. The SETTINGS frame is also used to acknowledge the 1532 receipt of those settings. Individually, a configuration parameter 1533 from a SETTINGS frame is referred to as a "setting". 1535 Settings are not negotiated; they describe characteristics of the 1536 sending peer, which are used by the receiving peer. Different values 1537 for the same setting can be advertised by each peer. For example, a 1538 client might set a high initial flow-control window, whereas a server 1539 might set a lower value to conserve resources. 1541 A SETTINGS frame MUST be sent by both endpoints at the start of a 1542 connection and MAY be sent at any other time by either endpoint over 1543 the lifetime of the connection. Implementations MUST support all of 1544 the settings defined by this specification. 1546 Each parameter in a SETTINGS frame replaces any existing value for 1547 that parameter. Settings are processed in the order in which they 1548 appear, and a receiver of a SETTINGS frame does not need to maintain 1549 any state other than the current value of each setting. Therefore, 1550 the value of a SETTINGS parameter is the last value that is seen by a 1551 receiver. 1553 SETTINGS frames are acknowledged by the receiving peer. To enable 1554 this, the SETTINGS frame defines the ACK flag: 1556 ACK (0x1): When set, the ACK flag indicates that this frame 1557 acknowledges receipt and application of the peer's SETTINGS frame. 1558 When this bit is set, the frame payload of the SETTINGS frame MUST 1559 be empty. Receipt of a SETTINGS frame with the ACK flag set and a 1560 length field value other than 0 MUST be treated as a connection 1561 error (Section 5.4.1) of type FRAME_SIZE_ERROR. For more 1562 information, see Section 6.5.3 ("Settings Synchronization"). 1564 SETTINGS frames always apply to a connection, never a single stream. 1565 The stream identifier for a SETTINGS frame MUST be zero (0x0). If an 1566 endpoint receives a SETTINGS frame whose stream identifier field is 1567 anything other than 0x0, the endpoint MUST respond with a connection 1568 error (Section 5.4.1) of type PROTOCOL_ERROR. 1570 The SETTINGS frame affects connection state. A badly formed or 1571 incomplete SETTINGS frame MUST be treated as a connection error 1572 (Section 5.4.1) of type PROTOCOL_ERROR. 1574 A SETTINGS frame with a length other than a multiple of 6 octets MUST 1575 be treated as a connection error (Section 5.4.1) of type 1576 FRAME_SIZE_ERROR. 1578 6.5.1. SETTINGS Format 1580 The frame payload of a SETTINGS frame consists of zero or more 1581 settings, each consisting of an unsigned 16-bit setting identifier 1582 and an unsigned 32-bit value. 1584 SETTINGS Frame { 1585 Length (24), 1586 Type (8) = 4, 1588 Unused Flags (7), 1589 ACK Flag (1), 1591 Reserved (1), 1592 Stream Identifier (31), 1594 Setting (48) ..., 1595 } 1597 Setting { 1598 Identifier (16), 1599 Value (32), 1600 } 1601 Figure 7: SETTINGS Frame Format 1603 6.5.2. Defined Settings 1605 The following settings are defined: 1607 SETTINGS_HEADER_TABLE_SIZE (0x1): Allows the sender to inform the 1608 remote endpoint of the maximum size of the compression table used 1609 to decode field blocks, in octets. The encoder can select any 1610 size equal to or less than this value by using signaling specific 1611 to the compression format inside a field block (see 1612 [COMPRESSION]). The initial value is 4,096 octets. 1614 SETTINGS_ENABLE_PUSH (0x2): This setting can be used to disable 1615 server push (Section 8.4). A server MUST NOT send a PUSH_PROMISE 1616 frame if it receives this parameter set to a value of 0. A client 1617 that has both set this parameter to 0 and had it acknowledged MUST 1618 treat the receipt of a PUSH_PROMISE frame as a connection error 1619 (Section 5.4.1) of type PROTOCOL_ERROR. 1621 The initial value of SETTINGS_ENABLE_PUSH is 1, which indicates 1622 that server push is permitted. Any value other than 0 or 1 MUST 1623 be treated as a connection error (Section 5.4.1) of type 1624 PROTOCOL_ERROR. 1626 A server MUST NOT explicitly set this value to 1. A server MAY 1627 choose to omit this setting when it sends a SETTINGS frame, but if 1628 a server does include a value it MUST be 0. A client MUST treat 1629 receipt of a SETTINGS frame with SETTINGS_ENABLE_PUSH set to 1 as 1630 a connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1632 SETTINGS_MAX_CONCURRENT_STREAMS (0x3): Indicates the maximum number 1633 of concurrent streams that the sender will allow. This limit is 1634 directional: it applies to the number of streams that the sender 1635 permits the receiver to create. Initially, there is no limit to 1636 this value. It is recommended that this value be no smaller than 1637 100, so as to not unnecessarily limit parallelism. 1639 A value of 0 for SETTINGS_MAX_CONCURRENT_STREAMS SHOULD NOT be 1640 treated as special by endpoints. A zero value does prevent the 1641 creation of new streams; however, this can also happen for any 1642 limit that is exhausted with active streams. Servers SHOULD only 1643 set a zero value for short durations; if a server does not wish to 1644 accept requests, closing the connection is more appropriate. 1646 SETTINGS_INITIAL_WINDOW_SIZE (0x4): Indicates the sender's initial 1647 window size (in octets) for stream-level flow control. The 1648 initial value is 2^16-1 (65,535) octets. 1650 This setting affects the window size of all streams (see 1651 Section 6.9.2). 1653 Values above the maximum flow-control window size of 2^31-1 MUST 1654 be treated as a connection error (Section 5.4.1) of type 1655 FLOW_CONTROL_ERROR. 1657 SETTINGS_MAX_FRAME_SIZE (0x5): Indicates the size of the largest 1658 frame payload that the sender is willing to receive, in octets. 1660 The initial value is 2^14 (16,384) octets. The value advertised 1661 by an endpoint MUST be between this initial value and the maximum 1662 allowed frame size (2^24-1 or 16,777,215 octets), inclusive. 1663 Values outside this range MUST be treated as a connection error 1664 (Section 5.4.1) of type PROTOCOL_ERROR. 1666 SETTINGS_MAX_HEADER_LIST_SIZE (0x6): This advisory setting informs a 1667 peer of the maximum size of field section that the sender is 1668 prepared to accept, in octets. The value is based on the 1669 uncompressed size of field lines, including the length of the name 1670 and value in octets plus an overhead of 32 octets for each field 1671 line. 1673 For any given request, a lower limit than what is advertised MAY 1674 be enforced. The initial value of this setting is unlimited. 1676 An endpoint that receives a SETTINGS frame with any unknown or 1677 unsupported identifier MUST ignore that setting. 1679 6.5.3. Settings Synchronization 1681 Most values in SETTINGS benefit from or require an understanding of 1682 when the peer has received and applied the changed parameter values. 1683 In order to provide such synchronization timepoints, the recipient of 1684 a SETTINGS frame in which the ACK flag is not set MUST apply the 1685 updated settings as soon as possible upon receipt. 1687 The values in the SETTINGS frame MUST be processed in the order they 1688 appear, with no other frame processing between values. Unsupported 1689 settings MUST be ignored. Once all values have been processed, the 1690 recipient MUST immediately emit a SETTINGS frame with the ACK flag 1691 set. Upon receiving a SETTINGS frame with the ACK flag set, the 1692 sender of the altered settings can rely on the value having been 1693 applied. 1695 If the sender of a SETTINGS frame does not receive an acknowledgement 1696 within a reasonable amount of time, it MAY issue a connection error 1697 (Section 5.4.1) of type SETTINGS_TIMEOUT. 1699 6.6. PUSH_PROMISE 1701 The PUSH_PROMISE frame (type=0x5) is used to notify the peer endpoint 1702 in advance of streams the sender intends to initiate. The 1703 PUSH_PROMISE frame includes the unsigned 31-bit identifier of the 1704 stream the endpoint plans to create along with a field section that 1705 provides additional context for the stream. Section 8.4 contains a 1706 thorough description of the use of PUSH_PROMISE frames. 1708 PUSH_PROMISE Frame { 1709 Length (24), 1710 Type (8) = 5, 1712 Unused Flags (4), 1713 PADDED Flag (1), 1714 END_HEADERS Flag (1), 1715 Unused Flags (2), 1717 Reserved (1), 1718 Stream Identifier (31), 1720 [Pad Length (8)], 1721 Reserved (1), 1722 Promised Stream ID (31), 1723 Field Block Fragment (..), 1724 Padding (..), 1725 } 1727 Figure 8: PUSH_PROMISE Frame Format 1729 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1730 fields are described in Section 4. The PUSH_PROMISE frame payload 1731 has the following additional fields: 1733 Pad Length: An 8-bit field containing the length of the frame 1734 padding in units of octets. This field is only present if the 1735 PADDED flag is set. 1737 Reserved: A single reserved bit. 1739 Promised Stream ID: An unsigned 31-bit integer that identifies the 1740 stream that is reserved by the PUSH_PROMISE. The promised stream 1741 identifier MUST be a valid choice for the next stream sent by the 1742 sender (see "new stream identifier" in Section 5.1.1). 1744 Field Block Fragment: A field block fragment (Section 4.3) 1745 containing request control data and header section. 1747 Padding: Padding octets that contain no application semantic value. 1748 Padding octets MUST be set to zero when sending. A receiver is 1749 not obligated to verify padding but MAY treat non-zero padding as 1750 a connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1752 The PUSH_PROMISE frame defines the following flags: 1754 PADDED (0x8): When set, the PADDED flag indicates that the Pad 1755 Length field and any padding that it describes are present. 1757 END_HEADERS (0x4): When set, the END_HEADERS flag indicates that 1758 this frame contains an entire field block (Section 4.3) and is not 1759 followed by any CONTINUATION frames. 1761 A PUSH_PROMISE frame without the END_HEADERS flag set MUST be 1762 followed by a CONTINUATION frame for the same stream. A receiver 1763 MUST treat the receipt of any other type of frame or a frame on a 1764 different stream as a connection error (Section 5.4.1) of type 1765 PROTOCOL_ERROR. 1767 PUSH_PROMISE frames MUST only be sent on a peer-initiated stream that 1768 is in either the "open" or "half-closed (remote)" state. The stream 1769 identifier of a PUSH_PROMISE frame indicates the stream it is 1770 associated with. If the stream identifier field specifies the value 1771 0x0, a recipient MUST respond with a connection error (Section 5.4.1) 1772 of type PROTOCOL_ERROR. 1774 Promised streams are not required to be used in the order they are 1775 promised. The PUSH_PROMISE only reserves stream identifiers for 1776 later use. 1778 PUSH_PROMISE MUST NOT be sent if the SETTINGS_ENABLE_PUSH setting of 1779 the peer endpoint is set to 0. An endpoint that has set this setting 1780 and has received acknowledgement MUST treat the receipt of a 1781 PUSH_PROMISE frame as a connection error (Section 5.4.1) of type 1782 PROTOCOL_ERROR. 1784 Recipients of PUSH_PROMISE frames can choose to reject promised 1785 streams by returning a RST_STREAM referencing the promised stream 1786 identifier back to the sender of the PUSH_PROMISE. 1788 A PUSH_PROMISE frame modifies the connection state in two ways. 1789 First, the inclusion of a field block (Section 4.3) potentially 1790 modifies the state maintained for field section compression. Second, 1791 PUSH_PROMISE also reserves a stream for later use, causing the 1792 promised stream to enter the "reserved" state. A sender MUST NOT 1793 send a PUSH_PROMISE on a stream unless that stream is either "open" 1794 or "half-closed (remote)"; the sender MUST ensure that the promised 1795 stream is a valid choice for a new stream identifier (Section 5.1.1) 1796 (that is, the promised stream MUST be in the "idle" state). 1798 Since PUSH_PROMISE reserves a stream, ignoring a PUSH_PROMISE frame 1799 causes the stream state to become indeterminate. A receiver MUST 1800 treat the receipt of a PUSH_PROMISE on a stream that is neither 1801 "open" nor "half-closed (local)" as a connection error 1802 (Section 5.4.1) of type PROTOCOL_ERROR. However, an endpoint that 1803 has sent RST_STREAM on the associated stream MUST handle PUSH_PROMISE 1804 frames that might have been created before the RST_STREAM frame is 1805 received and processed. 1807 A receiver MUST treat the receipt of a PUSH_PROMISE that promises an 1808 illegal stream identifier (Section 5.1.1) as a connection error 1809 (Section 5.4.1) of type PROTOCOL_ERROR. Note that an illegal stream 1810 identifier is an identifier for a stream that is not currently in the 1811 "idle" state. 1813 The total number of padding octets is determined by the value of the 1814 Pad Length field. If the length of the padding is the length of the 1815 frame payload or greater, the recipient MUST treat this as a 1816 connection error (Section 5.4.1) of type PROTOCOL_ERROR. 1818 | Note: A frame can be increased in size by one octet by 1819 | including a Pad Length field with a value of zero. 1821 6.7. PING 1823 The PING frame (type=0x6) is a mechanism for measuring a minimal 1824 round-trip time from the sender, as well as determining whether an 1825 idle connection is still functional. PING frames can be sent from 1826 any endpoint. 1828 PING Frame { 1829 Length (24), 1830 Type (8) = 6, 1832 Unused Flags (7), 1833 ACK Flag (1), 1835 Reserved (1), 1836 Stream Identifier (31), 1838 Opaque Data (64), 1839 } 1841 Figure 9: PING Frame Format 1843 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1844 fields are described in Section 4. 1846 In addition to the frame header, PING frames MUST contain 8 octets of 1847 opaque data in the frame payload. A sender can include any value it 1848 chooses and use those octets in any fashion. 1850 Receivers of a PING frame that does not include an ACK flag MUST send 1851 a PING frame with the ACK flag set in response, with an identical 1852 frame payload. PING responses SHOULD be given higher priority than 1853 any other frame. 1855 The PING frame defines the following flags: 1857 ACK (0x1): When set, the ACK flag indicates that this PING frame is 1858 a PING response. An endpoint MUST set this flag in PING 1859 responses. An endpoint MUST NOT respond to PING frames containing 1860 this flag. 1862 PING frames are not associated with any individual stream. If a PING 1863 frame is received with a stream identifier field value other than 1864 0x0, the recipient MUST respond with a connection error 1865 (Section 5.4.1) of type PROTOCOL_ERROR. 1867 Receipt of a PING frame with a length field value other than 8 MUST 1868 be treated as a connection error (Section 5.4.1) of type 1869 FRAME_SIZE_ERROR. 1871 6.8. GOAWAY 1873 The GOAWAY frame (type=0x7) is used to initiate shutdown of a 1874 connection or to signal serious error conditions. GOAWAY allows an 1875 endpoint to gracefully stop accepting new streams while still 1876 finishing processing of previously established streams. This enables 1877 administrative actions, like server maintenance. 1879 There is an inherent race condition between an endpoint starting new 1880 streams and the remote sending a GOAWAY frame. To deal with this 1881 case, the GOAWAY contains the stream identifier of the last peer- 1882 initiated stream that was or might be processed on the sending 1883 endpoint in this connection. For instance, if the server sends a 1884 GOAWAY frame, the identified stream is the highest-numbered stream 1885 initiated by the client. 1887 Once sent, the sender will ignore frames sent on streams initiated by 1888 the receiver if the stream has an identifier higher than the included 1889 last stream identifier. Receivers of a GOAWAY frame MUST NOT open 1890 additional streams on the connection, although a new connection can 1891 be established for new streams. 1893 If the receiver of the GOAWAY has sent data on streams with a higher 1894 stream identifier than what is indicated in the GOAWAY frame, those 1895 streams are not or will not be processed. The receiver of the GOAWAY 1896 frame can treat the streams as though they had never been created at 1897 all, thereby allowing those streams to be retried later on a new 1898 connection. 1900 Endpoints SHOULD always send a GOAWAY frame before closing a 1901 connection so that the remote peer can know whether a stream has been 1902 partially processed or not. For example, if an HTTP client sends a 1903 POST at the same time that a server closes a connection, the client 1904 cannot know if the server started to process that POST request if the 1905 server does not send a GOAWAY frame to indicate what streams it might 1906 have acted on. 1908 An endpoint might choose to close a connection without sending a 1909 GOAWAY for misbehaving peers. 1911 A GOAWAY frame might not immediately precede closing of the 1912 connection; a receiver of a GOAWAY that has no more use for the 1913 connection SHOULD still send a GOAWAY frame before terminating the 1914 connection. 1916 GOAWAY Frame { 1917 Length (24), 1918 Type (8) = 7, 1920 Unused Flags (8), 1922 Reserved (1), 1923 Stream Identifier (31), 1925 Reserved (1), 1926 Last-Stream-ID (31), 1927 Error Code (32), 1928 Additional Debug Data (..), 1929 } 1931 Figure 10: GOAWAY Frame Format 1933 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 1934 fields are described in Section 4. 1936 The GOAWAY frame does not define any flags. 1938 The GOAWAY frame applies to the connection, not a specific stream. 1939 An endpoint MUST treat a GOAWAY frame with a stream identifier other 1940 than 0x0 as a connection error (Section 5.4.1) of type 1941 PROTOCOL_ERROR. 1943 The last stream identifier in the GOAWAY frame contains the highest- 1944 numbered stream identifier for which the sender of the GOAWAY frame 1945 might have taken some action on or might yet take action on. All 1946 streams up to and including the identified stream might have been 1947 processed in some way. The last stream identifier can be set to 0 if 1948 no streams were processed. 1950 | Note: In this context, "processed" means that some data from 1951 | the stream was passed to some higher layer of software that 1952 | might have taken some action as a result. 1954 If a connection terminates without a GOAWAY frame, the last stream 1955 identifier is effectively the highest possible stream identifier. 1957 On streams with lower- or equal-numbered identifiers that were not 1958 closed completely prior to the connection being closed, reattempting 1959 requests, transactions, or any protocol activity is not possible, 1960 with the exception of idempotent actions like HTTP GET, PUT, or 1961 DELETE. Any protocol activity that uses higher-numbered streams can 1962 be safely retried using a new connection. 1964 Activity on streams numbered lower or equal to the last stream 1965 identifier might still complete successfully. The sender of a GOAWAY 1966 frame might gracefully shut down a connection by sending a GOAWAY 1967 frame, maintaining the connection in an "open" state until all in- 1968 progress streams complete. 1970 An endpoint MAY send multiple GOAWAY frames if circumstances change. 1971 For instance, an endpoint that sends GOAWAY with NO_ERROR during 1972 graceful shutdown could subsequently encounter a condition that 1973 requires immediate termination of the connection. The last stream 1974 identifier from the last GOAWAY frame received indicates which 1975 streams could have been acted upon. Endpoints MUST NOT increase the 1976 value they send in the last stream identifier, since the peers might 1977 already have retried unprocessed requests on another connection. 1979 A client that is unable to retry requests loses all requests that are 1980 in flight when the server closes the connection. This is especially 1981 true for intermediaries that might not be serving clients using 1982 HTTP/2. A server that is attempting to gracefully shut down a 1983 connection SHOULD send an initial GOAWAY frame with the last stream 1984 identifier set to 2^31-1 and a NO_ERROR code. This signals to the 1985 client that a shutdown is imminent and that initiating further 1986 requests is prohibited. After allowing time for any in-flight stream 1987 creation (at least one round-trip time), the server can send another 1988 GOAWAY frame with an updated last stream identifier. This ensures 1989 that a connection can be cleanly shut down without losing requests. 1991 After sending a GOAWAY frame, the sender can discard frames for 1992 streams initiated by the receiver with identifiers higher than the 1993 identified last stream. However, any frames that alter connection 1994 state cannot be completely ignored. For instance, HEADERS, 1995 PUSH_PROMISE, and CONTINUATION frames MUST be minimally processed to 1996 ensure the state maintained for field section compression is 1997 consistent (see Section 4.3); similarly, DATA frames MUST be counted 1998 toward the connection flow-control window. Failure to process these 1999 frames can cause flow control or field section compression state to 2000 become unsynchronized. 2002 The GOAWAY frame also contains a 32-bit error code (Section 7) that 2003 contains the reason for closing the connection. 2005 Endpoints MAY append opaque data to the frame payload of any GOAWAY 2006 frame. Additional debug data is intended for diagnostic purposes 2007 only and carries no semantic value. Debug information could contain 2008 security- or privacy-sensitive data. Logged or otherwise 2009 persistently stored debug data MUST have adequate safeguards to 2010 prevent unauthorized access. 2012 6.9. WINDOW_UPDATE 2014 The WINDOW_UPDATE frame (type=0x8) is used to implement flow control; 2015 see Section 5.2 for an overview. 2017 Flow control operates at two levels: on each individual stream and on 2018 the entire connection. 2020 Both types of flow control are hop by hop, that is, only between the 2021 two endpoints. Intermediaries do not forward WINDOW_UPDATE frames 2022 between dependent connections. However, throttling of data transfer 2023 by any receiver can indirectly cause the propagation of flow-control 2024 information toward the original sender. 2026 Flow control only applies to frames that are identified as being 2027 subject to flow control. Of the frame types defined in this 2028 document, this includes only DATA frames. Frames that are exempt 2029 from flow control MUST be accepted and processed, unless the receiver 2030 is unable to assign resources to handling the frame. A receiver MAY 2031 respond with a stream error (Section 5.4.2) or connection error 2032 (Section 5.4.1) of type FLOW_CONTROL_ERROR if it is unable to accept 2033 a frame. 2035 WINDOW_UPDATE Frame { 2036 Length (24), 2037 Type (8) = 8, 2039 Unused Flags (8), 2041 Reserved (1), 2042 Stream Identifier (31), 2044 Reserved (1), 2045 Window Size Increment (31), 2046 } 2048 Figure 11: WINDOW_UPDATE Frame Format 2050 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 2051 fields are described in Section 4. The frame payload of a 2052 WINDOW_UPDATE frame is one reserved bit plus an unsigned 31-bit 2053 integer indicating the number of octets that the sender can transmit 2054 in addition to the existing flow-control window. The legal range for 2055 the increment to the flow-control window is 1 to 2^31-1 2056 (2,147,483,647) octets. 2058 The WINDOW_UPDATE frame does not define any flags. 2060 The WINDOW_UPDATE frame can be specific to a stream or to the entire 2061 connection. In the former case, the frame's stream identifier 2062 indicates the affected stream; in the latter, the value "0" indicates 2063 that the entire connection is the subject of the frame. 2065 A receiver MUST treat the receipt of a WINDOW_UPDATE frame with an 2066 flow-control window increment of 0 as a stream error (Section 5.4.2) 2067 of type PROTOCOL_ERROR; errors on the connection flow-control window 2068 MUST be treated as a connection error (Section 5.4.1). 2070 WINDOW_UPDATE can be sent by a peer that has sent a frame with the 2071 END_STREAM flag set. This means that a receiver could receive a 2072 WINDOW_UPDATE frame on a "half-closed (remote)" or "closed" stream. 2073 A receiver MUST NOT treat this as an error (see Section 5.1). 2075 A receiver that receives a flow-controlled frame MUST always account 2076 for its contribution against the connection flow-control window, 2077 unless the receiver treats this as a connection error 2078 (Section 5.4.1). This is necessary even if the frame is in error. 2079 The sender counts the frame toward the flow-control window, but if 2080 the receiver does not, the flow-control window at the sender and 2081 receiver can become different. 2083 A WINDOW_UPDATE frame with a length other than 4 octets MUST be 2084 treated as a connection error (Section 5.4.1) of type 2085 FRAME_SIZE_ERROR. 2087 6.9.1. The Flow-Control Window 2089 Flow control in HTTP/2 is implemented using a window kept by each 2090 sender on every stream. The flow-control window is a simple integer 2091 value that indicates how many octets of data the sender is permitted 2092 to transmit; as such, its size is a measure of the buffering capacity 2093 of the receiver. 2095 Two flow-control windows are applicable: the stream flow-control 2096 window and the connection flow-control window. The sender MUST NOT 2097 send a flow-controlled frame with a length that exceeds the space 2098 available in either of the flow-control windows advertised by the 2099 receiver. Frames with zero length with the END_STREAM flag set (that 2100 is, an empty DATA frame) MAY be sent if there is no available space 2101 in either flow-control window. 2103 For flow-control calculations, the 9-octet frame header is not 2104 counted. 2106 After sending a flow-controlled frame, the sender reduces the space 2107 available in both windows by the length of the transmitted frame. 2109 The receiver of a frame sends a WINDOW_UPDATE frame as it consumes 2110 data and frees up space in flow-control windows. Separate 2111 WINDOW_UPDATE frames are sent for the stream- and connection-level 2112 flow-control windows. 2114 A sender that receives a WINDOW_UPDATE frame updates the 2115 corresponding window by the amount specified in the frame. 2117 A sender MUST NOT allow a flow-control window to exceed 2^31-1 2118 octets. If a sender receives a WINDOW_UPDATE that causes a flow- 2119 control window to exceed this maximum, it MUST terminate either the 2120 stream or the connection, as appropriate. For streams, the sender 2121 sends a RST_STREAM with an error code of FLOW_CONTROL_ERROR; for the 2122 connection, a GOAWAY frame with an error code of FLOW_CONTROL_ERROR 2123 is sent. 2125 Flow-controlled frames from the sender and WINDOW_UPDATE frames from 2126 the receiver are completely asynchronous with respect to each other. 2127 This property allows a receiver to aggressively update the window 2128 size kept by the sender to prevent streams from stalling. 2130 6.9.2. Initial Flow-Control Window Size 2132 When an HTTP/2 connection is first established, new streams are 2133 created with an initial flow-control window size of 65,535 octets. 2134 The connection flow-control window is also 65,535 octets. Both 2135 endpoints can adjust the initial window size for new streams by 2136 including a value for SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS 2137 frame that forms part of the connection preface. The connection 2138 flow-control window can only be changed using WINDOW_UPDATE frames. 2140 Prior to receiving a SETTINGS frame that sets a value for 2141 SETTINGS_INITIAL_WINDOW_SIZE, an endpoint can only use the default 2142 initial window size when sending flow-controlled frames. Similarly, 2143 the connection flow-control window is set to the default initial 2144 window size until a WINDOW_UPDATE frame is received. 2146 In addition to changing the flow-control window for streams that are 2147 not yet active, a SETTINGS frame can alter the initial flow-control 2148 window size for streams with active flow-control windows (that is, 2149 streams in the "open" or "half-closed (remote)" state). When the 2150 value of SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST adjust 2151 the size of all stream flow-control windows that it maintains by the 2152 difference between the new value and the old value. 2154 A change to SETTINGS_INITIAL_WINDOW_SIZE can cause the available 2155 space in a flow-control window to become negative. A sender MUST 2156 track the negative flow-control window and MUST NOT send new flow- 2157 controlled frames until it receives WINDOW_UPDATE frames that cause 2158 the flow-control window to become positive. 2160 For example, if the client sends 60 KB immediately on connection 2161 establishment and the server sets the initial window size to be 16 2162 KB, the client will recalculate the available flow-control window to 2163 be -44 KB on receipt of the SETTINGS frame. The client retains a 2164 negative flow-control window until WINDOW_UPDATE frames restore the 2165 window to being positive, after which the client can resume sending. 2167 A SETTINGS frame cannot alter the connection flow-control window. 2169 An endpoint MUST treat a change to SETTINGS_INITIAL_WINDOW_SIZE that 2170 causes any flow-control window to exceed the maximum size as a 2171 connection error (Section 5.4.1) of type FLOW_CONTROL_ERROR. 2173 6.9.3. Reducing the Stream Window Size 2175 A receiver that wishes to use a smaller flow-control window than the 2176 current size can send a new SETTINGS frame. However, the receiver 2177 MUST be prepared to receive data that exceeds this window size, since 2178 the sender might send data that exceeds the lower limit prior to 2179 processing the SETTINGS frame. 2181 After sending a SETTINGS frame that reduces the initial flow-control 2182 window size, a receiver MAY continue to process streams that exceed 2183 flow-control limits. Allowing streams to continue does not allow the 2184 receiver to immediately reduce the space it reserves for flow-control 2185 windows. Progress on these streams can also stall, since 2186 WINDOW_UPDATE frames are needed to allow the sender to resume 2187 sending. The receiver MAY instead send a RST_STREAM with an error 2188 code of FLOW_CONTROL_ERROR for the affected streams. 2190 6.10. CONTINUATION 2192 The CONTINUATION frame (type=0x9) is used to continue a sequence of 2193 field block fragments (Section 4.3). Any number of CONTINUATION 2194 frames can be sent, as long as the preceding frame is on the same 2195 stream and is a HEADERS, PUSH_PROMISE, or CONTINUATION frame without 2196 the END_HEADERS flag set. 2198 CONTINUATION Frame { 2199 Length (24), 2200 Type (8) = 9, 2202 Unused Flags (5), 2203 END_HEADERS Flag (1), 2204 Unused Flags (2), 2206 Reserved (1), 2207 Stream Identifier (31), 2209 Field Block Fragment (..), 2210 } 2212 Figure 12: CONTINUATION Frame Format 2214 The Length, Type, Unused Flag(s), Reserved, and Stream Identifier 2215 fields are described in Section 4. The CONTINUATION frame payload 2216 contains a field block fragment (Section 4.3). 2218 The CONTINUATION frame defines the following flag: 2220 END_HEADERS (0x4): When set, the END_HEADERS flag indicates that 2221 this frame ends a field block (Section 4.3). 2223 If the END_HEADERS flag is not set, this frame MUST be followed by 2224 another CONTINUATION frame. A receiver MUST treat the receipt of 2225 any other type of frame or a frame on a different stream as a 2226 connection error (Section 5.4.1) of type PROTOCOL_ERROR. 2228 The CONTINUATION frame changes the connection state as defined in 2229 Section 4.3. 2231 CONTINUATION frames MUST be associated with a stream. If a 2232 CONTINUATION frame is received whose stream identifier field is 0x0, 2233 the recipient MUST respond with a connection error (Section 5.4.1) of 2234 type PROTOCOL_ERROR. 2236 A CONTINUATION frame MUST be preceded by a HEADERS, PUSH_PROMISE or 2237 CONTINUATION frame without the END_HEADERS flag set. A recipient 2238 that observes violation of this rule MUST respond with a connection 2239 error (Section 5.4.1) of type PROTOCOL_ERROR. 2241 7. Error Codes 2243 Error codes are 32-bit fields that are used in RST_STREAM and GOAWAY 2244 frames to convey the reasons for the stream or connection error. 2246 Error codes share a common code space. Some error codes apply only 2247 to either streams or the entire connection and have no defined 2248 semantics in the other context. 2250 The following error codes are defined: 2252 NO_ERROR (0x0): The associated condition is not a result of an 2253 error. For example, a GOAWAY might include this code to indicate 2254 graceful shutdown of a connection. 2256 PROTOCOL_ERROR (0x1): The endpoint detected an unspecific protocol 2257 error. This error is for use when a more specific error code is 2258 not available. 2260 INTERNAL_ERROR (0x2): The endpoint encountered an unexpected 2261 internal error. 2263 FLOW_CONTROL_ERROR (0x3): The endpoint detected that its peer 2264 violated the flow-control protocol. 2266 SETTINGS_TIMEOUT (0x4): The endpoint sent a SETTINGS frame but did 2267 not receive a response in a timely manner. See Section 6.5.3 2268 ("Settings Synchronization"). 2270 STREAM_CLOSED (0x5): The endpoint received a frame after a stream 2271 was half-closed. 2273 FRAME_SIZE_ERROR (0x6): The endpoint received a frame with an 2274 invalid size. 2276 REFUSED_STREAM (0x7): The endpoint refused the stream prior to 2277 performing any application processing (see Section 8.7 for 2278 details). 2280 CANCEL (0x8): Used by the endpoint to indicate that the stream is no 2281 longer needed. 2283 COMPRESSION_ERROR (0x9): The endpoint is unable to maintain the 2284 field section compression context for the connection. 2286 CONNECT_ERROR (0xa): The connection established in response to a 2287 CONNECT request (Section 8.5) was reset or abnormally closed. 2289 ENHANCE_YOUR_CALM (0xb): The endpoint detected that its peer is 2290 exhibiting a behavior that might be generating excessive load. 2292 INADEQUATE_SECURITY (0xc): The underlying transport has properties 2293 that do not meet minimum security requirements (see Section 9.2). 2295 HTTP_1_1_REQUIRED (0xd): The endpoint requires that HTTP/1.1 be used 2296 instead of HTTP/2. 2298 Unknown or unsupported error codes MUST NOT trigger any special 2299 behavior. These MAY be treated by an implementation as being 2300 equivalent to INTERNAL_ERROR. 2302 8. Expressing HTTP Semantics in HTTP/2 2304 HTTP/2 is an instantiation of the HTTP message abstraction (Section 6 2305 of [HTTP]). 2307 8.1. HTTP Message Framing 2309 A client sends an HTTP request on a new stream, using a previously 2310 unused stream identifier (Section 5.1.1). A server sends an HTTP 2311 response on the same stream as the request. 2313 An HTTP message (request or response) consists of: 2315 1. one HEADERS frame (followed by zero or more CONTINUATION frames) 2316 containing the header section (see Section 6.3 of [HTTP]), 2318 2. zero or more DATA frames containing the message content (see 2319 Section 6.4 of [HTTP]), and 2321 3. optionally, one HEADERS frame (followed by zero or more 2322 CONTINUATION frames) containing the trailer section, if present 2323 (see Section 6.5 of [HTTP]). 2325 For a response only, a server MAY send any number of interim 2326 responses before the HEADERS frame containing a final response. An 2327 interim response consists of a HEADERS frame (which might be followed 2328 by zero or more CONTINUATION frames) containing the control data and 2329 header section of an interim (1xx) HTTP response (see Section 15 of 2330 [HTTP]). A HEADERS frame with the END_STREAM flag set that carries 2331 an informational status code is malformed (Section 8.1.1). 2333 The last frame in the sequence bears an END_STREAM flag, noting that 2334 a HEADERS frame with the END_STREAM flag set can be followed by 2335 CONTINUATION frames that carry any remaining fragments of the field 2336 block. 2338 Other frames (from any stream) MUST NOT occur between the HEADERS 2339 frame and any CONTINUATION frames that might follow. 2341 HTTP/2 uses DATA frames to carry message content. The chunked 2342 transfer encoding defined in Section 7.1 of [HTTP11] cannot be used 2343 in HTTP/2; see Section 8.2.2. 2345 Trailer fields are carried in a field block that also terminates the 2346 stream. That is, trailer fields comprise a sequence starting with a 2347 HEADERS frame, followed by zero or more CONTINUATION frames, where 2348 the HEADERS frame bears an END_STREAM flag. Trailers MUST NOT 2349 include pseudo-header fields (Section 8.3). An endpoint that 2350 receives pseudo-header fields in trailers MUST treat the request or 2351 response as malformed (Section 8.1.1). 2353 An endpoint that receives a HEADERS frame without the END_STREAM flag 2354 set after receiving the HEADERS frame that opens a request or after 2355 receiving a final (non-informational) status code MUST treat the 2356 corresponding request or response as malformed (Section 8.1.1). 2358 An HTTP request/response exchange fully consumes a single stream. A 2359 request starts with the HEADERS frame that puts the stream into the 2360 "open" state. The request ends with a frame with the END_STREAM flag 2361 set, which causes the stream to become "half-closed (local)" for the 2362 client and "half-closed (remote)" for the server. A response stream 2363 starts with zero or more interim responses in HEADERS frames, 2364 followed by a HEADERS frame containing a final status code. 2366 An HTTP response is complete after the server sends -- or the client 2367 receives -- a frame with the END_STREAM flag set (including any 2368 CONTINUATION frames needed to complete a field block). A server can 2369 send a complete response prior to the client sending an entire 2370 request if the response does not depend on any portion of the request 2371 that has not been sent and received. When this is true, a server MAY 2372 request that the client abort transmission of a request without error 2373 by sending a RST_STREAM with an error code of NO_ERROR after sending 2374 a complete response (i.e., a frame with the END_STREAM flag set). 2375 Clients MUST NOT discard responses as a result of receiving such a 2376 RST_STREAM, though clients can always discard responses at their 2377 discretion for other reasons. 2379 8.1.1. Malformed Messages 2381 A malformed request or response is one that is an otherwise valid 2382 sequence of HTTP/2 frames but is invalid due to the presence of 2383 extraneous frames, prohibited fields or pseudo-header fields, the 2384 absence of mandatory pseudo-header fields, the inclusion of uppercase 2385 field names, or invalid field names and/or values (in certain 2386 circumstances; see Section 8.2). 2388 A request or response that includes message content can include a 2389 content-length header field. A request or response is also malformed 2390 if the value of a content-length header field does not equal the sum 2391 of the DATA frame payload lengths that form the content. A response 2392 that is defined to have no content, as described in Section 6.4 of 2393 [HTTP], can have a non-zero content-length header field, even though 2394 no content is included in DATA frames. 2396 Intermediaries that process HTTP requests or responses (i.e., any 2397 intermediary not acting as a tunnel) MUST NOT forward a malformed 2398 request or response. Malformed requests or responses that are 2399 detected MUST be treated as a stream error (Section 5.4.2) of type 2400 PROTOCOL_ERROR. 2402 For malformed requests, a server MAY send an HTTP response prior to 2403 closing or resetting the stream. Clients MUST NOT accept a malformed 2404 response. 2406 Endpoints that progressively process messages might have performed 2407 some processing before identifying a request or response as 2408 malformed. For instance, it might be possible to generate an 2409 informational or 404 status code without having received a complete 2410 request. Similarly, intermediaries might forward incomplete messages 2411 before detecting errors. A server MAY generate a final response 2412 before receiving an entire request when the response does not depend 2413 on the remainder of the request being correct. A server or 2414 intermediary MAY use RST_STREAM -- with a code other than 2415 REFUSED_STREAM -- to abort a stream if a malformed request or 2416 response is received. 2418 These requirements are intended to protect against several types of 2419 common attacks against HTTP; they are deliberately strict because 2420 being permissive can expose implementations to these vulnerabilities. 2422 8.2. HTTP Fields 2424 HTTP fields (Section 5 of [HTTP]) are conveyed by HTTP/2 in the 2425 HEADERS, CONTINUATION, and PUSH_PROMISE frames, compressed with HPACK 2426 [COMPRESSION]. 2428 Field names MUST be converted to lowercase when constructing an 2429 HTTP/2 message. 2431 8.2.1. Field Validity 2433 The definitions of field names and values in HTTP prohibits some 2434 characters that HPACK might be able to convey. HTTP/2 2435 implementations SHOULD validate field names and values according to 2436 their definitions in Sections Section 5.1 of [5.1] and Section 5.5 of 2437 [5.5] of [HTTP] respectively and treat messages that contain 2438 prohibited characters as malformed (Section 8.1.1). 2440 Failure to validate fields can be exploited for request smuggling 2441 attacks. In particular, unvalidated fields might enable attacks when 2442 messages are forwarded using HTTP 1.1 [HTTP11], where characters such 2443 as CR, LF, and COLON are used as delimiters. Implementations MUST 2444 perform the following minimal validation of field names and values: 2446 * A field name MUST NOT contain characters in the ranges 0x00-0x20, 2447 0x41-0x5a, or 0x7f-0xff (all ranges inclusive). This specifically 2448 excludes all non-visible ASCII characters, ASCII SP (0x20), and 2449 uppercase characters ('A' to 'Z', ASCII 0x41 to 0x5a). 2451 * With the exception of pseudo-header fields (Section 8.3), which 2452 have a name that starts with a single colon, field names MUST NOT 2453 include a colon (ASCII COLON, 0x3a). 2455 * A field value MUST NOT contain the zero value (ASCII NUL, 0x0), 2456 line feed (ASCII LF, 0xa), or carriage return (ASCII CR, 0xd) at 2457 any position. 2459 * A field value MUST NOT start or end with an ASCII whitespace 2460 character (ASCII SP or HTAB, 0x20 or 0x9). 2462 | Note: An implementation that validates fields according the 2463 | definitions in Sections Section 5.1 of [5.1] and Section 5.5 of 2464 | [5.5] of [HTTP] only needs an additional check that field names 2465 | do not include uppercase characters. 2467 A request or response that contains a field that violates any of 2468 these conditions MUST be treated as malformed (Section 8.1.1). In 2469 particular, an intermediary that does not process fields when 2470 forwarding messages MUST NOT forward fields that contain any of the 2471 values that are listed as prohibited above. 2473 When a request message violates one of these requirements, an 2474 implementation SHOULD generate a Section 15.5.1 of 400 (Bad Request) 2475 status code [HTTP], unless a more suitable status code is defined or 2476 the status code cannot be sent (e.g., because the error occurs in a 2477 trailer field). 2479 | Note: Field values that are not valid according to the 2480 | definition of the corresponding field do not cause a request to 2481 | be malformed; the requirements above only apply to the generic 2482 | syntax for fields as defined in Section 5 of [HTTP]. 2484 8.2.2. Connection-Specific Header Fields 2486 HTTP/2 does not use the Connection header field (Section 7.6.1 of 2487 [HTTP]) to indicate connection-specific header fields; in this 2488 protocol, connection-specific metadata is conveyed by other means. 2489 An endpoint MUST NOT generate an HTTP/2 message containing 2490 connection-specific header fields. This includes the Connection 2491 header field and those listed as having connection-specific semantics 2492 in Section 7.6.1 of [HTTP] (that is, Proxy-Connection, Keep-Alive, 2493 Transfer-Encoding, and Upgrade). Any message containing connection- 2494 specific header fields MUST be treated as malformed (Section 8.1.1). 2496 The only exception to this is the TE header field, which MAY be 2497 present in an HTTP/2 request; when it is, it MUST NOT contain any 2498 value other than "trailers". 2500 An intermediary transforming a HTTP/1.x message to HTTP/2 MUST remove 2501 connection-specific header fields as discussed in Section 7.6.1 of 2502 [HTTP], or their messages will be treated by other HTTP/2 endpoints 2503 as malformed (Section 8.1.1). 2505 | Note: HTTP/2 purposefully does not support upgrade to another 2506 | protocol. The handshake methods described in Section 3 are 2507 | believed sufficient to negotiate the use of alternative 2508 | protocols. 2510 8.2.3. Compressing the Cookie Header Field 2512 The Cookie header field [COOKIE] uses a semi-colon (";") to delimit 2513 cookie-pairs (or "crumbs"). This header field contains multiple 2514 values, but does not use a COMMA (",") as a separator, which prevents 2515 cookie-pairs from being sent on multiple field lines (see Section 5.2 2516 of [HTTP]). This can significantly reduce compression efficiency as 2517 updates to individual cookie-pairs would invalidate any field lines 2518 that are stored in the HPACK table. 2520 To allow for better compression efficiency, the Cookie header field 2521 MAY be split into separate header fields, each with one or more 2522 cookie-pairs. If there are multiple Cookie header fields after 2523 decompression, these MUST be concatenated into a single octet string 2524 using the two-octet delimiter of 0x3b, 0x20 (the ASCII string "; ") 2525 before being passed into a non-HTTP/2 context, such as an HTTP/1.1 2526 connection, or a generic HTTP server application. 2528 Therefore, the following two lists of Cookie header fields are 2529 semantically equivalent. 2531 cookie: a=b; c=d; e=f 2533 cookie: a=b 2534 cookie: c=d 2535 cookie: e=f 2537 8.3. HTTP Control Data 2539 HTTP/2 uses special pseudo-header fields beginning with ':' character 2540 (ASCII 0x3a) to convey message control data (see Section 6.2 of 2541 [HTTP]). 2543 Pseudo-header fields are not HTTP header fields. Endpoints MUST NOT 2544 generate pseudo-header fields other than those defined in this 2545 document. Note that an extension could negotiate the use of 2546 additional pseudo-header fields; see Section 5.5. 2548 Pseudo-header fields are only valid in the context in which they are 2549 defined. Pseudo-header fields defined for requests MUST NOT appear 2550 in responses; pseudo-header fields defined for responses MUST NOT 2551 appear in requests. Pseudo-header fields MUST NOT appear in a 2552 trailer section. Endpoints MUST treat a request or response that 2553 contains undefined or invalid pseudo-header fields as malformed 2554 (Section 8.1.1). 2556 All pseudo-header fields MUST appear in a field block before all 2557 regular field lines. Any request or response that contains a pseudo- 2558 header field that appears in a field block after a regular field line 2559 MUST be treated as malformed (Section 8.1.1). 2561 The same pseudo-header field name MUST NOT appear more than once in a 2562 field block. A field block for an HTTP request or response that 2563 contains a repeated pseudo-header field name MUST be treated as 2564 malformed (Section 8.1.1). 2566 8.3.1. Request Pseudo-Header Fields 2568 The following pseudo-header fields are defined for HTTP/2 requests: 2570 * The :method pseudo-header field includes the HTTP method 2571 (Section 9 of [HTTP]). 2573 * The :scheme pseudo-header field includes the scheme portion of the 2574 request target. The scheme is taken from the target URI 2575 (Section 3.1 of [RFC3986]) when generating a request directly, or 2576 from the scheme of a translated request (for example, see 2577 Section 3.3 of [HTTP11]). Scheme is omitted for CONNECT requests 2578 (Section 8.5). 2580 :scheme is not restricted to http and https schemed URIs. A proxy 2581 or gateway can translate requests for non-HTTP schemes, enabling 2582 the use of HTTP to interact with non-HTTP services. 2584 * The :authority pseudo-header field conveys the authority portion 2585 (Section 3.2 of [RFC3986]) of the target URI (Section 7.1 of 2586 [HTTP]). The recipient of a HTTP/2 request MUST ignore the Host 2587 header field if :authority is present. 2589 Clients that generate HTTP/2 requests directly MUST use the 2590 :authority pseudo-header field to convey authority information, 2591 unless there is no authority information to convey (in which case 2592 it MUST NOT generate :authority). 2594 Clients MUST NOT generate a request with a Host header field that 2595 differs from the :authority pseudo-header field. A server SHOULD 2596 treat a request as malformed if it contains a Host header field 2597 that identifies a different entity to the :authority pseudo-header 2598 field. The values of fields need to be normalized to compare them 2599 (see Section 6.2 of [RFC3986]). An origin server can apply any 2600 normalization method, whereas other servers MUST perform scheme- 2601 based normalization (see Section 6.2.3 of [RFC3986]) of the two 2602 fields. 2604 An intermediary that forwards a request over HTTP/2 MUST construct 2605 an :authority pseudo-header field using the authority information 2606 from the control data of the original request, unless the the 2607 original request's target URI does not contain authority 2608 information (in which case it MUST NOT generate :authority). Note 2609 that the Host header field is not the sole source of this 2610 information; see Section 7.2 of [HTTP]. 2612 An intermediary that needs to generate a Host header field (which 2613 might be necessary to construct an HTTP/1.1 request) MUST use the 2614 value from the :authority pseudo-header field as the value of the 2615 Host field, unless the intermediary also changes the request 2616 target. This replaces any existing Host field to avoid potential 2617 vulnerabilities in HTTP routing. 2619 An intermediary that forwards a request over HTTP/2 MAY retain any 2620 Host header field. 2622 Note that request targets for CONNECT or asterisk-form OPTIONS 2623 requests never include authority information. 2625 :authority MUST NOT include the deprecated userinfo subcomponent 2626 for http or https schemed URIs. 2628 * The :path pseudo-header field includes the path and query parts of 2629 the target URI (the absolute-path production and optionally a '?' 2630 character followed by the query production; see Section 4.1 of 2631 [HTTP]). A request in asterisk form (for OPTIONS) includes the 2632 value '*' for the :path pseudo-header field. 2634 This pseudo-header field MUST NOT be empty for http or https URIs; 2635 http or https URIs that do not contain a path component MUST 2636 include a value of '/'. The exceptions to this rule are: 2638 - an OPTIONS request for an http or https URI that does not 2639 include a path component; these MUST include a :path pseudo- 2640 header field with a value of '*' (see Section 7.1 of [HTTP]) 2642 - CONNECT requests (Section 8.5), where the :path pseudo-header 2643 field is omitted. 2645 All HTTP/2 requests MUST include exactly one valid value for the 2646 :method, :scheme, and :path pseudo-header fields, unless it is a 2647 CONNECT request (Section 8.5). An HTTP request that omits mandatory 2648 pseudo-header fields is malformed (Section 8.1.1). 2650 Individual HTTP/2 requests do not carry an explicit indicator of 2651 protocol version. All HTTP/2 requests implicitly have a protocol 2652 version of "2.0" (see Section 6.2 of [HTTP]). 2654 8.3.2. Response Pseudo-Header Fields 2656 For HTTP/2 responses, a single :status pseudo-header field is defined 2657 that carries the HTTP status code field (see Section 15 of [HTTP]). 2658 This pseudo-header field MUST be included in all responses, including 2659 interim responses; otherwise, the response is malformed 2660 (Section 8.1.1). 2662 HTTP/2 responses implicitly have a protocol version of "2.0". 2664 8.4. Server Push 2666 HTTP/2 allows a server to pre-emptively send (or "push") responses 2667 (along with corresponding "promised" requests) to a client in 2668 association with a previous client-initiated request. 2670 Server push was designed to allow a server to improve client- 2671 perceived performance by predicting what requests will follow those 2672 that it receives, thereby removing a round trip for them. For 2673 example, a request for HTML is often followed by requests for 2674 stylesheets and scripts referenced by that page. When these requests 2675 are pushed, the client does not need to wait to receive the 2676 references to them in the HTML and issue separate requests. 2678 In practice, server push is difficult to use effectively, because it 2679 requires the server to correctly anticipate the additional requests 2680 the client will make, taking into account factors such as caching, 2681 content negotiation, and user behavior. Errors in prediction can 2682 lead to performance degradation, due to the opportunity cost that the 2683 additional data on the wire represents. In particular, pushing any 2684 significant amount of data can cause contention issues with more- 2685 important responses. 2687 A client can request that server push be disabled, though this is 2688 negotiated for each hop independently. The SETTINGS_ENABLE_PUSH 2689 setting can be set to 0 to indicate that server push is disabled. 2691 Promised requests MUST be safe (see Section 9.2.1 of [HTTP]) and 2692 cacheable (see Section 9.2.3 of [HTTP]). Promised requests cannot 2693 include any content or a trailer section. Clients that receive a 2694 promised request that is not cacheable, that is not known to be safe, 2695 or that indicates the presence of request content MUST reset the 2696 promised stream with a stream error (Section 5.4.2) of type 2697 PROTOCOL_ERROR. Note this could result in the promised stream being 2698 reset if the client does not recognize a newly defined method as 2699 being safe. 2701 Pushed responses that are cacheable (see Section 3 of [CACHE]) can be 2702 stored by the client, if it implements an HTTP cache. Pushed 2703 responses are considered successfully validated on the origin server 2704 (e.g., if the "no-cache" cache response directive is present; see 2705 Section 5.2.2.4 of [CACHE]) while the stream identified by the 2706 promised stream ID is still open. 2708 Pushed responses that are not cacheable MUST NOT be stored by any 2709 HTTP cache. They MAY be made available to the application 2710 separately. 2712 The server MUST include a value in the :authority pseudo-header field 2713 for which the server is authoritative (see Section 10.1). A client 2714 MUST treat a PUSH_PROMISE for which the server is not authoritative 2715 as a stream error (Section 5.4.2) of type PROTOCOL_ERROR. 2717 An intermediary can receive pushes from the server and choose not to 2718 forward them on to the client. In other words, how to make use of 2719 the pushed information is up to that intermediary. Equally, the 2720 intermediary might choose to make additional pushes to the client, 2721 without any action taken by the server. 2723 A client cannot push. Thus, servers MUST treat the receipt of a 2724 PUSH_PROMISE frame as a connection error (Section 5.4.1) of type 2725 PROTOCOL_ERROR. A server cannot set the SETTINGS_ENABLE_PUSH setting 2726 to a value other than 0 (see Section 6.5.2). 2728 8.4.1. Push Requests 2730 Server push is semantically equivalent to a server responding to a 2731 request; however, in this case, that request is also sent by the 2732 server, as a PUSH_PROMISE frame. 2734 The PUSH_PROMISE frame includes a field block that contains control 2735 data and a complete set of request header fields that the server 2736 attributes to the request. It is not possible to push a response to 2737 a request that includes message content. 2739 Promised requests are always associated with an explicit request from 2740 the client. The PUSH_PROMISE frames sent by the server are sent on 2741 that explicit request's stream. The PUSH_PROMISE frame also includes 2742 a promised stream identifier, chosen from the stream identifiers 2743 available to the server (see Section 5.1.1). 2745 The header fields in PUSH_PROMISE and any subsequent CONTINUATION 2746 frames MUST be a valid and complete set of request header fields 2747 (Section 8.3.1). The server MUST include a method in the :method 2748 pseudo-header field that is safe and cacheable. If a client receives 2749 a PUSH_PROMISE that does not include a complete and valid set of 2750 header fields or the :method pseudo-header field identifies a method 2751 that is not safe, it MUST respond with a stream error (Section 5.4.2) 2752 of type PROTOCOL_ERROR. 2754 The server SHOULD send PUSH_PROMISE (Section 6.6) frames prior to 2755 sending any frames that reference the promised responses. This 2756 avoids a race where clients issue requests prior to receiving any 2757 PUSH_PROMISE frames. 2759 For example, if the server receives a request for a document 2760 containing embedded links to multiple image files and the server 2761 chooses to push those additional images to the client, sending 2762 PUSH_PROMISE frames before the DATA frames that contain the image 2763 links ensures that the client is able to see that a resource will be 2764 pushed before discovering embedded links. Similarly, if the server 2765 pushes resources referenced by the field block (for instance, in Link 2766 header fields), sending a PUSH_PROMISE before sending the header 2767 ensures that clients do not request those resources. 2769 PUSH_PROMISE frames MUST NOT be sent by the client. 2771 PUSH_PROMISE frames can be sent by the server on any client-initiated 2772 stream, but the stream MUST be in either the "open" or "half-closed 2773 (remote)" state with respect to the server. PUSH_PROMISE frames are 2774 interspersed with the frames that comprise a response, though they 2775 cannot be interspersed with HEADERS and CONTINUATION frames that 2776 comprise a single field block. 2778 Sending a PUSH_PROMISE frame creates a new stream and puts the stream 2779 into the "reserved (local)" state for the server and the "reserved 2780 (remote)" state for the client. 2782 8.4.2. Push Responses 2784 After sending the PUSH_PROMISE frame, the server can begin delivering 2785 the pushed response as a response (Section 8.3.2) on a server- 2786 initiated stream that uses the promised stream identifier. The 2787 server uses this stream to transmit an HTTP response, using the same 2788 sequence of frames as defined in Section 8.1. This stream becomes 2789 "half-closed" to the client (Section 5.1) after the initial HEADERS 2790 frame is sent. 2792 Once a client receives a PUSH_PROMISE frame and chooses to accept the 2793 pushed response, the client SHOULD NOT issue any requests for the 2794 promised response until after the promised stream has closed. 2796 If the client determines, for any reason, that it does not wish to 2797 receive the pushed response from the server or if the server takes 2798 too long to begin sending the promised response, the client can send 2799 a RST_STREAM frame, using either the CANCEL or REFUSED_STREAM code 2800 and referencing the pushed stream's identifier. 2802 A client can use the SETTINGS_MAX_CONCURRENT_STREAMS setting to limit 2803 the number of responses that can be concurrently pushed by a server. 2804 Advertising a SETTINGS_MAX_CONCURRENT_STREAMS value of zero disables 2805 server push by preventing the server from creating the necessary 2806 streams. This does not prohibit a server from sending PUSH_PROMISE 2807 frames; clients need to reset any promised streams that are not 2808 wanted. 2810 Clients receiving a pushed response MUST validate that either the 2811 server is authoritative (see Section 10.1) or the proxy that provided 2812 the pushed response is configured for the corresponding request. For 2813 example, a server that offers a certificate for only the example.com 2814 DNS-ID is not permitted to push a response for 2815 https://www.example.org/doc. 2817 The response for a PUSH_PROMISE stream begins with a HEADERS frame, 2818 which immediately puts the stream into the "half-closed (remote)" 2819 state for the server and "half-closed (local)" state for the client, 2820 and ends with a frame with the END_STREAM flag set, which places the 2821 stream in the "closed" state. 2823 | Note: The client never sends a frame with the END_STREAM flag 2824 | set for a server push. 2826 8.5. The CONNECT Method 2828 The CONNECT method (Section 9.3.6 of [HTTP]) is used to convert an 2829 HTTP connection into a tunnel to a remote host. CONNECT is primarily 2830 used with HTTP proxies to establish a TLS session with an origin 2831 server for the purposes of interacting with https resources. 2833 In HTTP/2, the CONNECT method establishes a tunnel over a single 2834 HTTP/2 stream to a remote host, rather than converting the entire 2835 connection to a tunnel. A CONNECT header section is constructed as 2836 defined in Section 8.3.1 ("Request Pseudo-Header Fields"), with a few 2837 differences. Specifically: 2839 * The :method pseudo-header field is set to CONNECT. 2841 * The :scheme and :path pseudo-header fields MUST be omitted. 2843 * The :authority pseudo-header field contains the host and port to 2844 connect to (equivalent to the authority-form of the request-target 2845 of CONNECT requests; see Section 3.2.3 of [HTTP11]). 2847 A CONNECT request that does not conform to these restrictions is 2848 malformed (Section 8.1.1). 2850 A proxy that supports CONNECT establishes a TCP connection [TCP] to 2851 the host and port identified in the :authority pseudo-header field. 2852 Once this connection is successfully established, the proxy sends a 2853 HEADERS frame containing a 2xx series status code to the client, as 2854 defined in Section 9.3.6 of [HTTP]. 2856 After the initial HEADERS frame sent by each peer, all subsequent 2857 DATA frames correspond to data sent on the TCP connection. The frame 2858 payload of any DATA frames sent by the client is transmitted by the 2859 proxy to the TCP server; data received from the TCP server is 2860 assembled into DATA frames by the proxy. Frame types other than DATA 2861 or stream management frames (RST_STREAM, WINDOW_UPDATE, and PRIORITY) 2862 MUST NOT be sent on a connected stream and MUST be treated as a 2863 stream error (Section 5.4.2) if received. 2865 The TCP connection can be closed by either peer. The END_STREAM flag 2866 on a DATA frame is treated as being equivalent to the TCP FIN bit. A 2867 client is expected to send a DATA frame with the END_STREAM flag set 2868 after receiving a frame with the END_STREAM flag set. A proxy that 2869 receives a DATA frame with the END_STREAM flag set sends the attached 2870 data with the FIN bit set on the last TCP segment. A proxy that 2871 receives a TCP segment with the FIN bit set sends a DATA frame with 2872 the END_STREAM flag set. Note that the final TCP segment or DATA 2873 frame could be empty. 2875 A TCP connection error is signaled with RST_STREAM. A proxy treats 2876 any error in the TCP connection, which includes receiving a TCP 2877 segment with the RST bit set, as a stream error (Section 5.4.2) of 2878 type CONNECT_ERROR. Correspondingly, a proxy MUST send a TCP segment 2879 with the RST bit set if it detects an error with the stream or the 2880 HTTP/2 connection. 2882 8.6. The Upgrade Header Field 2884 HTTP/2 does not support the 101 (Switching Protocols) informational 2885 status code (Section 15.2.2 of [HTTP]). 2887 The semantics of 101 (Switching Protocols) aren't applicable to a 2888 multiplexed protocol. Similar functionality might be enabled through 2889 the use of extended CONNECT [RFC8441] and other protocols are able to 2890 use the same mechanisms that HTTP/2 uses to negotiate their use (see 2891 Section 3). 2893 8.7. Request Reliability 2895 In general, an HTTP client is unable to retry a non-idempotent 2896 request when an error occurs because there is no means to determine 2897 the nature of the error (see Section 9.2.2 of [HTTP]). It is 2898 possible that some server processing occurred prior to the error, 2899 which could result in undesirable effects if the request were 2900 reattempted. 2902 HTTP/2 provides two mechanisms for providing a guarantee to a client 2903 that a request has not been processed: 2905 * The GOAWAY frame indicates the highest stream number that might 2906 have been processed. Requests on streams with higher numbers are 2907 therefore guaranteed to be safe to retry. 2909 * The REFUSED_STREAM error code can be included in a RST_STREAM 2910 frame to indicate that the stream is being closed prior to any 2911 processing having occurred. Any request that was sent on the 2912 reset stream can be safely retried. 2914 Requests that have not been processed have not failed; clients MAY 2915 automatically retry them, even those with non-idempotent methods. 2917 A server MUST NOT indicate that a stream has not been processed 2918 unless it can guarantee that fact. If frames that are on a stream 2919 are passed to the application layer for any stream, then 2920 REFUSED_STREAM MUST NOT be used for that stream, and a GOAWAY frame 2921 MUST include a stream identifier that is greater than or equal to the 2922 given stream identifier. 2924 In addition to these mechanisms, the PING frame provides a way for a 2925 client to easily test a connection. Connections that remain idle can 2926 become broken as some middleboxes (for instance, network address 2927 translators or load balancers) silently discard connection bindings. 2928 The PING frame allows a client to safely test whether a connection is 2929 still active without sending a request. 2931 8.8. Examples 2933 This section shows HTTP/1.1 requests and responses, with 2934 illustrations of equivalent HTTP/2 requests and responses. 2936 8.8.1. Simple Request 2938 An HTTP GET request includes control data and a request header with 2939 no message content and is therefore transmitted as a single HEADERS 2940 frame, followed by zero or more CONTINUATION frames containing the 2941 serialized block of request header fields. The HEADERS frame in the 2942 following has both the END_HEADERS and END_STREAM flags set; no 2943 CONTINUATION frames are sent. 2945 GET /resource HTTP/1.1 HEADERS 2946 Host: example.org ==> + END_STREAM 2947 Accept: image/jpeg + END_HEADERS 2948 :method = GET 2949 :scheme = https 2950 :authority = example.org 2951 :path = /resource 2952 host = example.org 2953 accept = image/jpeg 2955 8.8.2. Simple Response 2957 Similarly, a response that includes only control data and a response 2958 header is transmitted as a HEADERS frame (again, followed by zero or 2959 more CONTINUATION frames) containing the serialized block of response 2960 header fields. 2962 HTTP/1.1 304 Not Modified HEADERS 2963 ETag: "xyzzy" ==> + END_STREAM 2964 Expires: Thu, 23 Jan ... + END_HEADERS 2965 :status = 304 2966 etag = "xyzzy" 2967 expires = Thu, 23 Jan ... 2969 8.8.3. Complex Request 2971 An HTTP POST request that includes control data and a request header 2972 and message content is transmitted as one HEADERS frame, followed by 2973 zero or more CONTINUATION frames containing the request header, 2974 followed by one or more DATA frames, with the last CONTINUATION (or 2975 HEADERS) frame having the END_HEADERS flag set and the final DATA 2976 frame having the END_STREAM flag set: 2978 POST /resource HTTP/1.1 HEADERS 2979 Host: example.org ==> - END_STREAM 2980 Content-Type: image/jpeg - END_HEADERS 2981 Content-Length: 123 :method = POST 2982 :authority = example.org 2983 :path = /resource 2984 {binary data} :scheme = https 2986 CONTINUATION 2987 + END_HEADERS 2988 content-type = image/jpeg 2989 host = example.org 2990 content-length = 123 2992 DATA 2993 + END_STREAM 2994 {binary data} 2996 Note that data contributing to any given field line could be spread 2997 between field block fragments. The allocation of field lines to 2998 frames in this example is illustrative only. 3000 8.8.4. Response with Body 3002 A response that includes control data and a response header and 3003 message content is transmitted as a HEADERS frame, followed by zero 3004 or more CONTINUATION frames, followed by one or more DATA frames, 3005 with the last DATA frame in the sequence having the END_STREAM flag 3006 set: 3008 HTTP/1.1 200 OK HEADERS 3009 Content-Type: image/jpeg ==> - END_STREAM 3010 Content-Length: 123 + END_HEADERS 3011 :status = 200 3012 {binary data} content-type = image/jpeg 3013 content-length = 123 3015 DATA 3016 + END_STREAM 3017 {binary data} 3019 8.8.5. Informational Responses 3021 An informational response using a 1xx status code other than 101 is 3022 transmitted as a HEADERS frame, followed by zero or more CONTINUATION 3023 frames. 3025 A trailer section is sent as a field block after both the request or 3026 response field block and all the DATA frames have been sent. The 3027 HEADERS frame starting the field block that comprises the trailer 3028 section has the END_STREAM flag set. 3030 The following example includes both a 100 (Continue) status code, 3031 which is sent in response to a request containing a "100-continue" 3032 token in the Expect header field, and a trailer section: 3034 HTTP/1.1 100 Continue HEADERS 3035 Extension-Field: bar ==> - END_STREAM 3036 + END_HEADERS 3037 :status = 100 3038 extension-field = bar 3040 HTTP/1.1 200 OK HEADERS 3041 Content-Type: image/jpeg ==> - END_STREAM 3042 Transfer-Encoding: chunked + END_HEADERS 3043 Trailer: Foo :status = 200 3044 content-type = image/jpeg 3045 123 trailer = Foo 3046 {binary data} 3047 0 DATA 3048 Foo: bar - END_STREAM 3049 {binary data} 3051 HEADERS 3052 + END_STREAM 3053 + END_HEADERS 3054 foo = bar 3056 9. HTTP/2 Connections 3058 This section outlines attributes of the HTTP protocol that improve 3059 interoperability, reduce exposure to known security vulnerabilities, 3060 or reduce the potential for implementation variation. 3062 9.1. Connection Management 3064 HTTP/2 connections are persistent. For best performance, it is 3065 expected that clients will not close connections until it is 3066 determined that no further communication with a server is necessary 3067 (for example, when a user navigates away from a particular web page) 3068 or until the server closes the connection. 3070 Clients SHOULD NOT open more than one HTTP/2 connection to a given 3071 host and port pair, where the host is derived from a URI, a selected 3072 alternative service [ALT-SVC], or a configured proxy. 3074 A client can create additional connections as replacements, either to 3075 replace connections that are near to exhausting the available stream 3076 identifier space (Section 5.1.1), to refresh the keying material for 3077 a TLS connection, or to replace connections that have encountered 3078 errors (Section 5.4.1). 3080 A client MAY open multiple connections to the same IP address and TCP 3081 port using different Server Name Indication [TLS-EXT] values or to 3082 provide different TLS client certificates but SHOULD avoid creating 3083 multiple connections with the same configuration. 3085 Servers are encouraged to maintain open connections for as long as 3086 possible but are permitted to terminate idle connections if 3087 necessary. When either endpoint chooses to close the transport-layer 3088 TCP connection, the terminating endpoint SHOULD first send a GOAWAY 3089 (Section 6.8) frame so that both endpoints can reliably determine 3090 whether previously sent frames have been processed and gracefully 3091 complete or terminate any necessary remaining tasks. 3093 9.1.1. Connection Reuse 3095 Connections that are made to an origin server, either directly or 3096 through a tunnel created using the CONNECT method (Section 8.5), MAY 3097 be reused for requests with multiple different URI authority 3098 components. A connection can be reused as long as the origin server 3099 is authoritative (Section 10.1). For TCP connections without TLS, 3100 this depends on the host having resolved to the same IP address. 3102 For https resources, connection reuse additionally depends on having 3103 a certificate that is valid for the host in the URI. The certificate 3104 presented by the server MUST satisfy any checks that the client would 3105 perform when forming a new TLS connection for the host in the URI. A 3106 single certificate can be used to establish authority for multiple 3107 origins. Section 4.3 of [HTTP] describes how a client determines 3108 whether a server is authoritative for a URI. 3110 In some deployments, reusing a connection for multiple origins can 3111 result in requests being directed to the wrong origin server. For 3112 example, TLS termination might be performed by a middlebox that uses 3113 the TLS Server Name Indication (SNI) [TLS-EXT] extension to select an 3114 origin server. This means that it is possible for clients to send 3115 requests to servers that might not be the intended target for the 3116 request, even though the server is otherwise authoritative. 3118 A server that does not wish clients to reuse connections can indicate 3119 that it is not authoritative for a request by sending a 421 3120 (Misdirected Request) status code in response to the request (see 3121 Section 15.5.20 of [HTTP]). 3123 A client that is configured to use a proxy over HTTP/2 directs 3124 requests to that proxy through a single connection. That is, all 3125 requests sent via a proxy reuse the connection to the proxy. 3127 9.2. Use of TLS Features 3129 Implementations of HTTP/2 MUST use TLS version 1.2 [TLS12] or higher 3130 for HTTP/2 over TLS. The general TLS usage guidance in [TLSBCP] 3131 SHOULD be followed, with some additional restrictions that are 3132 specific to HTTP/2. 3134 The TLS implementation MUST support the Server Name Indication (SNI) 3135 [TLS-EXT] extension to TLS. If the server is identified by a domain 3136 name [DNS-TERMS], clients MUST send the server_name TLS extension 3137 unless an alternative mechanism to indicate the target host is used. 3139 Requirements for deployments of HTTP/2 that negotiate TLS 1.3 [TLS13] 3140 are included in Section 9.2.3. Deployments of TLS 1.2 are subject to 3141 the requirements in Section 9.2.1 and Section 9.2.2. Implementations 3142 are encouraged to provide defaults that comply, but it is recognized 3143 that deployments are ultimately responsible for compliance. 3145 9.2.1. TLS 1.2 Features 3147 This section describes restrictions on the TLS 1.2 feature set that 3148 can be used with HTTP/2. Due to deployment limitations, it might not 3149 be possible to fail TLS negotiation when these restrictions are not 3150 met. An endpoint MAY immediately terminate an HTTP/2 connection that 3151 does not meet these TLS requirements with a connection error 3152 (Section 5.4.1) of type INADEQUATE_SECURITY. 3154 A deployment of HTTP/2 over TLS 1.2 MUST disable compression. TLS 3155 compression can lead to the exposure of information that would not 3156 otherwise be revealed [RFC3749]. Generic compression is unnecessary 3157 since HTTP/2 provides compression features that are more aware of 3158 context and therefore likely to be more appropriate for use for 3159 performance, security, or other reasons. 3161 A deployment of HTTP/2 over TLS 1.2 MUST disable renegotiation. An 3162 endpoint MUST treat a TLS renegotiation as a connection error 3163 (Section 5.4.1) of type PROTOCOL_ERROR. Note that disabling 3164 renegotiation can result in long-lived connections becoming unusable 3165 due to limits on the number of messages the underlying cipher suite 3166 can encipher. 3168 An endpoint MAY use renegotiation to provide confidentiality 3169 protection for client credentials offered in the handshake, but any 3170 renegotiation MUST occur prior to sending the connection preface. A 3171 server SHOULD request a client certificate if it sees a renegotiation 3172 request immediately after establishing a connection. 3174 This effectively prevents the use of renegotiation in response to a 3175 request for a specific protected resource. A future specification 3176 might provide a way to support this use case. Alternatively, a 3177 server might use an error (Section 5.4) of type HTTP_1_1_REQUIRED to 3178 request the client use a protocol that supports renegotiation. 3180 Implementations MUST support ephemeral key exchange sizes of at least 3181 2048 bits for cipher suites that use ephemeral finite field Diffie- 3182 Hellman (DHE) [TLS13] and 224 bits for cipher suites that use 3183 ephemeral elliptic curve Diffie-Hellman (ECDHE) [RFC8422]. Clients 3184 MUST accept DHE sizes of up to 4096 bits. Endpoints MAY treat 3185 negotiation of key sizes smaller than the lower limits as a 3186 connection error (Section 5.4.1) of type INADEQUATE_SECURITY. 3188 9.2.2. TLS 1.2 Cipher Suites 3190 A deployment of HTTP/2 over TLS 1.2 SHOULD NOT use any of the cipher 3191 suites that are listed in the list of prohibited cipher suites 3192 (Appendix A). 3194 Endpoints MAY choose to generate a connection error (Section 5.4.1) 3195 of type INADEQUATE_SECURITY if one of the prohibited cipher suites is 3196 negotiated. A deployment that chooses to use a prohibited cipher 3197 suite risks triggering a connection error unless the set of potential 3198 peers is known to accept that cipher suite. 3200 Implementations MUST NOT generate this error in reaction to the 3201 negotiation of a cipher suite that is not prohibited. Consequently, 3202 when clients offer a cipher suite that is not prohibited, they have 3203 to be prepared to use that cipher suite with HTTP/2. 3205 The list of prohibited cipher suites includes the cipher suite that 3206 TLS 1.2 makes mandatory, which means that TLS 1.2 deployments could 3207 have non-intersecting sets of permitted cipher suites. To avoid this 3208 problem causing TLS handshake failures, deployments of HTTP/2 that 3209 use TLS 1.2 MUST support TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 3210 [TLS-ECDHE] with the P-256 elliptic curve [FIPS186]. 3212 Note that clients might advertise support of cipher suites that are 3213 prohibited in order to allow for connection to servers that do not 3214 support HTTP/2. This allows servers to select HTTP/1.1 with a cipher 3215 suite that is prohibited in HTTP/2. However, this can result in 3216 HTTP/2 being negotiated with a prohibited cipher suite if the 3217 application protocol and cipher suite are independently selected. 3219 9.2.3. TLS 1.3 Features 3221 TLS 1.3 includes a number of features not available in earlier 3222 versions. This section discusses the use of these features. 3224 HTTP/2 servers MUST NOT send post-handshake TLS 1.3 3225 CertificateRequest messages. HTTP/2 clients MUST treat a TLS post- 3226 handshake CertificateRequest message as a connection error 3227 (Section 5.4.1) of type PROTOCOL_ERROR. 3229 The prohibition on post-handshake authentication applies even if the 3230 client offered the "post_handshake_auth" TLS extension. Post- 3231 handshake authentication support might be advertised independently of 3232 ALPN [TLS-ALPN]. Clients might offer the capability for use in other 3233 protocols, but inclusion of the extension cannot imply support within 3234 HTTP/2. 3236 [TLS13] defines other post-handshake messages, NewSessionTicket and 3237 KeyUpdate, which can be used as they have no direct interaction with 3238 HTTP/2. Unless the use of a new type of TLS message depends on an 3239 interaction with the application-layer protocol, that TLS message can 3240 be sent after the handshake completes. 3242 TLS early data MAY be used to send requests, provided that the 3243 guidance in [RFC8470] is observed. Clients send requests in early 3244 data assuming initial values for all server settings. 3246 10. Security Considerations 3248 The use of TLS is necessary to provide many of the security 3249 properties of this protocol. Many of the claims in this section do 3250 not hold unless TLS is used as described in Section 9.2. 3252 10.1. Server Authority 3254 HTTP/2 relies on the HTTP definition of authority for determining 3255 whether a server is authoritative in providing a given response (see 3256 Section 4.3 of [HTTP]). This relies on local name resolution for the 3257 "http" URI scheme and the authenticated server identity for the 3258 "https" scheme. 3260 10.2. Cross-Protocol Attacks 3262 In a cross-protocol attack, an attacker causes a client to initiate a 3263 transaction in one protocol toward a server that understands a 3264 different protocol. An attacker might be able to cause the 3265 transaction to appear as a valid transaction in the second protocol. 3266 In combination with the capabilities of the web context, this can be 3267 used to interact with poorly protected servers in private networks. 3269 Completing a TLS handshake with an ALPN identifier for HTTP/2 can be 3270 considered sufficient protection against cross-protocol attacks. 3271 ALPN provides a positive indication that a server is willing to 3272 proceed with HTTP/2, which prevents attacks on other TLS-based 3273 protocols. 3275 The encryption in TLS makes it difficult for attackers to control the 3276 data that could be used in a cross-protocol attack on a cleartext 3277 protocol. 3279 The cleartext version of HTTP/2 has minimal protection against cross- 3280 protocol attacks. The connection preface (Section 3.4) contains a 3281 string that is designed to confuse HTTP/1.1 servers, but no special 3282 protection is offered for other protocols. 3284 10.3. Intermediary Encapsulation Attacks 3286 HPACK permits encoding of field names and values that might be 3287 treated as delimiters in other HTTP versions. An intermediary that 3288 translates an HTTP/2 request or response MUST validate fields 3289 according to the rules in Section 8.2 roles before translating a 3290 message to another HTTP version. Translating a field that includes 3291 invalid delimiters could be used to cause recipients to incorrectly 3292 interpret a message, which could be exploited by an attacker. 3294 An intermediary can reject fields that contain invalid field names or 3295 values for other reasons, in particular those that do not conform to 3296 the HTTP ABNF grammar from Section 5 of [HTTP]. Intermediaries that 3297 do not perform any validation of fields other than the minimum 3298 required by Section 8.2 could forward messages that contain invalid 3299 field names or values. 3301 An intermediary that receives any field that requires removal before 3302 forwarding (see Section 7.6.1 of [HTTP]) MUST remove or replace those 3303 header fields when forwarding messages. Additionally, intermediaries 3304 should take care when forwarding messages containing Content-Length 3305 fields to ensure that the message is well-formed (Section 8.1.1). 3306 This ensures that if the message is translated into HTTP/1.1 at any 3307 point the framing will be correct. 3309 10.4. Cacheability of Pushed Responses 3311 Pushed responses do not have an explicit request from the client; the 3312 request is provided by the server in the PUSH_PROMISE frame. 3314 Caching responses that are pushed is possible based on the guidance 3315 provided by the origin server in the Cache-Control header field. 3316 However, this can cause issues if a single server hosts more than one 3317 tenant. For example, a server might offer multiple users each a 3318 small portion of its URI space. 3320 Where multiple tenants share space on the same server, that server 3321 MUST ensure that tenants are not able to push representations of 3322 resources that they do not have authority over. Failure to enforce 3323 this would allow a tenant to provide a representation that would be 3324 served out of cache, overriding the actual representation that the 3325 authoritative tenant provides. 3327 Pushed responses for which an origin server is not authoritative (see 3328 Section 10.1) MUST NOT be used or cached. 3330 10.5. Denial-of-Service Considerations 3332 An HTTP/2 connection can demand a greater commitment of resources to 3333 operate than an HTTP/1.1 connection. The use of field section 3334 compression and flow control depend on a commitment of resources for 3335 storing a greater amount of state. Settings for these features 3336 ensure that memory commitments for these features are strictly 3337 bounded. 3339 The number of PUSH_PROMISE frames is not constrained in the same 3340 fashion. A client that accepts server push SHOULD limit the number 3341 of streams it allows to be in the "reserved (remote)" state. An 3342 excessive number of server push streams can be treated as a stream 3343 error (Section 5.4.2) of type ENHANCE_YOUR_CALM. 3345 A number of HTTP/2 implementations were found to be vulnerable to 3346 denial of service [NFLX-2019-002]. The following lists known ways 3347 that implementations might be subject to denial of service attack: 3349 * Inefficient tracking of outstanding outbound frames can lead to 3350 overload if an adversary can cause large numbers of frames to be 3351 enqueued for sending. A peer could use one of several techniques 3352 to cause large numbers of frames to be generated: 3354 - Providing tiny increments to flow control in WINDOW_UPDATE 3355 frames can cause a sender to generate a large number of DATA 3356 frames. 3358 - An endpoint is required to respond to a PING frame. 3360 - Each SETTINGS frame requires acknowledgment. 3362 - An invalid request (or server push) can cause a peer to send 3363 RST_STREAM frames in response. 3365 * Large numbers of small or empty frames can be abused to cause a 3366 peer to expend time processing frame headers. Caution is required 3367 here as some uses of small frames are entirely legitimate, such as 3368 the sending of an empty DATA or CONTINUATION frame at the end of a 3369 stream. 3371 * The SETTINGS frame might also be abused to cause a peer to expend 3372 additional processing time. This might be done by pointlessly 3373 changing settings, sending multiple undefined settings, or 3374 changing the same setting multiple times in the same frame. 3376 * Handling reprioritization with PRIORITY frames can require 3377 significant processing time and can lead to overload if many 3378 PRIORITY frames are sent. 3380 * Field section compression also offers some opportunities to waste 3381 processing resources; see Section 7 of [COMPRESSION] for more 3382 details on potential abuses. 3384 * Limits in SETTINGS cannot be reduced instantaneously, which leaves 3385 an endpoint exposed to behavior from a peer that could exceed the 3386 new limits. In particular, immediately after establishing a 3387 connection, limits set by a server are not known to clients and 3388 could be exceeded without being an obvious protocol violation. 3390 * An attacker can provide large amounts of flow control credit at 3391 the HTTP/2 layer, but withhold credit at the TCP layer, preventing 3392 frames from being sent. An endpoint that constructs and remembers 3393 frames for sending without considering TCP limits might be subject 3394 to resource exhaustion. 3396 Most of the features that might be exploited for denial of service -- 3397 i.e., SETTINGS changes, small frames, field section compression -- 3398 have legitimate uses. These features become a burden only when they 3399 are used unnecessarily or to excess. 3401 An endpoint that doesn't monitor use of these features exposes itself 3402 to a risk of denial of service. Implementations SHOULD track the use 3403 of these features and set limits on their use. An endpoint MAY treat 3404 activity that is suspicious as a connection error (Section 5.4.1) of 3405 type ENHANCE_YOUR_CALM. 3407 10.5.1. Limits on Field Block Size 3409 A large field block (Section 4.3) can cause an implementation to 3410 commit a large amount of state. Field lines that are critical for 3411 routing can appear toward the end of a field block, which prevents 3412 streaming of fields to their ultimate destination. This ordering and 3413 other reasons, such as ensuring cache correctness, mean that an 3414 endpoint might need to buffer the entire field block. Since there is 3415 no hard limit to the size of a field block, some endpoints could be 3416 forced to commit a large amount of available memory for field blocks. 3418 An endpoint can use the SETTINGS_MAX_HEADER_LIST_SIZE to advise peers 3419 of limits that might apply on the size of uncompressed field blocks. 3420 This setting is only advisory, so endpoints MAY choose to send field 3421 blocks that exceed this limit and risk the request or response being 3422 treated as malformed. This setting is specific to a connection, so 3423 any request or response could encounter a hop with a lower, unknown 3424 limit. An intermediary can attempt to avoid this problem by passing 3425 on values presented by different peers, but they are not obliged to 3426 do so. 3428 A server that receives a larger field block than it is willing to 3429 handle can send an HTTP 431 (Request Header Fields Too Large) status 3430 code [RFC6585]. A client can discard responses that it cannot 3431 process. The field block MUST be processed to ensure a consistent 3432 connection state, unless the connection is closed. 3434 10.5.2. CONNECT Issues 3436 The CONNECT method can be used to create disproportionate load on an 3437 proxy, since stream creation is relatively inexpensive when compared 3438 to the creation and maintenance of a TCP connection. A proxy might 3439 also maintain some resources for a TCP connection beyond the closing 3440 of the stream that carries the CONNECT request, since the outgoing 3441 TCP connection remains in the TIME_WAIT state. Therefore, a proxy 3442 cannot rely on SETTINGS_MAX_CONCURRENT_STREAMS alone to limit the 3443 resources consumed by CONNECT requests. 3445 10.6. Use of Compression 3447 Compression can allow an attacker to recover secret data when it is 3448 compressed in the same context as data under attacker control. 3449 HTTP/2 enables compression of field lines (Section 4.3); the 3450 following concerns also apply to the use of HTTP compressed content- 3451 codings (Section 8.4.1 of [HTTP]). 3453 There are demonstrable attacks on compression that exploit the 3454 characteristics of the web (e.g., [BREACH]). The attacker induces 3455 multiple requests containing varying plaintext, observing the length 3456 of the resulting ciphertext in each, which reveals a shorter length 3457 when a guess about the secret is correct. 3459 Implementations communicating on a secure channel MUST NOT compress 3460 content that includes both confidential and attacker-controlled data 3461 unless separate compression dictionaries are used for each source of 3462 data. Compression MUST NOT be used if the source of data cannot be 3463 reliably determined. Generic stream compression, such as that 3464 provided by TLS, MUST NOT be used with HTTP/2 (see Section 9.2). 3466 Further considerations regarding the compression of header fields are 3467 described in [COMPRESSION]. 3469 10.7. Use of Padding 3471 Padding within HTTP/2 is not intended as a replacement for general 3472 purpose padding, such as that provided by TLS [TLS13]. Redundant 3473 padding could even be counterproductive. Correct application can 3474 depend on having specific knowledge of the data that is being padded. 3476 To mitigate attacks that rely on compression, disabling or limiting 3477 compression might be preferable to padding as a countermeasure. 3479 Padding can be used to obscure the exact size of frame content and is 3480 provided to mitigate specific attacks within HTTP, for example, 3481 attacks where compressed content includes both attacker-controlled 3482 plaintext and secret data (e.g., [BREACH]). 3484 Use of padding can result in less protection than might seem 3485 immediately obvious. At best, padding only makes it more difficult 3486 for an attacker to infer length information by increasing the number 3487 of frames an attacker has to observe. Incorrectly implemented 3488 padding schemes can be easily defeated. In particular, randomized 3489 padding with a predictable distribution provides very little 3490 protection; similarly, padding frame payloads to a fixed size exposes 3491 information as frame payload sizes cross the fixed-sized boundary, 3492 which could be possible if an attacker can control plaintext. 3494 Intermediaries SHOULD retain padding for DATA frames but MAY drop 3495 padding for HEADERS and PUSH_PROMISE frames. A valid reason for an 3496 intermediary to change the amount of padding of frames is to improve 3497 the protections that padding provides. 3499 10.8. Privacy Considerations 3501 Several characteristics of HTTP/2 provide an observer an opportunity 3502 to correlate actions of a single client or server over time. These 3503 include the value of settings, the manner in which flow-control 3504 windows are managed, the way priorities are allocated to streams, the 3505 timing of reactions to stimulus, and the handling of any features 3506 that are controlled by settings. 3508 As far as these create observable differences in behavior, they could 3509 be used as a basis for fingerprinting a specific client, as defined 3510 in Section 3.2 of [PRIVACY]. 3512 HTTP/2's preference for using a single TCP connection allows 3513 correlation of a user's activity on a site. Reusing connections for 3514 different origins allows tracking across those origins. 3516 Because the PING and SETTINGS frames solicit immediate responses, 3517 they can be used by an endpoint to measure latency to their peer. 3518 This might have privacy implications in certain scenarios. 3520 10.9. Remote Timing Attacks 3522 Remote timing attacks extract secrets from servers by observing 3523 variations in the time that servers take when processing requests 3524 that use secrets. HTTP/2 enables concurrent request creation and 3525 processing, which can give attackers better control over when request 3526 processing commences. Multiple HTTP/2 requests can be included in 3527 the same IP packet or TLS record. HTTP/2 can therefore make remote 3528 timing attacks more efficient by eliminating variability in request 3529 delivery, leaving only request order and the delivery of responses as 3530 sources of timing variability. 3532 Ensuring that processing time is not dependent on the value of 3533 secrets is the best defense against any form of timing attack. 3535 11. IANA Considerations 3537 This revision of the document marks the HTTP2-Settings header field 3538 and the h2c Upgrade token, both defined in [RFC7540], as obsolete. 3540 Section 11 of [RFC7540] registered the h2 and h2c ALPN identifiers 3541 along with the PRI HTTP method. RFC 7540 also established a registry 3542 for frame types, settings, and error codes. These registrations and 3543 registries apply to HTTP/2, but are not redefined in this document. 3545 [RFC Editor: please remove this paragraph.] IANA is requested to 3546 update references to RFC 7540 in the following registries to refer to 3547 this document: Application-Layer Protocol Negotiation (ALPN) Protocol 3548 IDs, HTTP/2 Frame Type, HTTP/2 Settings, HTTP/2 Error Code, and HTTP 3549 Method Registry. The registration of the PRI method needs to be 3550 updated to refer to Section 3.4; all other section numbers have not 3551 changed. 3553 11.1. HTTP2-Settings Header Field Registration 3555 This section marks the HTTP2-Settings header field registered by 3556 Section 11.5 of [RFC7540] in the Hypertext Transfer Protocol (HTTP) 3557 Field Name Registry as obsolete. This capability has been removed: 3558 see Section 3.1. The registration is updated to include the details 3559 as required by Section 18.4 of [HTTP]: 3561 Field Name: HTTP2-Settings 3563 Status: Standard 3565 Ref.: Section 3.2.1 of [RFC7540] 3567 Comments: Obsolete; see Section 11.1 3569 11.2. The h2c Upgrade Token 3571 This section records the h2c upgrade token registered by Section 11.8 3572 of [RFC7540] in the Hypertext Transfer Protocol (HTTP) Upgrade Token 3573 Registry as obsolete. This capability has been removed: see 3574 Section 3.1. The registration is updated as follows: 3576 Value: h2c 3578 Description: Hypertext Transfer Protocol version 2 (HTTP/2) 3580 Expected Version Tokens: None 3582 Reference: Section 3.1 of this document 3584 12. References 3586 12.1. Normative References 3588 [CACHE] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3589 Ed., "HTTP Caching", Work in Progress, Internet-Draft, 3590 draft-ietf-httpbis-cache-18, 18 August 2021, 3591 . 3594 [COMPRESSION] 3595 Peon, R. and H. Ruellan, "HPACK: Header Compression for 3596 HTTP/2", RFC 7541, May 2015, 3597 . 3599 [COOKIE] Barth, A., "HTTP State Management Mechanism", RFC 6265, 3600 April 2011, . 3602 [FIPS186] NIST, "Digital Signature Standard (DSS)", FIPS PUB 186-4, 3603 July 2013, . 3605 [HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3606 Ed., "HTTP Semantics", Work in Progress, Internet-Draft, 3607 draft-ietf-httpbis-semantics-18, 18 August 2021, 3608 . 3611 [QUIC] Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 3612 Multiplexed and Secure Transport", RFC 9000, 3613 DOI 10.17487/RFC9000, May 2021, 3614 . 3616 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3617 Requirement Levels", BCP 14, RFC 2119, March 1997, 3618 . 3620 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 3621 Resource Identifier (URI): Generic Syntax", STD 66, 3622 RFC 3986, January 2005, 3623 . 3625 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 3626 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 3627 May 2017, . 3629 [RFC8470] Thomson, M., Nottingham, M., and W. Tarreau, "Using Early 3630 Data in HTTP", RFC 8470, DOI 10.17487/RFC8470, September 3631 2018, . 3633 [TCP] Postel, J., "Transmission Control Protocol", STD 7, 3634 RFC 793, September 1981, 3635 . 3637 [TLS-ALPN] Friedl, S., Popov, A., Langley, A., and E. Stephan, 3638 "Transport Layer Security (TLS) Application-Layer Protocol 3639 Negotiation Extension", RFC 7301, July 2014, 3640 . 3642 [TLS-ECDHE] 3643 Rescorla, E., "TLS Elliptic Curve Cipher Suites with SHA- 3644 256/384 and AES Galois Counter Mode (GCM)", RFC 5289, 3645 August 2008, . 3647 [TLS-EXT] Eastlake 3rd, D., "Transport Layer Security (TLS) 3648 Extensions: Extension Definitions", RFC 6066, January 3649 2011, . 3651 [TLS12] Dierks, T. and E. Rescorla, "The Transport Layer Security 3652 (TLS) Protocol Version 1.2", RFC 5246, August 2008, 3653 . 3655 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 3656 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 3657 . 3659 12.2. Informative References 3661 [ALT-SVC] Nottingham, M., McManus, P., and J. Reschke, "HTTP 3662 Alternative Services", RFC 7838, April 2016, 3663 . 3665 [BREACH] Gluck, Y., Harris, N., and A. Prado, "BREACH: Reviving the 3666 CRIME Attack", 12 July 2013, 3667 . 3670 [DNS-TERMS] 3671 Hoffman, P., Sullivan, A., and K. Fujiwara, "DNS 3672 Terminology", BCP 219, RFC 8499, DOI 10.17487/RFC8499, 3673 January 2019, . 3675 [HTTP11] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3676 Ed., "HTTP/1.1", Work in Progress, Internet-Draft, draft- 3677 ietf-httpbis-messaging-18, 18 August 2021, 3678 . 3681 [I-D.ietf-httpbis-priority] 3682 Oku, K. and L. Pardue, "Extensible Prioritization Scheme 3683 for HTTP", Work in Progress, Internet-Draft, draft-ietf- 3684 httpbis-priority-04, 11 July 2021, 3685 . 3688 [NFLX-2019-002] 3689 Netflix, "HTTP/2 Denial of Service Advisory", 13 August 3690 2019, . 3693 [PRIVACY] Cooper, A., Tschofenig, H., Aboba, B., Peterson, J., 3694 Morris, J., Hansen, M., and R. Smith, "Privacy 3695 Considerations for Internet Protocols", RFC 6973, 3696 DOI 10.17487/RFC6973, July 2013, 3697 . 3699 [RFC3749] Hollenbeck, S., "Transport Layer Security Protocol 3700 Compression Methods", RFC 3749, May 2004, 3701 . 3703 [RFC6585] Nottingham, M. and R. Fielding, "Additional HTTP Status 3704 Codes", RFC 6585, April 2012, 3705 . 3707 [RFC7323] Borman, D., Braden, B., Jacobson, V., and R. 3708 Scheffenegger, Ed., "TCP Extensions for High Performance", 3709 RFC 7323, September 2014, 3710 . 3712 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 3713 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 3714 DOI 10.17487/RFC7540, May 2015, 3715 . 3717 [RFC8422] Nir, Y., Josefsson, S., and M. Pegourie-Gonnard, "Elliptic 3718 Curve Cryptography (ECC) Cipher Suites for Transport Layer 3719 Security (TLS) Versions 1.2 and Earlier", RFC 8422, August 3720 2018, . 3722 [RFC8441] McManus, P., "Bootstrapping WebSockets with HTTP/2", 3723 RFC 8441, DOI 10.17487/RFC8441, September 2018, 3724 . 3726 [RFC8740] Benjamin, D., "Using TLS 1.3 with HTTP/2", RFC 8740, 3727 DOI 10.17487/RFC8740, February 2020, 3728 . 3730 [TALKING] Huang, L., Chen, E., Barth, A., Rescorla, E., and C. 3731 Jackson, "Talking to Yourself for Fun and Profit", 2011, 3732 . 3734 [TLSBCP] Sheffer, Y., Holz, R., and P. Saint-Andre, 3735 "Recommendations for Secure Use of Transport Layer 3736 Security (TLS) and Datagram Transport Layer Security 3737 (DTLS)", BCP 195, RFC 7525, May 2015, 3738 . 3740 Appendix A. Prohibited TLS 1.2 Cipher Suites 3742 An HTTP/2 implementation MAY treat the negotiation of any of the 3743 following cipher suites with TLS 1.2 as a connection error 3744 (Section 5.4.1) of type INADEQUATE_SECURITY: 3746 * TLS_NULL_WITH_NULL_NULL 3747 * TLS_RSA_WITH_NULL_MD5 3748 * TLS_RSA_WITH_NULL_SHA 3749 * TLS_RSA_EXPORT_WITH_RC4_40_MD5 3750 * TLS_RSA_WITH_RC4_128_MD5 3751 * TLS_RSA_WITH_RC4_128_SHA 3752 * TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 3753 * TLS_RSA_WITH_IDEA_CBC_SHA 3754 * TLS_RSA_EXPORT_WITH_DES40_CBC_SHA 3755 * TLS_RSA_WITH_DES_CBC_SHA 3756 * TLS_RSA_WITH_3DES_EDE_CBC_SHA 3757 * TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA 3758 * TLS_DH_DSS_WITH_DES_CBC_SHA 3759 * TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA 3760 * TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA 3761 * TLS_DH_RSA_WITH_DES_CBC_SHA 3762 * TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA 3763 * TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA 3764 * TLS_DHE_DSS_WITH_DES_CBC_SHA 3765 * TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA 3766 * TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA 3767 * TLS_DHE_RSA_WITH_DES_CBC_SHA 3768 * TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 3769 * TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 3770 * TLS_DH_anon_WITH_RC4_128_MD5 3771 * TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA 3772 * TLS_DH_anon_WITH_DES_CBC_SHA 3773 * TLS_DH_anon_WITH_3DES_EDE_CBC_SHA 3774 * TLS_KRB5_WITH_DES_CBC_SHA 3775 * TLS_KRB5_WITH_3DES_EDE_CBC_SHA 3776 * TLS_KRB5_WITH_RC4_128_SHA 3777 * TLS_KRB5_WITH_IDEA_CBC_SHA 3778 * TLS_KRB5_WITH_DES_CBC_MD5 3779 * TLS_KRB5_WITH_3DES_EDE_CBC_MD5 3780 * TLS_KRB5_WITH_RC4_128_MD5 3781 * TLS_KRB5_WITH_IDEA_CBC_MD5 3782 * TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA 3783 * TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA 3784 * TLS_KRB5_EXPORT_WITH_RC4_40_SHA 3785 * TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 3786 * TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 3787 * TLS_KRB5_EXPORT_WITH_RC4_40_MD5 3788 * TLS_PSK_WITH_NULL_SHA 3789 * TLS_DHE_PSK_WITH_NULL_SHA 3790 * TLS_RSA_PSK_WITH_NULL_SHA 3791 * TLS_RSA_WITH_AES_128_CBC_SHA 3792 * TLS_DH_DSS_WITH_AES_128_CBC_SHA 3793 * TLS_DH_RSA_WITH_AES_128_CBC_SHA 3794 * TLS_DHE_DSS_WITH_AES_128_CBC_SHA 3795 * TLS_DHE_RSA_WITH_AES_128_CBC_SHA 3796 * TLS_DH_anon_WITH_AES_128_CBC_SHA 3797 * TLS_RSA_WITH_AES_256_CBC_SHA 3798 * TLS_DH_DSS_WITH_AES_256_CBC_SHA 3799 * TLS_DH_RSA_WITH_AES_256_CBC_SHA 3800 * TLS_DHE_DSS_WITH_AES_256_CBC_SHA 3801 * TLS_DHE_RSA_WITH_AES_256_CBC_SHA 3802 * TLS_DH_anon_WITH_AES_256_CBC_SHA 3803 * TLS_RSA_WITH_NULL_SHA256 3804 * TLS_RSA_WITH_AES_128_CBC_SHA256 3805 * TLS_RSA_WITH_AES_256_CBC_SHA256 3806 * TLS_DH_DSS_WITH_AES_128_CBC_SHA256 3807 * TLS_DH_RSA_WITH_AES_128_CBC_SHA256 3808 * TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 3809 * TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 3810 * TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 3811 * TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 3812 * TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 3813 * TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 3814 * TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA 3815 * TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 3816 * TLS_DH_DSS_WITH_AES_256_CBC_SHA256 3817 * TLS_DH_RSA_WITH_AES_256_CBC_SHA256 3818 * TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 3819 * TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 3820 * TLS_DH_anon_WITH_AES_128_CBC_SHA256 3821 * TLS_DH_anon_WITH_AES_256_CBC_SHA256 3822 * TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 3823 * TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 3824 * TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 3825 * TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 3826 * TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 3827 * TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA 3828 * TLS_PSK_WITH_RC4_128_SHA 3829 * TLS_PSK_WITH_3DES_EDE_CBC_SHA 3830 * TLS_PSK_WITH_AES_128_CBC_SHA 3831 * TLS_PSK_WITH_AES_256_CBC_SHA 3832 * TLS_DHE_PSK_WITH_RC4_128_SHA 3833 * TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA 3834 * TLS_DHE_PSK_WITH_AES_128_CBC_SHA 3835 * TLS_DHE_PSK_WITH_AES_256_CBC_SHA 3836 * TLS_RSA_PSK_WITH_RC4_128_SHA 3837 * TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA 3838 * TLS_RSA_PSK_WITH_AES_128_CBC_SHA 3839 * TLS_RSA_PSK_WITH_AES_256_CBC_SHA 3840 * TLS_RSA_WITH_SEED_CBC_SHA 3841 * TLS_DH_DSS_WITH_SEED_CBC_SHA 3842 * TLS_DH_RSA_WITH_SEED_CBC_SHA 3843 * TLS_DHE_DSS_WITH_SEED_CBC_SHA 3844 * TLS_DHE_RSA_WITH_SEED_CBC_SHA 3845 * TLS_DH_anon_WITH_SEED_CBC_SHA 3846 * TLS_RSA_WITH_AES_128_GCM_SHA256 3847 * TLS_RSA_WITH_AES_256_GCM_SHA384 3848 * TLS_DH_RSA_WITH_AES_128_GCM_SHA256 3849 * TLS_DH_RSA_WITH_AES_256_GCM_SHA384 3850 * TLS_DH_DSS_WITH_AES_128_GCM_SHA256 3851 * TLS_DH_DSS_WITH_AES_256_GCM_SHA384 3852 * TLS_DH_anon_WITH_AES_128_GCM_SHA256 3853 * TLS_DH_anon_WITH_AES_256_GCM_SHA384 3854 * TLS_PSK_WITH_AES_128_GCM_SHA256 3855 * TLS_PSK_WITH_AES_256_GCM_SHA384 3856 * TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 3857 * TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 3858 * TLS_PSK_WITH_AES_128_CBC_SHA256 3859 * TLS_PSK_WITH_AES_256_CBC_SHA384 3860 * TLS_PSK_WITH_NULL_SHA256 3861 * TLS_PSK_WITH_NULL_SHA384 3862 * TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 3863 * TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 3864 * TLS_DHE_PSK_WITH_NULL_SHA256 3865 * TLS_DHE_PSK_WITH_NULL_SHA384 3866 * TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 3867 * TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 3868 * TLS_RSA_PSK_WITH_NULL_SHA256 3869 * TLS_RSA_PSK_WITH_NULL_SHA384 3870 * TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 3871 * TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 3872 * TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 3873 * TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 3874 * TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 3875 * TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256 3876 * TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 3877 * TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 3878 * TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 3879 * TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 3880 * TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 3881 * TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256 3882 * TLS_EMPTY_RENEGOTIATION_INFO_SCSV 3883 * TLS_ECDH_ECDSA_WITH_NULL_SHA 3884 * TLS_ECDH_ECDSA_WITH_RC4_128_SHA 3885 * TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 3886 * TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 3887 * TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 3888 * TLS_ECDHE_ECDSA_WITH_NULL_SHA 3889 * TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 3890 * TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 3891 * TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 3892 * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 3893 * TLS_ECDH_RSA_WITH_NULL_SHA 3894 * TLS_ECDH_RSA_WITH_RC4_128_SHA 3895 * TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 3896 * TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 3897 * TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 3898 * TLS_ECDHE_RSA_WITH_NULL_SHA 3899 * TLS_ECDHE_RSA_WITH_RC4_128_SHA 3900 * TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 3901 * TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 3902 * TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 3903 * TLS_ECDH_anon_WITH_NULL_SHA 3904 * TLS_ECDH_anon_WITH_RC4_128_SHA 3905 * TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA 3906 * TLS_ECDH_anon_WITH_AES_128_CBC_SHA 3907 * TLS_ECDH_anon_WITH_AES_256_CBC_SHA 3908 * TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA 3909 * TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 3910 * TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 3911 * TLS_SRP_SHA_WITH_AES_128_CBC_SHA 3912 * TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 3913 * TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 3914 * TLS_SRP_SHA_WITH_AES_256_CBC_SHA 3915 * TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 3916 * TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 3917 * TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 3918 * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 3919 * TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 3920 * TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 3921 * TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 3922 * TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 3923 * TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 3924 * TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 3925 * TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 3926 * TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 3927 * TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 3928 * TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 3929 * TLS_ECDHE_PSK_WITH_RC4_128_SHA 3930 * TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 3931 * TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 3932 * TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 3933 * TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 3934 * TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 3935 * TLS_ECDHE_PSK_WITH_NULL_SHA 3936 * TLS_ECDHE_PSK_WITH_NULL_SHA256 3937 * TLS_ECDHE_PSK_WITH_NULL_SHA384 3938 * TLS_RSA_WITH_ARIA_128_CBC_SHA256 3939 * TLS_RSA_WITH_ARIA_256_CBC_SHA384 3940 * TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256 3941 * TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384 3942 * TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256 3943 * TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384 3944 * TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256 3945 * TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384 3946 * TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 3947 * TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 3948 * TLS_DH_anon_WITH_ARIA_128_CBC_SHA256 3949 * TLS_DH_anon_WITH_ARIA_256_CBC_SHA384 3950 * TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 3951 * TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 3952 * TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 3953 * TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 3954 * TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 3955 * TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 3956 * TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 3957 * TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 3958 * TLS_RSA_WITH_ARIA_128_GCM_SHA256 3959 * TLS_RSA_WITH_ARIA_256_GCM_SHA384 3960 * TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256 3961 * TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384 3962 * TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256 3963 * TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384 3964 * TLS_DH_anon_WITH_ARIA_128_GCM_SHA256 3965 * TLS_DH_anon_WITH_ARIA_256_GCM_SHA384 3966 * TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 3967 * TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 3968 * TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 3969 * TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 3970 * TLS_PSK_WITH_ARIA_128_CBC_SHA256 3971 * TLS_PSK_WITH_ARIA_256_CBC_SHA384 3972 * TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 3973 * TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 3974 * TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 3975 * TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 3976 * TLS_PSK_WITH_ARIA_128_GCM_SHA256 3977 * TLS_PSK_WITH_ARIA_256_GCM_SHA384 3978 * TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 3979 * TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 3980 * TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 3981 * TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 3982 * TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 3983 * TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 3984 * TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 3985 * TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 3986 * TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 3987 * TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 3988 * TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 3989 * TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 3990 * TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 3991 * TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 3992 * TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256 3993 * TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384 3994 * TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256 3995 * TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384 3996 * TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256 3997 * TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384 3998 * TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 3999 * TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 4000 * TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 4001 * TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 4002 * TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 4003 * TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 4004 * TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 4005 * TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 4006 * TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 4007 * TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 4008 * TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 4009 * TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 4010 * TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 4011 * TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 4012 * TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 4013 * TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 4014 * TLS_RSA_WITH_AES_128_CCM 4015 * TLS_RSA_WITH_AES_256_CCM 4016 * TLS_RSA_WITH_AES_128_CCM_8 4017 * TLS_RSA_WITH_AES_256_CCM_8 4018 * TLS_PSK_WITH_AES_128_CCM 4019 * TLS_PSK_WITH_AES_256_CCM 4020 * TLS_PSK_WITH_AES_128_CCM_8 4021 * TLS_PSK_WITH_AES_256_CCM_8 4022 | Note: This list was assembled from the set of registered TLS 4023 | cipher suites when [RFC7540] was developed. This list includes 4024 | those cipher suites that do not offer an ephemeral key exchange 4025 | and those that are based on the TLS null, stream, or block 4026 | cipher type (as defined in Section 6.2.3 of [TLS12]). 4027 | Additional cipher suites with these properties could be 4028 | defined; these would not be explicitly prohibited. 4030 Appendix B. Changes from RFC 7540 4032 This revision includes a number of editorial updates, plus the 4033 following substantive changes: 4035 * Use of TLS 1.3 was defined based on RFC 8740, which this document 4036 obsoletes. 4038 * The priority scheme defined in RFC 7540 is deprecated. 4039 Definitions for the format of the PRIORITY frame and the priority 4040 fields in the HEADERS frame have been retained, plus the rules 4041 governing when PRIORITY frames can be sent and received, but the 4042 semantics of these fields are only described in RFC 7540. The 4043 priority signaling scheme from RFC 7540 was not successful. Using 4044 the simpler successor signaling [I-D.ietf-httpbis-priority] is 4045 recommended. 4047 * The HTTP/1.1 Upgrade mechanism is no longer specified in this 4048 document. It was never widely deployed, with plaintext HTTP/2 4049 users choosing to use the prior-knowledge implementation instead. 4051 * Validation for field names and values has been narrowed. The 4052 validation that is mandatory for intermediaries is precisely 4053 defined and error reporting for requests has been amended to 4054 encourage sending 400-series status codes. 4056 * The ranges of codepoints for settings and frame types that were 4057 reserved for "Experimental Use" are now available for general use. 4059 * Connection-specific header fields - which are prohibited - are 4060 more precisely and comprehensively identified. 4062 * Host and :authority are no longer permitted to disagree. 4064 Contributors 4066 The previous version of this document was authored by Mike Belshe and 4067 Roberto Peon. 4069 Acknowledgments 4071 Credit for non-trivial input to this document is owed to a large 4072 number of people who have contributed to the HTTP working group over 4073 the years. [RFC7540] contains a more extensive list of people that 4074 deserve acknowledgment for their contributions. 4076 Authors' Addresses 4078 Martin Thomson (editor) 4079 Mozilla 4080 Australia 4082 Email: mt@lowentropy.net 4084 Cory Benfield (editor) 4085 Apple Inc. 4087 Email: cbenfield@apple.com