idnits 2.17.1 draft-ietf-quic-http-31.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == There is 1 instance of lines with non-ascii characters in the document. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (25 September 2020) is 1309 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) == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-11 -- Possible downref: Normative reference to a draft: ref. 'CACHING' == Outdated reference: A later version (-21) exists of draft-ietf-quic-qpack-18 == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-31 ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) ** Downref: Normative reference to an Historic RFC: RFC 8164 == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-semantics-11 -- Possible downref: Normative reference to a draft: ref. 'SEMANTICS' == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-messaging-11 -- Obsolete informational reference (is this intentional?): RFC 7540 (ref. 'HTTP2') (Obsoleted by RFC 9113) Summary: 3 errors (**), 0 flaws (~~), 7 warnings (==), 5 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 25 September 2020 5 Expires: 29 March 2021 7 Hypertext Transfer Protocol Version 3 (HTTP/3) 8 draft-ietf-quic-http-31 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. 25 Working Group information can be found at https://github.com/quicwg; 26 source code and issues list for this draft can be found at 27 https://github.com/quicwg/base-drafts/labels/-http. 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 29 March 2021. 46 Copyright Notice 48 Copyright (c) 2020 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 (https://trustee.ietf.org/ 53 license-info) in effect on the date of publication of this document. 54 Please review these documents carefully, as they describe your rights 55 and restrictions with respect to this document. Code Components 56 extracted from this document must include Simplified BSD License text 57 as described in Section 4.e of the Trust Legal Provisions and are 58 provided without warranty as described in the Simplified BSD License. 60 Table of Contents 62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 63 1.1. Prior versions of HTTP . . . . . . . . . . . . . . . . . 5 64 1.2. Delegation to QUIC . . . . . . . . . . . . . . . . . . . 5 65 2. HTTP/3 Protocol Overview . . . . . . . . . . . . . . . . . . 5 66 2.1. Document Organization . . . . . . . . . . . . . . . . . . 6 67 2.2. Conventions and Terminology . . . . . . . . . . . . . . . 7 68 3. Connection Setup and Management . . . . . . . . . . . . . . . 8 69 3.1. Draft Version Identification . . . . . . . . . . . . . . 8 70 3.2. Discovering an HTTP/3 Endpoint . . . . . . . . . . . . . 9 71 3.2.1. HTTP Alternative Services . . . . . . . . . . . . . . 9 72 3.2.2. Other Schemes . . . . . . . . . . . . . . . . . . . . 10 73 3.3. Connection Establishment . . . . . . . . . . . . . . . . 10 74 3.4. Connection Reuse . . . . . . . . . . . . . . . . . . . . 11 75 4. HTTP Request Lifecycle . . . . . . . . . . . . . . . . . . . 12 76 4.1. HTTP Message Exchanges . . . . . . . . . . . . . . . . . 12 77 4.1.1. Field Formatting and Compression . . . . . . . . . . 14 78 4.1.2. Request Cancellation and Rejection . . . . . . . . . 17 79 4.1.3. Malformed Requests and Responses . . . . . . . . . . 18 80 4.2. The CONNECT Method . . . . . . . . . . . . . . . . . . . 19 81 4.3. HTTP Upgrade . . . . . . . . . . . . . . . . . . . . . . 20 82 4.4. Server Push . . . . . . . . . . . . . . . . . . . . . . . 20 83 5. Connection Closure . . . . . . . . . . . . . . . . . . . . . 22 84 5.1. Idle Connections . . . . . . . . . . . . . . . . . . . . 22 85 5.2. Connection Shutdown . . . . . . . . . . . . . . . . . . . 23 86 5.3. Immediate Application Closure . . . . . . . . . . . . . . 25 87 5.4. Transport Closure . . . . . . . . . . . . . . . . . . . . 25 88 6. Stream Mapping and Usage . . . . . . . . . . . . . . . . . . 25 89 6.1. Bidirectional Streams . . . . . . . . . . . . . . . . . . 26 90 6.2. Unidirectional Streams . . . . . . . . . . . . . . . . . 26 91 6.2.1. Control Streams . . . . . . . . . . . . . . . . . . . 28 92 6.2.2. Push Streams . . . . . . . . . . . . . . . . . . . . 28 93 6.2.3. Reserved Stream Types . . . . . . . . . . . . . . . . 29 95 7. HTTP Framing Layer . . . . . . . . . . . . . . . . . . . . . 29 96 7.1. Frame Layout . . . . . . . . . . . . . . . . . . . . . . 30 97 7.2. Frame Definitions . . . . . . . . . . . . . . . . . . . . 31 98 7.2.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . 31 99 7.2.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 31 100 7.2.3. CANCEL_PUSH . . . . . . . . . . . . . . . . . . . . . 32 101 7.2.4. SETTINGS . . . . . . . . . . . . . . . . . . . . . . 33 102 7.2.5. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . 36 103 7.2.6. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . 38 104 7.2.7. MAX_PUSH_ID . . . . . . . . . . . . . . . . . . . . . 38 105 7.2.8. Reserved Frame Types . . . . . . . . . . . . . . . . 39 106 8. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 39 107 8.1. HTTP/3 Error Codes . . . . . . . . . . . . . . . . . . . 40 108 9. Extensions to HTTP/3 . . . . . . . . . . . . . . . . . . . . 41 109 10. Security Considerations . . . . . . . . . . . . . . . . . . . 42 110 10.1. Server Authority . . . . . . . . . . . . . . . . . . . . 42 111 10.2. Cross-Protocol Attacks . . . . . . . . . . . . . . . . . 42 112 10.3. Intermediary Encapsulation Attacks . . . . . . . . . . . 43 113 10.4. Cacheability of Pushed Responses . . . . . . . . . . . . 43 114 10.5. Denial-of-Service Considerations . . . . . . . . . . . . 43 115 10.5.1. Limits on Field Section Size . . . . . . . . . . . . 44 116 10.5.2. CONNECT Issues . . . . . . . . . . . . . . . . . . . 45 117 10.6. Use of Compression . . . . . . . . . . . . . . . . . . . 45 118 10.7. Padding and Traffic Analysis . . . . . . . . . . . . . . 46 119 10.8. Frame Parsing . . . . . . . . . . . . . . . . . . . . . 46 120 10.9. Early Data . . . . . . . . . . . . . . . . . . . . . . . 46 121 10.10. Migration . . . . . . . . . . . . . . . . . . . . . . . 47 122 10.11. Privacy Considerations . . . . . . . . . . . . . . . . . 47 123 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 47 124 11.1. Registration of HTTP/3 Identification String . . . . . . 47 125 11.2. New Registries . . . . . . . . . . . . . . . . . . . . . 48 126 11.2.1. Frame Types . . . . . . . . . . . . . . . . . . . . 48 127 11.2.2. Settings Parameters . . . . . . . . . . . . . . . . 49 128 11.2.3. Error Codes . . . . . . . . . . . . . . . . . . . . 50 129 11.2.4. Stream Types . . . . . . . . . . . . . . . . . . . . 53 130 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 53 131 12.1. Normative References . . . . . . . . . . . . . . . . . . 53 132 12.2. Informative References . . . . . . . . . . . . . . . . . 55 133 Appendix A. Considerations for Transitioning from HTTP/2 . . . . 56 134 A.1. Streams . . . . . . . . . . . . . . . . . . . . . . . . . 56 135 A.2. HTTP Frame Types . . . . . . . . . . . . . . . . . . . . 57 136 A.2.1. Prioritization Differences . . . . . . . . . . . . . 57 137 A.2.2. Field Compression Differences . . . . . . . . . . . . 58 138 A.2.3. Flow Control Differences . . . . . . . . . . . . . . 58 139 A.2.4. Guidance for New Frame Type Definitions . . . . . . . 58 140 A.2.5. Mapping Between HTTP/2 and HTTP/3 Frame Types . . . . 59 141 A.3. HTTP/2 SETTINGS Parameters . . . . . . . . . . . . . . . 60 142 A.4. HTTP/2 Error Codes . . . . . . . . . . . . . . . . . . . 61 143 A.4.1. Mapping Between HTTP/2 and HTTP/3 Errors . . . . . . 62 144 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 63 145 B.1. Since draft-ietf-quic-http-30 . . . . . . . . . . . . . . 63 146 B.2. Since draft-ietf-quic-http-29 . . . . . . . . . . . . . . 63 147 B.3. Since draft-ietf-quic-http-28 . . . . . . . . . . . . . . 63 148 B.4. Since draft-ietf-quic-http-27 . . . . . . . . . . . . . . 63 149 B.5. Since draft-ietf-quic-http-26 . . . . . . . . . . . . . . 63 150 B.6. Since draft-ietf-quic-http-25 . . . . . . . . . . . . . . 63 151 B.7. Since draft-ietf-quic-http-24 . . . . . . . . . . . . . . 64 152 B.8. Since draft-ietf-quic-http-23 . . . . . . . . . . . . . . 64 153 B.9. Since draft-ietf-quic-http-22 . . . . . . . . . . . . . . 64 154 B.10. Since draft-ietf-quic-http-21 . . . . . . . . . . . . . . 65 155 B.11. Since draft-ietf-quic-http-20 . . . . . . . . . . . . . . 65 156 B.12. Since draft-ietf-quic-http-19 . . . . . . . . . . . . . . 66 157 B.13. Since draft-ietf-quic-http-18 . . . . . . . . . . . . . . 66 158 B.14. Since draft-ietf-quic-http-17 . . . . . . . . . . . . . . 66 159 B.15. Since draft-ietf-quic-http-16 . . . . . . . . . . . . . . 67 160 B.16. Since draft-ietf-quic-http-15 . . . . . . . . . . . . . . 67 161 B.17. Since draft-ietf-quic-http-14 . . . . . . . . . . . . . . 67 162 B.18. Since draft-ietf-quic-http-13 . . . . . . . . . . . . . . 67 163 B.19. Since draft-ietf-quic-http-12 . . . . . . . . . . . . . . 68 164 B.20. Since draft-ietf-quic-http-11 . . . . . . . . . . . . . . 68 165 B.21. Since draft-ietf-quic-http-10 . . . . . . . . . . . . . . 68 166 B.22. Since draft-ietf-quic-http-09 . . . . . . . . . . . . . . 68 167 B.23. Since draft-ietf-quic-http-08 . . . . . . . . . . . . . . 69 168 B.24. Since draft-ietf-quic-http-07 . . . . . . . . . . . . . . 69 169 B.25. Since draft-ietf-quic-http-06 . . . . . . . . . . . . . . 69 170 B.26. Since draft-ietf-quic-http-05 . . . . . . . . . . . . . . 69 171 B.27. Since draft-ietf-quic-http-04 . . . . . . . . . . . . . . 69 172 B.28. Since draft-ietf-quic-http-03 . . . . . . . . . . . . . . 69 173 B.29. Since draft-ietf-quic-http-02 . . . . . . . . . . . . . . 70 174 B.30. Since draft-ietf-quic-http-01 . . . . . . . . . . . . . . 70 175 B.31. Since draft-ietf-quic-http-00 . . . . . . . . . . . . . . 70 176 B.32. Since draft-shade-quic-http2-mapping-00 . . . . . . . . . 71 177 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 71 178 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 72 180 1. Introduction 182 HTTP semantics ([SEMANTICS]) are used for a broad range of services 183 on the Internet. These semantics have most commonly been used with 184 HTTP/1.1, over a variety of transport and session layers, and with 185 HTTP/2 over TLS. HTTP/3 supports the same semantics over a new 186 transport protocol, QUIC. 188 1.1. Prior versions of HTTP 190 HTTP/1.1 ([HTTP11]) uses whitespace-delimited text fields to convey 191 HTTP messages. While these exchanges are human-readable, using 192 whitespace for message formatting leads to parsing complexity and 193 excessive tolerance of variant behavior. Because HTTP/1.x does not 194 include a multiplexing layer, multiple TCP connections are often used 195 to service requests in parallel. However, that has a negative impact 196 on congestion control and network efficiency, since TCP does not 197 share congestion control across multiple connections. 199 HTTP/2 ([HTTP2]) introduced a binary framing and multiplexing layer 200 to improve latency without modifying the transport layer. However, 201 because the parallel nature of HTTP/2's multiplexing is not visible 202 to TCP's loss recovery mechanisms, a lost or reordered packet causes 203 all active transactions to experience a stall regardless of whether 204 that transaction was directly impacted by the lost packet. 206 1.2. Delegation to QUIC 208 The QUIC transport protocol incorporates stream multiplexing and per- 209 stream flow control, similar to that provided by the HTTP/2 framing 210 layer. By providing reliability at the stream level and congestion 211 control across the entire connection, it has the capability to 212 improve the performance of HTTP compared to a TCP mapping. QUIC also 213 incorporates TLS 1.3 ([TLS13]) at the transport layer, offering 214 comparable security to running TLS over TCP, with the improved 215 connection setup latency of TCP Fast Open ([TFO]). 217 This document defines a mapping of HTTP semantics over the QUIC 218 transport protocol, drawing heavily on the design of HTTP/2. While 219 delegating stream lifetime and flow control issues to QUIC, a similar 220 binary framing is used on each stream. Some HTTP/2 features are 221 subsumed by QUIC, while other features are implemented atop QUIC. 223 QUIC is described in [QUIC-TRANSPORT]. For a full description of 224 HTTP/2, see [HTTP2]. 226 2. HTTP/3 Protocol Overview 228 HTTP/3 provides a transport for HTTP semantics using the QUIC 229 transport protocol and an internal framing layer similar to HTTP/2. 231 Once a client knows that an HTTP/3 server exists at a certain 232 endpoint, it opens a QUIC connection. QUIC provides protocol 233 negotiation, stream-based multiplexing, and flow control. Discovery 234 of an HTTP/3 endpoint is described in Section 3.2. 236 Within each stream, the basic unit of HTTP/3 communication is a frame 237 (Section 7.2). Each frame type serves a different purpose. For 238 example, HEADERS and DATA frames form the basis of HTTP requests and 239 responses (Section 4.1). 241 Multiplexing of requests is performed using the QUIC stream 242 abstraction, described in Section 2 of [QUIC-TRANSPORT]. Each 243 request-response pair consumes a single QUIC stream. Streams are 244 independent of each other, so one stream that is blocked or suffers 245 packet loss does not prevent progress on other streams. 247 Server push is an interaction mode introduced in HTTP/2 ([HTTP2]) 248 that permits a server to push a request-response exchange to a client 249 in anticipation of the client making the indicated request. This 250 trades off network usage against a potential latency gain. Several 251 HTTP/3 frames are used to manage server push, such as PUSH_PROMISE, 252 MAX_PUSH_ID, and CANCEL_PUSH. 254 As in HTTP/2, request and response fields are compressed for 255 transmission. Because HPACK ([HPACK]) relies on in-order 256 transmission of compressed field sections (a guarantee not provided 257 by QUIC), HTTP/3 replaces HPACK with QPACK ([QPACK]). QPACK uses 258 separate unidirectional streams to modify and track field table 259 state, while encoded field sections refer to the state of the table 260 without modifying it. 262 2.1. Document Organization 264 The following sections provide a detailed overview of the connection 265 lifecycle and key concepts: 267 * Connection Setup and Management (Section 3) covers how an HTTP/3 268 endpoint is discovered and a connection is established. 270 * HTTP Request Lifecycle (Section 4) describes how HTTP semantics 271 are expressed using frames. 273 * Connection Closure (Section 5) describes how connections are 274 terminated, either gracefully or abruptly. 276 The details of the wire protocol and interactions with the transport 277 are described in subsequent sections: 279 * Stream Mapping and Usage (Section 6) describes the way QUIC 280 streams are used. 282 * HTTP Framing Layer (Section 7) describes the frames used on most 283 streams. 285 * Error Handling (Section 8) describes how error conditions are 286 handled and expressed, either on a particular stream or for the 287 connection as a whole. 289 Additional resources are provided in the final sections: 291 * Extensions to HTTP/3 (Section 9) describes how new capabilities 292 can be added in future documents. 294 * A more detailed comparison between HTTP/2 and HTTP/3 can be found 295 in Appendix A. 297 2.2. Conventions and Terminology 299 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 300 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 301 "OPTIONAL" in this document are to be interpreted as described in 302 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 303 capitals, as shown here. 305 This document uses the variable-length integer encoding from 306 [QUIC-TRANSPORT]. 308 The following terms are used: 310 abort: An abrupt termination of a connection or stream, possibly due 311 to an error condition. 313 client: The endpoint that initiates an HTTP/3 connection. Clients 314 send HTTP requests and receive HTTP responses. 316 connection: A transport-layer connection between two endpoints, 317 using QUIC as the transport protocol. 319 connection error: An error that affects the entire HTTP/3 320 connection. 322 endpoint: Either the client or server of the connection. 324 frame: The smallest unit of communication on a stream in HTTP/3, 325 consisting of a header and a variable-length sequence of bytes 326 structured according to the frame type. Protocol elements called 327 "frames" exist in both this document and [QUIC-TRANSPORT]. Where 328 frames from [QUIC-TRANSPORT] are referenced, the frame name will 329 be prefaced with "QUIC." For example, "QUIC CONNECTION_CLOSE 330 frames." References without this preface refer to frames defined 331 in Section 7.2. 333 peer: An endpoint. When discussing a particular endpoint, "peer" 334 refers to the endpoint that is remote to the primary subject of 335 discussion. 337 receiver: An endpoint that is receiving frames. 339 sender: An endpoint that is transmitting frames. 341 server: The endpoint that accepts an HTTP/3 connection. Servers 342 receive HTTP requests and send HTTP responses. 344 stream: A bidirectional or unidirectional bytestream provided by the 345 QUIC transport. 347 stream error: An error on the individual HTTP/3 stream. 349 The term "payload body" is defined in Section 7.3.3 of [SEMANTICS]. 351 Finally, the terms "gateway", "intermediary", "proxy", and "tunnel" 352 are defined in Section 2.2 of [SEMANTICS]. Intermediaries act as 353 both client and server at different times. 355 Packet diagrams in this document use the format defined in 356 Section 1.3 of [QUIC-TRANSPORT] to illustrate the order and size of 357 fields. 359 3. Connection Setup and Management 361 3.1. Draft Version Identification 363 *RFC Editor's Note:* Please remove this section prior to 364 publication of a final version of this document. 366 HTTP/3 uses the token "h3" to identify itself in ALPN and Alt-Svc. 367 Only implementations of the final, published RFC can identify 368 themselves as "h3". Until such an RFC exists, implementations MUST 369 NOT identify themselves using this string. 371 Implementations of draft versions of the protocol MUST add the string 372 "-" and the corresponding draft number to the identifier. For 373 example, draft-ietf-quic-http-01 is identified using the string 374 "h3-01". 376 Draft versions MUST use the corresponding draft transport version as 377 their transport. For example, the application protocol defined in 378 draft-ietf-quic-http-25 uses the transport defined in draft-ietf- 379 quic-transport-25. 381 Non-compatible experiments that are based on these draft versions 382 MUST append the string "-" and an experiment name to the identifier. 383 For example, an experimental implementation based on draft-ietf-quic- 384 http-09 that reserves an extra stream for unsolicited transmission of 385 1980s pop music might identify itself as "h3-09-rickroll". Note that 386 any label MUST conform to the "token" syntax defined in 387 Section 5.4.1.1 of [SEMANTICS]. Experimenters are encouraged to 388 coordinate their experiments on the quic@ietf.org mailing list. 390 3.2. Discovering an HTTP/3 Endpoint 392 HTTP relies on the notion of an authoritative response: a response 393 that has been determined to be the most appropriate response for that 394 request given the state of the target resource at the time of 395 response message origination by (or at the direction of) the origin 396 server identified within the target URI. Locating an authoritative 397 server for an HTTP URL is discussed in Section 6.4 of [SEMANTICS]. 399 The "https" scheme associates authority with possession of a 400 certificate that the client considers to be trustworthy for the host 401 identified by the authority component of the URL. If a server 402 presents a certificate and proof that it controls the corresponding 403 private key, then a client will accept a secured connection to that 404 server as being authoritative for all origins with the "https" scheme 405 and a host identified in the certificate. 407 A client MAY attempt access to a resource with an "https" URI by 408 resolving the host identifier to an IP address, establishing a QUIC 409 connection to that address on the indicated port, and sending an 410 HTTP/3 request message targeting the URI to the server over that 411 secured connection. 413 Connectivity problems (e.g., blocking UDP) can result in QUIC 414 connection establishment failure; clients SHOULD attempt to use TCP- 415 based versions of HTTP in this case. 417 Servers MAY serve HTTP/3 on any UDP port; an alternative service 418 advertisement always includes an explicit port, and URLs contain 419 either an explicit port or a default port associated with the scheme. 421 3.2.1. HTTP Alternative Services 423 An HTTP origin advertises the availability of an equivalent HTTP/3 424 endpoint via the Alt-Svc HTTP response header field or the HTTP/2 425 ALTSVC frame ([ALTSVC]), using the Application Layer Protocol 426 Negotiation (ALPN; see [RFC7301]) token defined in Section 3.3. 428 For example, an origin could indicate in an HTTP response that HTTP/3 429 was available on UDP port 50781 at the same hostname by including the 430 following header field: 432 Alt-Svc: h3=":50781" 434 On receipt of an Alt-Svc record indicating HTTP/3 support, a client 435 MAY attempt to establish a QUIC connection to the indicated host and 436 port; if this connection is successful, the client can send HTTP 437 requests using the mapping described in this document. 439 3.2.2. Other Schemes 441 Although HTTP is independent of the transport protocol, the "http" 442 scheme associates authority with the ability to receive TCP 443 connections on the indicated port of whatever host is identified 444 within the authority component. Because HTTP/3 does not use TCP, 445 HTTP/3 cannot be used for direct access to the authoritative server 446 for a resource identified by an "http" URI. However, protocol 447 extensions such as [ALTSVC] permit the authoritative server to 448 identify other services that are also authoritative and that might be 449 reachable over HTTP/3. 451 Prior to making requests for an origin whose scheme is not "https", 452 the client MUST ensure the server is willing to serve that scheme. 453 If the client intends to make requests for an origin whose scheme is 454 "http", this means that it MUST obtain a valid "http-opportunistic" 455 response for the origin as described in [RFC8164] prior to making any 456 such requests. Other schemes might define other mechanisms. 458 3.3. Connection Establishment 460 HTTP/3 relies on QUIC version 1 as the underlying transport. The use 461 of other QUIC transport versions with HTTP/3 MAY be defined by future 462 specifications. 464 QUIC version 1 uses TLS version 1.3 or greater as its handshake 465 protocol. HTTP/3 clients MUST support a mechanism to indicate the 466 target host to the server during the TLS handshake. If the server is 467 identified by a DNS name, clients MUST send the Server Name 468 Indication (SNI; [RFC6066]) TLS extension unless an alternative 469 mechanism to indicate the target host is used. 471 QUIC connections are established as described in [QUIC-TRANSPORT]. 472 During connection establishment, HTTP/3 support is indicated by 473 selecting the ALPN token "h3" in the TLS handshake. Support for 474 other application-layer protocols MAY be offered in the same 475 handshake. 477 While connection-level options pertaining to the core QUIC protocol 478 are set in the initial crypto handshake, HTTP/3-specific settings are 479 conveyed in the SETTINGS frame. After the QUIC connection is 480 established, a SETTINGS frame (Section 7.2.4) MUST be sent by each 481 endpoint as the initial frame of their respective HTTP control 482 stream; see Section 6.2.1. 484 3.4. Connection Reuse 486 HTTP/3 connections are persistent across multiple requests. For best 487 performance, it is expected that clients will not close connections 488 until it is determined that no further communication with a server is 489 necessary (for example, when a user navigates away from a particular 490 web page) or until the server closes the connection. 492 Once a connection exists to a server endpoint, this connection MAY be 493 reused for requests with multiple different URI authority components. 494 In general, a server is considered authoritative for all URIs with 495 the "https" scheme for which the hostname in the URI is present in 496 the authenticated certificate provided by the server, either as the 497 CN field of the certificate subject or as a dNSName in the 498 subjectAltName field of the certificate; see [RFC6125]. For a host 499 that is an IP address, the client MUST verify that the address 500 appears as an iPAddress in the subjectAltName field of the 501 certificate. If the hostname or address is not present in the 502 certificate, the client MUST NOT consider the server authoritative 503 for origins containing that hostname or address. See Section 6.4 of 504 [SEMANTICS] for more detail on authoritative access. 506 Clients SHOULD NOT open more than one HTTP/3 connection to a given 507 host and port pair, where the host is derived from a URI, a selected 508 alternative service ([ALTSVC]), or a configured proxy. A client MAY 509 open multiple connections to the same IP address and UDP port using 510 different transport or TLS configurations but SHOULD avoid creating 511 multiple connections with the same configuration. 513 Servers are encouraged to maintain open connections for as long as 514 possible but are permitted to terminate idle connections if 515 necessary. When either endpoint chooses to close the HTTP/3 516 connection, the terminating endpoint SHOULD first send a GOAWAY frame 517 (Section 5.2) so that both endpoints can reliably determine whether 518 previously sent frames have been processed and gracefully complete or 519 terminate any necessary remaining tasks. 521 A server that does not wish clients to reuse connections for a 522 particular origin can indicate that it is not authoritative for a 523 request by sending a 421 (Misdirected Request) status code in 524 response to the request; see Section 9.1.2 of [HTTP2]. 526 4. HTTP Request Lifecycle 528 4.1. HTTP Message Exchanges 530 A client sends an HTTP request on a client-initiated bidirectional 531 QUIC stream. A client MUST send only a single request on a given 532 stream. A server sends zero or more interim HTTP responses on the 533 same stream as the request, followed by a single final HTTP response, 534 as detailed below. See Section 10 of [SEMANTICS] for a description 535 of interim and final HTTP responses. 537 Pushed responses are sent on a server-initiated unidirectional QUIC 538 stream; see Section 6.2.2. A server sends zero or more interim HTTP 539 responses, followed by a single final HTTP response, in the same 540 manner as a standard response. Push is described in more detail in 541 Section 4.4. 543 On a given stream, receipt of multiple requests or receipt of an 544 additional HTTP response following a final HTTP response MUST be 545 treated as malformed (Section 4.1.3). 547 An HTTP message (request or response) consists of: 549 1. the header field section, sent as a single HEADERS frame (see 550 Section 7.2.2), 552 2. optionally, the payload body, if present, sent as a series of 553 DATA frames (see Section 7.2.1), and 555 3. optionally, the trailer field section, if present, sent as a 556 single HEADERS frame. 558 Header and trailer field sections are described in Section 5 of 559 [SEMANTICS]; the payload body is described in Section 7.3.3 of 560 [SEMANTICS]. 562 Receipt of an invalid sequence of frames MUST be treated as a 563 connection error of type H3_FRAME_UNEXPECTED (Section 8). In 564 particular, a DATA frame before any HEADERS frame, or a HEADERS or 565 DATA frame after the trailing HEADERS frame is considered invalid. 567 A server MAY send one or more PUSH_PROMISE frames (Section 7.2.5) 568 before, after, or interleaved with the frames of a response message. 569 These PUSH_PROMISE frames are not part of the response; see 570 Section 4.4 for more details. These frames are not permitted in 571 pushed responses; a pushed response that includes PUSH_PROMISE frames 572 MUST be treated as a connection error of type H3_FRAME_UNEXPECTED. 574 Frames of unknown types (Section 9), including reserved frames 575 (Section 7.2.8) MAY be sent on a request or push stream before, 576 after, or interleaved with other frames described in this section. 578 The HEADERS and PUSH_PROMISE frames might reference updates to the 579 QPACK dynamic table. While these updates are not directly part of 580 the message exchange, they must be received and processed before the 581 message can be consumed. See Section 4.1.1 for more details. 583 The "chunked" transfer encoding defined in Section 7.1 of [HTTP11] 584 MUST NOT be used. 586 A response MAY consist of multiple messages when and only when one or 587 more interim responses (1xx; see Section 10.2 of [SEMANTICS]) precede 588 a final response to the same request. Interim responses do not 589 contain a payload body or trailers. 591 An HTTP request/response exchange fully consumes a client-initiated 592 bidirectional QUIC stream. After sending a request, a client MUST 593 close the stream for sending. Unless using the CONNECT method (see 594 Section 4.2), clients MUST NOT make stream closure dependent on 595 receiving a response to their request. After sending a final 596 response, the server MUST close the stream for sending. At this 597 point, the QUIC stream is fully closed. 599 When a stream is closed, this indicates the end of the final HTTP 600 message. Because some messages are large or unbounded, endpoints 601 SHOULD begin processing partial HTTP messages once enough of the 602 message has been received to make progress. If a client-initiated 603 stream terminates without enough of the HTTP message to provide a 604 complete response, the server SHOULD abort its response with the 605 error code H3_REQUEST_INCOMPLETE. 607 A server can send a complete response prior to the client sending an 608 entire request if the response does not depend on any portion of the 609 request that has not been sent and received. When the server does 610 not need to receive the remainder of the request, it MAY abort 611 reading the request stream, send a complete response, and cleanly 612 close the sending part of the stream. The error code H3_NO_ERROR 613 SHOULD be used when requesting that the client stop sending on the 614 request stream. Clients MUST NOT discard complete responses as a 615 result of having their request terminated abruptly, though clients 616 can always discard responses at their discretion for other reasons. 617 If the server sends a partial or complete response but does not abort 618 reading the request, clients SHOULD continue sending the body of the 619 request and close the stream normally. 621 4.1.1. Field Formatting and Compression 623 HTTP messages carry metadata as a series of key-value pairs, called 624 HTTP fields. For a listing of registered HTTP fields, see the 625 "Hypertext Transfer Protocol (HTTP) Field Name Registry" maintained 626 at https://www.iana.org/assignments/http-fields/. 628 As in previous versions of HTTP, field names are strings containing a 629 subset of ASCII characters that are compared in a case-insensitive 630 fashion. Properties of HTTP field names and values are discussed in 631 more detail in Section 5.3 of [SEMANTICS]. As in HTTP/2, characters 632 in field names MUST be converted to lowercase prior to their 633 encoding. A request or response containing uppercase characters in 634 field names MUST be treated as malformed (Section 4.1.3). 636 Like HTTP/2, HTTP/3 does not use the Connection header field to 637 indicate connection-specific fields; in this protocol, connection- 638 specific metadata is conveyed by other means. An endpoint MUST NOT 639 generate an HTTP/3 field section containing connection-specific 640 fields; any message containing connection-specific fields MUST be 641 treated as malformed (Section 4.1.3). 643 The only exception to this is the TE header field, which MAY be 644 present in an HTTP/3 request header; when it is, it MUST NOT contain 645 any value other than "trailers". 647 This means that an intermediary transforming an HTTP/1.x message to 648 HTTP/3 will need to remove any fields nominated by the Connection 649 field, along with the Connection field itself. Such intermediaries 650 SHOULD also remove other connection-specific fields, such as Keep- 651 Alive, Proxy-Connection, Transfer-Encoding, and Upgrade, even if they 652 are not nominated by the Connection field. 654 4.1.1.1. Pseudo-Header Fields 656 Like HTTP/2, HTTP/3 employs a series of pseudo-header fields where 657 the field name begins with the ':' character (ASCII 0x3a). These 658 pseudo-header fields convey the target URI, the method of the 659 request, and the status code for the response. 661 Pseudo-header fields are not HTTP fields. Endpoints MUST NOT 662 generate pseudo-header fields other than those defined in this 663 document, except as negotiated via an extension; see Section 9. 665 Pseudo-header fields are only valid in the context in which they are 666 defined. Pseudo-header fields defined for requests MUST NOT appear 667 in responses; pseudo-header fields defined for responses MUST NOT 668 appear in requests. Pseudo-header fields MUST NOT appear in 669 trailers. Endpoints MUST treat a request or response that contains 670 undefined or invalid pseudo-header fields as malformed 671 (Section 4.1.3). 673 All pseudo-header fields MUST appear in the header field section 674 before regular header fields. Any request or response that contains 675 a pseudo-header field that appears in a header field section after a 676 regular header field MUST be treated as malformed (Section 4.1.3). 678 The following pseudo-header fields are defined for requests: 680 ":method": Contains the HTTP method (Section 8 of [SEMANTICS]) 682 ":scheme": Contains the scheme portion of the target URI 683 (Section 3.1 of [URI]) 685 ":scheme" is not restricted to "http" and "https" schemed URIs. A 686 proxy or gateway can translate requests for non-HTTP schemes, 687 enabling the use of HTTP to interact with non-HTTP services. 689 ":authority": Contains the authority portion of the target URI 690 (Section 3.2 of [URI]). The authority MUST NOT include the 691 deprecated "userinfo" subcomponent for "http" or "https" schemed 692 URIs. 694 To ensure that the HTTP/1.1 request line can be reproduced 695 accurately, this pseudo-header field MUST be omitted when 696 translating from an HTTP/1.1 request that has a request target in 697 origin or asterisk form; see Section 3.2 of [HTTP11]. Clients 698 that generate HTTP/3 requests directly SHOULD use the ":authority" 699 pseudo-header field instead of the Host field. An intermediary 700 that converts an HTTP/3 request to HTTP/1.1 MUST create a Host 701 field if one is not present in a request by copying the value of 702 the ":authority" pseudo-header field. 704 ":path": Contains the path and query parts of the target URI (the 705 "path-absolute" production and optionally a '?' character followed 706 by the "query" production; see Sections 3.3 and 3.4 of [URI]. A 707 request in asterisk form includes the value '*' for the ":path" 708 pseudo-header field. 710 This pseudo-header field MUST NOT be empty for "http" or "https" 711 URIs; "http" or "https" URIs that do not contain a path component 712 MUST include a value of '/'. The exception to this rule is an 713 OPTIONS request for an "http" or "https" URI that does not include 714 a path component; these MUST include a ":path" pseudo-header field 715 with a value of '*'; see Section 3.2.4 of [HTTP11]. 717 All HTTP/3 requests MUST include exactly one value for the ":method", 718 ":scheme", and ":path" pseudo-header fields, unless it is a CONNECT 719 request; see Section 4.2. 721 If the ":scheme" pseudo-header field identifies a scheme that has a 722 mandatory authority component (including "http" and "https"), the 723 request MUST contain either an ":authority" pseudo-header field or a 724 "Host" header field. If these fields are present, they MUST NOT be 725 empty. If both fields are present, they MUST contain the same value. 726 If the scheme does not have a mandatory authority component and none 727 is provided in the request target, the request MUST NOT contain the 728 ":authority" pseudo-header or "Host" header fields. 730 An HTTP request that omits mandatory pseudo-header fields or contains 731 invalid values for those pseudo-header fields is malformed 732 (Section 4.1.3). 734 HTTP/3 does not define a way to carry the version identifier that is 735 included in the HTTP/1.1 request line. 737 For responses, a single ":status" pseudo-header field is defined that 738 carries the HTTP status code; see Section 10 of [SEMANTICS]. This 739 pseudo-header field MUST be included in all responses; otherwise, the 740 response is malformed (Section 4.1.3). 742 HTTP/3 does not define a way to carry the version or reason phrase 743 that is included in an HTTP/1.1 status line. 745 4.1.1.2. Field Compression 747 HTTP/3 uses QPACK field compression as described in [QPACK], a 748 variation of HPACK that allows the flexibility to avoid compression- 749 induced head-of-line blocking. See that document for additional 750 details. 752 To allow for better compression efficiency, the "Cookie" field 753 ([RFC6265]) MAY be split into separate field lines, each with one or 754 more cookie-pairs, before compression. If a decompressed field 755 section contains multiple cookie field lines, these MUST be 756 concatenated into a single octet string using the two-octet delimiter 757 of 0x3b, 0x20 (the ASCII string "; ") before being passed into a 758 context other than HTTP/2 or HTTP/3, such as an HTTP/1.1 connection, 759 or a generic HTTP server application. 761 4.1.1.3. Header Size Constraints 763 An HTTP/3 implementation MAY impose a limit on the maximum size of 764 the message header it will accept on an individual HTTP message. A 765 server that receives a larger header section than it is willing to 766 handle can send an HTTP 431 (Request Header Fields Too Large) status 767 code ([RFC6585]). A client can discard responses that it cannot 768 process. The size of a field list is calculated based on the 769 uncompressed size of fields, including the length of the name and 770 value in bytes plus an overhead of 32 bytes for each field. 772 If an implementation wishes to advise its peer of this limit, it can 773 be conveyed as a number of bytes in the 774 SETTINGS_MAX_FIELD_SECTION_SIZE parameter. An implementation that 775 has received this parameter SHOULD NOT send an HTTP message header 776 that exceeds the indicated size, as the peer will likely refuse to 777 process it. However, because this limit is applied at each hop, 778 messages below this limit are not guaranteed to be accepted. 780 4.1.2. Request Cancellation and Rejection 782 Once a request stream has been opened, the request MAY be cancelled 783 by either endpoint. Clients cancel requests if the response is no 784 longer of interest; servers cancel requests if they are unable to or 785 choose not to respond. When possible, it is RECOMMENDED that servers 786 send an HTTP response with an appropriate status code rather than 787 canceling a request it has already begun processing. 789 Implementations SHOULD cancel requests by abruptly terminating any 790 directions of a stream that are still open. This means resetting the 791 sending parts of streams and aborting reading on receiving parts of 792 streams; see Section 2.4 of [QUIC-TRANSPORT]. 794 When the server cancels a request without performing any application 795 processing, the request is considered "rejected." The server SHOULD 796 abort its response stream with the error code H3_REQUEST_REJECTED. 797 In this context, "processed" means that some data from the stream was 798 passed to some higher layer of software that might have taken some 799 action as a result. The client can treat requests rejected by the 800 server as though they had never been sent at all, thereby allowing 801 them to be retried later. 803 Servers MUST NOT use the H3_REQUEST_REJECTED error code for requests 804 that were partially or fully processed. When a server abandons a 805 response after partial processing, it SHOULD abort its response 806 stream with the error code H3_REQUEST_CANCELLED. 808 Client SHOULD use the error code H3_REQUEST_CANCELLED to cancel 809 requests. Upon receipt of this error code, a server MAY abruptly 810 terminate the response using the error code H3_REQUEST_REJECTED if no 811 processing was performed. Clients MUST NOT use the 812 H3_REQUEST_REJECTED error code, except when a server has requested 813 closure of the request stream with this error code. 815 If a stream is canceled after receiving a complete response, the 816 client MAY ignore the cancellation and use the response. However, if 817 a stream is cancelled after receiving a partial response, the 818 response SHOULD NOT be used. Automatically retrying such requests is 819 not possible, unless this is otherwise permitted (e.g., idempotent 820 actions like GET, PUT, or DELETE). 822 4.1.3. Malformed Requests and Responses 824 A malformed request or response is one that is an otherwise valid 825 sequence of frames but is invalid due to: 827 * the presence of prohibited fields or pseudo-header fields, 829 * the absence of mandatory pseudo-header fields, 831 * invalid values for pseudo-header fields, 833 * pseudo-header fields after fields, 835 * an invalid sequence of HTTP messages, 837 * the inclusion of uppercase field names, or 839 * the inclusion of invalid characters in field names or values 841 A request or response that includes a payload body can include a 842 Content-Length header field. A request or response is also malformed 843 if the value of a content-length header field does not equal the sum 844 of the DATA frame payload lengths that form the body. A response 845 that is defined to have no payload, as described in Section 7.3.3 of 846 [SEMANTICS] can have a non-zero content-length field, even though no 847 content is included in DATA frames. 849 Intermediaries that process HTTP requests or responses (i.e., any 850 intermediary not acting as a tunnel) MUST NOT forward a malformed 851 request or response. Malformed requests or responses that are 852 detected MUST be treated as a stream error (Section 8) of type 853 H3_GENERAL_PROTOCOL_ERROR. 855 For malformed requests, a server MAY send an HTTP response indicating 856 the error prior to closing or resetting the stream. Clients MUST NOT 857 accept a malformed response. Note that these requirements are 858 intended to protect against several types of common attacks against 859 HTTP; they are deliberately strict because being permissive can 860 expose implementations to these vulnerabilities. 862 4.2. The CONNECT Method 864 The CONNECT method requests that the recipient establish a tunnel to 865 the destination origin server identified by the request-target 866 (Section 3.2 of [HTTP11]). It is primarily used with HTTP proxies to 867 establish a TLS session with an origin server for the purposes of 868 interacting with "https" resources. 870 In HTTP/1.x, CONNECT is used to convert an entire HTTP connection 871 into a tunnel to a remote host. In HTTP/2 and HTTP/3, the CONNECT 872 method is used to establish a tunnel over a single stream. 874 A CONNECT request MUST be constructed as follows: 876 * The ":method" pseudo-header field is set to "CONNECT" 878 * The ":scheme" and ":path" pseudo-header fields are omitted 880 * The ":authority" pseudo-header field contains the host and port to 881 connect to (equivalent to the authority-form of the request-target 882 of CONNECT requests; see Section 3.2.3 of [HTTP11]) 884 The request stream remains open at the end of the request to carry 885 the data to be transferred. A CONNECT request that does not conform 886 to these restrictions is malformed; see Section 4.1.3. 888 A proxy that supports CONNECT establishes a TCP connection 889 ([RFC0793]) to the server identified in the ":authority" pseudo- 890 header field. Once this connection is successfully established, the 891 proxy sends a HEADERS frame containing a 2xx series status code to 892 the client, as defined in Section 10.3 of [SEMANTICS]. 894 All DATA frames on the stream correspond to data sent or received on 895 the TCP connection. The payload of any DATA frame sent by the client 896 is transmitted by the proxy to the TCP server; data received from the 897 TCP server is packaged into DATA frames by the proxy. Note that the 898 size and number of TCP segments is not guaranteed to map predictably 899 to the size and number of HTTP DATA or QUIC STREAM frames. 901 Once the CONNECT method has completed, only DATA frames are permitted 902 to be sent on the stream. Extension frames MAY be used if 903 specifically permitted by the definition of the extension. Receipt 904 of any other known frame type MUST be treated as a connection error 905 of type H3_FRAME_UNEXPECTED. 907 The TCP connection can be closed by either peer. When the client 908 ends the request stream (that is, the receive stream at the proxy 909 enters the "Data Recvd" state), the proxy will set the FIN bit on its 910 connection to the TCP server. When the proxy receives a packet with 911 the FIN bit set, it will close the send stream that it sends to the 912 client. TCP connections that remain half-closed in a single 913 direction are not invalid, but are often handled poorly by servers, 914 so clients SHOULD NOT close a stream for sending while they still 915 expect to receive data from the target of the CONNECT. 917 A TCP connection error is signaled by abruptly terminating the 918 stream. A proxy treats any error in the TCP connection, which 919 includes receiving a TCP segment with the RST bit set, as a stream 920 error of type H3_CONNECT_ERROR (Section 8.1). Correspondingly, if a 921 proxy detects an error with the stream or the QUIC connection, it 922 MUST close the TCP connection. If the underlying TCP implementation 923 permits it, the proxy SHOULD send a TCP segment with the RST bit set. 925 4.3. HTTP Upgrade 927 HTTP/3 does not support the HTTP Upgrade mechanism (Section 6.7 of 928 {{!SEMANTICS}) or 101 (Switching Protocols) informational status code 929 (Section 10.2.2 of [SEMANTICS]). 931 4.4. Server Push 933 Server push is an interaction mode that permits a server to push a 934 request-response exchange to a client in anticipation of the client 935 making the indicated request. This trades off network usage against 936 a potential latency gain. HTTP/3 server push is similar to what is 937 described in Section 8.2 of [HTTP2], but uses different mechanisms. 939 Each server push is assigned a unique Push ID by the server. The 940 Push ID is used to refer to the push in various contexts throughout 941 the lifetime of the connection. 943 The Push ID space begins at zero, and ends at a maximum value set by 944 the MAX_PUSH_ID frame; see Section 7.2.7. In particular, a server is 945 not able to push until after the client sends a MAX_PUSH_ID frame. A 946 client sends MAX_PUSH_ID frames to control the number of pushes that 947 a server can promise. A server SHOULD use Push IDs sequentially, 948 beginning from zero. A client MUST treat receipt of a push stream as 949 a connection error of type H3_ID_ERROR when no MAX_PUSH_ID frame has 950 been sent or when the stream references a Push ID that is greater 951 than the maximum Push ID. 953 The Push ID is used in one or more PUSH_PROMISE frames 954 (Section 7.2.5) that carry the header section of the request message. 955 These frames are sent on the request stream that generated the push. 956 This allows the server push to be associated with a client request. 957 When the same Push ID is promised on multiple request streams, the 958 decompressed request field sections MUST contain the same fields in 959 the same order, and both the name and the value in each field MUST be 960 identical. 962 The Push ID is then included with the push stream that ultimately 963 fulfills those promises; see Section 6.2.2. The push stream 964 identifies the Push ID of the promise that it fulfills, then contains 965 a response to the promised request as described in Section 4.1. 967 Finally, the Push ID can be used in CANCEL_PUSH frames; see 968 Section 7.2.3. Clients use this frame to indicate they do not wish 969 to receive a promised resource. Servers use this frame to indicate 970 they will not be fulfilling a previous promise. 972 Not all requests can be pushed. A server MAY push requests that have 973 the following properties: 975 * cacheable; see Section 8.2.3 of [SEMANTICS] 977 * safe; see Section 8.2.1 of [SEMANTICS] 979 * does not include a request body or trailer section 981 The server MUST include a value in the ":authority" pseudo-header 982 field for which the server is authoritative; see Section 3.4. 984 Clients SHOULD send a CANCEL_PUSH frame upon receipt of a 985 PUSH_PROMISE frame carrying a request that is not cacheable, is not 986 known to be safe, that indicates the presence of a request body, or 987 for which it does not consider the server authoritative. Any 988 corresponding responses MUST NOT be used or cached. 990 Each pushed response is associated with one or more client requests. 991 The push is associated with the request stream on which the 992 PUSH_PROMISE frame was received. The same server push can be 993 associated with additional client requests using a PUSH_PROMISE frame 994 with the same Push ID on multiple request streams. These 995 associations do not affect the operation of the protocol, but MAY be 996 considered by user agents when deciding how to use pushed resources. 998 Ordering of a PUSH_PROMISE frame in relation to certain parts of the 999 response is important. The server SHOULD send PUSH_PROMISE frames 1000 prior to sending HEADERS or DATA frames that reference the promised 1001 responses. This reduces the chance that a client requests a resource 1002 that will be pushed by the server. 1004 Due to reordering, push stream data can arrive before the 1005 corresponding PUSH_PROMISE frame. When a client receives a new push 1006 stream with an as-yet-unknown Push ID, both the associated client 1007 request and the pushed request header fields are unknown. The client 1008 can buffer the stream data in expectation of the matching 1009 PUSH_PROMISE. The client can use stream flow control (see section 1010 4.1 of [QUIC-TRANSPORT]) to limit the amount of data a server may 1011 commit to the pushed stream. 1013 Push stream data can also arrive after a client has canceled a push. 1014 In this case, the client can abort reading the stream with an error 1015 code of H3_REQUEST_CANCELLED. This asks the server not to transfer 1016 additional data and indicates that it will be discarded upon receipt. 1018 Pushed responses that are cacheable (see Section 3 of [CACHING]) can 1019 be stored by the client, if it implements an HTTP cache. Pushed 1020 responses are considered successfully validated on the origin server 1021 (e.g., if the "no-cache" cache response directive is present; see 1022 Section 5.2.2.3 of [CACHING]) at the time the pushed response is 1023 received. 1025 Pushed responses that are not cacheable MUST NOT be stored by any 1026 HTTP cache. They MAY be made available to the application 1027 separately. 1029 5. Connection Closure 1031 Once established, an HTTP/3 connection can be used for many requests 1032 and responses over time until the connection is closed. Connection 1033 closure can happen in any of several different ways. 1035 5.1. Idle Connections 1037 Each QUIC endpoint declares an idle timeout during the handshake. If 1038 the connection remains idle (no packets received) for longer than 1039 this duration, the peer will assume that the connection has been 1040 closed. HTTP/3 implementations will need to open a new connection 1041 for new requests if the existing connection has been idle for longer 1042 than the server's advertised idle timeout, and SHOULD do so if 1043 approaching the idle timeout. 1045 HTTP clients are expected to request that the transport keep 1046 connections open while there are responses outstanding for requests 1047 or server pushes, as described in Section 10.1.2 of [QUIC-TRANSPORT]. 1048 If the client is not expecting a response from the server, allowing 1049 an idle connection to time out is preferred over expending effort 1050 maintaining a connection that might not be needed. A gateway MAY 1051 maintain connections in anticipation of need rather than incur the 1052 latency cost of connection establishment to servers. Servers SHOULD 1053 NOT actively keep connections open. 1055 5.2. Connection Shutdown 1057 Even when a connection is not idle, either endpoint can decide to 1058 stop using the connection and initiate a graceful connection close. 1059 Endpoints initiate the graceful shutdown of a connection by sending a 1060 GOAWAY frame (Section 7.2.6). The GOAWAY frame contains an 1061 identifier that indicates to the receiver the range of requests or 1062 pushes that were or might be processed in this connection. The 1063 server sends a client-initiated bidirectional Stream ID; the client 1064 sends a Push ID (Section 4.4). Requests or pushes with the indicated 1065 identifier or greater are rejected (Section 4.1.2) by the sender of 1066 the GOAWAY. This identifier MAY be zero if no requests or pushes 1067 were processed. 1069 The information in the GOAWAY frame enables a client and server to 1070 agree on which requests or pushes were accepted prior to the 1071 connection shutdown. Upon sending a GOAWAY frame, the endpoint 1072 SHOULD explicitly cancel (see Section 4.1.2 and Section 7.2.3) any 1073 requests or pushes that have identifiers greater than or equal to 1074 that indicated, in order to clean up transport state for the affected 1075 streams. The endpoint SHOULD continue to do so as more requests or 1076 pushes arrive. 1078 Endpoints MUST NOT initiate new requests or promise new pushes on the 1079 connection after receipt of a GOAWAY frame from the peer. Clients 1080 MAY establish a new connection to send additional requests. 1082 Some requests or pushes might already be in transit: 1084 * Upon receipt of a GOAWAY frame, if the client has already sent 1085 requests with a Stream ID greater than or equal to the identifier 1086 contained in the GOAWAY frame, those requests will not be 1087 processed. Clients can safely retry unprocessed requests on a 1088 different connection. A client that is unable to retry requests 1089 loses all requests that are in flight when the server closes the 1090 connection. 1092 Requests on Stream IDs less than the Stream ID in a GOAWAY frame 1093 from the server might have been processed; their status cannot be 1094 known until a response is received, the stream is reset 1095 individually, another GOAWAY is received, or the connection 1096 terminates. 1098 Servers MAY reject individual requests on streams below the 1099 indicated ID if these requests were not processed. 1101 * If a server receives a GOAWAY frame after having promised pushes 1102 with a Push ID greater than or equal to the identifier contained 1103 in the GOAWAY frame, those pushes will not be accepted. 1105 Servers SHOULD send a GOAWAY frame when the closing of a connection 1106 is known in advance, even if the advance notice is small, so that the 1107 remote peer can know whether a request has been partially processed 1108 or not. For example, if an HTTP client sends a POST at the same time 1109 that a server closes a QUIC connection, the client cannot know if the 1110 server started to process that POST request if the server does not 1111 send a GOAWAY frame to indicate what streams it might have acted on. 1113 An endpoint MAY send multiple GOAWAY frames indicating different 1114 identifiers, but the identifier in each frame MUST NOT be greater 1115 than the identifier in any previous frame, since clients might 1116 already have retried unprocessed requests on another connection. 1117 Receiving a GOAWAY containing a larger identifier than previously 1118 received MUST be treated as a connection error of type H3_ID_ERROR. 1120 An endpoint that is attempting to gracefully shut down a connection 1121 can send a GOAWAY frame with a value set to the maximum possible 1122 value (2^62-4 for servers, 2^62-1 for clients). This ensures that 1123 the peer stops creating new requests or pushes. After allowing time 1124 for any in-flight requests or pushes to arrive, the endpoint can send 1125 another GOAWAY frame indicating which requests or pushes it might 1126 accept before the end of the connection. This ensures that a 1127 connection can be cleanly shut down without losing requests. 1129 A client has more flexibility in the value it chooses for the Push ID 1130 in a GOAWAY that it sends. A value of 2^62 - 1 indicates that the 1131 server can continue fulfilling pushes that have already been 1132 promised. A smaller value indicates the client will reject pushes 1133 with Push IDs greater than or equal to this value. Like the server, 1134 the client MAY send subsequent GOAWAY frames so long as the specified 1135 Push ID is no greater than any previously sent value. 1137 Even when a GOAWAY indicates that a given request or push will not be 1138 processed or accepted upon receipt, the underlying transport 1139 resources still exist. The endpoint that initiated these requests 1140 can cancel them to clean up transport state. 1142 Once all accepted requests and pushes have been processed, the 1143 endpoint can permit the connection to become idle, or MAY initiate an 1144 immediate closure of the connection. An endpoint that completes a 1145 graceful shutdown SHOULD use the H3_NO_ERROR error code when closing 1146 the connection. 1148 If a client has consumed all available bidirectional stream IDs with 1149 requests, the server need not send a GOAWAY frame, since the client 1150 is unable to make further requests. 1152 5.3. Immediate Application Closure 1154 An HTTP/3 implementation can immediately close the QUIC connection at 1155 any time. This results in sending a QUIC CONNECTION_CLOSE frame to 1156 the peer indicating that the application layer has terminated the 1157 connection. The application error code in this frame indicates to 1158 the peer why the connection is being closed. See Section 8 for error 1159 codes that can be used when closing a connection in HTTP/3. 1161 Before closing the connection, a GOAWAY frame MAY be sent to allow 1162 the client to retry some requests. Including the GOAWAY frame in the 1163 same packet as the QUIC CONNECTION_CLOSE frame improves the chances 1164 of the frame being received by clients. 1166 5.4. Transport Closure 1168 For various reasons, the QUIC transport could indicate to the 1169 application layer that the connection has terminated. This might be 1170 due to an explicit closure by the peer, a transport-level error, or a 1171 change in network topology that interrupts connectivity. 1173 If a connection terminates without a GOAWAY frame, clients MUST 1174 assume that any request that was sent, whether in whole or in part, 1175 might have been processed. 1177 6. Stream Mapping and Usage 1179 A QUIC stream provides reliable in-order delivery of bytes, but makes 1180 no guarantees about order of delivery with regard to bytes on other 1181 streams. On the wire, data is framed into QUIC STREAM frames, but 1182 this framing is invisible to the HTTP framing layer. The transport 1183 layer buffers and orders received QUIC STREAM frames, exposing the 1184 data contained within as a reliable byte stream to the application. 1186 Although QUIC permits out-of-order delivery within a stream, HTTP/3 1187 does not make use of this feature. 1189 QUIC streams can be either unidirectional, carrying data only from 1190 initiator to receiver, or bidirectional. Streams can be initiated by 1191 either the client or the server. For more detail on QUIC streams, 1192 see Section 2 of [QUIC-TRANSPORT]. 1194 When HTTP fields and data are sent over QUIC, the QUIC layer handles 1195 most of the stream management. HTTP does not need to do any separate 1196 multiplexing when using QUIC - data sent over a QUIC stream always 1197 maps to a particular HTTP transaction or connection context. 1199 6.1. Bidirectional Streams 1201 All client-initiated bidirectional streams are used for HTTP requests 1202 and responses. A bidirectional stream ensures that the response can 1203 be readily correlated with the request. This means that the client's 1204 first request occurs on QUIC stream 0, with subsequent requests on 1205 stream 4, 8, and so on. In order to permit these streams to open, an 1206 HTTP/3 server SHOULD configure non-zero minimum values for the number 1207 of permitted streams and the initial stream flow control window. So 1208 as to not unnecessarily limit parallelism, at least 100 requests 1209 SHOULD be permitted at a time. 1211 HTTP/3 does not use server-initiated bidirectional streams, though an 1212 extension could define a use for these streams. Clients MUST treat 1213 receipt of a server-initiated bidirectional stream as a connection 1214 error of type H3_STREAM_CREATION_ERROR unless such an extension has 1215 been negotiated. 1217 6.2. Unidirectional Streams 1219 Unidirectional streams, in either direction, are used for a range of 1220 purposes. The purpose is indicated by a stream type, which is sent 1221 as a variable-length integer at the start of the stream. The format 1222 and structure of data that follows this integer is determined by the 1223 stream type. 1225 Unidirectional Stream Header { 1226 Stream Type (i), 1227 } 1229 Figure 1: Unidirectional Stream Header 1231 Two stream types are defined in this document: control streams 1232 (Section 6.2.1) and push streams (Section 6.2.2). [QPACK] defines 1233 two additional stream types. Other stream types can be defined by 1234 extensions to HTTP/3; see Section 9 for more details. Some stream 1235 types are reserved (Section 6.2.3). 1237 The performance of HTTP/3 connections in the early phase of their 1238 lifetime is sensitive to the creation and exchange of data on 1239 unidirectional streams. Endpoints that excessively restrict the 1240 number of streams or the flow control window of these streams will 1241 increase the chance that the remote peer reaches the limit early and 1242 becomes blocked. In particular, implementations should consider that 1243 remote peers may wish to exercise reserved stream behavior 1244 (Section 6.2.3) with some of the unidirectional streams they are 1245 permitted to use. To avoid blocking, the transport parameters sent 1246 by both clients and servers MUST allow the peer to create at least 1247 one unidirectional stream for the HTTP control stream plus the number 1248 of unidirectional streams required by mandatory extensions (three 1249 being the minimum number required for the base HTTP/3 protocol and 1250 QPACK), and SHOULD provide at least 1,024 bytes of flow control 1251 credit to each stream. 1253 Note that an endpoint is not required to grant additional credits to 1254 create more unidirectional streams if its peer consumes all the 1255 initial credits before creating the critical unidirectional streams. 1256 Endpoints SHOULD create the HTTP control stream as well as the 1257 unidirectional streams required by mandatory extensions (such as the 1258 QPACK encoder and decoder streams) first, and then create additional 1259 streams as allowed by their peer. 1261 If the stream header indicates a stream type that is not supported by 1262 the recipient, the remainder of the stream cannot be consumed as the 1263 semantics are unknown. Recipients of unknown stream types MAY abort 1264 reading of the stream with an error code of H3_STREAM_CREATION_ERROR 1265 or a reserved error code (Section 8.1), but MUST NOT consider such 1266 streams to be a connection error of any kind. 1268 Implementations MAY send stream types before knowing whether the peer 1269 supports them. However, stream types that could modify the state or 1270 semantics of existing protocol components, including QPACK or other 1271 extensions, MUST NOT be sent until the peer is known to support them. 1273 A sender can close or reset a unidirectional stream unless otherwise 1274 specified. A receiver MUST tolerate unidirectional streams being 1275 closed or reset prior to the reception of the unidirectional stream 1276 header. 1278 6.2.1. Control Streams 1280 A control stream is indicated by a stream type of 0x00. Data on this 1281 stream consists of HTTP/3 frames, as defined in Section 7.2. 1283 Each side MUST initiate a single control stream at the beginning of 1284 the connection and send its SETTINGS frame as the first frame on this 1285 stream. If the first frame of the control stream is any other frame 1286 type, this MUST be treated as a connection error of type 1287 H3_MISSING_SETTINGS. Only one control stream per peer is permitted; 1288 receipt of a second stream claiming to be a control stream MUST be 1289 treated as a connection error of type H3_STREAM_CREATION_ERROR. The 1290 sender MUST NOT close the control stream, and the receiver MUST NOT 1291 request that the sender close the control stream. If either control 1292 stream is closed at any point, this MUST be treated as a connection 1293 error of type H3_CLOSED_CRITICAL_STREAM. 1295 A pair of unidirectional streams is used rather than a single 1296 bidirectional stream. This allows either peer to send data as soon 1297 as it is able. Depending on whether 0-RTT is enabled on the 1298 connection, either client or server might be able to send stream data 1299 first after the cryptographic handshake completes. 1301 6.2.2. Push Streams 1303 Server push is an optional feature introduced in HTTP/2 that allows a 1304 server to initiate a response before a request has been made. See 1305 Section 4.4 for more details. 1307 A push stream is indicated by a stream type of 0x01, followed by the 1308 Push ID of the promise that it fulfills, encoded as a variable-length 1309 integer. The remaining data on this stream consists of HTTP/3 1310 frames, as defined in Section 7.2, and fulfills a promised server 1311 push by zero or more interim HTTP responses followed by a single 1312 final HTTP response, as defined in Section 4.1. Server push and Push 1313 IDs are described in Section 4.4. 1315 Only servers can push; if a server receives a client-initiated push 1316 stream, this MUST be treated as a connection error of type 1317 H3_STREAM_CREATION_ERROR. 1319 Push Stream Header { 1320 Stream Type (i) = 0x01, 1321 Push ID (i), 1322 } 1324 Figure 2: Push Stream Header 1326 Each Push ID MUST only be used once in a push stream header. If a 1327 push stream header includes a Push ID that was used in another push 1328 stream header, the client MUST treat this as a connection error of 1329 type H3_ID_ERROR. 1331 6.2.3. Reserved Stream Types 1333 Stream types of the format "0x1f * N + 0x21" for non-negative integer 1334 values of N are reserved to exercise the requirement that unknown 1335 types be ignored. These streams have no semantics, and can be sent 1336 when application-layer padding is desired. They MAY also be sent on 1337 connections where no data is currently being transferred. Endpoints 1338 MUST NOT consider these streams to have any meaning upon receipt. 1340 The payload and length of the stream are selected in any manner the 1341 sending implementation chooses. When sending a reserved stream type, 1342 the implementation MAY either terminate the stream cleanly or reset 1343 it. When resetting the stream, either the H3_NO_ERROR error code or 1344 a reserved error code (Section 8.1) SHOULD be used. 1346 7. HTTP Framing Layer 1348 HTTP frames are carried on QUIC streams, as described in Section 6. 1349 HTTP/3 defines three stream types: control stream, request stream, 1350 and push stream. This section describes HTTP/3 frame formats and 1351 their permitted stream types; see Table 1 for an overview. A 1352 comparison between HTTP/2 and HTTP/3 frames is provided in 1353 Appendix A.2. 1355 +==============+================+================+========+=========+ 1356 | Frame | Control Stream | Request | Push | Section | 1357 | | | Stream | Stream | | 1358 +==============+================+================+========+=========+ 1359 | DATA | No | Yes | Yes | Section | 1360 | | | | | 7.2.1 | 1361 +--------------+----------------+----------------+--------+---------+ 1362 | HEADERS | No | Yes | Yes | Section | 1363 | | | | | 7.2.2 | 1364 +--------------+----------------+----------------+--------+---------+ 1365 | CANCEL_PUSH | Yes | No | No | Section | 1366 | | | | | 7.2.3 | 1367 +--------------+----------------+----------------+--------+---------+ 1368 | SETTINGS | Yes (1) | No | No | Section | 1369 | | | | | 7.2.4 | 1370 +--------------+----------------+----------------+--------+---------+ 1371 | PUSH_PROMISE | No | Yes | No | Section | 1372 | | | | | 7.2.5 | 1373 +--------------+----------------+----------------+--------+---------+ 1374 | GOAWAY | Yes | No | No | Section | 1375 | | | | | 7.2.6 | 1376 +--------------+----------------+----------------+--------+---------+ 1377 | MAX_PUSH_ID | Yes | No | No | Section | 1378 | | | | | 7.2.7 | 1379 +--------------+----------------+----------------+--------+---------+ 1380 | Reserved | Yes | Yes | Yes | Section | 1381 | | | | | 7.2.8 | 1382 +--------------+----------------+----------------+--------+---------+ 1384 Table 1: HTTP/3 Frames and Stream Type Overview 1386 Certain frames can only occur as the first frame of a particular 1387 stream type; these are indicated in Table 1 with a (1). Specific 1388 guidance is provided in the relevant section. 1390 Note that, unlike QUIC frames, HTTP/3 frames can span multiple 1391 packets. 1393 7.1. Frame Layout 1395 All frames have the following format: 1397 HTTP/3 Frame Format { 1398 Type (i), 1399 Length (i), 1400 Frame Payload (..), 1401 } 1402 Figure 3: HTTP/3 Frame Format 1404 A frame includes the following fields: 1406 Type: A variable-length integer that identifies the frame type. 1408 Length: A variable-length integer that describes the length in bytes 1409 of the Frame Payload. 1411 Frame Payload: A payload, the semantics of which are determined by 1412 the Type field. 1414 Each frame's payload MUST contain exactly the fields identified in 1415 its description. A frame payload that contains additional bytes 1416 after the identified fields or a frame payload that terminates before 1417 the end of the identified fields MUST be treated as a connection 1418 error (Section 8) of type H3_FRAME_ERROR. 1420 When a stream terminates cleanly, if the last frame on the stream was 1421 truncated, this MUST be treated as a connection error (Section 8) of 1422 type H3_FRAME_ERROR. Streams that terminate abruptly may be reset at 1423 any point in a frame. 1425 7.2. Frame Definitions 1427 7.2.1. DATA 1429 DATA frames (type=0x0) convey arbitrary, variable-length sequences of 1430 bytes associated with an HTTP request or response payload body. 1432 DATA frames MUST be associated with an HTTP request or response. If 1433 a DATA frame is received on a control stream, the recipient MUST 1434 respond with a connection error (Section 8) of type 1435 H3_FRAME_UNEXPECTED. 1437 DATA Frame { 1438 Type (i) = 0x0, 1439 Length (i), 1440 Data (..), 1441 } 1443 Figure 4: DATA Frame 1445 7.2.2. HEADERS 1447 The HEADERS frame (type=0x1) is used to carry an HTTP field section, 1448 encoded using QPACK. See [QPACK] for more details. 1450 HEADERS Frame { 1451 Type (i) = 0x1, 1452 Length (i), 1453 Encoded Field Section (..), 1454 } 1456 Figure 5: HEADERS Frame 1458 HEADERS frames can only be sent on request or push streams. If a 1459 HEADERS frame is received on a control stream, the recipient MUST 1460 respond with a connection error (Section 8) of type 1461 H3_FRAME_UNEXPECTED. 1463 7.2.3. CANCEL_PUSH 1465 The CANCEL_PUSH frame (type=0x3) is used to request cancellation of a 1466 server push prior to the push stream being received. The CANCEL_PUSH 1467 frame identifies a server push by Push ID (see Section 4.4), encoded 1468 as a variable-length integer. 1470 When a client sends CANCEL_PUSH, it is indicating that it does not 1471 wish to receive the promised resource. The server SHOULD abort 1472 sending the resource, but the mechanism to do so depends on the state 1473 of the corresponding push stream. If the server has not yet created 1474 a push stream, it does not create one. If the push stream is open, 1475 the server SHOULD abruptly terminate that stream. If the push stream 1476 has already ended, the server MAY still abruptly terminate the stream 1477 or MAY take no action. 1479 When a server sends CANCEL_PUSH, it is indicating that it will not be 1480 fulfilling a promise. The client cannot expect the corresponding 1481 promise to be fulfilled, unless it has already received and processed 1482 the promised response. A server SHOULD send a CANCEL_PUSH frame even 1483 if it has opened the corresponding stream. 1485 Sending a CANCEL_PUSH frame has no direct effect on the state of 1486 existing push streams. A client SHOULD NOT send a CANCEL_PUSH frame 1487 when it has already received a corresponding push stream. A push 1488 stream could arrive after a client has sent a CANCEL_PUSH frame, 1489 because a server might not have processed the CANCEL_PUSH. The 1490 client SHOULD abort reading the stream with an error code of 1491 H3_REQUEST_CANCELLED. 1493 A CANCEL_PUSH frame is sent on the control stream. Receiving a 1494 CANCEL_PUSH frame on a stream other than the control stream MUST be 1495 treated as a connection error of type H3_FRAME_UNEXPECTED. 1497 CANCEL_PUSH Frame { 1498 Type (i) = 0x3, 1499 Length (i), 1500 Push ID (..), 1501 } 1503 Figure 6: CANCEL_PUSH Frame 1505 The CANCEL_PUSH frame carries a Push ID encoded as a variable-length 1506 integer. The Push ID identifies the server push that is being 1507 cancelled; see Section 4.4. If a CANCEL_PUSH frame is received that 1508 references a Push ID greater than currently allowed on the 1509 connection, this MUST be treated as a connection error of type 1510 H3_ID_ERROR. 1512 If the client receives a CANCEL_PUSH frame, that frame might identify 1513 a Push ID that has not yet been mentioned by a PUSH_PROMISE frame due 1514 to reordering. If a server receives a CANCEL_PUSH frame for a Push 1515 ID that has not yet been mentioned by a PUSH_PROMISE frame, this MUST 1516 be treated as a connection error of type H3_ID_ERROR. 1518 7.2.4. SETTINGS 1520 The SETTINGS frame (type=0x4) conveys configuration parameters that 1521 affect how endpoints communicate, such as preferences and constraints 1522 on peer behavior. Individually, a SETTINGS parameter can also be 1523 referred to as a "setting"; the identifier and value of each setting 1524 parameter can be referred to as a "setting identifier" and a "setting 1525 value". 1527 SETTINGS frames always apply to a connection, never a single stream. 1528 A SETTINGS frame MUST be sent as the first frame of each control 1529 stream (see Section 6.2.1) by each peer, and MUST NOT be sent 1530 subsequently. If an endpoint receives a second SETTINGS frame on the 1531 control stream, the endpoint MUST respond with a connection error of 1532 type H3_FRAME_UNEXPECTED. 1534 SETTINGS frames MUST NOT be sent on any stream other than the control 1535 stream. If an endpoint receives a SETTINGS frame on a different 1536 stream, the endpoint MUST respond with a connection error of type 1537 H3_FRAME_UNEXPECTED. 1539 SETTINGS parameters are not negotiated; they describe characteristics 1540 of the sending peer that can be used by the receiving peer. However, 1541 a negotiation can be implied by the use of SETTINGS - each peer uses 1542 SETTINGS to advertise a set of supported values. The definition of 1543 the setting would describe how each peer combines the two sets to 1544 conclude which choice will be used. SETTINGS does not provide a 1545 mechanism to identify when the choice takes effect. 1547 Different values for the same parameter can be advertised by each 1548 peer. For example, a client might be willing to consume a very large 1549 response field section, while servers are more cautious about request 1550 size. 1552 The same setting identifier MUST NOT occur more than once in the 1553 SETTINGS frame. A receiver MAY treat the presence of duplicate 1554 setting identifiers as a connection error of type H3_SETTINGS_ERROR. 1556 The payload of a SETTINGS frame consists of zero or more parameters. 1557 Each parameter consists of a setting identifier and a value, both 1558 encoded as QUIC variable-length integers. 1560 Setting { 1561 Identifier (i), 1562 Value (i), 1563 } 1565 SETTINGS Frame { 1566 Type (i) = 0x4, 1567 Length (i), 1568 Setting (..) ..., 1569 } 1571 Figure 7: SETTINGS Frame 1573 An implementation MUST ignore the contents for any SETTINGS 1574 identifier it does not understand. 1576 7.2.4.1. Defined SETTINGS Parameters 1578 The following settings are defined in HTTP/3: 1580 SETTINGS_MAX_FIELD_SECTION_SIZE (0x6): The default value is 1581 unlimited. See Section 4.1.1 for usage. 1583 Setting identifiers of the format "0x1f * N + 0x21" for non-negative 1584 integer values of N are reserved to exercise the requirement that 1585 unknown identifiers be ignored. Such settings have no defined 1586 meaning. Endpoints SHOULD include at least one such setting in their 1587 SETTINGS frame. Endpoints MUST NOT consider such settings to have 1588 any meaning upon receipt. 1590 Because the setting has no defined meaning, the value of the setting 1591 can be any value the implementation selects. 1593 Setting identifiers which were used in HTTP/2 where there is no 1594 corresponding HTTP/3 setting have also been reserved 1595 (Section 11.2.2). These settings MUST NOT be sent, and their receipt 1596 MUST be treated as a connection error of type H3_SETTINGS_ERROR. 1598 Additional settings can be defined by extensions to HTTP/3; see 1599 Section 9 for more details. 1601 7.2.4.2. Initialization 1603 An HTTP implementation MUST NOT send frames or requests that would be 1604 invalid based on its current understanding of the peer's settings. 1606 All settings begin at an initial value. Each endpoint SHOULD use 1607 these initial values to send messages before the peer's SETTINGS 1608 frame has arrived, as packets carrying the settings can be lost or 1609 delayed. When the SETTINGS frame arrives, any settings are changed 1610 to their new values. 1612 This removes the need to wait for the SETTINGS frame before sending 1613 messages. Endpoints MUST NOT require any data to be received from 1614 the peer prior to sending the SETTINGS frame; settings MUST be sent 1615 as soon as the transport is ready to send data. 1617 For servers, the initial value of each client setting is the default 1618 value. 1620 For clients using a 1-RTT QUIC connection, the initial value of each 1621 server setting is the default value. 1-RTT keys will always become 1622 available prior to the packet containing SETTINGS being processed by 1623 QUIC, even if the server sends SETTINGS immediately. Clients SHOULD 1624 NOT wait indefinitely for SETTINGS to arrive before sending requests, 1625 but SHOULD process received datagrams in order to increase the 1626 likelihood of processing SETTINGS before sending the first request. 1628 When a 0-RTT QUIC connection is being used, the initial value of each 1629 server setting is the value used in the previous session. Clients 1630 SHOULD store the settings the server provided in the connection where 1631 resumption information was provided, but MAY opt not to store 1632 settings in certain cases (e.g., if the session ticket is received 1633 before the SETTINGS frame). A client MUST comply with stored 1634 settings - or default values, if no values are stored - when 1635 attempting 0-RTT. Once a server has provided new settings, clients 1636 MUST comply with those values. 1638 A server can remember the settings that it advertised, or store an 1639 integrity-protected copy of the values in the ticket and recover the 1640 information when accepting 0-RTT data. A server uses the HTTP/3 1641 settings values in determining whether to accept 0-RTT data. If the 1642 server cannot determine that the settings remembered by a client are 1643 compatible with its current settings, it MUST NOT accept 0-RTT data. 1644 Remembered settings are compatible if a client complying with those 1645 settings would not violate the server's current settings. 1647 A server MAY accept 0-RTT and subsequently provide different settings 1648 in its SETTINGS frame. If 0-RTT data is accepted by the server, its 1649 SETTINGS frame MUST NOT reduce any limits or alter any values that 1650 might be violated by the client with its 0-RTT data. The server MUST 1651 include all settings that differ from their default values. If a 1652 server accepts 0-RTT but then sends settings that are not compatible 1653 with the previously specified settings, this MUST be treated as a 1654 connection error of type H3_SETTINGS_ERROR. If a server accepts 1655 0-RTT but then sends a SETTINGS frame that omits a setting value that 1656 the client understands (apart from reserved setting identifiers) that 1657 was previously specified to have a non-default value, this MUST be 1658 treated as a connection error of type H3_SETTINGS_ERROR. 1660 7.2.5. PUSH_PROMISE 1662 The PUSH_PROMISE frame (type=0x5) is used to carry a promised request 1663 header field section from server to client on a request stream, as in 1664 HTTP/2. 1666 PUSH_PROMISE Frame { 1667 Type (i) = 0x5, 1668 Length (i), 1669 Push ID (i), 1670 Encoded Field Section (..), 1671 } 1673 Figure 8: PUSH_PROMISE Frame 1675 The payload consists of: 1677 Push ID: A variable-length integer that identifies the server push 1678 operation. A Push ID is used in push stream headers (Section 4.4) 1679 and CANCEL_PUSH frames (Section 7.2.3). 1681 Encoded Field Section: QPACK-encoded request header fields for the 1682 promised response. See [QPACK] for more details. 1684 A server MUST NOT use a Push ID that is larger than the client has 1685 provided in a MAX_PUSH_ID frame (Section 7.2.7). A client MUST treat 1686 receipt of a PUSH_PROMISE frame that contains a larger Push ID than 1687 the client has advertised as a connection error of H3_ID_ERROR. 1689 A server MAY use the same Push ID in multiple PUSH_PROMISE frames. 1690 If so, the decompressed request header sets MUST contain the same 1691 fields in the same order, and both the name and the value in each 1692 field MUST be exact matches. Clients SHOULD compare the request 1693 header sections for resources promised multiple times. If a client 1694 receives a Push ID that has already been promised and detects a 1695 mismatch, it MUST respond with a connection error of type 1696 H3_GENERAL_PROTOCOL_ERROR. If the decompressed field sections match 1697 exactly, the client SHOULD associate the pushed content with each 1698 stream on which a PUSH_PROMISE frame was received. 1700 Allowing duplicate references to the same Push ID is primarily to 1701 reduce duplication caused by concurrent requests. A server SHOULD 1702 avoid reusing a Push ID over a long period. Clients are likely to 1703 consume server push responses and not retain them for reuse over 1704 time. Clients that see a PUSH_PROMISE frame that uses a Push ID that 1705 they have already consumed and discarded are forced to ignore the 1706 promise. 1708 If a PUSH_PROMISE frame is received on the control stream, the client 1709 MUST respond with a connection error (Section 8) of type 1710 H3_FRAME_UNEXPECTED. 1712 A client MUST NOT send a PUSH_PROMISE frame. A server MUST treat the 1713 receipt of a PUSH_PROMISE frame as a connection error of type 1714 H3_FRAME_UNEXPECTED. 1716 See Section 4.4 for a description of the overall server push 1717 mechanism. 1719 7.2.6. GOAWAY 1721 The GOAWAY frame (type=0x7) is used to initiate graceful shutdown of 1722 a connection by either endpoint. GOAWAY allows an endpoint to stop 1723 accepting new requests or pushes while still finishing processing of 1724 previously received requests and pushes. This enables administrative 1725 actions, like server maintenance. GOAWAY by itself does not close a 1726 connection. 1728 GOAWAY Frame { 1729 Type (i) = 0x7, 1730 Length (i), 1731 Stream ID/Push ID (..), 1732 } 1734 Figure 9: GOAWAY Frame 1736 The GOAWAY frame is always sent on the control stream. In the server 1737 to client direction, it carries a QUIC Stream ID for a client- 1738 initiated bidirectional stream encoded as a variable-length integer. 1739 A client MUST treat receipt of a GOAWAY frame containing a Stream ID 1740 of any other type as a connection error of type H3_ID_ERROR. 1742 In the client to server direction, the GOAWAY frame carries a Push ID 1743 encoded as a variable-length integer. 1745 The GOAWAY frame applies to the connection, not a specific stream. A 1746 client MUST treat a GOAWAY frame on a stream other than the control 1747 stream as a connection error (Section 8) of type H3_FRAME_UNEXPECTED. 1749 See Section 5.2 for more information on the use of the GOAWAY frame. 1751 7.2.7. MAX_PUSH_ID 1753 The MAX_PUSH_ID frame (type=0xd) is used by clients to control the 1754 number of server pushes that the server can initiate. This sets the 1755 maximum value for a Push ID that the server can use in PUSH_PROMISE 1756 and CANCEL_PUSH frames. Consequently, this also limits the number of 1757 push streams that the server can initiate in addition to the limit 1758 maintained by the QUIC transport. 1760 The MAX_PUSH_ID frame is always sent on the control stream. Receipt 1761 of a MAX_PUSH_ID frame on any other stream MUST be treated as a 1762 connection error of type H3_FRAME_UNEXPECTED. 1764 A server MUST NOT send a MAX_PUSH_ID frame. A client MUST treat the 1765 receipt of a MAX_PUSH_ID frame as a connection error of type 1766 H3_FRAME_UNEXPECTED. 1768 The maximum Push ID is unset when a connection is created, meaning 1769 that a server cannot push until it receives a MAX_PUSH_ID frame. A 1770 client that wishes to manage the number of promised server pushes can 1771 increase the maximum Push ID by sending MAX_PUSH_ID frames as the 1772 server fulfills or cancels server pushes. 1774 MAX_PUSH_ID Frame { 1775 Type (i) = 0xd, 1776 Length (i), 1777 Push ID (i), 1778 } 1780 Figure 10: MAX_PUSH_ID Frame 1782 The MAX_PUSH_ID frame carries a single variable-length integer that 1783 identifies the maximum value for a Push ID that the server can use; 1784 see Section 4.4. A MAX_PUSH_ID frame cannot reduce the maximum Push 1785 ID; receipt of a MAX_PUSH_ID frame that contains a smaller value than 1786 previously received MUST be treated as a connection error of type 1787 H3_ID_ERROR. 1789 7.2.8. Reserved Frame Types 1791 Frame types of the format "0x1f * N + 0x21" for non-negative integer 1792 values of N are reserved to exercise the requirement that unknown 1793 types be ignored (Section 9). These frames have no semantics, and 1794 can be sent on any open stream when application-layer padding is 1795 desired. They MAY also be sent on connections where no data is 1796 currently being transferred. Endpoints MUST NOT consider these 1797 frames to have any meaning upon receipt. 1799 The payload and length of the frames are selected in any manner the 1800 implementation chooses. 1802 Frame types that were used in HTTP/2 where there is no corresponding 1803 HTTP/3 frame have also been reserved (Section 11.2.1). These frame 1804 types MUST NOT be sent, and their receipt MUST be treated as a 1805 connection error of type H3_FRAME_UNEXPECTED. 1807 8. Error Handling 1809 QUIC allows the application to abruptly terminate (reset) individual 1810 streams or the entire connection; see Sections 2.4 and 5.3 of 1811 [QUIC-TRANSPORT]. These are referred to as "stream errors" or 1812 "connection errors" (see Section 11 of [QUIC-TRANSPORT]) and have 1813 associated error codes, but do not necessarily indicate a problem 1814 with the connection or either implementation. For example, a stream 1815 can be reset if the requested resource is no longer needed. 1817 An endpoint MAY choose to treat a stream error as a connection error 1818 under certain circumstances. Implementations need to consider the 1819 impact on outstanding requests before making this choice. 1821 Because new error codes can be defined without negotiation (see 1822 Section 9), use of an error code in an unexpected context or receipt 1823 of an unknown error code MUST be treated as equivalent to 1824 H3_NO_ERROR. However, closing a stream can have other effects 1825 regardless of the error code; for example, see Section 4.1. 1827 This section describes HTTP/3-specific error codes that can be used 1828 to express the cause of a connection or stream error. 1830 8.1. HTTP/3 Error Codes 1832 The following error codes are defined for use when abruptly 1833 terminating streams, aborting reading of streams, or immediately 1834 closing connections. 1836 H3_NO_ERROR (0x100): No error. This is used when the connection or 1837 stream needs to be closed, but there is no error to signal. 1839 H3_GENERAL_PROTOCOL_ERROR (0x101): Peer violated protocol 1840 requirements in a way that does not match a more specific error 1841 code, or endpoint declines to use the more specific error code. 1843 H3_INTERNAL_ERROR (0x102): An internal error has occurred in the 1844 HTTP stack. 1846 H3_STREAM_CREATION_ERROR (0x103): The endpoint detected that its 1847 peer created a stream that it will not accept. 1849 H3_CLOSED_CRITICAL_STREAM (0x104): A stream required by the 1850 connection was closed or reset. 1852 H3_FRAME_UNEXPECTED (0x105): A frame was received that was not 1853 permitted in the current state or on the current stream. 1855 H3_FRAME_ERROR (0x106): A frame that fails to satisfy layout 1856 requirements or with an invalid size was received. 1858 H3_EXCESSIVE_LOAD (0x107): The endpoint detected that its peer is 1859 exhibiting a behavior that might be generating excessive load. 1861 H3_ID_ERROR (0x108): A Stream ID or Push ID was used incorrectly, 1862 such as exceeding a limit, reducing a limit, or being reused. 1864 H3_SETTINGS_ERROR (0x109): An endpoint detected an error in the 1865 payload of a SETTINGS frame. 1867 H3_MISSING_SETTINGS (0x10a): No SETTINGS frame was received at the 1868 beginning of the control stream. 1870 H3_REQUEST_REJECTED (0x10b): A server rejected a request without 1871 performing any application processing. 1873 H3_REQUEST_CANCELLED (0x10c): The request or its response (including 1874 pushed response) is cancelled. 1876 H3_REQUEST_INCOMPLETE (0x10d): The client's stream terminated 1877 without containing a fully-formed request. 1879 H3_CONNECT_ERROR (0x10f): The connection established in response to 1880 a CONNECT request was reset or abnormally closed. 1882 H3_VERSION_FALLBACK (0x110): The requested operation cannot be 1883 served over HTTP/3. The peer should retry over HTTP/1.1. 1885 Error codes of the format "0x1f * N + 0x21" for non-negative integer 1886 values of N are reserved to exercise the requirement that unknown 1887 error codes be treated as equivalent to H3_NO_ERROR (Section 9). 1888 Implementations SHOULD select an error code from this space with some 1889 probability when they would have sent H3_NO_ERROR. 1891 9. Extensions to HTTP/3 1893 HTTP/3 permits extension of the protocol. Within the limitations 1894 described in this section, protocol extensions can be used to provide 1895 additional services or alter any aspect of the protocol. Extensions 1896 are effective only within the scope of a single HTTP/3 connection. 1898 This applies to the protocol elements defined in this document. This 1899 does not affect the existing options for extending HTTP, such as 1900 defining new methods, status codes, or fields. 1902 Extensions are permitted to use new frame types (Section 7.2), new 1903 settings (Section 7.2.4.1), new error codes (Section 8), or new 1904 unidirectional stream types (Section 6.2). Registries are 1905 established for managing these extension points: frame types 1906 (Section 11.2.1), settings (Section 11.2.2), error codes 1907 (Section 11.2.3), and stream types (Section 11.2.4). 1909 Implementations MUST ignore unknown or unsupported values in all 1910 extensible protocol elements. Implementations MUST discard frames 1911 and unidirectional streams that have unknown or unsupported types. 1912 This means that any of these extension points can be safely used by 1913 extensions without prior arrangement or negotiation. However, where 1914 a known frame type is required to be in a specific location, such as 1915 the SETTINGS frame as the first frame of the control stream (see 1916 Section 6.2.1), an unknown frame type does not satisfy that 1917 requirement and SHOULD be treated as an error. 1919 Extensions that could change the semantics of existing protocol 1920 components MUST be negotiated before being used. For example, an 1921 extension that changes the layout of the HEADERS frame cannot be used 1922 until the peer has given a positive signal that this is acceptable. 1923 Coordinating when such a revised layout comes into effect could prove 1924 complex. As such, allocating new identifiers for new definitions of 1925 existing protocol elements is likely to be more effective. 1927 This document does not mandate a specific method for negotiating the 1928 use of an extension but notes that a setting (Section 7.2.4.1) could 1929 be used for that purpose. If both peers set a value that indicates 1930 willingness to use the extension, then the extension can be used. If 1931 a setting is used for extension negotiation, the default value MUST 1932 be defined in such a fashion that the extension is disabled if the 1933 setting is omitted. 1935 10. Security Considerations 1937 The security considerations of HTTP/3 should be comparable to those 1938 of HTTP/2 with TLS. However, many of the considerations from 1939 Section 10 of [HTTP2] apply to [QUIC-TRANSPORT] and are discussed in 1940 that document. 1942 10.1. Server Authority 1944 HTTP/3 relies on the HTTP definition of authority. The security 1945 considerations of establishing authority are discussed in 1946 Section 12.1 of [SEMANTICS]. 1948 10.2. Cross-Protocol Attacks 1950 The use of ALPN in the TLS and QUIC handshakes establishes the target 1951 application protocol before application-layer bytes are processed. 1952 Because all QUIC packets are encrypted, it is difficult for an 1953 attacker to control the plaintext bytes of an HTTP/3 connection, 1954 which could be used in a cross-protocol attack on a plaintext 1955 protocol. 1957 10.3. Intermediary Encapsulation Attacks 1959 The HTTP/3 field encoding allows the expression of names that are not 1960 valid field names in the syntax used by HTTP (Section 5.3 of 1961 [SEMANTICS]). Requests or responses containing invalid field names 1962 MUST be treated as malformed (Section 4.1.3). An intermediary 1963 therefore cannot translate an HTTP/3 request or response containing 1964 an invalid field name into an HTTP/1.1 message. 1966 Similarly, HTTP/3 can transport field values that are not valid. 1967 While most values that can be encoded will not alter field parsing, 1968 carriage return (CR, ASCII 0xd), line feed (LF, ASCII 0xa), and the 1969 zero character (NUL, ASCII 0x0) might be exploited by an attacker if 1970 they are translated verbatim. Any request or response that contains 1971 a character not permitted in a field value MUST be treated as 1972 malformed (Section 4.1.3). Valid characters are defined by the 1973 "field-content" ABNF rule in Section 5.4 of [SEMANTICS]. 1975 10.4. Cacheability of Pushed Responses 1977 Pushed responses do not have an explicit request from the client; the 1978 request is provided by the server in the PUSH_PROMISE frame. 1980 Caching responses that are pushed is possible based on the guidance 1981 provided by the origin server in the Cache-Control header field. 1982 However, this can cause issues if a single server hosts more than one 1983 tenant. For example, a server might offer multiple users each a 1984 small portion of its URI space. 1986 Where multiple tenants share space on the same server, that server 1987 MUST ensure that tenants are not able to push representations of 1988 resources that they do not have authority over. Failure to enforce 1989 this would allow a tenant to provide a representation that would be 1990 served out of cache, overriding the actual representation that the 1991 authoritative tenant provides. 1993 Clients are required to reject pushed responses for which an origin 1994 server is not authoritative; see Section 4.4. 1996 10.5. Denial-of-Service Considerations 1998 An HTTP/3 connection can demand a greater commitment of resources to 1999 operate than an HTTP/1.1 or HTTP/2 connection. The use of field 2000 compression and flow control depend on a commitment of resources for 2001 storing a greater amount of state. Settings for these features 2002 ensure that memory commitments for these features are strictly 2003 bounded. 2005 The number of PUSH_PROMISE frames is constrained in a similar 2006 fashion. A client that accepts server push SHOULD limit the number 2007 of Push IDs it issues at a time. 2009 Processing capacity cannot be guarded as effectively as state 2010 capacity. 2012 The ability to send undefined protocol elements that the peer is 2013 required to ignore can be abused to cause a peer to expend additional 2014 processing time. This might be done by setting multiple undefined 2015 SETTINGS parameters, unknown frame types, or unknown stream types. 2016 Note, however, that some uses are entirely legitimate, such as 2017 optional-to-understand extensions and padding to increase resistance 2018 to traffic analysis. 2020 Compression of field sections also offers some opportunities to waste 2021 processing resources; see Section 7 of [QPACK] for more details on 2022 potential abuses. 2024 All these features - i.e., server push, unknown protocol elements, 2025 field compression - have legitimate uses. These features become a 2026 burden only when they are used unnecessarily or to excess. 2028 An endpoint that does not monitor this behavior exposes itself to a 2029 risk of denial-of-service attack. Implementations SHOULD track the 2030 use of these features and set limits on their use. An endpoint MAY 2031 treat activity that is suspicious as a connection error (Section 8) 2032 of type H3_EXCESSIVE_LOAD, but false positives will result in 2033 disrupting valid connections and requests. 2035 10.5.1. Limits on Field Section Size 2037 A large field section (Section 4.1) can cause an implementation to 2038 commit a large amount of state. Header fields that are critical for 2039 routing can appear toward the end of a header field section, which 2040 prevents streaming of the header field section to its ultimate 2041 destination. This ordering and other reasons, such as ensuring cache 2042 correctness, mean that an endpoint likely needs to buffer the entire 2043 header field section. Since there is no hard limit to the size of a 2044 field section, some endpoints could be forced to commit a large 2045 amount of available memory for header fields. 2047 An endpoint can use the SETTINGS_MAX_FIELD_SECTION_SIZE 2048 (Section 4.1.1.3) setting to advise peers of limits that might apply 2049 on the size of field sections. This setting is only advisory, so 2050 endpoints MAY choose to send field sections that exceed this limit 2051 and risk having the request or response being treated as malformed. 2052 This setting is specific to a connection, so any request or response 2053 could encounter a hop with a lower, unknown limit. An intermediary 2054 can attempt to avoid this problem by passing on values presented by 2055 different peers, but they are not obligated to do so. 2057 A server that receives a larger field section than it is willing to 2058 handle can send an HTTP 431 (Request Header Fields Too Large) status 2059 code ([RFC6585]). A client can discard responses that it cannot 2060 process. 2062 10.5.2. CONNECT Issues 2064 The CONNECT method can be used to create disproportionate load on a 2065 proxy, since stream creation is relatively inexpensive when compared 2066 to the creation and maintenance of a TCP connection. A proxy might 2067 also maintain some resources for a TCP connection beyond the closing 2068 of the stream that carries the CONNECT request, since the outgoing 2069 TCP connection remains in the TIME_WAIT state. Therefore, a proxy 2070 cannot rely on QUIC stream limits alone to control the resources 2071 consumed by CONNECT requests. 2073 10.6. Use of Compression 2075 Compression can allow an attacker to recover secret data when it is 2076 compressed in the same context as data under attacker control. 2077 HTTP/3 enables compression of fields (Section 4.1.1); the following 2078 concerns also apply to the use of HTTP compressed content-codings; 2079 see Section 7.1.2 of [SEMANTICS]. 2081 There are demonstrable attacks on compression that exploit the 2082 characteristics of the web (e.g., [BREACH]). The attacker induces 2083 multiple requests containing varying plaintext, observing the length 2084 of the resulting ciphertext in each, which reveals a shorter length 2085 when a guess about the secret is correct. 2087 Implementations communicating on a secure channel MUST NOT compress 2088 content that includes both confidential and attacker-controlled data 2089 unless separate compression contexts are used for each source of 2090 data. Compression MUST NOT be used if the source of data cannot be 2091 reliably determined. 2093 Further considerations regarding the compression of fields sections 2094 are described in [QPACK]. 2096 10.7. Padding and Traffic Analysis 2098 Padding can be used to obscure the exact size of frame content and is 2099 provided to mitigate specific attacks within HTTP, for example, 2100 attacks where compressed content includes both attacker-controlled 2101 plaintext and secret data (e.g., [BREACH]). 2103 Where HTTP/2 employs PADDING frames and Padding fields in other 2104 frames to make a connection more resistant to traffic analysis, 2105 HTTP/3 can either rely on transport-layer padding or employ the 2106 reserved frame and stream types discussed in Section 7.2.8 and 2107 Section 6.2.3. These methods of padding produce different results in 2108 terms of the granularity of padding, how padding is arranged in 2109 relation to the information that is being protected, whether padding 2110 is applied in the case of packet loss, and how an implementation 2111 might control padding. Redundant padding could even be 2112 counterproductive. 2114 To mitigate attacks that rely on compression, disabling or limiting 2115 compression might be preferable to padding as a countermeasure. 2117 Use of padding can result in less protection than might seem 2118 immediately obvious. At best, padding only makes it more difficult 2119 for an attacker to infer length information by increasing the number 2120 of frames an attacker has to observe. Incorrectly implemented 2121 padding schemes can be easily defeated. In particular, randomized 2122 padding with a predictable distribution provides very little 2123 protection; similarly, padding payloads to a fixed size exposes 2124 information as payload sizes cross the fixed-sized boundary, which 2125 could be possible if an attacker can control plaintext. 2127 10.8. Frame Parsing 2129 Several protocol elements contain nested length elements, typically 2130 in the form of frames with an explicit length containing variable- 2131 length integers. This could pose a security risk to an incautious 2132 implementer. An implementation MUST ensure that the length of a 2133 frame exactly matches the length of the fields it contains. 2135 10.9. Early Data 2137 The use of 0-RTT with HTTP/3 creates an exposure to replay attack. 2138 The anti-replay mitigations in [HTTP-REPLAY] MUST be applied when 2139 using HTTP/3 with 0-RTT. 2141 10.10. Migration 2143 Certain HTTP implementations use the client address for logging or 2144 access-control purposes. Since a QUIC client's address might change 2145 during a connection (and future versions might support simultaneous 2146 use of multiple addresses), such implementations will need to either 2147 actively retrieve the client's current address or addresses when they 2148 are relevant or explicitly accept that the original address might 2149 change. 2151 10.11. Privacy Considerations 2153 Several characteristics of HTTP/3 provide an observer an opportunity 2154 to correlate actions of a single client or server over time. These 2155 include the value of settings, the timing of reactions to stimulus, 2156 and the handling of any features that are controlled by settings. 2158 As far as these create observable differences in behavior, they could 2159 be used as a basis for fingerprinting a specific client. 2161 HTTP/3's preference for using a single QUIC connection allows 2162 correlation of a user's activity on a site. Reusing connections for 2163 different origins allows for correlation of activity across those 2164 origins. 2166 Several features of QUIC solicit immediate responses and can be used 2167 by an endpoint to measure latency to their peer; this might have 2168 privacy implications in certain scenarios. 2170 11. IANA Considerations 2172 This document registers a new ALPN protocol ID (Section 11.1) and 2173 creates new registries that manage the assignment of codepoints in 2174 HTTP/3. 2176 11.1. Registration of HTTP/3 Identification String 2178 This document creates a new registration for the identification of 2179 HTTP/3 in the "Application Layer Protocol Negotiation (ALPN) Protocol 2180 IDs" registry established in [RFC7301]. 2182 The "h3" string identifies HTTP/3: 2184 Protocol: HTTP/3 2186 Identification Sequence: 0x68 0x33 ("h3") 2188 Specification: This document 2190 11.2. New Registries 2192 New registries created in this document operate under the QUIC 2193 registration policy documented in Section 22.1 of [QUIC-TRANSPORT]. 2194 These registries all include the common set of fields listed in 2195 Section 22.1.1 of [QUIC-TRANSPORT]. 2197 The initial allocations in these registries created in this document 2198 are all assigned permanent status and list as contact both the IESG 2199 (iesg@ietf.org) and the HTTP working group (ietf-http-wg@w3.org). 2201 11.2.1. Frame Types 2203 This document establishes a registry for HTTP/3 frame type codes. 2204 The "HTTP/3 Frame Type" registry governs a 62-bit space. This 2205 registry follows the QUIC registry policy; see Section 11.2. 2206 Permanent registrations in this registry are assigned using the 2207 Specification Required policy ([RFC8126]), except for values between 2208 0x00 and 0x3f (in hexadecimal; inclusive), which are assigned using 2209 Standards Action or IESG Approval as defined in Section 4.9 and 4.10 2210 of [RFC8126]. 2212 While this registry is separate from the "HTTP/2 Frame Type" registry 2213 defined in [HTTP2], it is preferable that the assignments parallel 2214 each other where the code spaces overlap. If an entry is present in 2215 only one registry, every effort SHOULD be made to avoid assigning the 2216 corresponding value to an unrelated operation. 2218 In addition to common fields as described in Section 11.2, permanent 2219 registrations in this registry MUST include the following field: 2221 Frame Type: A name or label for the frame type. 2223 Specifications of frame types MUST include a description of the frame 2224 layout and its semantics, including any parts of the frame that are 2225 conditionally present. 2227 The entries in Table 2 are registered by this document. 2229 +==============+=======+===============+ 2230 | Frame Type | Value | Specification | 2231 +==============+=======+===============+ 2232 | DATA | 0x0 | Section 7.2.1 | 2233 +--------------+-------+---------------+ 2234 | HEADERS | 0x1 | Section 7.2.2 | 2235 +--------------+-------+---------------+ 2236 | Reserved | 0x2 | N/A | 2237 +--------------+-------+---------------+ 2238 | CANCEL_PUSH | 0x3 | Section 7.2.3 | 2239 +--------------+-------+---------------+ 2240 | SETTINGS | 0x4 | Section 7.2.4 | 2241 +--------------+-------+---------------+ 2242 | PUSH_PROMISE | 0x5 | Section 7.2.5 | 2243 +--------------+-------+---------------+ 2244 | Reserved | 0x6 | N/A | 2245 +--------------+-------+---------------+ 2246 | GOAWAY | 0x7 | Section 7.2.6 | 2247 +--------------+-------+---------------+ 2248 | Reserved | 0x8 | N/A | 2249 +--------------+-------+---------------+ 2250 | Reserved | 0x9 | N/A | 2251 +--------------+-------+---------------+ 2252 | MAX_PUSH_ID | 0xd | Section 7.2.7 | 2253 +--------------+-------+---------------+ 2255 Table 2: Initial HTTP/3 Frame Types 2257 Additionally, each code of the format "0x1f * N + 0x21" for non- 2258 negative integer values of N (that is, 0x21, 0x40, ..., through 2259 0x3FFFFFFFFFFFFFFE) MUST NOT be assigned by IANA. 2261 11.2.2. Settings Parameters 2263 This document establishes a registry for HTTP/3 settings. The 2264 "HTTP/3 Settings" registry governs a 62-bit space. This registry 2265 follows the QUIC registry policy; see Section 11.2. Permanent 2266 registrations in this registry are assigned using the Specification 2267 Required policy ([RFC8126]), except for values between 0x00 and 0x3f 2268 (in hexadecimal; inclusive), which are assigned using Standards 2269 Action or IESG Approval as defined in Section 4.9 and 4.10 of 2270 [RFC8126]. 2272 While this registry is separate from the "HTTP/2 Settings" registry 2273 defined in [HTTP2], it is preferable that the assignments parallel 2274 each other. If an entry is present in only one registry, every 2275 effort SHOULD be made to avoid assigning the corresponding value to 2276 an unrelated operation. 2278 In addition to common fields as described in Section 11.2, permanent 2279 registrations in this registry MUST include the following fields: 2281 Setting Name: A symbolic name for the setting. Specifying a setting 2282 name is optional. 2284 Default: The value of the setting unless otherwise indicated. A 2285 default SHOULD be the most restrictive possible value. 2287 The entries in Table 3 are registered by this document. 2289 +========================+=======+=================+===========+ 2290 | Setting Name | Value | Specification | Default | 2291 +========================+=======+=================+===========+ 2292 | Reserved | 0x2 | N/A | N/A | 2293 +------------------------+-------+-----------------+-----------+ 2294 | Reserved | 0x3 | N/A | N/A | 2295 +------------------------+-------+-----------------+-----------+ 2296 | Reserved | 0x4 | N/A | N/A | 2297 +------------------------+-------+-----------------+-----------+ 2298 | Reserved | 0x5 | N/A | N/A | 2299 +------------------------+-------+-----------------+-----------+ 2300 | MAX_FIELD_SECTION_SIZE | 0x6 | Section 7.2.4.1 | Unlimited | 2301 +------------------------+-------+-----------------+-----------+ 2303 Table 3: Initial HTTP/3 Settings 2305 Additionally, each code of the format "0x1f * N + 0x21" for non- 2306 negative integer values of N (that is, 0x21, 0x40, ..., through 2307 0x3ffffffffffffffe) MUST NOT be assigned by IANA. 2309 11.2.3. Error Codes 2311 This document establishes a registry for HTTP/3 error codes. The 2312 "HTTP/3 Error Code" registry manages a 62-bit space. This registry 2313 follows the QUIC registry policy; see Section 11.2. Permanent 2314 registrations in this registry are assigned using the Specification 2315 Required policy ([RFC8126]), except for values between 0x00 and 0x3f 2316 (in hexadecimal; inclusive), which are assigned using Standards 2317 Action or IESG Approval as defined in Section 4.9 and 4.10 of 2318 [RFC8126]. 2320 Registrations for error codes are required to include a description 2321 of the error code. An expert reviewer is advised to examine new 2322 registrations for possible duplication with existing error codes. 2323 Use of existing registrations is to be encouraged, but not mandated. 2325 In addition to common fields as described in Section 11.2, this 2326 registry includes two additional fields. Permanent registrations in 2327 this registry MUST include the following field: 2329 Name: A name for the error code. 2331 Description: A brief description of the error code semantics. 2333 The entries in Table 4 are registered by this document. 2335 +===========================+========+==============+===============+ 2336 | Name | Value | Description | Specification | 2337 +===========================+========+==============+===============+ 2338 | H3_NO_ERROR | 0x0100 | No error | Section 8.1 | 2339 +---------------------------+--------+--------------+---------------+ 2340 | H3_GENERAL_PROTOCOL_ERROR | 0x0101 | General | Section 8.1 | 2341 | | | protocol | | 2342 | | | error | | 2343 +---------------------------+--------+--------------+---------------+ 2344 | H3_INTERNAL_ERROR | 0x0102 | Internal | Section 8.1 | 2345 | | | error | | 2346 +---------------------------+--------+--------------+---------------+ 2347 | H3_STREAM_CREATION_ERROR | 0x0103 | Stream | Section 8.1 | 2348 | | | creation | | 2349 | | | error | | 2350 +---------------------------+--------+--------------+---------------+ 2351 | H3_CLOSED_CRITICAL_STREAM | 0x0104 | Critical | Section 8.1 | 2352 | | | stream was | | 2353 | | | closed | | 2354 +---------------------------+--------+--------------+---------------+ 2355 | H3_FRAME_UNEXPECTED | 0x0105 | Frame not | Section 8.1 | 2356 | | | permitted | | 2357 | | | in the | | 2358 | | | current | | 2359 | | | state | | 2360 +---------------------------+--------+--------------+---------------+ 2361 | H3_FRAME_ERROR | 0x0106 | Frame | Section 8.1 | 2362 | | | violated | | 2363 | | | layout or | | 2364 | | | size rules | | 2365 +---------------------------+--------+--------------+---------------+ 2366 | H3_EXCESSIVE_LOAD | 0x0107 | Peer | Section 8.1 | 2367 | | | generating | | 2368 | | | excessive | | 2369 | | | load | | 2370 +---------------------------+--------+--------------+---------------+ 2371 | H3_ID_ERROR | 0x0108 | An | Section 8.1 | 2372 | | | identifier | | 2373 | | | was used | | 2374 | | | incorrectly | | 2375 +---------------------------+--------+--------------+---------------+ 2376 | H3_SETTINGS_ERROR | 0x0109 | SETTINGS | Section 8.1 | 2377 | | | frame | | 2378 | | | contained | | 2379 | | | invalid | | 2380 | | | values | | 2381 +---------------------------+--------+--------------+---------------+ 2382 | H3_MISSING_SETTINGS | 0x010a | No SETTINGS | Section 8.1 | 2383 | | | frame | | 2384 | | | received | | 2385 +---------------------------+--------+--------------+---------------+ 2386 | H3_REQUEST_REJECTED | 0x010b | Request not | Section 8.1 | 2387 | | | processed | | 2388 +---------------------------+--------+--------------+---------------+ 2389 | H3_REQUEST_CANCELLED | 0x010c | Data no | Section 8.1 | 2390 | | | longer | | 2391 | | | needed | | 2392 +---------------------------+--------+--------------+---------------+ 2393 | H3_REQUEST_INCOMPLETE | 0x010d | Stream | Section 8.1 | 2394 | | | terminated | | 2395 | | | early | | 2396 +---------------------------+--------+--------------+---------------+ 2397 | H3_CONNECT_ERROR | 0x010f | TCP reset | Section 8.1 | 2398 | | | or error on | | 2399 | | | CONNECT | | 2400 | | | request | | 2401 +---------------------------+--------+--------------+---------------+ 2402 | H3_VERSION_FALLBACK | 0x0110 | Retry over | Section 8.1 | 2403 | | | HTTP/1.1 | | 2404 +---------------------------+--------+--------------+---------------+ 2406 Table 4: Initial HTTP/3 Error Codes 2408 Additionally, each code of the format "0x1f * N + 0x21" for non- 2409 negative integer values of N (that is, 0x21, 0x40, ..., through 2410 0x3ffffffffffffffe) MUST NOT be assigned by IANA. 2412 11.2.4. Stream Types 2414 This document establishes a registry for HTTP/3 unidirectional stream 2415 types. The "HTTP/3 Stream Type" registry governs a 62-bit space. 2416 This registry follows the QUIC registry policy; see Section 11.2. 2417 Permanent registrations in this registry are assigned using the 2418 Specification Required policy ([RFC8126]), except for values between 2419 0x00 and 0x3f (in hexadecimal; inclusive), which are assigned using 2420 Standards Action or IESG Approval as defined in Section 4.9 and 4.10 2421 of [RFC8126]. 2423 In addition to common fields as described in Section 11.2, permanent 2424 registrations in this registry MUST include the following fields: 2426 Stream Type: A name or label for the stream type. 2428 Sender: Which endpoint on a connection may initiate a stream of this 2429 type. Values are "Client", "Server", or "Both". 2431 Specifications for permanent registrations MUST include a description 2432 of the stream type, including the layout and semantics of the stream 2433 contents. 2435 The entries in the following table are registered by this document. 2437 +================+=======+===============+========+ 2438 | Stream Type | Value | Specification | Sender | 2439 +================+=======+===============+========+ 2440 | Control Stream | 0x00 | Section 6.2.1 | Both | 2441 +----------------+-------+---------------+--------+ 2442 | Push Stream | 0x01 | Section 4.4 | Server | 2443 +----------------+-------+---------------+--------+ 2445 Table 5 2447 Additionally, each code of the format "0x1f * N + 0x21" for non- 2448 negative integer values of N (that is, 0x21, 0x40, ..., through 2449 0x3ffffffffffffffe) MUST NOT be assigned by IANA. 2451 12. References 2453 12.1. Normative References 2455 [ALTSVC] Nottingham, M., McManus, P., and J. Reschke, "HTTP 2456 Alternative Services", RFC 7838, DOI 10.17487/RFC7838, 2457 April 2016, . 2459 [CACHING] Fielding, R., Nottingham, M., and J. Reschke, "HTTP 2460 Caching", Work in Progress, Internet-Draft, draft-ietf- 2461 httpbis-cache-11, 27 August 2020, . 2464 [HTTP-REPLAY] 2465 Thomson, M., Nottingham, M., and W. Tarreau, "Using Early 2466 Data in HTTP", RFC 8470, DOI 10.17487/RFC8470, September 2467 2018, . 2469 [QPACK] Krasic, C., Bishop, M., and A. Frindell, Ed., "QPACK: 2470 Header Compression for HTTP over QUIC", Work in Progress, 2471 Internet-Draft, draft-ietf-quic-qpack-18, 25 September 2472 2020, 2473 . 2475 [QUIC-TRANSPORT] 2476 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 2477 Multiplexed and Secure Transport", Work in Progress, 2478 Internet-Draft, draft-ietf-quic-transport-31, 25 September 2479 2020, . 2482 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 2483 RFC 793, DOI 10.17487/RFC0793, September 1981, 2484 . 2486 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2487 Requirement Levels", BCP 14, RFC 2119, 2488 DOI 10.17487/RFC2119, March 1997, 2489 . 2491 [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) 2492 Extensions: Extension Definitions", RFC 6066, 2493 DOI 10.17487/RFC6066, January 2011, 2494 . 2496 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 2497 Verification of Domain-Based Application Service Identity 2498 within Internet Public Key Infrastructure Using X.509 2499 (PKIX) Certificates in the Context of Transport Layer 2500 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 2501 2011, . 2503 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 2504 DOI 10.17487/RFC6265, April 2011, 2505 . 2507 [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, 2508 "Transport Layer Security (TLS) Application-Layer Protocol 2509 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 2510 July 2014, . 2512 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2513 Writing an IANA Considerations Section in RFCs", BCP 26, 2514 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2515 . 2517 [RFC8164] Nottingham, M. and M. Thomson, "Opportunistic Security for 2518 HTTP/2", RFC 8164, DOI 10.17487/RFC8164, May 2017, 2519 . 2521 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2522 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2523 May 2017, . 2525 [SEMANTICS] 2526 Fielding, R., Nottingham, M., and J. Reschke, "HTTP 2527 Semantics", Work in Progress, Internet-Draft, draft-ietf- 2528 httpbis-semantics-11, 27 August 2020, 2529 . 2532 [URI] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2533 Resource Identifier (URI): Generic Syntax", STD 66, 2534 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2535 . 2537 12.2. Informative References 2539 [BREACH] Gluck, Y., Harris, N., and A. Prado, "BREACH: Reviving the 2540 CRIME Attack", July 2013, 2541 . 2544 [HPACK] Peon, R. and H. Ruellan, "HPACK: Header Compression for 2545 HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015, 2546 . 2548 [HTTP11] Fielding, R., Nottingham, M., and J. Reschke, "HTTP/1.1 2549 Messaging", Work in Progress, Internet-Draft, draft-ietf- 2550 httpbis-messaging-11, 27 August 2020, 2551 . 2554 [HTTP2] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 2555 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 2556 DOI 10.17487/RFC7540, May 2015, 2557 . 2559 [RFC6585] Nottingham, M. and R. Fielding, "Additional HTTP Status 2560 Codes", RFC 6585, DOI 10.17487/RFC6585, April 2012, 2561 . 2563 [TFO] Cheng, Y., Chu, J., Radhakrishnan, S., and A. Jain, "TCP 2564 Fast Open", RFC 7413, DOI 10.17487/RFC7413, December 2014, 2565 . 2567 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 2568 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 2569 . 2571 Appendix A. Considerations for Transitioning from HTTP/2 2573 HTTP/3 is strongly informed by HTTP/2, and bears many similarities. 2574 This section describes the approach taken to design HTTP/3, points 2575 out important differences from HTTP/2, and describes how to map 2576 HTTP/2 extensions into HTTP/3. 2578 HTTP/3 begins from the premise that similarity to HTTP/2 is 2579 preferable, but not a hard requirement. HTTP/3 departs from HTTP/2 2580 where QUIC differs from TCP, either to take advantage of QUIC 2581 features (like streams) or to accommodate important shortcomings 2582 (such as a lack of total ordering). These differences make HTTP/3 2583 similar to HTTP/2 in key aspects, such as the relationship of 2584 requests and responses to streams. However, the details of the 2585 HTTP/3 design are substantially different from HTTP/2. 2587 These departures are noted in this section. 2589 A.1. Streams 2591 HTTP/3 permits use of a larger number of streams (2^62-1) than 2592 HTTP/2. The same considerations about exhaustion of stream 2593 identifier space apply, though the space is significantly larger such 2594 that it is likely that other limits in QUIC are reached first, such 2595 as the limit on the connection flow control window. 2597 In contrast to HTTP/2, stream concurrency in HTTP/3 is managed by 2598 QUIC. QUIC considers a stream closed when all data has been received 2599 and sent data has been acknowledged by the peer. HTTP/2 considers a 2600 stream closed when the frame containing the END_STREAM bit has been 2601 committed to the transport. As a result, the stream for an 2602 equivalent exchange could remain "active" for a longer period of 2603 time. HTTP/3 servers might choose to permit a larger number of 2604 concurrent client-initiated bidirectional streams to achieve 2605 equivalent concurrency to HTTP/2, depending on the expected usage 2606 patterns. 2608 Due to the presence of other unidirectional stream types, HTTP/3 does 2609 not rely exclusively on the number of concurrent unidirectional 2610 streams to control the number of concurrent in-flight pushes. 2611 Instead, HTTP/3 clients use the MAX_PUSH_ID frame to control the 2612 number of pushes received from an HTTP/3 server. 2614 A.2. HTTP Frame Types 2616 Many framing concepts from HTTP/2 can be elided on QUIC, because the 2617 transport deals with them. Because frames are already on a stream, 2618 they can omit the stream number. Because frames do not block 2619 multiplexing (QUIC's multiplexing occurs below this layer), the 2620 support for variable-maximum-length packets can be removed. Because 2621 stream termination is handled by QUIC, an END_STREAM flag is not 2622 required. This permits the removal of the Flags field from the 2623 generic frame layout. 2625 Frame payloads are largely drawn from [HTTP2]. However, QUIC 2626 includes many features (e.g., flow control) that are also present in 2627 HTTP/2. In these cases, the HTTP mapping does not re-implement them. 2628 As a result, several HTTP/2 frame types are not required in HTTP/3. 2629 Where an HTTP/2-defined frame is no longer used, the frame ID has 2630 been reserved in order to maximize portability between HTTP/2 and 2631 HTTP/3 implementations. However, even equivalent frames between the 2632 two mappings are not identical. 2634 Many of the differences arise from the fact that HTTP/2 provides an 2635 absolute ordering between frames across all streams, while QUIC 2636 provides this guarantee on each stream only. As a result, if a frame 2637 type makes assumptions that frames from different streams will still 2638 be received in the order sent, HTTP/3 will break them. 2640 Some examples of feature adaptations are described below, as well as 2641 general guidance to extension frame implementors converting an HTTP/2 2642 extension to HTTP/3. 2644 A.2.1. Prioritization Differences 2646 HTTP/2 specifies priority assignments in PRIORITY frames and 2647 (optionally) in HEADERS frames. HTTP/3 does not provide a means of 2648 signaling priority. 2650 Note that while there is no explicit signaling for priority, this 2651 does not mean that prioritization is not important for achieving good 2652 performance. 2654 A.2.2. Field Compression Differences 2656 HPACK was designed with the assumption of in-order delivery. A 2657 sequence of encoded field sections must arrive (and be decoded) at an 2658 endpoint in the same order in which they were encoded. This ensures 2659 that the dynamic state at the two endpoints remains in sync. 2661 Because this total ordering is not provided by QUIC, HTTP/3 uses a 2662 modified version of HPACK, called QPACK. QPACK uses a single 2663 unidirectional stream to make all modifications to the dynamic table, 2664 ensuring a total order of updates. All frames that contain encoded 2665 fields merely reference the table state at a given time without 2666 modifying it. 2668 [QPACK] provides additional details. 2670 A.2.3. Flow Control Differences 2672 HTTP/2 specifies a stream flow control mechanism. Although all 2673 HTTP/2 frames are delivered on streams, only the DATA frame payload 2674 is subject to flow control. QUIC provides flow control for stream 2675 data and all HTTP/3 frame types defined in this document are sent on 2676 streams. Therefore, all frame headers and payload are subject to 2677 flow control. 2679 A.2.4. Guidance for New Frame Type Definitions 2681 Frame type definitions in HTTP/3 often use the QUIC variable-length 2682 integer encoding. In particular, Stream IDs use this encoding, which 2683 allows for a larger range of possible values than the encoding used 2684 in HTTP/2. Some frames in HTTP/3 use an identifier rather than a 2685 Stream ID (e.g., Push IDs). Redefinition of the encoding of 2686 extension frame types might be necessary if the encoding includes a 2687 Stream ID. 2689 Because the Flags field is not present in generic HTTP/3 frames, 2690 those frames that depend on the presence of flags need to allocate 2691 space for flags as part of their frame payload. 2693 Other than these issues, frame type HTTP/2 extensions are typically 2694 portable to QUIC simply by replacing Stream 0 in HTTP/2 with a 2695 control stream in HTTP/3. HTTP/3 extensions will not assume 2696 ordering, but would not be harmed by ordering, and would be portable 2697 to HTTP/2 in the same manner. 2699 A.2.5. Mapping Between HTTP/2 and HTTP/3 Frame Types 2701 DATA (0x0): Padding is not defined in HTTP/3 frames. See 2702 Section 7.2.1. 2704 HEADERS (0x1): The PRIORITY region of HEADERS is not defined in 2705 HTTP/3 frames. Padding is not defined in HTTP/3 frames. See 2706 Section 7.2.2. 2708 PRIORITY (0x2): As described in Appendix A.2.1, HTTP/3 does not 2709 provide a means of signaling priority. 2711 RST_STREAM (0x3): RST_STREAM frames do not exist in HTTP/3, since 2712 QUIC provides stream lifecycle management. The same code point is 2713 used for the CANCEL_PUSH frame (Section 7.2.3). 2715 SETTINGS (0x4): SETTINGS frames are sent only at the beginning of 2716 the connection. See Section 7.2.4 and Appendix A.3. 2718 PUSH_PROMISE (0x5): The PUSH_PROMISE frame does not reference a 2719 stream; instead the push stream references the PUSH_PROMISE frame 2720 using a Push ID. See Section 7.2.5. 2722 PING (0x6): PING frames do not exist in HTTP/3, as QUIC provides 2723 equivalent functionality. 2725 GOAWAY (0x7): GOAWAY does not contain an error code. In the client 2726 to server direction, it carries a Push ID instead of a server 2727 initiated stream ID. See Section 7.2.6. 2729 WINDOW_UPDATE (0x8): WINDOW_UPDATE frames do not exist in HTTP/3, 2730 since QUIC provides flow control. 2732 CONTINUATION (0x9): CONTINUATION frames do not exist in HTTP/3; 2733 instead, larger HEADERS/PUSH_PROMISE frames than HTTP/2 are 2734 permitted. 2736 Frame types defined by extensions to HTTP/2 need to be separately 2737 registered for HTTP/3 if still applicable. The IDs of frames defined 2738 in [HTTP2] have been reserved for simplicity. Note that the frame 2739 type space in HTTP/3 is substantially larger (62 bits versus 8 bits), 2740 so many HTTP/3 frame types have no equivalent HTTP/2 code points. 2741 See Section 11.2.1. 2743 A.3. HTTP/2 SETTINGS Parameters 2745 An important difference from HTTP/2 is that settings are sent once, 2746 as the first frame of the control stream, and thereafter cannot 2747 change. This eliminates many corner cases around synchronization of 2748 changes. 2750 Some transport-level options that HTTP/2 specifies via the SETTINGS 2751 frame are superseded by QUIC transport parameters in HTTP/3. The 2752 HTTP-level options that are retained in HTTP/3 have the same value as 2753 in HTTP/2. The superseded settings are reserved, and their receipt 2754 is an error. See Section 7.2.4.1 for discussion of both the retained 2755 and reserved values. 2757 Below is a listing of how each HTTP/2 SETTINGS parameter is mapped: 2759 SETTINGS_HEADER_TABLE_SIZE: See [QPACK]. 2761 SETTINGS_ENABLE_PUSH: This is removed in favor of the MAX_PUSH_ID 2762 frame, which provides a more granular control over server push. 2763 Specifying a setting with the identifier 0x2 (corresponding to the 2764 SETTINGS_ENABLE_PUSH parameter) in the HTTP/3 SETTINGS frame is an 2765 error. 2767 SETTINGS_MAX_CONCURRENT_STREAMS: QUIC controls the largest open 2768 Stream ID as part of its flow control logic. Specifying a setting 2769 with the identifier 0x3 (corresponding to the 2770 SETTINGS_MAX_CONCURRENT_STREAMS parameter) in the HTTP/3 SETTINGS 2771 frame is an error. 2773 SETTINGS_INITIAL_WINDOW_SIZE: QUIC requires both stream and 2774 connection flow control window sizes to be specified in the 2775 initial transport handshake. Specifying a setting with the 2776 identifier 0x4 (corresponding to the SETTINGS_INITIAL_WINDOW_SIZE 2777 parameter) in the HTTP/3 SETTINGS frame is an error. 2779 SETTINGS_MAX_FRAME_SIZE: This setting has no equivalent in HTTP/3. 2780 Specifying a setting with the identifier 0x5 (corresponding to the 2781 SETTINGS_MAX_FRAME_SIZE parameter) in the HTTP/3 SETTINGS frame is 2782 an error. 2784 SETTINGS_MAX_HEADER_LIST_SIZE: This setting identifier has been 2785 renamed SETTINGS_MAX_FIELD_SECTION_SIZE. 2787 In HTTP/3, setting values are variable-length integers (6, 14, 30, or 2788 62 bits long) rather than fixed-length 32-bit fields as in HTTP/2. 2789 This will often produce a shorter encoding, but can produce a longer 2790 encoding for settings that use the full 32-bit space. Settings 2791 ported from HTTP/2 might choose to redefine their value to limit it 2792 to 30 bits for more efficient encoding, or to make use of the 62-bit 2793 space if more than 30 bits are required. 2795 Settings need to be defined separately for HTTP/2 and HTTP/3. The 2796 IDs of settings defined in [HTTP2] have been reserved for simplicity. 2797 Note that the settings identifier space in HTTP/3 is substantially 2798 larger (62 bits versus 16 bits), so many HTTP/3 settings have no 2799 equivalent HTTP/2 code point. See Section 11.2.2. 2801 As QUIC streams might arrive out of order, endpoints are advised not 2802 to wait for the peers' settings to arrive before responding to other 2803 streams. See Section 7.2.4.2. 2805 A.4. HTTP/2 Error Codes 2807 QUIC has the same concepts of "stream" and "connection" errors that 2808 HTTP/2 provides. However, the differences between HTTP/2 and HTTP/3 2809 mean that error codes are not directly portable between versions. 2811 The HTTP/2 error codes defined in Section 7 of [HTTP2] logically map 2812 to the HTTP/3 error codes as follows: 2814 NO_ERROR (0x0): H3_NO_ERROR in Section 8.1. 2816 PROTOCOL_ERROR (0x1): This is mapped to H3_GENERAL_PROTOCOL_ERROR 2817 except in cases where more specific error codes have been defined. 2818 Such cases include H3_FRAME_UNEXPECTED and 2819 H3_CLOSED_CRITICAL_STREAM defined in Section 8.1. 2821 INTERNAL_ERROR (0x2): H3_INTERNAL_ERROR in Section 8.1. 2823 FLOW_CONTROL_ERROR (0x3): Not applicable, since QUIC handles flow 2824 control. 2826 SETTINGS_TIMEOUT (0x4): Not applicable, since no acknowledgement of 2827 SETTINGS is defined. 2829 STREAM_CLOSED (0x5): Not applicable, since QUIC handles stream 2830 management. 2832 FRAME_SIZE_ERROR (0x6): H3_FRAME_ERROR error code defined in 2833 Section 8.1. 2835 REFUSED_STREAM (0x7): H3_REQUEST_REJECTED (in Section 8.1) is used 2836 to indicate that a request was not processed. Otherwise, not 2837 applicable because QUIC handles stream management. 2839 CANCEL (0x8): H3_REQUEST_CANCELLED in Section 8.1. 2841 COMPRESSION_ERROR (0x9): Multiple error codes are defined in 2842 [QPACK]. 2844 CONNECT_ERROR (0xa): H3_CONNECT_ERROR in Section 8.1. 2846 ENHANCE_YOUR_CALM (0xb): H3_EXCESSIVE_LOAD in Section 8.1. 2848 INADEQUATE_SECURITY (0xc): Not applicable, since QUIC is assumed to 2849 provide sufficient security on all connections. 2851 HTTP_1_1_REQUIRED (0xd): H3_VERSION_FALLBACK in Section 8.1. 2853 Error codes need to be defined for HTTP/2 and HTTP/3 separately. See 2854 Section 11.2.3. 2856 A.4.1. Mapping Between HTTP/2 and HTTP/3 Errors 2858 An intermediary that converts between HTTP/2 and HTTP/3 may encounter 2859 error conditions from either upstream. It is useful to communicate 2860 the occurrence of error to the downstream but error codes largely 2861 reflect connection-local problems that generally do not make sense to 2862 propagate. 2864 An intermediary that encounters an error from an upstream origin can 2865 indicate this by sending an HTTP status code such as 502, which is 2866 suitable for a broad class of errors. 2868 There are some rare cases where it is beneficial to propagate the 2869 error by mapping it to the closest matching error type to the 2870 receiver. For example, an intermediary that receives an HTTP/2 2871 stream error of type REFUSED_STREAM from the origin has a clear 2872 signal that the request was not processed and that the request is 2873 safe to retry. Propagating this error condition to the client as an 2874 HTTP/3 stream error of type H3_REQUEST_REJECTED allows the client to 2875 take the action it deems most appropriate. In the reverse direction, 2876 the intermediary might deem it beneficial to pass on client request 2877 cancellations that are indicated by terminating a stream with 2878 H3_REQUEST_CANCELLED; see Section 4.1.2. 2880 Conversion between errors is described in the logical mapping. The 2881 error codes are defined in non-overlapping spaces in order to protect 2882 against accidental conversion that could result in the use of 2883 inappropriate or unknown error codes for the target version. An 2884 intermediary is permitted to promote stream errors to connection 2885 errors but they should be aware of the cost to the connection for 2886 what might be a temporary or intermittent error. 2888 Appendix B. Change Log 2890 *RFC Editor's Note:* Please remove this section prior to 2891 publication of a final version of this document. 2893 B.1. Since draft-ietf-quic-http-30 2895 Editorial changes only. 2897 B.2. Since draft-ietf-quic-http-29 2899 * Require a connection error if a reserved frame type that 2900 corresponds to a frame in HTTP/2 is received (#3991, #3993) 2902 * Require a connection error if a reserved setting that corresponds 2903 to a setting in HTTP/2 is received (#3954, #3955) 2905 B.3. Since draft-ietf-quic-http-28 2907 * CANCEL_PUSH is recommended even when the stream is reset (#3698, 2908 #3700) 2910 * Use H3_ID_ERROR when GOAWAY contains a larger identifier (#3631, 2911 #3634) 2913 B.4. Since draft-ietf-quic-http-27 2915 * Updated text to refer to latest HTTP revisions 2917 * Use the HTTP definition of authority for establishing and 2918 coalescing connections (#253, #2223, #3558) 2920 * Define use of GOAWAY from both endpoints (#2632, #3129) 2922 * Require either :authority or Host if the URI scheme has a 2923 mandatory authority component (#3408, #3475) 2925 B.5. Since draft-ietf-quic-http-26 2927 * No changes 2929 B.6. Since draft-ietf-quic-http-25 2931 * Require QUICv1 for HTTP/3 (#3117, #3323) 2933 * Remove DUPLICATE_PUSH and allow duplicate PUSH_PROMISE (#3275, 2934 #3309) 2936 * Clarify the definition of "malformed" (#3352, #3345) 2938 B.7. Since draft-ietf-quic-http-24 2940 * Removed H3_EARLY_RESPONSE error code; H3_NO_ERROR is recommended 2941 instead (#3130,#3208) 2943 * Unknown error codes are equivalent to H3_NO_ERROR (#3276,#3331) 2945 * Some error codes are reserved for greasing (#3325,#3360) 2947 B.8. Since draft-ietf-quic-http-23 2949 * Removed "quic" Alt-Svc parameter (#3061,#3118) 2951 * Clients need not persist unknown settings for use in 0-RTT 2952 (#3110,#3113) 2954 * Clarify error cases around CANCEL_PUSH (#2819,#3083) 2956 B.9. Since draft-ietf-quic-http-22 2958 * Removed priority signaling (#2922,#2924) 2960 * Further changes to error codes (#2662,#2551): 2962 - Error codes renumbered 2964 - HTTP_MALFORMED_FRAME replaced by HTTP_FRAME_ERROR, 2965 HTTP_ID_ERROR, and others 2967 * Clarify how unknown frame types interact with required frame 2968 sequence (#2867,#2858) 2970 * Describe interactions with the transport in terms of defined 2971 interface terms (#2857,#2805) 2973 * Require the use of the "http-opportunistic" resource (RFC 8164) 2974 when scheme is "http" (#2439,#2973) 2976 * Settings identifiers cannot be duplicated (#2979) 2978 * Changes to SETTINGS frames in 0-RTT (#2972,#2790,#2945): 2980 - Servers must send all settings with non-default values in their 2981 SETTINGS frame, even when resuming 2983 - If a client doesn't have settings associated with a 0-RTT 2984 ticket, it uses the defaults 2986 - Servers can't accept early data if they cannot recover the 2987 settings the client will have remembered 2989 * Clarify that Upgrade and the 101 status code are prohibited 2990 (#2898,#2889) 2992 * Clarify that frame types reserved for greasing can occur on any 2993 stream, but frame types reserved due to HTTP/2 correspondence are 2994 prohibited (#2997,#2692,#2693) 2996 * Unknown error codes cannot be treated as errors (#2998,#2816) 2998 B.10. Since draft-ietf-quic-http-21 3000 No changes 3002 B.11. Since draft-ietf-quic-http-20 3004 * Prohibit closing the control stream (#2509, #2666) 3006 * Change default priority to use an orphan node (#2502, #2690) 3008 * Exclusive priorities are restored (#2754, #2781) 3010 * Restrict use of frames when using CONNECT (#2229, #2702) 3012 * Close and maybe reset streams if a connection error occurs for 3013 CONNECT (#2228, #2703) 3015 * Encourage provision of sufficient unidirectional streams for QPACK 3016 (#2100, #2529, #2762) 3018 * Allow extensions to use server-initiated bidirectional streams 3019 (#2711, #2773) 3021 * Clarify use of maximum header list size setting (#2516, #2774) 3023 * Extensive changes to error codes and conditions of their sending 3025 - Require connection errors for more error conditions (#2511, 3026 #2510) 3028 - Updated the error codes for illegal GOAWAY frames (#2714, 3029 #2707) 3031 - Specified error code for HEADERS on control stream (#2708) 3033 - Specified error code for servers receiving PUSH_PROMISE (#2709) 3035 - Specified error code for receiving DATA before HEADERS (#2715) 3037 - Describe malformed messages and their handling (#2410, #2764) 3039 - Remove HTTP_PUSH_ALREADY_IN_CACHE error (#2812, #2813) 3041 - Refactor Push ID related errors (#2818, #2820) 3043 - Rationalize HTTP/3 stream creation errors (#2821, #2822) 3045 B.12. Since draft-ietf-quic-http-19 3047 * SETTINGS_NUM_PLACEHOLDERS is 0x9 (#2443,#2530) 3049 * Non-zero bits in the Empty field of the PRIORITY frame MAY be 3050 treated as an error (#2501) 3052 B.13. Since draft-ietf-quic-http-18 3054 * Resetting streams following a GOAWAY is recommended, but not 3055 required (#2256,#2457) 3057 * Use variable-length integers throughout (#2437,#2233,#2253,#2275) 3059 - Variable-length frame types, stream types, and settings 3060 identifiers 3062 - Renumbered stream type assignments 3064 - Modified associated reserved values 3066 * Frame layout switched from Length-Type-Value to Type-Length-Value 3067 (#2395,#2235) 3069 * Specified error code for servers receiving DUPLICATE_PUSH (#2497) 3071 * Use connection error for invalid PRIORITY (#2507, #2508) 3073 B.14. Since draft-ietf-quic-http-17 3075 * HTTP_REQUEST_REJECTED is used to indicate a request can be retried 3076 (#2106, #2325) 3078 * Changed error code for GOAWAY on the wrong stream (#2231, #2343) 3080 B.15. Since draft-ietf-quic-http-16 3082 * Rename "HTTP/QUIC" to "HTTP/3" (#1973) 3084 * Changes to PRIORITY frame (#1865, #2075) 3086 - Permitted as first frame of request streams 3088 - Remove exclusive reprioritization 3090 - Changes to Prioritized Element Type bits 3092 * Define DUPLICATE_PUSH frame to refer to another PUSH_PROMISE 3093 (#2072) 3095 * Set defaults for settings, allow request before receiving SETTINGS 3096 (#1809, #1846, #2038) 3098 * Clarify message processing rules for streams that aren't closed 3099 (#1972, #2003) 3101 * Removed reservation of error code 0 and moved HTTP_NO_ERROR to 3102 this value (#1922) 3104 * Removed prohibition of zero-length DATA frames (#2098) 3106 B.16. Since draft-ietf-quic-http-15 3108 Substantial editorial reorganization; no technical changes. 3110 B.17. Since draft-ietf-quic-http-14 3112 * Recommend sensible values for QUIC transport parameters 3113 (#1720,#1806) 3115 * Define error for missing SETTINGS frame (#1697,#1808) 3117 * Setting values are variable-length integers (#1556,#1807) and do 3118 not have separate maximum values (#1820) 3120 * Expanded discussion of connection closure (#1599,#1717,#1712) 3122 * HTTP_VERSION_FALLBACK falls back to HTTP/1.1 (#1677,#1685) 3124 B.18. Since draft-ietf-quic-http-13 3126 * Reserved some frame types for grease (#1333, #1446) 3127 * Unknown unidirectional stream types are tolerated, not errors; 3128 some reserved for grease (#1490, #1525) 3130 * Require settings to be remembered for 0-RTT, prohibit reductions 3131 (#1541, #1641) 3133 * Specify behavior for truncated requests (#1596, #1643) 3135 B.19. Since draft-ietf-quic-http-12 3137 * TLS SNI extension isn't mandatory if an alternative method is used 3138 (#1459, #1462, #1466) 3140 * Removed flags from HTTP/3 frames (#1388, #1398) 3142 * Reserved frame types and settings for use in preserving 3143 extensibility (#1333, #1446) 3145 * Added general error code (#1391, #1397) 3147 * Unidirectional streams carry a type byte and are extensible 3148 (#910,#1359) 3150 * Priority mechanism now uses explicit placeholders to enable 3151 persistent structure in the tree (#441,#1421,#1422) 3153 B.20. Since draft-ietf-quic-http-11 3155 * Moved QPACK table updates and acknowledgments to dedicated streams 3156 (#1121, #1122, #1238) 3158 B.21. Since draft-ietf-quic-http-10 3160 * Settings need to be remembered when attempting and accepting 0-RTT 3161 (#1157, #1207) 3163 B.22. Since draft-ietf-quic-http-09 3165 * Selected QCRAM for header compression (#228, #1117) 3167 * The server_name TLS extension is now mandatory (#296, #495) 3169 * Specified handling of unsupported versions in Alt-Svc (#1093, 3170 #1097) 3172 B.23. Since draft-ietf-quic-http-08 3174 * Clarified connection coalescing rules (#940, #1024) 3176 B.24. Since draft-ietf-quic-http-07 3178 * Changes for integer encodings in QUIC (#595,#905) 3180 * Use unidirectional streams as appropriate (#515, #240, #281, #886) 3182 * Improvement to the description of GOAWAY (#604, #898) 3184 * Improve description of server push usage (#947, #950, #957) 3186 B.25. Since draft-ietf-quic-http-06 3188 * Track changes in QUIC error code usage (#485) 3190 B.26. Since draft-ietf-quic-http-05 3192 * Made push ID sequential, add MAX_PUSH_ID, remove 3193 SETTINGS_ENABLE_PUSH (#709) 3195 * Guidance about keep-alive and QUIC PINGs (#729) 3197 * Expanded text on GOAWAY and cancellation (#757) 3199 B.27. Since draft-ietf-quic-http-04 3201 * Cite RFC 5234 (#404) 3203 * Return to a single stream per request (#245,#557) 3205 * Use separate frame type and settings registries from HTTP/2 (#81) 3207 * SETTINGS_ENABLE_PUSH instead of SETTINGS_DISABLE_PUSH (#477) 3209 * Restored GOAWAY (#696) 3211 * Identify server push using Push ID rather than a stream ID 3212 (#702,#281) 3214 * DATA frames cannot be empty (#700) 3216 B.28. Since draft-ietf-quic-http-03 3218 None. 3220 B.29. Since draft-ietf-quic-http-02 3222 * Track changes in transport draft 3224 B.30. Since draft-ietf-quic-http-01 3226 * SETTINGS changes (#181): 3228 - SETTINGS can be sent only once at the start of a connection; no 3229 changes thereafter 3231 - SETTINGS_ACK removed 3233 - Settings can only occur in the SETTINGS frame a single time 3235 - Boolean format updated 3237 * Alt-Svc parameter changed from "v" to "quic"; format updated 3238 (#229) 3240 * Closing the connection control stream or any message control 3241 stream is a fatal error (#176) 3243 * HPACK Sequence counter can wrap (#173) 3245 * 0-RTT guidance added 3247 * Guide to differences from HTTP/2 and porting HTTP/2 extensions 3248 added (#127,#242) 3250 B.31. Since draft-ietf-quic-http-00 3252 * Changed "HTTP/2-over-QUIC" to "HTTP/QUIC" throughout (#11,#29) 3254 * Changed from using HTTP/2 framing within Stream 3 to new framing 3255 format and two-stream-per-request model (#71,#72,#73) 3257 * Adopted SETTINGS format from draft-bishop-httpbis-extended- 3258 settings-01 3260 * Reworked SETTINGS_ACK to account for indeterminate inter-stream 3261 order (#75) 3263 * Described CONNECT pseudo-method (#95) 3265 * Updated ALPN token and Alt-Svc guidance (#13,#87) 3267 * Application-layer-defined error codes (#19,#74) 3269 B.32. Since draft-shade-quic-http2-mapping-00 3271 * Adopted as base for draft-ietf-quic-http 3273 * Updated authors/editors list 3275 Acknowledgements 3277 The original authors of this specification were Robbie Shade and Mike 3278 Warres. 3280 The IETF QUIC Working Group received an enormous amount of support 3281 from many people. Among others, the following people provided 3282 substantial contributions to this document: 3284 * Bence Beky 3286 * Daan De Meyer 3288 * Martin Duke 3290 * Roy Fielding 3292 * Alan Frindell 3294 * Alessandro Ghedini 3296 * Nick Harper 3298 * Ryan Hamilton 3300 * Christian Huitema 3302 * Subodh Iyengar 3304 * Robin Marx 3306 * Patrick McManus 3308 * Luca Nicco 3310 * 奥 一穂 (Kazuho Oku) 3312 * Lucas Pardue 3314 * Roberto Peon 3316 * Julian Reschke 3317 * Eric Rescorla 3319 * Martin Seemann 3321 * Ben Schwartz 3323 * Ian Swett 3325 * Willy Taureau 3327 * Martin Thomson 3329 * Dmitri Tikhonov 3331 * Tatsuhiro Tsujikawa 3333 A portion of Mike's contribution was supported by Microsoft during 3334 his employment there. 3336 Author's Address 3338 Mike Bishop (editor) 3339 Akamai 3341 Email: mbishop@evequefou.be