idnits 2.17.00 (12 Aug 2021) /tmp/idnits42581/draft-ietf-quic-http-24.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 abstract seems to contain references ([2], [3], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 04, 2019) is 928 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 2071 -- Looks like a reference, but probably isn't: '2' on line 2073 -- Looks like a reference, but probably isn't: '3' on line 2075 -- Looks like a reference, but probably isn't: '4' on line 2077 == Outdated reference: A later version (-21) exists of draft-ietf-quic-qpack-11 == Outdated reference: draft-ietf-quic-transport has been published as RFC 9000 -- Duplicate reference: RFC7838, mentioned in 'RFC7838', was also mentioned in 'ALTSVC'. ** Downref: Normative reference to an Historic RFC: RFC 8164 Summary: 2 errors (**), 0 flaws (~~), 3 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 QUIC M. Bishop, Ed. 3 Internet-Draft Akamai 4 Intended status: Standards Track November 04, 2019 5 Expires: May 7, 2020 7 Hypertext Transfer Protocol Version 3 (HTTP/3) 8 draft-ietf-quic-http-24 10 Abstract 12 The QUIC transport protocol has several features that are desirable 13 in a transport for HTTP, such as stream multiplexing, per-stream flow 14 control, and low-latency connection establishment. This document 15 describes a mapping of HTTP semantics over QUIC. This document also 16 identifies HTTP/2 features that are subsumed by QUIC, and describes 17 how HTTP/2 extensions can be ported to HTTP/3. 19 Note to Readers 21 Discussion of this draft takes place on the QUIC working group 22 mailing list (quic@ietf.org), which is archived at 23 https://mailarchive.ietf.org/arch/search/?email_list=quic [1]. 25 Working Group information can be found at https://github.com/quicwg 26 [2]; source code and issues list for this draft can be found at 27 https://github.com/quicwg/base-drafts/labels/-http [3]. 29 Status of This Memo 31 This Internet-Draft is submitted in full conformance with the 32 provisions of BCP 78 and BCP 79. 34 Internet-Drafts are working documents of the Internet Engineering 35 Task Force (IETF). Note that other groups may also distribute 36 working documents as Internet-Drafts. The list of current Internet- 37 Drafts is at https://datatracker.ietf.org/drafts/current/. 39 Internet-Drafts are draft documents valid for a maximum of six months 40 and may be updated, replaced, or obsoleted by other documents at any 41 time. It is inappropriate to use Internet-Drafts as reference 42 material or to cite them other than as "work in progress." 44 This Internet-Draft will expire on May 7, 2020. 46 Copyright Notice 48 Copyright (c) 2019 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (https://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 64 1.1. Prior versions of HTTP . . . . . . . . . . . . . . . . . 4 65 1.2. Delegation to QUIC . . . . . . . . . . . . . . . . . . . 5 66 2. HTTP/3 Protocol Overview . . . . . . . . . . . . . . . . . . 5 67 2.1. Document Organization . . . . . . . . . . . . . . . . . . 6 68 2.2. Conventions and Terminology . . . . . . . . . . . . . . . 6 69 3. Connection Setup and Management . . . . . . . . . . . . . . . 8 70 3.1. Draft Version Identification . . . . . . . . . . . . . . 8 71 3.2. Discovering an HTTP/3 Endpoint . . . . . . . . . . . . . 8 72 3.3. Connection Establishment . . . . . . . . . . . . . . . . 9 73 3.4. Connection Reuse . . . . . . . . . . . . . . . . . . . . 9 74 4. HTTP Request Lifecycle . . . . . . . . . . . . . . . . . . . 10 75 4.1. HTTP Message Exchanges . . . . . . . . . . . . . . . . . 10 76 4.1.1. Header Formatting and Compression . . . . . . . . . . 12 77 4.1.2. Request Cancellation and Rejection . . . . . . . . . 13 78 4.1.3. Malformed Requests and Responses . . . . . . . . . . 13 79 4.2. The CONNECT Method . . . . . . . . . . . . . . . . . . . 14 80 4.3. HTTP Upgrade . . . . . . . . . . . . . . . . . . . . . . 15 81 4.4. Server Push . . . . . . . . . . . . . . . . . . . . . . . 15 82 5. Connection Closure . . . . . . . . . . . . . . . . . . . . . 17 83 5.1. Idle Connections . . . . . . . . . . . . . . . . . . . . 17 84 5.2. Connection Shutdown . . . . . . . . . . . . . . . . . . . 17 85 5.3. Immediate Application Closure . . . . . . . . . . . . . . 19 86 5.4. Transport Closure . . . . . . . . . . . . . . . . . . . . 19 87 6. Stream Mapping and Usage . . . . . . . . . . . . . . . . . . 19 88 6.1. Bidirectional Streams . . . . . . . . . . . . . . . . . . 20 89 6.2. Unidirectional Streams . . . . . . . . . . . . . . . . . 20 90 6.2.1. Control Streams . . . . . . . . . . . . . . . . . . . 21 91 6.2.2. Push Streams . . . . . . . . . . . . . . . . . . . . 22 92 6.2.3. Reserved Stream Types . . . . . . . . . . . . . . . . 23 93 7. HTTP Framing Layer . . . . . . . . . . . . . . . . . . . . . 23 94 7.1. Frame Layout . . . . . . . . . . . . . . . . . . . . . . 24 95 7.2. Frame Definitions . . . . . . . . . . . . . . . . . . . . 25 96 7.2.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . 25 97 7.2.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 26 98 7.2.3. CANCEL_PUSH . . . . . . . . . . . . . . . . . . . . . 26 99 7.2.4. SETTINGS . . . . . . . . . . . . . . . . . . . . . . 27 100 7.2.5. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . 30 101 7.2.6. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . 31 102 7.2.7. MAX_PUSH_ID . . . . . . . . . . . . . . . . . . . . . 32 103 7.2.8. DUPLICATE_PUSH . . . . . . . . . . . . . . . . . . . 32 104 7.2.9. Reserved Frame Types . . . . . . . . . . . . . . . . 33 105 8. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 34 106 8.1. HTTP/3 Error Codes . . . . . . . . . . . . . . . . . . . 34 107 9. Extensions to HTTP/3 . . . . . . . . . . . . . . . . . . . . 35 108 10. Security Considerations . . . . . . . . . . . . . . . . . . . 36 109 10.1. Traffic Analysis . . . . . . . . . . . . . . . . . . . . 36 110 10.2. Frame Parsing . . . . . . . . . . . . . . . . . . . . . 37 111 10.3. Early Data . . . . . . . . . . . . . . . . . . . . . . . 37 112 10.4. Migration . . . . . . . . . . . . . . . . . . . . . . . 37 113 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 37 114 11.1. Registration of HTTP/3 Identification String . . . . . . 37 115 11.2. Frame Types . . . . . . . . . . . . . . . . . . . . . . 37 116 11.3. Settings Parameters . . . . . . . . . . . . . . . . . . 39 117 11.4. Error Codes . . . . . . . . . . . . . . . . . . . . . . 40 118 11.5. Stream Types . . . . . . . . . . . . . . . . . . . . . . 42 119 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 43 120 12.1. Normative References . . . . . . . . . . . . . . . . . . 43 121 12.2. Informative References . . . . . . . . . . . . . . . . . 45 122 12.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 45 123 Appendix A. Considerations for Transitioning from HTTP/2 . . . . 45 124 A.1. Streams . . . . . . . . . . . . . . . . . . . . . . . . . 46 125 A.2. HTTP Frame Types . . . . . . . . . . . . . . . . . . . . 46 126 A.2.1. Prioritization Differences . . . . . . . . . . . . . 47 127 A.2.2. Header Compression Differences . . . . . . . . . . . 47 128 A.2.3. Guidance for New Frame Type Definitions . . . . . . . 48 129 A.2.4. Mapping Between HTTP/2 and HTTP/3 Frame Types . . . . 48 130 A.3. HTTP/2 SETTINGS Parameters . . . . . . . . . . . . . . . 49 131 A.4. HTTP/2 Error Codes . . . . . . . . . . . . . . . . . . . 50 132 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 51 133 B.1. Since draft-ietf-quic-http-23 . . . . . . . . . . . . . . 51 134 B.2. Since draft-ietf-quic-http-22 . . . . . . . . . . . . . . 51 135 B.3. Since draft-ietf-quic-http-21 . . . . . . . . . . . . . . 52 136 B.4. Since draft-ietf-quic-http-20 . . . . . . . . . . . . . . 52 137 B.5. Since draft-ietf-quic-http-19 . . . . . . . . . . . . . . 53 138 B.6. Since draft-ietf-quic-http-18 . . . . . . . . . . . . . . 53 139 B.7. Since draft-ietf-quic-http-17 . . . . . . . . . . . . . . 54 140 B.8. Since draft-ietf-quic-http-16 . . . . . . . . . . . . . . 54 141 B.9. Since draft-ietf-quic-http-15 . . . . . . . . . . . . . . 54 142 B.10. Since draft-ietf-quic-http-14 . . . . . . . . . . . . . . 55 143 B.11. Since draft-ietf-quic-http-13 . . . . . . . . . . . . . . 55 144 B.12. Since draft-ietf-quic-http-12 . . . . . . . . . . . . . . 55 145 B.13. Since draft-ietf-quic-http-11 . . . . . . . . . . . . . . 56 146 B.14. Since draft-ietf-quic-http-10 . . . . . . . . . . . . . . 56 147 B.15. Since draft-ietf-quic-http-09 . . . . . . . . . . . . . . 56 148 B.16. Since draft-ietf-quic-http-08 . . . . . . . . . . . . . . 56 149 B.17. Since draft-ietf-quic-http-07 . . . . . . . . . . . . . . 56 150 B.18. Since draft-ietf-quic-http-06 . . . . . . . . . . . . . . 56 151 B.19. Since draft-ietf-quic-http-05 . . . . . . . . . . . . . . 56 152 B.20. Since draft-ietf-quic-http-04 . . . . . . . . . . . . . . 57 153 B.21. Since draft-ietf-quic-http-03 . . . . . . . . . . . . . . 57 154 B.22. Since draft-ietf-quic-http-02 . . . . . . . . . . . . . . 57 155 B.23. Since draft-ietf-quic-http-01 . . . . . . . . . . . . . . 57 156 B.24. Since draft-ietf-quic-http-00 . . . . . . . . . . . . . . 58 157 B.25. Since draft-shade-quic-http2-mapping-00 . . . . . . . . . 58 158 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 58 159 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 58 161 1. Introduction 163 HTTP semantics are used for a broad range of services on the 164 Internet. These semantics have commonly been used with two different 165 TCP mappings, HTTP/1.1 and HTTP/2. HTTP/3 supports the same 166 semantics over a new transport protocol, QUIC. 168 1.1. Prior versions of HTTP 170 HTTP/1.1 is a TCP mapping which uses whitespace-delimited text fields 171 to convey HTTP messages. While these exchanges are human-readable, 172 using whitespace for message formatting leads to parsing difficulties 173 and workarounds to be tolerant of variant behavior. Because each 174 connection can transfer only a single HTTP request or response at a 175 time in each direction, multiple parallel TCP connections are often 176 used, reducing the ability of the congestion controller to accurately 177 manage traffic between endpoints. 179 HTTP/2 introduced a binary framing and multiplexing layer to improve 180 latency without modifying the transport layer. However, because the 181 parallel nature of HTTP/2's multiplexing is not visible to TCP's loss 182 recovery mechanisms, a lost or reordered packet causes all active 183 transactions to experience a stall regardless of whether that 184 transaction was impacted by the lost packet. 186 1.2. Delegation to QUIC 188 The QUIC transport protocol incorporates stream multiplexing and per- 189 stream flow control, similar to that provided by the HTTP/2 framing 190 layer. By providing reliability at the stream level and congestion 191 control across the entire connection, it has the capability to 192 improve the performance of HTTP compared to a TCP mapping. QUIC also 193 incorporates TLS 1.3 at the transport layer, offering comparable 194 security to running TLS over TCP, with the improved connection setup 195 latency of TCP Fast Open [RFC7413]. 197 This document defines a mapping of HTTP semantics over the QUIC 198 transport protocol, drawing heavily on the design of HTTP/2. While 199 delegating stream lifetime and flow control issues to QUIC, a similar 200 binary framing is used on each stream. Some HTTP/2 features are 201 subsumed by QUIC, while other features are implemented atop QUIC. 203 QUIC is described in [QUIC-TRANSPORT]. For a full description of 204 HTTP/2, see [HTTP2]. 206 2. HTTP/3 Protocol Overview 208 HTTP/3 provides a transport for HTTP semantics using the QUIC 209 transport protocol and an internal framing layer similar to HTTP/2. 211 Once a client knows that an HTTP/3 server exists at a certain 212 endpoint, it opens a QUIC connection. QUIC provides protocol 213 negotiation, stream-based multiplexing, and flow control. An HTTP/3 214 endpoint can be discovered using HTTP Alternative Services; this 215 process is described in greater detail in Section 3.2. 217 Within each stream, the basic unit of HTTP/3 communication is a frame 218 (Section 7.2). Each frame type serves a different purpose. For 219 example, HEADERS and DATA frames form the basis of HTTP requests and 220 responses (Section 4.1). 222 Multiplexing of requests is performed using the QUIC stream 223 abstraction, described in Section 2 of [QUIC-TRANSPORT]. Each 224 request and response consumes a single QUIC stream. Streams are 225 independent of each other, so one stream that is blocked or suffers 226 packet loss does not prevent progress on other streams. 228 Server push is an interaction mode introduced in HTTP/2 [HTTP2] which 229 permits a server to push a request-response exchange to a client in 230 anticipation of the client making the indicated request. This trades 231 off network usage against a potential latency gain. Several HTTP/3 232 frames are used to manage server push, such as PUSH_PROMISE, 233 DUPLICATE_PUSH, MAX_PUSH_ID, and CANCEL_PUSH. 235 As in HTTP/2, request and response headers are compressed for 236 transmission. Because HPACK [HPACK] relies on in-order transmission 237 of compressed header blocks (a guarantee not provided by QUIC), 238 HTTP/3 replaces HPACK with QPACK [QPACK]. QPACK uses separate 239 unidirectional streams to modify and track header table state, while 240 header blocks refer to the state of the table without modifying it. 242 2.1. Document Organization 244 The HTTP/3 specification is split into seven parts. The document 245 begins with a detailed overview of the connection lifecycle and key 246 concepts: 248 o Connection Setup and Management (Section 3) covers how an HTTP/3 249 endpoint is discovered and a connection is established. 251 o HTTP Request Lifecycle (Section 4) describes how HTTP semantics 252 are expressed using frames. 254 o Connection Closure (Section 5) describes how connections are 255 terminated, either gracefully or abruptly. 257 The details of the wire protocol and interactions with the transport 258 are described in subsequent sections: 260 o Stream Mapping and Usage (Section 6) describes the way QUIC 261 streams are used. 263 o HTTP Framing Layer (Section 7) describes the frames used on most 264 streams. 266 o Error Handling (Section 8) describes how error conditions are 267 handled and expressed, either on a particular stream or for the 268 connection as a whole. 270 Additional resources are provided in the final sections: 272 o Extensions to HTTP/3 (Section 9) describes how new capabilities 273 can be added in future documents. 275 o A more detailed comparison between HTTP/2 and HTTP/3 can be found 276 in Appendix A. 278 2.2. Conventions and Terminology 280 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 281 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 282 "OPTIONAL" in this document are to be interpreted as described in BCP 283 14 [RFC2119] [RFC8174] when, and only when, they appear in all 284 capitals, as shown here. 286 Field definitions are given in Augmented Backus-Naur Form (ABNF), as 287 defined in [RFC5234]. 289 This document uses the variable-length integer encoding from 290 [QUIC-TRANSPORT]. 292 The following terms are used: 294 abort: An abrupt termination of a connection or stream, possibly due 295 to an error condition. 297 client: The endpoint that initiates an HTTP/3 connection. Clients 298 send HTTP requests and receive HTTP responses. 300 connection: A transport-layer connection between two endpoints, 301 using QUIC as the transport protocol. 303 connection error: An error that affects the entire HTTP/3 304 connection. 306 endpoint: Either the client or server of the connection. 308 frame: The smallest unit of communication on a stream in HTTP/3, 309 consisting of a header and a variable-length sequence of bytes 310 structured according to the frame type. Protocol elements called 311 "frames" exist in both this document and [QUIC-TRANSPORT]. Where 312 frames from [QUIC-TRANSPORT] are referenced, the frame name will 313 be prefaced with "QUIC." For example, "QUIC CONNECTION_CLOSE 314 frames." References without this preface refer to frames defined 315 in Section 7.2. 317 peer: An endpoint. When discussing a particular endpoint, "peer" 318 refers to the endpoint that is remote to the primary subject of 319 discussion. 321 receiver: An endpoint that is receiving frames. 323 sender: An endpoint that is transmitting frames. 325 server: The endpoint that accepts an HTTP/3 connection. Servers 326 receive HTTP requests and send HTTP responses. 328 stream: A bidirectional or unidirectional bytestream provided by the 329 QUIC transport. 331 stream error: An error on the individual HTTP/3 stream. 333 The term "payload body" is defined in Section 3.3 of [RFC7230]. 335 Finally, the terms "gateway", "intermediary", "proxy", and "tunnel" 336 are defined in Section 2.3 of [RFC7230]. Intermediaries act as both 337 client and server at different times. 339 3. Connection Setup and Management 341 3.1. Draft Version Identification 343 *RFC Editor's Note:* Please remove this section prior to 344 publication of a final version of this document. 346 HTTP/3 uses the token "h3" to identify itself in ALPN and Alt-Svc. 347 Only implementations of the final, published RFC can identify 348 themselves as "h3". Until such an RFC exists, implementations MUST 349 NOT identify themselves using this string. 351 Implementations of draft versions of the protocol MUST add the string 352 "-" and the corresponding draft number to the identifier. For 353 example, draft-ietf-quic-http-01 is identified using the string 354 "h3-01". 356 Non-compatible experiments that are based on these draft versions 357 MUST append the string "-" and an experiment name to the identifier. 358 For example, an experimental implementation based on draft-ietf-quic- 359 http-09 which reserves an extra stream for unsolicited transmission 360 of 1980s pop music might identify itself as "h3-09-rickroll". Note 361 that any label MUST conform to the "token" syntax defined in 362 Section 3.2.6 of [RFC7230]. Experimenters are encouraged to 363 coordinate their experiments on the quic@ietf.org mailing list. 365 3.2. Discovering an HTTP/3 Endpoint 367 An HTTP origin advertises the availability of an equivalent HTTP/3 368 endpoint via the Alt-Svc HTTP response header field or the HTTP/2 369 ALTSVC frame ([ALTSVC]), using the ALPN token defined in Section 3.3. 371 For example, an origin could indicate in an HTTP response that HTTP/3 372 was available on UDP port 50781 at the same hostname by including the 373 following header field: 375 Alt-Svc: h3=":50781" 377 On receipt of an Alt-Svc record indicating HTTP/3 support, a client 378 MAY attempt to establish a QUIC connection to the indicated host and 379 port and, if successful, send HTTP requests using the mapping 380 described in this document. 382 Connectivity problems (e.g. firewall blocking UDP) can result in QUIC 383 connection establishment failure, in which case the client SHOULD 384 continue using the existing connection or try another alternative 385 endpoint offered by the origin. 387 Servers MAY serve HTTP/3 on any UDP port, since an alternative always 388 includes an explicit port. 390 3.3. Connection Establishment 392 HTTP/3 relies on QUIC as the underlying transport. The QUIC version 393 being used MUST use TLS version 1.3 or greater as its handshake 394 protocol. HTTP/3 clients MUST indicate the target domain name during 395 the TLS handshake. This may be done using the Server Name Indication 396 (SNI) [RFC6066] extension to TLS or using some other mechanism. 398 QUIC connections are established as described in [QUIC-TRANSPORT]. 399 During connection establishment, HTTP/3 support is indicated by 400 selecting the ALPN token "h3" in the TLS handshake. Support for 401 other application-layer protocols MAY be offered in the same 402 handshake. 404 While connection-level options pertaining to the core QUIC protocol 405 are set in the initial crypto handshake, HTTP/3-specific settings are 406 conveyed in the SETTINGS frame. After the QUIC connection is 407 established, a SETTINGS frame (Section 7.2.4) MUST be sent by each 408 endpoint as the initial frame of their respective HTTP control stream 409 (see Section 6.2.1). 411 3.4. Connection Reuse 413 Once a connection exists to a server endpoint, this connection MAY be 414 reused for requests with multiple different URI authority components. 415 The client MAY send any requests for which the client considers the 416 server authoritative. 418 An authoritative HTTP/3 endpoint is typically discovered because the 419 client has received an Alt-Svc record from the request's origin which 420 nominates the endpoint as a valid HTTP Alternative Service for that 421 origin. As required by [RFC7838], clients MUST check that the 422 nominated server can present a valid certificate for the origin 423 before considering it authoritative. Clients MUST NOT assume that an 424 HTTP/3 endpoint is authoritative for other origins without an 425 explicit signal. 427 Prior to making requests for an origin whose scheme is not "https," 428 the client MUST ensure the server is willing to serve that scheme. 429 If the client intends to make requests for an origin whose scheme is 430 "http", this means that it MUST obtain a valid "http-opportunistic" 431 response for the origin as described in [RFC8164] prior to making any 432 such requests. Other schemes might define other mechanisms. 434 A server that does not wish clients to reuse connections for a 435 particular origin can indicate that it is not authoritative for a 436 request by sending a 421 (Misdirected Request) status code in 437 response to the request (see Section 9.1.2 of [HTTP2]). 439 The considerations discussed in Section 9.1 of [HTTP2] also apply to 440 the management of HTTP/3 connections. 442 4. HTTP Request Lifecycle 444 4.1. HTTP Message Exchanges 446 A client sends an HTTP request on a client-initiated bidirectional 447 QUIC stream. A client MUST send only a single request on a given 448 stream. A server sends zero or more non-final HTTP responses on the 449 same stream as the request, followed by a single final HTTP response, 450 as detailed below. 452 An HTTP message (request or response) consists of: 454 1. the message header (see [RFC7230], Section 3.2), sent as a single 455 HEADERS frame (see Section 7.2.2), 457 2. optionally, the payload body, if present (see [RFC7230], 458 Section 3.3), sent as a series of DATA frames (see 459 Section 7.2.1), 461 3. optionally, trailing headers, if present (see [RFC7230], 462 Section 4.1.2), sent as a single HEADERS frame. 464 A server MAY send one or more PUSH_PROMISE frames (see Section 7.2.5) 465 before, after, or interleaved with the frames of a response message. 466 These PUSH_PROMISE frames are not part of the response; see 467 Section 4.4 for more details. 469 Frames of unknown types (Section 9), including reserved frames 470 (Section 7.2.9) MAY be sent on a request or push stream before, 471 after, or interleaved with other frames described in this section. 473 The HEADERS and PUSH_PROMISE frames might reference updates to the 474 QPACK dynamic table. While these updates are not directly part of 475 the message exchange, they must be received and processed before the 476 message can be consumed. See Section 4.1.1 for more details. 478 The "chunked" transfer encoding defined in Section 4.1 of [RFC7230] 479 MUST NOT be used. 481 A response MAY consist of multiple messages when and only when one or 482 more informational responses (1xx; see [RFC7231], Section 6.2) 483 precede a final response to the same request. Non-final responses do 484 not contain a payload body or trailers. 486 If an endpoint receives an invalid sequence of frames on either a 487 request or a push stream, it MUST respond with a connection error of 488 type H3_FRAME_UNEXPECTED (Section 8). In particular, a DATA frame 489 before any HEADERS frame, or a HEADERS or DATA frame after the 490 trailing HEADERS frame is considered invalid. 492 An HTTP request/response exchange fully consumes a bidirectional QUIC 493 stream. After sending a request, a client MUST close the stream for 494 sending. Unless using the CONNECT method (see Section 4.2), clients 495 MUST NOT make stream closure dependent on receiving a response to 496 their request. After sending a final response, the server MUST close 497 the stream for sending. At this point, the QUIC stream is fully 498 closed. 500 When a stream is closed, this indicates the end of an HTTP message. 501 Because some messages are large or unbounded, endpoints SHOULD begin 502 processing partial HTTP messages once enough of the message has been 503 received to make progress. If a client stream terminates without 504 enough of the HTTP message to provide a complete response, the server 505 SHOULD abort its response with the error code H3_REQUEST_INCOMPLETE. 507 A server can send a complete response prior to the client sending an 508 entire request if the response does not depend on any portion of the 509 request that has not been sent and received. When the server does 510 not need to receive the remainder of the request, it MAY abort 511 reading the request stream with error code H3_EARLY_RESPONSE, send a 512 complete response, and cleanly close the sending part of the stream. 513 Clients MUST NOT discard complete responses as a result of having 514 their request terminated abruptly, though clients can always discard 515 responses at their discretion for other reasons. If the server sends 516 a partial or complete response but does not abort reading, clients 517 SHOULD continue sending the body of the request and close the stream 518 normally. 520 4.1.1. Header Formatting and Compression 522 HTTP message headers carry information as a series of key-value 523 pairs, called header fields. For a listing of registered HTTP header 524 fields, see the "Message Header Field" registry maintained at 525 https://www.iana.org/assignments/message-headers [4]. 527 Just as in previous versions of HTTP, header field names are strings 528 of ASCII characters that are compared in a case-insensitive fashion. 529 Properties of HTTP header field names and values are discussed in 530 more detail in Section 3.2 of [RFC7230], though the wire rendering in 531 HTTP/3 differs. As in HTTP/2, header field names MUST be converted 532 to lowercase prior to their encoding. A request or response 533 containing uppercase header field names MUST be treated as malformed 534 (Section 4.1.3). 536 As in HTTP/2, HTTP/3 uses special pseudo-header fields beginning with 537 the ':' character (ASCII 0x3a) to convey the target URI, the method 538 of the request, and the status code for the response. These pseudo- 539 header fields are defined in Section 8.1.2.3 and 8.1.2.4 of [HTTP2]. 540 Pseudo-header fields are not HTTP header fields. Endpoints MUST NOT 541 generate pseudo-header fields other than those defined in [HTTP2]. 542 The restrictions on the use of pseudo-header fields in Section 8.1.2 543 of [HTTP2] also apply to HTTP/3. Messages which are considered 544 malformed under these restrictions are handled as described in 545 Section 4.1.3. 547 HTTP/3 uses QPACK header compression as described in [QPACK], a 548 variation of HPACK which allows the flexibility to avoid header- 549 compression-induced head-of-line blocking. See that document for 550 additional details. 552 To allow for better compression efficiency, the cookie header field 553 [RFC6265] MAY be split into separate header fields, each with one or 554 more cookie-pairs, before compression. If a decompressed header list 555 contains multiple cookie header fields, these MUST be concatenated 556 before being passed into a non-HTTP/2, non-HTTP/3 context, as 557 described in [HTTP2], Section 8.1.2.5. 559 An HTTP/3 implementation MAY impose a limit on the maximum size of 560 the message header it will accept on an individual HTTP message. A 561 server that receives a larger header field list than it is willing to 562 handle can send an HTTP 431 (Request Header Fields Too Large) status 563 code [RFC6585]. A client can discard responses that it cannot 564 process. The size of a header field list is calculated based on the 565 uncompressed size of header fields, including the length of the name 566 and value in bytes plus an overhead of 32 bytes for each header 567 field. 569 If an implementation wishes to advise its peer of this limit, it can 570 be conveyed as a number of bytes in the 571 "SETTINGS_MAX_HEADER_LIST_SIZE" parameter. An implementation which 572 has received this parameter SHOULD NOT send an HTTP message header 573 which exceeds the indicated size, as the peer will likely refuse to 574 process it. However, because this limit is applied at each hop, 575 messages below this limit are not guaranteed to be accepted. 577 4.1.2. Request Cancellation and Rejection 579 Clients can cancel requests by resetting and aborting the request 580 stream with an error code of H3_REQUEST_CANCELLED (Section 8.1). 581 When the client aborts reading a response, it indicates that this 582 response is no longer of interest. Implementations SHOULD cancel 583 requests by abruptly terminating any directions of a stream that are 584 still open. 586 When the server rejects a request without performing any application 587 processing, it SHOULD abort its response stream with the error code 588 H3_REQUEST_REJECTED. In this context, "processed" means that some 589 data from the stream was passed to some higher layer of software that 590 might have taken some action as a result. The client can treat 591 requests rejected by the server as though they had never been sent at 592 all, thereby allowing them to be retried later on a new connection. 593 Servers MUST NOT use the H3_REQUEST_REJECTED error code for requests 594 which were partially or fully processed. When a server abandons a 595 response after partial processing, it SHOULD abort its response 596 stream with the error code H3_REQUEST_CANCELLED. 598 When a client resets a request with the error code 599 H3_REQUEST_CANCELLED, a server MAY abruptly terminate the response 600 using the error code H3_REQUEST_REJECTED if no processing was 601 performed. Clients MUST NOT use the H3_REQUEST_REJECTED error code, 602 except when a server has requested closure of the request stream with 603 this error code. 605 If a stream is cancelled after receiving a complete response, the 606 client MAY ignore the cancellation and use the response. However, if 607 a stream is cancelled after receiving a partial response, the 608 response SHOULD NOT be used. Automatically retrying such requests is 609 not possible, unless this is otherwise permitted (e.g., idempotent 610 actions like GET, PUT, or DELETE). 612 4.1.3. Malformed Requests and Responses 614 A malformed request or response is one that is an otherwise valid 615 sequence of frames but is invalid due to the presence of extraneous 616 frames, prohibited header fields, the absence of mandatory header 617 fields, or the inclusion of uppercase header field names. 619 A request or response that includes a payload body can include a 620 "content-length" header field. A request or response is also 621 malformed if the value of a content-length header field does not 622 equal the sum of the DATA frame payload lengths that form the body. 623 A response that is defined to have no payload, as described in 624 Section 3.3.2 of [RFC7230] can have a non-zero content-length header 625 field, even though no content is included in DATA frames. 627 Intermediaries that process HTTP requests or responses (i.e., any 628 intermediary not acting as a tunnel) MUST NOT forward a malformed 629 request or response. Malformed requests or responses that are 630 detected MUST be treated as a stream error (Section 8) of type 631 H3_GENERAL_PROTOCOL_ERROR. 633 For malformed requests, a server MAY send an HTTP response prior to 634 closing or resetting the stream. Clients MUST NOT accept a malformed 635 response. Note that these requirements are intended to protect 636 against several types of common attacks against HTTP; they are 637 deliberately strict because being permissive can expose 638 implementations to these vulnerabilities. 640 4.2. The CONNECT Method 642 The pseudo-method CONNECT ([RFC7231], Section 4.3.6) is primarily 643 used with HTTP proxies to establish a TLS session with an origin 644 server for the purposes of interacting with "https" resources. In 645 HTTP/1.x, CONNECT is used to convert an entire HTTP connection into a 646 tunnel to a remote host. In HTTP/2, the CONNECT method is used to 647 establish a tunnel over a single HTTP/2 stream to a remote host for 648 similar purposes. 650 A CONNECT request in HTTP/3 functions in the same manner as in 651 HTTP/2. The request MUST be formatted as described in [HTTP2], 652 Section 8.3. A CONNECT request that does not conform to these 653 restrictions is malformed (see Section 4.1.3). The request stream 654 MUST NOT be closed at the end of the request. 656 A proxy that supports CONNECT establishes a TCP connection 657 ([RFC0793]) to the server identified in the ":authority" pseudo- 658 header field. Once this connection is successfully established, the 659 proxy sends a HEADERS frame containing a 2xx series status code to 660 the client, as defined in [RFC7231], Section 4.3.6. 662 All DATA frames on the stream correspond to data sent or received on 663 the TCP connection. Any DATA frame sent by the client is transmitted 664 by the proxy to the TCP server; data received from the TCP server is 665 packaged into DATA frames by the proxy. Note that the size and 666 number of TCP segments is not guaranteed to map predictably to the 667 size and number of HTTP DATA or QUIC STREAM frames. 669 Once the CONNECT method has completed, only DATA frames are permitted 670 to be sent on the stream. Extension frames MAY be used if 671 specifically permitted by the definition of the extension. Receipt 672 of any other frame type MUST be treated as a connection error of type 673 H3_FRAME_UNEXPECTED. 675 The TCP connection can be closed by either peer. When the client 676 ends the request stream (that is, the receive stream at the proxy 677 enters the "Data Recvd" state), the proxy will set the FIN bit on its 678 connection to the TCP server. When the proxy receives a packet with 679 the FIN bit set, it will terminate the send stream that it sends to 680 the client. TCP connections which remain half-closed in a single 681 direction are not invalid, but are often handled poorly by servers, 682 so clients SHOULD NOT close a stream for sending while they still 683 expect to receive data from the target of the CONNECT. 685 A TCP connection error is signaled by abruptly terminating the 686 stream. A proxy treats any error in the TCP connection, which 687 includes receiving a TCP segment with the RST bit set, as a stream 688 error of type H3_CONNECT_ERROR (Section 8.1). Correspondingly, if a 689 proxy detects an error with the stream or the QUIC connection, it 690 MUST close the TCP connection. If the underlying TCP implementation 691 permits it, the proxy SHOULD send a TCP segment with the RST bit set. 693 4.3. HTTP Upgrade 695 HTTP/3 does not support the HTTP Upgrade mechanism ([RFC7230], 696 Section 6.7) or 101 (Switching Protocols) informational status code 697 ([RFC7231], Section 6.2.2). 699 4.4. Server Push 701 Server push is an interaction mode introduced in HTTP/2 [HTTP2] which 702 permits a server to push a request-response exchange to a client in 703 anticipation of the client making the indicated request. This trades 704 off network usage against a potential latency gain. HTTP/3 server 705 push is similar to what is described in HTTP/2 [HTTP2], but uses 706 different mechanisms. 708 Each server push is identified by a unique Push ID. This Push ID is 709 used in a single PUSH_PROMISE frame (see Section 7.2.5) which carries 710 the request headers, possibly included in one or more DUPLICATE_PUSH 711 frames (see Section 7.2.8), then included with the push stream which 712 ultimately fulfills those promises. 714 Server push is only enabled on a connection when a client sends a 715 MAX_PUSH_ID frame (see Section 7.2.7). A server cannot use server 716 push until it receives a MAX_PUSH_ID frame. A client sends 717 additional MAX_PUSH_ID frames to control the number of pushes that a 718 server can promise. A server SHOULD use Push IDs sequentially, 719 starting at 0. A client MUST treat receipt of a push stream with a 720 Push ID that is greater than the maximum Push ID as a connection 721 error of type H3_ID_ERROR. 723 The header of the request message is carried by a PUSH_PROMISE frame 724 (see Section 7.2.5) on the request stream which generated the push. 725 This allows the server push to be associated with a client request. 726 Promised requests MUST conform to the requirements in Section 8.2 of 727 [HTTP2]. 729 The same server push can be associated with additional client 730 requests using a DUPLICATE_PUSH frame (see Section 7.2.8). 732 Ordering of a PUSH_PROMISE or DUPLICATE_PUSH in relation to certain 733 parts of the response is important. The server SHOULD send 734 PUSH_PROMISE or DUPLICATE_PUSH frames prior to sending HEADERS or 735 DATA frames that reference the promised responses. This reduces the 736 chance that a client requests a resource that will be pushed by the 737 server. 739 When a server later fulfills a promise, the server push response is 740 conveyed on a push stream (see Section 6.2.2). The push stream 741 identifies the Push ID of the promise that it fulfills, then contains 742 a response to the promised request using the same format described 743 for responses in Section 4.1. 745 Due to reordering, DUPLICATE_PUSH frames or push stream data can 746 arrive before the corresponding PUSH_PROMISE frame. When a client 747 receives a DUPLICATE_PUSH frame for an as-yet-unknown Push ID, the 748 request headers of the push are not immediately available. The 749 client can either delay generating new requests for content 750 referenced following the DUPLICATE_PUSH frame until the request 751 headers become available, or can initiate requests for discovered 752 resources and cancel the requests if the requested resource is 753 already being pushed. When a client receives a new push stream with 754 an as-yet-unknown Push ID, both the associated client request and the 755 pushed request headers are unknown. The client can buffer the stream 756 data in expectation of the matching PUSH_PROMISE. The client can use 757 stream flow control (see section 4.1 of [QUIC-TRANSPORT]) to limit 758 the amount of data a server may commit to the pushed stream. 760 If a promised server push is not needed by the client, the client 761 SHOULD send a CANCEL_PUSH frame. If the push stream is already open 762 or opens after sending the CANCEL_PUSH frame, the client can abort 763 reading the stream with an error code of H3_REQUEST_CANCELLED. This 764 asks the server not to transfer additional data and indicates that it 765 will be discarded upon receipt. 767 5. Connection Closure 769 Once established, an HTTP/3 connection can be used for many requests 770 and responses over time until the connection is closed. Connection 771 closure can happen in any of several different ways. 773 5.1. Idle Connections 775 Each QUIC endpoint declares an idle timeout during the handshake. If 776 the connection remains idle (no packets received) for longer than 777 this duration, the peer will assume that the connection has been 778 closed. HTTP/3 implementations will need to open a new connection 779 for new requests if the existing connection has been idle for longer 780 than the server's advertised idle timeout, and SHOULD do so if 781 approaching the idle timeout. 783 HTTP clients are expected to request that the transport keep 784 connections open while there are responses outstanding for requests 785 or server pushes, as described in Section 19.2 of [QUIC-TRANSPORT]. 786 If the client is not expecting a response from the server, allowing 787 an idle connection to time out is preferred over expending effort 788 maintaining a connection that might not be needed. A gateway MAY 789 maintain connections in anticipation of need rather than incur the 790 latency cost of connection establishment to servers. Servers SHOULD 791 NOT actively keep connections open. 793 5.2. Connection Shutdown 795 Even when a connection is not idle, either endpoint can decide to 796 stop using the connection and let the connection close gracefully. 797 Since clients drive request generation, clients perform a connection 798 shutdown by not sending additional requests on the connection; 799 responses and pushed responses associated to previous requests will 800 continue to completion. Servers perform the same function by 801 communicating with clients. 803 Servers initiate the shutdown of a connection by sending a GOAWAY 804 frame (Section 7.2.6). The GOAWAY frame indicates that client- 805 initiated requests on lower stream IDs were or might be processed in 806 this connection, while requests on the indicated stream ID and 807 greater were rejected. This enables client and server to agree on 808 which requests were accepted prior to the connection shutdown. This 809 identifier MAY be zero if no requests were processed. Servers SHOULD 810 NOT permit additional QUIC streams after sending a GOAWAY frame. 812 Clients MUST NOT send new requests on the connection after receiving 813 GOAWAY; a new connection MAY be established to send additional 814 requests. 816 Some requests might already be in transit. If the client has already 817 sent requests on streams with a Stream ID greater than or equal to 818 that indicated in the GOAWAY frame, those requests will not be 819 processed and MAY be retried by the client on a different connection. 820 The client MAY cancel these requests. It is RECOMMENDED that the 821 server explicitly reject such requests (see Section 4.1.2) in order 822 to clean up transport state for the affected streams. 824 Requests on Stream IDs less than the Stream ID in the GOAWAY frame 825 might have been processed; their status cannot be known until a 826 response is received, the stream is reset individually, or the 827 connection terminates. Servers MAY reject individual requests on 828 streams below the indicated ID if these requests were not processed. 830 Servers SHOULD send a GOAWAY frame when the closing of a connection 831 is known in advance, even if the advance notice is small, so that the 832 remote peer can know whether a request has been partially processed 833 or not. For example, if an HTTP client sends a POST at the same time 834 that a server closes a QUIC connection, the client cannot know if the 835 server started to process that POST request if the server does not 836 send a GOAWAY frame to indicate what streams it might have acted on. 838 A client that is unable to retry requests loses all requests that are 839 in flight when the server closes the connection. A server MAY send 840 multiple GOAWAY frames indicating different stream IDs, but MUST NOT 841 increase the value they send in the last Stream ID, since clients 842 might already have retried unprocessed requests on another 843 connection. A server that is attempting to gracefully shut down a 844 connection SHOULD send an initial GOAWAY frame with the last Stream 845 ID set to the maximum value allowed by QUIC's MAX_STREAMS and SHOULD 846 NOT increase the MAX_STREAMS limit thereafter. This signals to the 847 client that a shutdown is imminent and that initiating further 848 requests is prohibited. After allowing time for any in-flight 849 requests (at least one round-trip time), the server MAY send another 850 GOAWAY frame with an updated last Stream ID. This ensures that a 851 connection can be cleanly shut down without losing requests. 853 Once all accepted requests have been processed, the server can permit 854 the connection to become idle, or MAY initiate an immediate closure 855 of the connection. An endpoint that completes a graceful shutdown 856 SHOULD use the H3_NO_ERROR code when closing the connection. 858 If a client has consumed all available bidirectional stream IDs with 859 requests, the server need not send a GOAWAY frame, since the client 860 is unable to make further requests. 862 5.3. Immediate Application Closure 864 An HTTP/3 implementation can immediately close the QUIC connection at 865 any time. This results in sending a QUIC CONNECTION_CLOSE frame to 866 the peer; the error code in this frame indicates to the peer why the 867 connection is being closed. See Section 8 for error codes which can 868 be used when closing a connection. 870 Before closing the connection, a GOAWAY MAY be sent to allow the 871 client to retry some requests. Including the GOAWAY frame in the 872 same packet as the QUIC CONNECTION_CLOSE frame improves the chances 873 of the frame being received by clients. 875 5.4. Transport Closure 877 For various reasons, the QUIC transport could indicate to the 878 application layer that the connection has terminated. This might be 879 due to an explicit closure by the peer, a transport-level error, or a 880 change in network topology which interrupts connectivity. 882 If a connection terminates without a GOAWAY frame, clients MUST 883 assume that any request which was sent, whether in whole or in part, 884 might have been processed. 886 6. Stream Mapping and Usage 888 A QUIC stream provides reliable in-order delivery of bytes, but makes 889 no guarantees about order of delivery with regard to bytes on other 890 streams. On the wire, data is framed into QUIC STREAM frames, but 891 this framing is invisible to the HTTP framing layer. The transport 892 layer buffers and orders received QUIC STREAM frames, exposing the 893 data contained within as a reliable byte stream to the application. 894 Although QUIC permits out-of-order delivery within a stream, HTTP/3 895 does not make use of this feature. 897 QUIC streams can be either unidirectional, carrying data only from 898 initiator to receiver, or bidirectional. Streams can be initiated by 899 either the client or the server. For more detail on QUIC streams, 900 see Section 2 of [QUIC-TRANSPORT]. 902 When HTTP headers and data are sent over QUIC, the QUIC layer handles 903 most of the stream management. HTTP does not need to do any separate 904 multiplexing when using QUIC - data sent over a QUIC stream always 905 maps to a particular HTTP transaction or connection context. 907 6.1. Bidirectional Streams 909 All client-initiated bidirectional streams are used for HTTP requests 910 and responses. A bidirectional stream ensures that the response can 911 be readily correlated with the request. This means that the client's 912 first request occurs on QUIC stream 0, with subsequent requests on 913 stream 4, 8, and so on. In order to permit these streams to open, an 914 HTTP/3 server SHOULD configure non-zero minimum values for the number 915 of permitted streams and the initial stream flow control window. So 916 as to not unnecessarily limit parallelism, at least 100 requests 917 SHOULD be permitted at a time. 919 HTTP/3 does not use server-initiated bidirectional streams, though an 920 extension could define a use for these streams. Clients MUST treat 921 receipt of a server-initiated bidirectional stream as a connection 922 error of type H3_STREAM_CREATION_ERROR unless such an extension has 923 been negotiated. 925 6.2. Unidirectional Streams 927 Unidirectional streams, in either direction, are used for a range of 928 purposes. The purpose is indicated by a stream type, which is sent 929 as a variable-length integer at the start of the stream. The format 930 and structure of data that follows this integer is determined by the 931 stream type. 933 0 1 2 3 934 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 935 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 936 | Stream Type (i) ... 937 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 939 Figure 1: Unidirectional Stream Header 941 Some stream types are reserved (Section 6.2.3). Two stream types are 942 defined in this document: control streams (Section 6.2.1) and push 943 streams (Section 6.2.2). [QPACK] defines two additional stream 944 types. Other stream types can be defined by extensions to HTTP/3; 945 see Section 9 for more details. 947 The performance of HTTP/3 connections in the early phase of their 948 lifetime is sensitive to the creation and exchange of data on 949 unidirectional streams. Endpoints that excessively restrict the 950 number of streams or the flow control window of these streams will 951 increase the chance that the remote peer reaches the limit early and 952 becomes blocked. In particular, implementations should consider that 953 remote peers may wish to exercise reserved stream behavior 954 (Section 6.2.3) with some of the unidirectional streams they are 955 permitted to use. To avoid blocking, the transport parameters sent 956 by both clients and servers MUST allow the peer to create at least 957 one unidirectional stream for the HTTP control stream plus the number 958 of unidirectional streams required by mandatory extensions (three 959 being the minimum number required for the base HTTP/3 protocol and 960 QPACK), and SHOULD provide at least 1,024 bytes of flow control 961 credit to each stream. 963 Note that an endpoint is not required to grant additional credits to 964 create more unidirectional streams if its peer consumes all the 965 initial credits before creating the critical unidirectional streams. 966 Endpoints SHOULD create the HTTP control stream as well as the 967 unidirectional streams required by mandatory extensions (such as the 968 QPACK encoder and decoder streams) first, and then create additional 969 streams as allowed by their peer. 971 If the stream header indicates a stream type which is not supported 972 by the recipient, the remainder of the stream cannot be consumed as 973 the semantics are unknown. Recipients of unknown stream types MAY 974 abort reading of the stream with an error code of 975 H3_STREAM_CREATION_ERROR, but MUST NOT consider such streams to be a 976 connection error of any kind. 978 Implementations MAY send stream types before knowing whether the peer 979 supports them. However, stream types which could modify the state or 980 semantics of existing protocol components, including QPACK or other 981 extensions, MUST NOT be sent until the peer is known to support them. 983 A sender can close or reset a unidirectional stream unless otherwise 984 specified. A receiver MUST tolerate unidirectional streams being 985 closed or reset prior to the reception of the unidirectional stream 986 header. 988 6.2.1. Control Streams 990 A control stream is indicated by a stream type of "0x00". Data on 991 this stream consists of HTTP/3 frames, as defined in Section 7.2. 993 Each side MUST initiate a single control stream at the beginning of 994 the connection and send its SETTINGS frame as the first frame on this 995 stream. If the first frame of the control stream is any other frame 996 type, this MUST be treated as a connection error of type 997 H3_MISSING_SETTINGS. Only one control stream per peer is permitted; 998 receipt of a second stream which claims to be a control stream MUST 999 be treated as a connection error of type H3_STREAM_CREATION_ERROR. 1000 The sender MUST NOT close the control stream, and the receiver MUST 1001 NOT request that the sender close the control stream. If either 1002 control stream is closed at any point, this MUST be treated as a 1003 connection error of type H3_CLOSED_CRITICAL_STREAM. 1005 A pair of unidirectional streams is used rather than a single 1006 bidirectional stream. This allows either peer to send data as soon 1007 as it is able. Depending on whether 0-RTT is enabled on the 1008 connection, either client or server might be able to send stream data 1009 first after the cryptographic handshake completes. 1011 6.2.2. Push Streams 1013 Server push is an optional feature introduced in HTTP/2 that allows a 1014 server to initiate a response before a request has been made. See 1015 Section 4.4 for more details. 1017 A push stream is indicated by a stream type of "0x01", followed by 1018 the Push ID of the promise that it fulfills, encoded as a variable- 1019 length integer. The remaining data on this stream consists of HTTP/3 1020 frames, as defined in Section 7.2, and fulfills a promised server 1021 push by zero or more non-final HTTP responses followed by a single 1022 final HTTP response, as defined in Section 4.1. Server push and Push 1023 IDs are described in Section 4.4. 1025 Only servers can push; if a server receives a client-initiated push 1026 stream, this MUST be treated as a connection error of type 1027 H3_STREAM_CREATION_ERROR. 1029 0 1 2 3 1030 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1031 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1032 | 0x01 (i) ... 1033 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1034 | Push ID (i) ... 1035 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1037 Figure 2: Push Stream Header 1039 Each Push ID MUST only be used once in a push stream header. If a 1040 push stream header includes a Push ID that was used in another push 1041 stream header, the client MUST treat this as a connection error of 1042 type H3_ID_ERROR. 1044 6.2.3. Reserved Stream Types 1046 Stream types of the format "0x1f * N + 0x21" for integer values of N 1047 are reserved to exercise the requirement that unknown types be 1048 ignored. These streams have no semantics, and can be sent when 1049 application-layer padding is desired. They MAY also be sent on 1050 connections where no data is currently being transferred. Endpoints 1051 MUST NOT consider these streams to have any meaning upon receipt. 1053 The payload and length of the stream are selected in any manner the 1054 implementation chooses. 1056 7. HTTP Framing Layer 1058 HTTP frames are carried on QUIC streams, as described in Section 6. 1059 HTTP/3 defines three stream types: control stream, request stream, 1060 and push stream. This section describes HTTP/3 frame formats and the 1061 streams types on which they are permitted; see Table 1 for an 1062 overview. A comparison between HTTP/2 and HTTP/3 frames is provided 1063 in Appendix A.2. 1065 +----------------+------------+------------+-----------+------------+ 1066 | Frame | Control | Request | Push | Section | 1067 | | Stream | Stream | Stream | | 1068 +----------------+------------+------------+-----------+------------+ 1069 | DATA | No | Yes | Yes | Section | 1070 | | | | | 7.2.1 | 1071 | | | | | | 1072 | HEADERS | No | Yes | Yes | Section | 1073 | | | | | 7.2.2 | 1074 | | | | | | 1075 | CANCEL_PUSH | Yes | No | No | Section | 1076 | | | | | 7.2.3 | 1077 | | | | | | 1078 | SETTINGS | Yes (1) | No | No | Section | 1079 | | | | | 7.2.4 | 1080 | | | | | | 1081 | PUSH_PROMISE | No | Yes | No | Section | 1082 | | | | | 7.2.5 | 1083 | | | | | | 1084 | GOAWAY | Yes | No | No | Section | 1085 | | | | | 7.2.6 | 1086 | | | | | | 1087 | MAX_PUSH_ID | Yes | No | No | Section | 1088 | | | | | 7.2.7 | 1089 | | | | | | 1090 | DUPLICATE_PUSH | No | Yes | No | Section | 1091 | | | | | 7.2.8 | 1092 | | | | | | 1093 | Reserved | Yes | Yes | Yes | Section | 1094 | | | | | 7.2.9 | 1095 +----------------+------------+------------+-----------+------------+ 1097 Table 1: HTTP/3 frames and stream type overview 1099 Certain frames can only occur as the first frame of a particular 1100 stream type; these are indicated in Table 1 with a (1). Specific 1101 guidance is provided in the relevant section. 1103 Note that, unlike QUIC frames, HTTP/3 frames can span multiple 1104 packets. 1106 7.1. Frame Layout 1108 All frames have the following format: 1110 0 1 2 3 1111 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1112 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1113 | Type (i) ... 1114 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1115 | Length (i) ... 1116 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1117 | Frame Payload (*) ... 1118 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1120 Figure 3: HTTP/3 frame format 1122 A frame includes the following fields: 1124 Type: A variable-length integer that identifies the frame type. 1126 Length: A variable-length integer that describes the length in bytes 1127 of the Frame Payload. 1129 Frame Payload: A payload, the semantics of which are determined by 1130 the Type field. 1132 Each frame's payload MUST contain exactly the fields identified in 1133 its description. A frame payload that contains additional bytes 1134 after the identified fields or a frame payload that terminates before 1135 the end of the identified fields MUST be treated as a connection 1136 error of type H3_FRAME_ERROR. 1138 When a stream terminates cleanly, if the last frame on the stream was 1139 truncated, this MUST be treated as a connection error (Section 8) of 1140 type H3_FRAME_ERROR. Streams which terminate abruptly may be reset 1141 at any point in a frame. 1143 7.2. Frame Definitions 1145 7.2.1. DATA 1147 DATA frames (type=0x0) convey arbitrary, variable-length sequences of 1148 bytes associated with an HTTP request or response payload. 1150 DATA frames MUST be associated with an HTTP request or response. If 1151 a DATA frame is received on a control stream, the recipient MUST 1152 respond with a connection error (Section 8) of type 1153 H3_FRAME_UNEXPECTED. 1155 0 1 2 3 1156 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1157 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1158 | Payload (*) ... 1159 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1161 Figure 4: DATA frame payload 1163 7.2.2. HEADERS 1165 The HEADERS frame (type=0x1) is used to carry a header block, 1166 compressed using QPACK. See [QPACK] for more details. 1168 0 1 2 3 1169 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1170 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1171 | Header Block (*) ... 1172 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1174 Figure 5: HEADERS frame payload 1176 HEADERS frames can only be sent on request / push streams. If a 1177 HEADERS frame is received on a control stream, the recipient MUST 1178 respond with a connection error (Section 8) of type 1179 H3_FRAME_UNEXPECTED. 1181 7.2.3. CANCEL_PUSH 1183 The CANCEL_PUSH frame (type=0x3) is used to request cancellation of a 1184 server push prior to the push stream being received. The CANCEL_PUSH 1185 frame identifies a server push by Push ID (see Section 7.2.5), 1186 encoded as a variable-length integer. 1188 When a client sends CANCEL_PUSH, it is indicating that it does not 1189 wish to receive the promised resource. The server SHOULD abort 1190 sending the resource, but the mechanism to do so depends on the state 1191 of the corresponding push stream. If the server has not yet created 1192 a push stream, it does not create one. If the push stream is open, 1193 the server SHOULD abruptly terminate that stream. If the push stream 1194 has already ended, the server MAY still abruptly terminate the stream 1195 or MAY take no action. 1197 When a server sends CANCEL_PUSH, it is indicating that it will not be 1198 fulfilling a promise and has not created a push stream. The client 1199 should not expect the corresponding promise to be fulfilled. 1201 Sending CANCEL_PUSH has no direct effect on the state of existing 1202 push streams. A server SHOULD NOT send a CANCEL_PUSH when it has 1203 already created a corresponding push stream, and a client SHOULD NOT 1204 send a CANCEL_PUSH when it has already received a corresponding push 1205 stream. 1207 A CANCEL_PUSH frame is sent on the control stream. Receiving a 1208 CANCEL_PUSH frame on a stream other than the control stream MUST be 1209 treated as a connection error of type H3_FRAME_UNEXPECTED. 1211 0 1 2 3 1212 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1213 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1214 | Push ID (i) ... 1215 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1217 Figure 6: CANCEL_PUSH frame payload 1219 The CANCEL_PUSH frame carries a Push ID encoded as a variable-length 1220 integer. The Push ID identifies the server push that is being 1221 cancelled (see Section 7.2.5). If a CANCEL_PUSH frame is received 1222 which references a Push ID greater than currently allowed on the 1223 connection, this MUST be treated as a connection error of type 1224 H3_ID_ERROR. 1226 If the client receives a CANCEL_PUSH frame, that frame might identify 1227 a Push ID that has not yet been mentioned by a PUSH_PROMISE frame due 1228 to reordering. If a server receives a CANCEL_PUSH frame for a Push 1229 ID that has not yet been mentioned by a PUSH_PROMISE frame, this MUST 1230 be treated as a connection error of type H3_ID_ERROR. 1232 7.2.4. SETTINGS 1234 The SETTINGS frame (type=0x4) conveys configuration parameters that 1235 affect how endpoints communicate, such as preferences and constraints 1236 on peer behavior. Individually, a SETTINGS parameter can also be 1237 referred to as a "setting"; the identifier and value of each setting 1238 parameter can be referred to as a "setting identifier" and a "setting 1239 value". 1241 SETTINGS frames always apply to a connection, never a single stream. 1242 A SETTINGS frame MUST be sent as the first frame of each control 1243 stream (see Section 6.2.1) by each peer, and MUST NOT be sent 1244 subsequently. If an endpoint receives a second SETTINGS frame on the 1245 control stream, the endpoint MUST respond with a connection error of 1246 type H3_FRAME_UNEXPECTED. 1248 SETTINGS frames MUST NOT be sent on any stream other than the control 1249 stream. If an endpoint receives a SETTINGS frame on a different 1250 stream, the endpoint MUST respond with a connection error of type 1251 H3_FRAME_UNEXPECTED. 1253 SETTINGS parameters are not negotiated; they describe characteristics 1254 of the sending peer, which can be used by the receiving peer. 1255 However, a negotiation can be implied by the use of SETTINGS - each 1256 peer uses SETTINGS to advertise a set of supported values. The 1257 definition of the setting would describe how each peer combines the 1258 two sets to conclude which choice will be used. SETTINGS does not 1259 provide a mechanism to identify when the choice takes effect. 1261 Different values for the same parameter can be advertised by each 1262 peer. For example, a client might be willing to consume a very large 1263 response header, while servers are more cautious about request size. 1265 The same setting identifier MUST NOT occur more than once in the 1266 SETTINGS frame. A receiver MAY treat the presence of duplicate 1267 setting identifiers as a connection error of type H3_SETTINGS_ERROR. 1269 The payload of a SETTINGS frame consists of zero or more parameters. 1270 Each parameter consists of a setting identifier and a value, both 1271 encoded as QUIC variable-length integers. 1273 0 1 2 3 1274 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1275 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1276 | Identifier (i) ... 1277 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1278 | Value (i) ... 1279 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1281 Figure 7: SETTINGS parameter format 1283 An implementation MUST ignore the contents for any SETTINGS 1284 identifier it does not understand. 1286 7.2.4.1. Defined SETTINGS Parameters 1288 The following settings are defined in HTTP/3: 1290 SETTINGS_MAX_HEADER_LIST_SIZE (0x6): The default value is unlimited. 1291 See Section 4.1.1 for usage. 1293 Setting identifiers of the format "0x1f * N + 0x21" for integer 1294 values of N are reserved to exercise the requirement that unknown 1295 identifiers be ignored. Such settings have no defined meaning. 1296 Endpoints SHOULD include at least one such setting in their SETTINGS 1297 frame. Endpoints MUST NOT consider such settings to have any meaning 1298 upon receipt. 1300 Because the setting has no defined meaning, the value of the setting 1301 can be any value the implementation selects. 1303 Additional settings can be defined by extensions to HTTP/3; see 1304 Section 9 for more details. 1306 7.2.4.2. Initialization 1308 An HTTP implementation MUST NOT send frames or requests which would 1309 be invalid based on its current understanding of the peer's settings. 1311 All settings begin at an initial value. Each endpoint SHOULD use 1312 these initial values to send messages before the peer's SETTINGS 1313 frame has arrived, as packets carrying the settings can be lost or 1314 delayed. When the SETTINGS frame arrives, any settings are changed 1315 to their new values. 1317 This removes the need to wait for the SETTINGS frame before sending 1318 messages. Endpoints MUST NOT require any data to be received from 1319 the peer prior to sending the SETTINGS frame; settings MUST be sent 1320 as soon as the transport is ready to send data. 1322 For servers, the initial value of each client setting is the default 1323 value. 1325 For clients using a 1-RTT QUIC connection, the initial value of each 1326 server setting is the default value. 1-RTT keys will always become 1327 available prior to SETTINGS arriving, even if the server sends 1328 SETTINGS immediately. Clients SHOULD NOT wait indefinitely for 1329 SETTINGS to arrive before sending requests, but SHOULD process 1330 received datagrams in order to increase the likelihood of processing 1331 SETTINGS before sending the first request. 1333 When a 0-RTT QUIC connection is being used, the initial value of each 1334 server setting is the value used in the previous session. Clients 1335 SHOULD store the settings the server provided in the connection where 1336 resumption information was provided, but MAY opt not to store 1337 settings in certain cases (e.g., if the session ticket is received 1338 before the SETTINGS frame). A client MUST comply with stored 1339 settings - or default values, if no values are stored - when 1340 attempting 0-RTT. Once a server has provided new settings, clients 1341 MUST comply with those values. 1343 A server can remember the settings that it advertised, or store an 1344 integrity-protected copy of the values in the ticket and recover the 1345 information when accepting 0-RTT data. A server uses the HTTP/3 1346 settings values in determining whether to accept 0-RTT data. If the 1347 server cannot determine that the settings remembered by a client are 1348 compatible with its current settings, it MUST NOT accept 0-RTT data. 1349 Remembered settings are compatible if a client complying with those 1350 settings would not violate the server's current settings. 1352 A server MAY accept 0-RTT and subsequently provide different settings 1353 in its SETTINGS frame. If 0-RTT data is accepted by the server, its 1354 SETTINGS frame MUST NOT reduce any limits or alter any values that 1355 might be violated by the client with its 0-RTT data. The server MUST 1356 include all settings which differ from their default values. If a 1357 server accepts 0-RTT but then sends settings that are not compatible 1358 with the previously specified settings, this MUST be treated as a 1359 connection error of type H3_SETTINGS_ERROR. If a server accepts 1360 0-RTT but then sends a SETTINGS frame that omits a setting value that 1361 the client understands (apart from reserved setting identifiers) that 1362 was previously specified to have a non-default value, this MUST be 1363 treated as a connection error of type H3_SETTINGS_ERROR. 1365 7.2.5. PUSH_PROMISE 1367 The PUSH_PROMISE frame (type=0x5) is used to carry a promised request 1368 header set from server to client on a request stream, as in HTTP/2. 1370 0 1 2 3 1371 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1372 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1373 | Push ID (i) ... 1374 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1375 | Header Block (*) ... 1376 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1378 Figure 8: PUSH_PROMISE frame payload 1380 The payload consists of: 1382 Push ID: A variable-length integer that identifies the server push 1383 operation. A Push ID is used in push stream headers 1384 (Section 4.4), CANCEL_PUSH frames (Section 7.2.3), and 1385 DUPLICATE_PUSH frames (Section 7.2.8). 1387 Header Block: QPACK-compressed request header fields for the 1388 promised response. See [QPACK] for more details. 1390 A server MUST NOT use a Push ID that is larger than the client has 1391 provided in a MAX_PUSH_ID frame (Section 7.2.7). A client MUST treat 1392 receipt of a PUSH_PROMISE frame that contains a larger Push ID than 1393 the client has advertised as a connection error of H3_ID_ERROR. 1395 A server MUST NOT use the same Push ID in multiple PUSH_PROMISE 1396 frames. A client MUST treat receipt of a Push ID which has already 1397 been promised as a connection error of type H3_ID_ERROR. 1399 If a PUSH_PROMISE frame is received on the control stream, the client 1400 MUST respond with a connection error (Section 8) of type 1401 H3_FRAME_UNEXPECTED. 1403 A client MUST NOT send a PUSH_PROMISE frame. A server MUST treat the 1404 receipt of a PUSH_PROMISE frame as a connection error of type 1405 H3_FRAME_UNEXPECTED. 1407 See Section 4.4 for a description of the overall server push 1408 mechanism. 1410 7.2.6. GOAWAY 1412 The GOAWAY frame (type=0x7) is used to initiate graceful shutdown of 1413 a connection by a server. GOAWAY allows a server to stop accepting 1414 new requests while still finishing processing of previously received 1415 requests. This enables administrative actions, like server 1416 maintenance. GOAWAY by itself does not close a connection. 1418 0 1 2 3 1419 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1420 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1421 | Stream ID (i) ... 1422 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1424 Figure 9: GOAWAY frame payload 1426 The GOAWAY frame is always sent on the control stream. It carries a 1427 QUIC Stream ID for a client-initiated bidirectional stream encoded as 1428 a variable-length integer. A client MUST treat receipt of a GOAWAY 1429 frame containing a Stream ID of any other type as a connection error 1430 of type H3_ID_ERROR. 1432 Clients do not need to send GOAWAY to initiate a graceful shutdown; 1433 they simply stop making new requests. A server MUST treat receipt of 1434 a GOAWAY frame on any stream as a connection error (Section 8) of 1435 type H3_FRAME_UNEXPECTED. 1437 The GOAWAY frame applies to the connection, not a specific stream. A 1438 client MUST treat a GOAWAY frame on a stream other than the control 1439 stream as a connection error (Section 8) of type H3_FRAME_UNEXPECTED. 1441 See Section 5.2 for more information on the use of the GOAWAY frame. 1443 7.2.7. MAX_PUSH_ID 1445 The MAX_PUSH_ID frame (type=0xD) is used by clients to control the 1446 number of server pushes that the server can initiate. This sets the 1447 maximum value for a Push ID that the server can use in PUSH_PROMISE 1448 and CANCEL_PUSH frames. Consequently, this also limits the number of 1449 push streams that the server can initiate in addition to the limit 1450 maintained by the QUIC transport. 1452 The MAX_PUSH_ID frame is always sent on the control stream. Receipt 1453 of a MAX_PUSH_ID frame on any other stream MUST be treated as a 1454 connection error of type H3_FRAME_UNEXPECTED. 1456 A server MUST NOT send a MAX_PUSH_ID frame. A client MUST treat the 1457 receipt of a MAX_PUSH_ID frame as a connection error of type 1458 H3_FRAME_UNEXPECTED. 1460 The maximum Push ID is unset when a connection is created, meaning 1461 that a server cannot push until it receives a MAX_PUSH_ID frame. A 1462 client that wishes to manage the number of promised server pushes can 1463 increase the maximum Push ID by sending MAX_PUSH_ID frames as the 1464 server fulfills or cancels server pushes. 1466 0 1 2 3 1467 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1468 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1469 | Push ID (i) ... 1470 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1472 Figure 10: MAX_PUSH_ID frame payload 1474 The MAX_PUSH_ID frame carries a single variable-length integer that 1475 identifies the maximum value for a Push ID that the server can use 1476 (see Section 7.2.5). A MAX_PUSH_ID frame cannot reduce the maximum 1477 Push ID; receipt of a MAX_PUSH_ID that contains a smaller value than 1478 previously received MUST be treated as a connection error of type 1479 H3_ID_ERROR. 1481 7.2.8. DUPLICATE_PUSH 1483 The DUPLICATE_PUSH frame (type=0xE) is used by servers to indicate 1484 that an existing pushed resource is related to multiple client 1485 requests. 1487 The DUPLICATE_PUSH frame is always sent on a request stream. Receipt 1488 of a DUPLICATE_PUSH frame on any other stream MUST be treated as a 1489 connection error of type H3_FRAME_UNEXPECTED. 1491 A client MUST NOT send a DUPLICATE_PUSH frame. A server MUST treat 1492 the receipt of a DUPLICATE_PUSH frame as a connection error of type 1493 H3_FRAME_UNEXPECTED. 1495 0 1 2 3 1496 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1497 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1498 | Push ID (i) ... 1499 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1501 Figure 11: DUPLICATE_PUSH frame payload 1503 The DUPLICATE_PUSH frame carries a single variable-length integer 1504 that identifies the Push ID of a resource that the server has 1505 previously promised (see Section 7.2.5), though that promise might 1506 not be received before this frame. A server MUST NOT use a Push ID 1507 that is larger than the client has provided in a MAX_PUSH_ID frame 1508 (Section 7.2.7). A client MUST treat receipt of a DUPLICATE_PUSH 1509 that contains a larger Push ID than the client has advertised as a 1510 connection error of type H3_ID_ERROR. 1512 This frame allows the server to use the same server push in response 1513 to multiple concurrent requests. Referencing the same server push 1514 ensures that a promise can be made in relation to every response in 1515 which server push might be needed without duplicating request headers 1516 or pushed responses. 1518 Allowing duplicate references to the same Push ID is primarily to 1519 reduce duplication caused by concurrent requests. A server SHOULD 1520 avoid reusing a Push ID over a long period. Clients are likely to 1521 consume server push responses and not retain them for reuse over 1522 time. Clients that see a DUPLICATE_PUSH that uses a Push ID that 1523 they have since consumed and discarded are forced to ignore the 1524 DUPLICATE_PUSH. 1526 7.2.9. Reserved Frame Types 1528 Frame types of the format "0x1f * N + 0x21" for integer values of N 1529 are reserved to exercise the requirement that unknown types be 1530 ignored (Section 9). These frames have no semantics, and can be sent 1531 on any open stream when application-layer padding is desired. They 1532 MAY also be sent on connections where no data is currently being 1533 transferred. Endpoints MUST NOT consider these frames to have any 1534 meaning upon receipt. 1536 The payload and length of the frames are selected in any manner the 1537 implementation chooses. 1539 Frame types which were used in HTTP/2 where there is no corresponding 1540 HTTP/3 frame have also been reserved (Section 11.2). These frame 1541 types MUST NOT be sent, and receipt MAY be treated as an error of 1542 type H3_FRAME_UNEXPECTED. 1544 8. Error Handling 1546 QUIC allows the application to abruptly terminate (reset) individual 1547 streams or the entire connection when an error is encountered. These 1548 are referred to as "stream errors" or "connection errors" and are 1549 described in more detail in [QUIC-TRANSPORT]. An endpoint MAY choose 1550 to treat a stream error as a connection error. 1552 Because new error codes can be defined without negotiation (see 1553 Section 9), receipt of an unknown error code or use of an error code 1554 in an unexpected context MUST NOT be treated as an error. However, 1555 closing a stream can constitute an error regardless of the error code 1556 (see Section 4.1). 1558 This section describes HTTP/3-specific error codes which can be used 1559 to express the cause of a connection or stream error. 1561 8.1. HTTP/3 Error Codes 1563 The following error codes are defined for use when abruptly 1564 terminating streams, aborting reading of streams, or immediately 1565 closing connections. 1567 H3_NO_ERROR (0x100): No error. This is used when the connection or 1568 stream needs to be closed, but there is no error to signal. 1570 H3_GENERAL_PROTOCOL_ERROR (0x101): Peer violated protocol 1571 requirements in a way which doesn't match a more specific error 1572 code, or endpoint declines to use the more specific error code. 1574 H3_INTERNAL_ERROR (0x102): An internal error has occurred in the 1575 HTTP stack. 1577 H3_STREAM_CREATION_ERROR (0x103): The endpoint detected that its 1578 peer created a stream that it will not accept. 1580 H3_CLOSED_CRITICAL_STREAM (0x104): A stream required by the 1581 connection was closed or reset. 1583 H3_FRAME_UNEXPECTED (0x105): A frame was received which was not 1584 permitted in the current state or on the current stream. 1586 H3_FRAME_ERROR (0x106): A frame that fails to satisfy layout 1587 requirements or with an invalid size was received. 1589 H3_EXCESSIVE_LOAD (0x107): The endpoint detected that its peer is 1590 exhibiting a behavior that might be generating excessive load. 1592 H3_ID_ERROR (0x108): A Stream ID or Push ID was used incorrectly, 1593 such as exceeding a limit, reducing a limit, or being reused. 1595 H3_SETTINGS_ERROR (0x109): An endpoint detected an error in the 1596 payload of a SETTINGS frame. 1598 H3_MISSING_SETTINGS (0x10A): No SETTINGS frame was received at the 1599 beginning of the control stream. 1601 H3_REQUEST_REJECTED (0x10B): A server rejected a request without 1602 performing any application processing. 1604 H3_REQUEST_CANCELLED (0x10C): The request or its response (including 1605 pushed response) is cancelled. 1607 H3_REQUEST_INCOMPLETE (0x10D): The client's stream terminated 1608 without containing a fully-formed request. 1610 H3_EARLY_RESPONSE (0x10E): The remainder of the client's request is 1611 not needed to produce a response. For use in STOP_SENDING only. 1613 H3_CONNECT_ERROR (0x10F): The connection established in response to 1614 a CONNECT request was reset or abnormally closed. 1616 H3_VERSION_FALLBACK (0x110): The requested operation cannot be 1617 served over HTTP/3. The peer should retry over HTTP/1.1. 1619 9. Extensions to HTTP/3 1621 HTTP/3 permits extension of the protocol. Within the limitations 1622 described in this section, protocol extensions can be used to provide 1623 additional services or alter any aspect of the protocol. Extensions 1624 are effective only within the scope of a single HTTP/3 connection. 1626 This applies to the protocol elements defined in this document. This 1627 does not affect the existing options for extending HTTP, such as 1628 defining new methods, status codes, or header fields. 1630 Extensions are permitted to use new frame types (Section 7.2), new 1631 settings (Section 7.2.4.1), new error codes (Section 8), or new 1632 unidirectional stream types (Section 6.2). Registries are 1633 established for managing these extension points: frame types 1634 (Section 11.2), settings (Section 11.3), error codes (Section 11.4), 1635 and stream types (Section 11.5). 1637 Implementations MUST ignore unknown or unsupported values in all 1638 extensible protocol elements. Implementations MUST discard frames 1639 and unidirectional streams that have unknown or unsupported types. 1640 This means that any of these extension points can be safely used by 1641 extensions without prior arrangement or negotiation. However, where 1642 a known frame type is required to be in a specific location, such as 1643 the SETTINGS frame as the first frame of the control stream (see 1644 Section 6.2.1), an unknown frame type does not satisfy that 1645 requirement and SHOULD be treated as an error. 1647 Extensions that could change the semantics of existing protocol 1648 components MUST be negotiated before being used. For example, an 1649 extension that changes the layout of the HEADERS frame cannot be used 1650 until the peer has given a positive signal that this is acceptable. 1651 In this case, it could also be necessary to coordinate when the 1652 revised layout comes into effect. 1654 This document doesn't mandate a specific method for negotiating the 1655 use of an extension but notes that a setting (Section 7.2.4.1) could 1656 be used for that purpose. If both peers set a value that indicates 1657 willingness to use the extension, then the extension can be used. If 1658 a setting is used for extension negotiation, the default value MUST 1659 be defined in such a fashion that the extension is disabled if the 1660 setting is omitted. 1662 10. Security Considerations 1664 The security considerations of HTTP/3 should be comparable to those 1665 of HTTP/2 with TLS; the considerations from Section 10 of [HTTP2] 1666 apply in addition to those listed here. 1668 When HTTP Alternative Services is used for discovery for HTTP/3 1669 endpoints, the security considerations of [ALTSVC] also apply. 1671 10.1. Traffic Analysis 1673 Where HTTP/2 employs PADDING frames and Padding fields in other 1674 frames to make a connection more resistant to traffic analysis, 1675 HTTP/3 can either rely on transport-layer padding or employ the 1676 reserved frame and stream types discussed in Section 7.2.9 and 1677 Section 6.2.3. These methods of padding produce different results in 1678 terms of the granularity of padding, the effect of packet loss and 1679 recovery, and how an implementation might control padding. 1681 10.2. Frame Parsing 1683 Several protocol elements contain nested length elements, typically 1684 in the form of frames with an explicit length containing variable- 1685 length integers. This could pose a security risk to an incautious 1686 implementer. An implementation MUST ensure that the length of a 1687 frame exactly matches the length of the fields it contains. 1689 10.3. Early Data 1691 The use of 0-RTT with HTTP/3 creates an exposure to replay attack. 1692 The anti-replay mitigations in [HTTP-REPLAY] MUST be applied when 1693 using HTTP/3 with 0-RTT. 1695 10.4. Migration 1697 Certain HTTP implementations use the client address for logging or 1698 access-control purposes. Since a QUIC client's address might change 1699 during a connection (and future versions might support simultaneous 1700 use of multiple addresses), such implementations will need to either 1701 actively retrieve the client's current address or addresses when they 1702 are relevant or explicitly accept that the original address might 1703 change. 1705 11. IANA Considerations 1707 11.1. Registration of HTTP/3 Identification String 1709 This document creates a new registration for the identification of 1710 HTTP/3 in the "Application Layer Protocol Negotiation (ALPN) Protocol 1711 IDs" registry established in [RFC7301]. 1713 The "h3" string identifies HTTP/3: 1715 Protocol: HTTP/3 1717 Identification Sequence: 0x68 0x33 ("h3") 1719 Specification: This document 1721 11.2. Frame Types 1723 This document establishes a registry for HTTP/3 frame type codes. 1724 The "HTTP/3 Frame Type" registry governs a 62-bit space. This space 1725 is split into three spaces that are governed by different policies. 1727 Values between "0x00" and "0x3f" (in hexadecimal) are assigned via 1728 the Standards Action or IESG Review policies [RFC8126]. Values from 1729 "0x40" to "0x3fff" operate on the Specification Required policy 1730 [RFC8126]. All other values are assigned to Private Use [RFC8126]. 1732 While this registry is separate from the "HTTP/2 Frame Type" registry 1733 defined in [HTTP2], it is preferable that the assignments parallel 1734 each other where the code spaces overlap. If an entry is present in 1735 only one registry, every effort SHOULD be made to avoid assigning the 1736 corresponding value to an unrelated operation. 1738 New entries in this registry require the following information: 1740 Frame Type: A name or label for the frame type. 1742 Code: The 62-bit code assigned to the frame type. 1744 Specification: A reference to a specification that includes a 1745 description of the frame layout and its semantics, including any 1746 parts of the frame that are conditionally present. 1748 The entries in the following table are registered by this document. 1750 +----------------+------+---------------+ 1751 | Frame Type | Code | Specification | 1752 +----------------+------+---------------+ 1753 | DATA | 0x0 | Section 7.2.1 | 1754 | | | | 1755 | HEADERS | 0x1 | Section 7.2.2 | 1756 | | | | 1757 | Reserved | 0x2 | N/A | 1758 | | | | 1759 | CANCEL_PUSH | 0x3 | Section 7.2.3 | 1760 | | | | 1761 | SETTINGS | 0x4 | Section 7.2.4 | 1762 | | | | 1763 | PUSH_PROMISE | 0x5 | Section 7.2.5 | 1764 | | | | 1765 | Reserved | 0x6 | N/A | 1766 | | | | 1767 | GOAWAY | 0x7 | Section 7.2.6 | 1768 | | | | 1769 | Reserved | 0x8 | N/A | 1770 | | | | 1771 | Reserved | 0x9 | N/A | 1772 | | | | 1773 | MAX_PUSH_ID | 0xD | Section 7.2.7 | 1774 | | | | 1775 | DUPLICATE_PUSH | 0xE | Section 7.2.8 | 1776 +----------------+------+---------------+ 1778 Additionally, each code of the format "0x1f * N + 0x21" for integer 1779 values of N (that is, "0x21", "0x40", ..., through 1780 "0x3FFFFFFFFFFFFFFE") MUST NOT be assigned by IANA. 1782 11.3. Settings Parameters 1784 This document establishes a registry for HTTP/3 settings. The 1785 "HTTP/3 Settings" registry governs a 62-bit space. This space is 1786 split into three spaces that are governed by different policies. 1787 Values between "0x00" and "0x3f" (in hexadecimal) are assigned via 1788 the Standards Action or IESG Review policies [RFC8126]. Values from 1789 "0x40" to "0x3fff" operate on the Specification Required policy 1790 [RFC8126]. All other values are assigned to Private Use [RFC8126]. 1791 The designated experts are the same as those for the "HTTP/2 1792 Settings" registry defined in [HTTP2]. 1794 While this registry is separate from the "HTTP/2 Settings" registry 1795 defined in [HTTP2], it is preferable that the assignments parallel 1796 each other. If an entry is present in only one registry, every 1797 effort SHOULD be made to avoid assigning the corresponding value to 1798 an unrelated operation. 1800 New registrations are advised to provide the following information: 1802 Name: A symbolic name for the setting. Specifying a setting name is 1803 optional. 1805 Code: The 62-bit code assigned to the setting. 1807 Specification: An optional reference to a specification that 1808 describes the use of the setting. 1810 Default: The value of the setting unless otherwise indicated. 1811 SHOULD be the most restrictive possible value. 1813 The entries in the following table are registered by this document. 1815 +----------------------+------+-----------------+-----------+ 1816 | Setting Name | Code | Specification | Default | 1817 +----------------------+------+-----------------+-----------+ 1818 | Reserved | 0x2 | N/A | N/A | 1819 | | | | | 1820 | Reserved | 0x3 | N/A | N/A | 1821 | | | | | 1822 | Reserved | 0x4 | N/A | N/A | 1823 | | | | | 1824 | Reserved | 0x5 | N/A | N/A | 1825 | | | | | 1826 | MAX_HEADER_LIST_SIZE | 0x6 | Section 7.2.4.1 | Unlimited | 1827 +----------------------+------+-----------------+-----------+ 1829 Additionally, each code of the format "0x1f * N + 0x21" for integer 1830 values of N (that is, "0x21", "0x40", ..., through 1831 "0x3FFFFFFFFFFFFFFE") MUST NOT be assigned by IANA. 1833 11.4. Error Codes 1835 This document establishes a registry for HTTP/3 error codes. The 1836 "HTTP/3 Error Code" registry manages a 62-bit space. The "HTTP/3 1837 Error Code" registry operates under the "Expert Review" policy 1838 [RFC8126]. 1840 Registrations for error codes are required to include a description 1841 of the error code. An expert reviewer is advised to examine new 1842 registrations for possible duplication with existing error codes. 1843 Use of existing registrations is to be encouraged, but not mandated. 1845 New registrations are advised to provide the following information: 1847 Name: A name for the error code. Specifying an error code name is 1848 optional. 1850 Code: The 62-bit error code value. 1852 Description: A brief description of the error code semantics, longer 1853 if no detailed specification is provided. 1855 Specification: An optional reference for a specification that 1856 defines the error code. 1858 The entries in the following table are registered by this document. 1860 +---------------------------+--------+--------------+---------------+ 1861 | Name | Code | Description | Specification | 1862 +---------------------------+--------+--------------+---------------+ 1863 | H3_NO_ERROR | 0x0100 | No error | Section 8.1 | 1864 | | | | | 1865 | H3_GENERAL_PROTOCOL_ERROR | 0x0101 | General | Section 8.1 | 1866 | | | protocol | | 1867 | | | error | | 1868 | | | | | 1869 | H3_INTERNAL_ERROR | 0x0102 | Internal | Section 8.1 | 1870 | | | error | | 1871 | | | | | 1872 | H3_STREAM_CREATION_ERROR | 0x0103 | Stream | Section 8.1 | 1873 | | | creation | | 1874 | | | error | | 1875 | | | | | 1876 | H3_CLOSED_CRITICAL_STREAM | 0x0104 | Critical | Section 8.1 | 1877 | | | stream was | | 1878 | | | closed | | 1879 | | | | | 1880 | H3_FRAME_UNEXPECTED | 0x0105 | Frame not | Section 8.1 | 1881 | | | permitted in | | 1882 | | | the current | | 1883 | | | state | | 1884 | | | | | 1885 | H3_FRAME_ERROR | 0x0106 | Frame | Section 8.1 | 1886 | | | violated | | 1887 | | | layout or | | 1888 | | | size rules | | 1889 | | | | | 1890 | H3_EXCESSIVE_LOAD | 0x0107 | Peer | Section 8.1 | 1891 | | | generating | | 1892 | | | excessive | | 1893 | | | load | | 1894 | | | | | 1895 | H3_ID_ERROR | 0x0108 | An | Section 8.1 | 1896 | | | identifier | | 1897 | | | was used | | 1898 | | | incorrectly | | 1899 | | | | | 1900 | H3_SETTINGS_ERROR | 0x0109 | SETTINGS | Section 8.1 | 1901 | | | frame | | 1902 | | | contained | | 1903 | | | invalid | | 1904 | | | values | | 1905 | | | | | 1906 | H3_MISSING_SETTINGS | 0x010A | No SETTINGS | Section 8.1 | 1907 | | | frame | | 1908 | | | received | | 1909 | | | | | 1910 | H3_REQUEST_REJECTED | 0x010B | Request not | Section 8.1 | 1911 | | | processed | | 1912 | | | | | 1913 | H3_REQUEST_CANCELLED | 0x010C | Data no | Section 8.1 | 1914 | | | longer | | 1915 | | | needed | | 1916 | | | | | 1917 | H3_REQUEST_INCOMPLETE | 0x010D | Stream | Section 8.1 | 1918 | | | terminated | | 1919 | | | early | | 1920 | | | | | 1921 | H3_EARLY_RESPONSE | 0x010E | Remainder of | Section 8.1 | 1922 | | | request not | | 1923 | | | needed | | 1924 | | | | | 1925 | H3_CONNECT_ERROR | 0x010F | TCP reset or | Section 8.1 | 1926 | | | error on | | 1927 | | | CONNECT | | 1928 | | | request | | 1929 | | | | | 1930 | H3_VERSION_FALLBACK | 0x0110 | Retry over | Section 8.1 | 1931 | | | HTTP/1.1 | | 1932 +---------------------------+--------+--------------+---------------+ 1934 11.5. Stream Types 1936 This document establishes a registry for HTTP/3 unidirectional stream 1937 types. The "HTTP/3 Stream Type" registry governs a 62-bit space. 1938 This space is split into three spaces that are governed by different 1939 policies. Values between "0x00" and 0x3f (in hexadecimal) are 1940 assigned via the Standards Action or IESG Review policies [RFC8126]. 1942 Values from "0x40" to "0x3fff" operate on the Specification Required 1943 policy [RFC8126]. All other values are assigned to Private Use 1944 [RFC8126]. 1946 New entries in this registry require the following information: 1948 Stream Type: A name or label for the stream type. 1950 Code: The 62-bit code assigned to the stream type. 1952 Specification: A reference to a specification that includes a 1953 description of the stream type, including the layout semantics of 1954 its payload. 1956 Sender: Which endpoint on a connection may initiate a stream of this 1957 type. Values are "Client", "Server", or "Both". 1959 The entries in the following table are registered by this document. 1961 +----------------+------+---------------+--------+ 1962 | Stream Type | Code | Specification | Sender | 1963 +----------------+------+---------------+--------+ 1964 | Control Stream | 0x00 | Section 6.2.1 | Both | 1965 | | | | | 1966 | Push Stream | 0x01 | Section 4.4 | Server | 1967 +----------------+------+---------------+--------+ 1969 Additionally, each code of the format "0x1f * N + 0x21" for integer 1970 values of N (that is, "0x21", "0x40", ..., through 1971 "0x3FFFFFFFFFFFFFFE") MUST NOT be assigned by IANA. 1973 12. References 1975 12.1. Normative References 1977 [ALTSVC] Nottingham, M., McManus, P., and J. Reschke, "HTTP 1978 Alternative Services", RFC 7838, DOI 10.17487/RFC7838, 1979 April 2016, . 1981 [HTTP-REPLAY] 1982 Thomson, M., Nottingham, M., and W. Tarreau, "Using Early 1983 Data in HTTP", RFC 8470, DOI 10.17487/RFC8470, September 1984 2018, . 1986 [HTTP2] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 1987 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 1988 DOI 10.17487/RFC7540, May 2015, 1989 . 1991 [QPACK] Krasic, C., Bishop, M., and A. Frindell, Ed., "QPACK: 1992 Header Compression for HTTP over QUIC", draft-ietf-quic- 1993 qpack-11 (work in progress), November 2019. 1995 [QUIC-TRANSPORT] 1996 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 1997 Multiplexed and Secure Transport", draft-ietf-quic- 1998 transport-24 (work in progress), November 2019. 2000 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 2001 RFC 793, DOI 10.17487/RFC0793, September 1981, 2002 . 2004 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2005 Requirement Levels", BCP 14, RFC 2119, 2006 DOI 10.17487/RFC2119, March 1997, 2007 . 2009 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 2010 Specifications: ABNF", STD 68, RFC 5234, 2011 DOI 10.17487/RFC5234, January 2008, 2012 . 2014 [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) 2015 Extensions: Extension Definitions", RFC 6066, 2016 DOI 10.17487/RFC6066, January 2011, 2017 . 2019 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 2020 DOI 10.17487/RFC6265, April 2011, 2021 . 2023 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2024 Protocol (HTTP/1.1): Message Syntax and Routing", 2025 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2026 . 2028 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2029 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 2030 DOI 10.17487/RFC7231, June 2014, 2031 . 2033 [RFC7838] Nottingham, M., McManus, P., and J. Reschke, "HTTP 2034 Alternative Services", RFC 7838, DOI 10.17487/RFC7838, 2035 April 2016, . 2037 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2038 Writing an IANA Considerations Section in RFCs", BCP 26, 2039 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2040 . 2042 [RFC8164] Nottingham, M. and M. Thomson, "Opportunistic Security for 2043 HTTP/2", RFC 8164, DOI 10.17487/RFC8164, May 2017, 2044 . 2046 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2047 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2048 May 2017, . 2050 12.2. Informative References 2052 [HPACK] Peon, R. and H. Ruellan, "HPACK: Header Compression for 2053 HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015, 2054 . 2056 [RFC6585] Nottingham, M. and R. Fielding, "Additional HTTP Status 2057 Codes", RFC 6585, DOI 10.17487/RFC6585, April 2012, 2058 . 2060 [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, 2061 "Transport Layer Security (TLS) Application-Layer Protocol 2062 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 2063 July 2014, . 2065 [RFC7413] Cheng, Y., Chu, J., Radhakrishnan, S., and A. Jain, "TCP 2066 Fast Open", RFC 7413, DOI 10.17487/RFC7413, December 2014, 2067 . 2069 12.3. URIs 2071 [1] https://mailarchive.ietf.org/arch/search/?email_list=quic 2073 [2] https://github.com/quicwg 2075 [3] https://github.com/quicwg/base-drafts/labels/-http 2077 [4] https://www.iana.org/assignments/message-headers 2079 Appendix A. Considerations for Transitioning from HTTP/2 2081 HTTP/3 is strongly informed by HTTP/2, and bears many similarities. 2082 This section describes the approach taken to design HTTP/3, points 2083 out important differences from HTTP/2, and describes how to map 2084 HTTP/2 extensions into HTTP/3. 2086 HTTP/3 begins from the premise that similarity to HTTP/2 is 2087 preferable, but not a hard requirement. HTTP/3 departs from HTTP/2 2088 where QUIC differs from TCP, either to take advantage of QUIC 2089 features (like streams) or to accommodate important shortcomings 2090 (such as a lack of total ordering). These differences make HTTP/3 2091 similar to HTTP/2 in key aspects, such as the relationship of 2092 requests and responses to streams. However, the details of the 2093 HTTP/3 design are substantially different than HTTP/2. 2095 These departures are noted in this section. 2097 A.1. Streams 2099 HTTP/3 permits use of a larger number of streams (2^62-1) than 2100 HTTP/2. The considerations about exhaustion of stream identifier 2101 space apply, though the space is significantly larger such that it is 2102 likely that other limits in QUIC are reached first, such as the limit 2103 on the connection flow control window. 2105 In contrast to HTTP/2, stream concurrency in HTTP/3 is managed by 2106 QUIC. QUIC considers a stream closed when all data has been received 2107 and sent data has been acknowledged by the peer. HTTP/2 considers a 2108 stream closed when the frame containing the END_STREAM bit has been 2109 committed to the transport. As a result, the stream for an 2110 equivalent exchange could remain "active" for a longer period of 2111 time. HTTP/3 servers might choose to permit a larger number of 2112 concurrent client-initiated bidirectional streams to achieve 2113 equivalent concurrency to HTTP/2, depending on the expected usage 2114 patterns. 2116 Due to the presence of other unidirectional stream types, HTTP/3 does 2117 not rely exclusively on the number of concurrent unidirectional 2118 streams to control the number of concurrent in-flight pushes. 2119 Instead, HTTP/3 clients use the MAX_PUSH_ID frame to control the 2120 number of pushes received from an HTTP/3 server. 2122 A.2. HTTP Frame Types 2124 Many framing concepts from HTTP/2 can be elided on QUIC, because the 2125 transport deals with them. Because frames are already on a stream, 2126 they can omit the stream number. Because frames do not block 2127 multiplexing (QUIC's multiplexing occurs below this layer), the 2128 support for variable-maximum-length packets can be removed. Because 2129 stream termination is handled by QUIC, an END_STREAM flag is not 2130 required. This permits the removal of the Flags field from the 2131 generic frame layout. 2133 Frame payloads are largely drawn from [HTTP2]. However, QUIC 2134 includes many features (e.g., flow control) which are also present in 2135 HTTP/2. In these cases, the HTTP mapping does not re-implement them. 2136 As a result, several HTTP/2 frame types are not required in HTTP/3. 2137 Where an HTTP/2-defined frame is no longer used, the frame ID has 2138 been reserved in order to maximize portability between HTTP/2 and 2139 HTTP/3 implementations. However, even equivalent frames between the 2140 two mappings are not identical. 2142 Many of the differences arise from the fact that HTTP/2 provides an 2143 absolute ordering between frames across all streams, while QUIC 2144 provides this guarantee on each stream only. As a result, if a frame 2145 type makes assumptions that frames from different streams will still 2146 be received in the order sent, HTTP/3 will break them. 2148 Some examples of feature adaptations are described below, as well as 2149 general guidance to extension frame implementors converting an HTTP/2 2150 extension to HTTP/3. 2152 A.2.1. Prioritization Differences 2154 HTTP/2 specifies priority assignments in PRIORITY frames and 2155 (optionally) in HEADERS frames. HTTP/3 does not provide a means of 2156 signaling priority. 2158 Note that while there is no explicit signaling for priority, this 2159 does not mean that prioritization is not important for achieving good 2160 performance. 2162 A.2.2. Header Compression Differences 2164 HPACK was designed with the assumption of in-order delivery. A 2165 sequence of encoded header blocks must arrive (and be decoded) at an 2166 endpoint in the same order in which they were encoded. This ensures 2167 that the dynamic state at the two endpoints remains in sync. 2169 Because this total ordering is not provided by QUIC, HTTP/3 uses a 2170 modified version of HPACK, called QPACK. QPACK uses a single 2171 unidirectional stream to make all modifications to the dynamic table, 2172 ensuring a total order of updates. All frames which contain encoded 2173 headers merely reference the table state at a given time without 2174 modifying it. 2176 [QPACK] provides additional details. 2178 A.2.3. Guidance for New Frame Type Definitions 2180 Frame type definitions in HTTP/3 often use the QUIC variable-length 2181 integer encoding. In particular, Stream IDs use this encoding, which 2182 allows for a larger range of possible values than the encoding used 2183 in HTTP/2. Some frames in HTTP/3 use an identifier rather than a 2184 Stream ID (e.g., Push IDs). Redefinition of the encoding of 2185 extension frame types might be necessary if the encoding includes a 2186 Stream ID. 2188 Because the Flags field is not present in generic HTTP/3 frames, 2189 those frames which depend on the presence of flags need to allocate 2190 space for flags as part of their frame payload. 2192 Other than this issue, frame type HTTP/2 extensions are typically 2193 portable to QUIC simply by replacing Stream 0 in HTTP/2 with a 2194 control stream in HTTP/3. HTTP/3 extensions will not assume 2195 ordering, but would not be harmed by ordering, and would be portable 2196 to HTTP/2 in the same manner. 2198 A.2.4. Mapping Between HTTP/2 and HTTP/3 Frame Types 2200 DATA (0x0): Padding is not defined in HTTP/3 frames. See 2201 Section 7.2.1. 2203 HEADERS (0x1): The PRIORITY region of HEADERS is not defined in 2204 HTTP/3 frames. Padding is not defined in HTTP/3 frames. See 2205 Section 7.2.2. 2207 PRIORITY (0x2): As described in Appendix A.2.1, HTTP/3 does not 2208 provide a means of signaling priority. 2210 RST_STREAM (0x3): RST_STREAM frames do not exist, since QUIC 2211 provides stream lifecycle management. The same code point is used 2212 for the CANCEL_PUSH frame (Section 7.2.3). 2214 SETTINGS (0x4): SETTINGS frames are sent only at the beginning of 2215 the connection. See Section 7.2.4 and Appendix A.3. 2217 PUSH_PROMISE (0x5): The PUSH_PROMISE does not reference a stream; 2218 instead the push stream references the PUSH_PROMISE frame using a 2219 Push ID. See Section 7.2.5. 2221 PING (0x6): PING frames do not exist, since QUIC provides equivalent 2222 functionality. 2224 GOAWAY (0x7): GOAWAY is sent only from server to client and does not 2225 contain an error code. See Section 7.2.6. 2227 WINDOW_UPDATE (0x8): WINDOW_UPDATE frames do not exist, since QUIC 2228 provides flow control. 2230 CONTINUATION (0x9): CONTINUATION frames do not exist; instead, 2231 larger HEADERS/PUSH_PROMISE frames than HTTP/2 are permitted. 2233 Frame types defined by extensions to HTTP/2 need to be separately 2234 registered for HTTP/3 if still applicable. The IDs of frames defined 2235 in [HTTP2] have been reserved for simplicity. Note that the frame 2236 type space in HTTP/3 is substantially larger (62 bits versus 8 bits), 2237 so many HTTP/3 frame types have no equivalent HTTP/2 code points. 2238 See Section 11.2. 2240 A.3. HTTP/2 SETTINGS Parameters 2242 An important difference from HTTP/2 is that settings are sent once, 2243 as the first frame of the control stream, and thereafter cannot 2244 change. This eliminates many corner cases around synchronization of 2245 changes. 2247 Some transport-level options that HTTP/2 specifies via the SETTINGS 2248 frame are superseded by QUIC transport parameters in HTTP/3. The 2249 HTTP-level options that are retained in HTTP/3 have the same value as 2250 in HTTP/2. 2252 Below is a listing of how each HTTP/2 SETTINGS parameter is mapped: 2254 SETTINGS_HEADER_TABLE_SIZE: See [QPACK]. 2256 SETTINGS_ENABLE_PUSH: This is removed in favor of the MAX_PUSH_ID 2257 which provides a more granular control over server push. 2259 SETTINGS_MAX_CONCURRENT_STREAMS: QUIC controls the largest open 2260 Stream ID as part of its flow control logic. Specifying 2261 SETTINGS_MAX_CONCURRENT_STREAMS in the SETTINGS frame is an error. 2263 SETTINGS_INITIAL_WINDOW_SIZE: QUIC requires both stream and 2264 connection flow control window sizes to be specified in the 2265 initial transport handshake. Specifying 2266 SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS frame is an error. 2268 SETTINGS_MAX_FRAME_SIZE: This setting has no equivalent in HTTP/3. 2269 Specifying it in the SETTINGS frame is an error. 2271 SETTINGS_MAX_HEADER_LIST_SIZE: See Section 7.2.4.1. 2273 In HTTP/3, setting values are variable-length integers (6, 14, 30, or 2274 62 bits long) rather than fixed-length 32-bit fields as in HTTP/2. 2276 This will often produce a shorter encoding, but can produce a longer 2277 encoding for settings which use the full 32-bit space. Settings 2278 ported from HTTP/2 might choose to redefine the format of their 2279 settings to avoid using the 62-bit encoding. 2281 Settings need to be defined separately for HTTP/2 and HTTP/3. The 2282 IDs of settings defined in [HTTP2] have been reserved for simplicity. 2283 Note that the settings identifier space in HTTP/3 is substantially 2284 larger (62 bits versus 16 bits), so many HTTP/3 settings have no 2285 equivalent HTTP/2 code point. See Section 11.3. 2287 As QUIC streams might arrive out-of-order, endpoints are advised to 2288 not wait for the peers' settings to arrive before responding to other 2289 streams. See Section 7.2.4.2. 2291 A.4. HTTP/2 Error Codes 2293 QUIC has the same concepts of "stream" and "connection" errors that 2294 HTTP/2 provides. However, there is no direct portability of HTTP/2 2295 error codes to HTTP/3 error codes; the values are shifted in order to 2296 prevent accidental or implicit conversion. 2298 The HTTP/2 error codes defined in Section 7 of [HTTP2] logically map 2299 to the HTTP/3 error codes as follows: 2301 NO_ERROR (0x0): H3_NO_ERROR in Section 8.1. 2303 PROTOCOL_ERROR (0x1): This is mapped to H3_GENERAL_PROTOCOL_ERROR 2304 except in cases where more specific error codes have been defined. 2305 This includes H3_FRAME_UNEXPECTED and H3_CLOSED_CRITICAL_STREAM 2306 defined in Section 8.1. 2308 INTERNAL_ERROR (0x2): H3_INTERNAL_ERROR in Section 8.1. 2310 FLOW_CONTROL_ERROR (0x3): Not applicable, since QUIC handles flow 2311 control. 2313 SETTINGS_TIMEOUT (0x4): Not applicable, since no acknowledgement of 2314 SETTINGS is defined. 2316 STREAM_CLOSED (0x5): Not applicable, since QUIC handles stream 2317 management. 2319 FRAME_SIZE_ERROR (0x6): H3_FRAME_ERROR error code defined in 2320 Section 8.1. 2322 REFUSED_STREAM (0x7): H3_REQUEST_REJECTED (in Section 8.1) is used 2323 to indicate that a request was not processed. Otherwise, not 2324 applicable because QUIC handles stream management. 2326 CANCEL (0x8): H3_REQUEST_CANCELLED in Section 8.1. 2328 COMPRESSION_ERROR (0x9): Multiple error codes are defined in 2329 [QPACK]. 2331 CONNECT_ERROR (0xa): H3_CONNECT_ERROR in Section 8.1. 2333 ENHANCE_YOUR_CALM (0xb): H3_EXCESSIVE_LOAD in Section 8.1. 2335 INADEQUATE_SECURITY (0xc): Not applicable, since QUIC is assumed to 2336 provide sufficient security on all connections. 2338 H3_1_1_REQUIRED (0xd): H3_VERSION_FALLBACK in Section 8.1. 2340 Error codes need to be defined for HTTP/2 and HTTP/3 separately. See 2341 Section 11.4. 2343 Appendix B. Change Log 2345 *RFC Editor's Note:* Please remove this section prior to 2346 publication of a final version of this document. 2348 B.1. Since draft-ietf-quic-http-23 2350 o Removed "quic" Alt-Svc parameter (#3061,#3118) 2352 o Clients need not persist unknown settings for use in 0-RTT 2353 (#3110,#3113) 2355 o Clarify error cases around CANCEL_PUSH (#2819,#3083) 2357 B.2. Since draft-ietf-quic-http-22 2359 o Removed priority signaling (#2922,#2924) 2361 o Further changes to error codes (#2662,#2551): 2363 * Error codes renumbered 2365 * HTTP_MALFORMED_FRAME replaced by HTTP_FRAME_ERROR, 2366 HTTP_ID_ERROR, and others 2368 o Clarify how unknown frame types interact with required frame 2369 sequence (#2867,#2858) 2371 o Describe interactions with the transport in terms of defined 2372 interface terms (#2857,#2805) 2374 o Require the use of the "http-opportunistic" resource (RFC 8164) 2375 when scheme is "http" (#2439,#2973) 2377 o Settings identifiers cannot be duplicated (#2979) 2379 o Changes to SETTINGS frames in 0-RTT (#2972,#2790,#2945): 2381 * Servers must send all settings with non-default values in their 2382 SETTINGS frame, even when resuming 2384 * If a client doesn't have settings associated with a 0-RTT 2385 ticket, it uses the defaults 2387 * Servers can't accept early data if they cannot recover the 2388 settings the client will have remembered 2390 o Clarify that Upgrade and the 101 status code are prohibited 2391 (#2898,#2889) 2393 o Clarify that frame types reserved for greasing can occur on any 2394 stream, but frame types reserved due to HTTP/2 correspondence are 2395 prohibited (#2997,#2692,#2693) 2397 o Unknown error codes cannot be treated as errors (#2998,#2816) 2399 B.3. Since draft-ietf-quic-http-21 2401 No changes 2403 B.4. Since draft-ietf-quic-http-20 2405 o Prohibit closing the control stream (#2509, #2666) 2407 o Change default priority to use an orphan node (#2502, #2690) 2409 o Exclusive priorities are restored (#2754, #2781) 2411 o Restrict use of frames when using CONNECT (#2229, #2702) 2413 o Close and maybe reset streams if a connection error occurs for 2414 CONNECT (#2228, #2703) 2416 o Encourage provision of sufficient unidirectional streams for QPACK 2417 (#2100, #2529, #2762) 2419 o Allow extensions to use server-initiated bidirectional streams 2420 (#2711, #2773) 2422 o Clarify use of maximum header list size setting (#2516, #2774) 2424 o Extensive changes to error codes and conditions of their sending 2426 * Require connection errors for more error conditions (#2511, 2427 #2510) 2429 * Updated the error codes for illegal GOAWAY frames (#2714, 2430 #2707) 2432 * Specified error code for HEADERS on control stream (#2708) 2434 * Specified error code for servers receiving PUSH_PROMISE (#2709) 2436 * Specified error code for receiving DATA before HEADERS (#2715) 2438 * Describe malformed messages and their handling (#2410, #2764) 2440 * Remove HTTP_PUSH_ALREADY_IN_CACHE error (#2812, #2813) 2442 * Refactor Push ID related errors (#2818, #2820) 2444 * Rationalize HTTP/3 stream creation errors (#2821, #2822) 2446 B.5. Since draft-ietf-quic-http-19 2448 o SETTINGS_NUM_PLACEHOLDERS is 0x9 (#2443,#2530) 2450 o Non-zero bits in the Empty field of the PRIORITY frame MAY be 2451 treated as an error (#2501) 2453 B.6. Since draft-ietf-quic-http-18 2455 o Resetting streams following a GOAWAY is recommended, but not 2456 required (#2256,#2457) 2458 o Use variable-length integers throughout (#2437,#2233,#2253,#2275) 2460 * Variable-length frame types, stream types, and settings 2461 identifiers 2463 * Renumbered stream type assignments 2465 * Modified associated reserved values 2467 o Frame layout switched from Length-Type-Value to Type-Length-Value 2468 (#2395,#2235) 2470 o Specified error code for servers receiving DUPLICATE_PUSH (#2497) 2472 o Use connection error for invalid PRIORITY (#2507, #2508) 2474 B.7. Since draft-ietf-quic-http-17 2476 o HTTP_REQUEST_REJECTED is used to indicate a request can be retried 2477 (#2106, #2325) 2479 o Changed error code for GOAWAY on the wrong stream (#2231, #2343) 2481 B.8. Since draft-ietf-quic-http-16 2483 o Rename "HTTP/QUIC" to "HTTP/3" (#1973) 2485 o Changes to PRIORITY frame (#1865, #2075) 2487 * Permitted as first frame of request streams 2489 * Remove exclusive reprioritization 2491 * Changes to Prioritized Element Type bits 2493 o Define DUPLICATE_PUSH frame to refer to another PUSH_PROMISE 2494 (#2072) 2496 o Set defaults for settings, allow request before receiving SETTINGS 2497 (#1809, #1846, #2038) 2499 o Clarify message processing rules for streams that aren't closed 2500 (#1972, #2003) 2502 o Removed reservation of error code 0 and moved HTTP_NO_ERROR to 2503 this value (#1922) 2505 o Removed prohibition of zero-length DATA frames (#2098) 2507 B.9. Since draft-ietf-quic-http-15 2509 Substantial editorial reorganization; no technical changes. 2511 B.10. Since draft-ietf-quic-http-14 2513 o Recommend sensible values for QUIC transport parameters 2514 (#1720,#1806) 2516 o Define error for missing SETTINGS frame (#1697,#1808) 2518 o Setting values are variable-length integers (#1556,#1807) and do 2519 not have separate maximum values (#1820) 2521 o Expanded discussion of connection closure (#1599,#1717,#1712) 2523 o HTTP_VERSION_FALLBACK falls back to HTTP/1.1 (#1677,#1685) 2525 B.11. Since draft-ietf-quic-http-13 2527 o Reserved some frame types for grease (#1333, #1446) 2529 o Unknown unidirectional stream types are tolerated, not errors; 2530 some reserved for grease (#1490, #1525) 2532 o Require settings to be remembered for 0-RTT, prohibit reductions 2533 (#1541, #1641) 2535 o Specify behavior for truncated requests (#1596, #1643) 2537 B.12. Since draft-ietf-quic-http-12 2539 o TLS SNI extension isn't mandatory if an alternative method is used 2540 (#1459, #1462, #1466) 2542 o Removed flags from HTTP/3 frames (#1388, #1398) 2544 o Reserved frame types and settings for use in preserving 2545 extensibility (#1333, #1446) 2547 o Added general error code (#1391, #1397) 2549 o Unidirectional streams carry a type byte and are extensible 2550 (#910,#1359) 2552 o Priority mechanism now uses explicit placeholders to enable 2553 persistent structure in the tree (#441,#1421,#1422) 2555 B.13. Since draft-ietf-quic-http-11 2557 o Moved QPACK table updates and acknowledgments to dedicated streams 2558 (#1121, #1122, #1238) 2560 B.14. Since draft-ietf-quic-http-10 2562 o Settings need to be remembered when attempting and accepting 0-RTT 2563 (#1157, #1207) 2565 B.15. Since draft-ietf-quic-http-09 2567 o Selected QCRAM for header compression (#228, #1117) 2569 o The server_name TLS extension is now mandatory (#296, #495) 2571 o Specified handling of unsupported versions in Alt-Svc (#1093, 2572 #1097) 2574 B.16. Since draft-ietf-quic-http-08 2576 o Clarified connection coalescing rules (#940, #1024) 2578 B.17. Since draft-ietf-quic-http-07 2580 o Changes for integer encodings in QUIC (#595,#905) 2582 o Use unidirectional streams as appropriate (#515, #240, #281, #886) 2584 o Improvement to the description of GOAWAY (#604, #898) 2586 o Improve description of server push usage (#947, #950, #957) 2588 B.18. Since draft-ietf-quic-http-06 2590 o Track changes in QUIC error code usage (#485) 2592 B.19. Since draft-ietf-quic-http-05 2594 o Made push ID sequential, add MAX_PUSH_ID, remove 2595 SETTINGS_ENABLE_PUSH (#709) 2597 o Guidance about keep-alive and QUIC PINGs (#729) 2599 o Expanded text on GOAWAY and cancellation (#757) 2601 B.20. Since draft-ietf-quic-http-04 2603 o Cite RFC 5234 (#404) 2605 o Return to a single stream per request (#245,#557) 2607 o Use separate frame type and settings registries from HTTP/2 (#81) 2609 o SETTINGS_ENABLE_PUSH instead of SETTINGS_DISABLE_PUSH (#477) 2611 o Restored GOAWAY (#696) 2613 o Identify server push using Push ID rather than a stream ID 2614 (#702,#281) 2616 o DATA frames cannot be empty (#700) 2618 B.21. Since draft-ietf-quic-http-03 2620 None. 2622 B.22. Since draft-ietf-quic-http-02 2624 o Track changes in transport draft 2626 B.23. Since draft-ietf-quic-http-01 2628 o SETTINGS changes (#181): 2630 * SETTINGS can be sent only once at the start of a connection; no 2631 changes thereafter 2633 * SETTINGS_ACK removed 2635 * Settings can only occur in the SETTINGS frame a single time 2637 * Boolean format updated 2639 o Alt-Svc parameter changed from "v" to "quic"; format updated 2640 (#229) 2642 o Closing the connection control stream or any message control 2643 stream is a fatal error (#176) 2645 o HPACK Sequence counter can wrap (#173) 2647 o 0-RTT guidance added 2648 o Guide to differences from HTTP/2 and porting HTTP/2 extensions 2649 added (#127,#242) 2651 B.24. Since draft-ietf-quic-http-00 2653 o Changed "HTTP/2-over-QUIC" to "HTTP/QUIC" throughout (#11,#29) 2655 o Changed from using HTTP/2 framing within Stream 3 to new framing 2656 format and two-stream-per-request model (#71,#72,#73) 2658 o Adopted SETTINGS format from draft-bishop-httpbis-extended- 2659 settings-01 2661 o Reworked SETTINGS_ACK to account for indeterminate inter-stream 2662 order (#75) 2664 o Described CONNECT pseudo-method (#95) 2666 o Updated ALPN token and Alt-Svc guidance (#13,#87) 2668 o Application-layer-defined error codes (#19,#74) 2670 B.25. Since draft-shade-quic-http2-mapping-00 2672 o Adopted as base for draft-ietf-quic-http 2674 o Updated authors/editors list 2676 Acknowledgements 2678 The original authors of this specification were Robbie Shade and Mike 2679 Warres. 2681 A substantial portion of Mike's contribution was supported by 2682 Microsoft during his employment there. 2684 Author's Address 2686 Mike Bishop (editor) 2687 Akamai 2689 Email: mbishop@evequefou.be