idnits 2.17.1 draft-ietf-quic-http-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- 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 seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (September 22, 2017) is 2407 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 4 errors (**), 0 flaws (~~), 2 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 QUIC M. Bishop, Ed. 3 Internet-Draft Microsoft 4 Intended status: Standards Track September 22, 2017 5 Expires: March 26, 2018 7 Hypertext Transfer Protocol (HTTP) over QUIC 8 draft-ietf-quic-http-06 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 QUIC. 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 http://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 March 26, 2018. 46 Copyright Notice 48 Copyright (c) 2017 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (http://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 64 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 65 2. QUIC Advertisement . . . . . . . . . . . . . . . . . . . . . 3 66 2.1. QUIC Version Hints . . . . . . . . . . . . . . . . . . . 4 67 3. Connection Establishment . . . . . . . . . . . . . . . . . . 5 68 3.1. Draft Version Identification . . . . . . . . . . . . . . 5 69 4. Stream Mapping and Usage . . . . . . . . . . . . . . . . . . 5 70 4.1. Stream 1: Control Stream . . . . . . . . . . . . . . . . 6 71 4.2. HTTP Message Exchanges . . . . . . . . . . . . . . . . . 6 72 4.2.1. Header Compression . . . . . . . . . . . . . . . . . 7 73 4.2.2. The CONNECT Method . . . . . . . . . . . . . . . . . 8 74 4.3. Request Prioritization . . . . . . . . . . . . . . . . . 9 75 4.4. Server Push . . . . . . . . . . . . . . . . . . . . . . . 9 76 5. HTTP Framing Layer . . . . . . . . . . . . . . . . . . . . . 10 77 5.1. Frame Layout . . . . . . . . . . . . . . . . . . . . . . 10 78 5.2. Frame Definitions . . . . . . . . . . . . . . . . . . . . 11 79 5.2.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . 11 80 5.2.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 11 81 5.2.3. PRIORITY . . . . . . . . . . . . . . . . . . . . . . 12 82 5.2.4. CANCEL_PUSH . . . . . . . . . . . . . . . . . . . . . 13 83 5.2.5. SETTINGS . . . . . . . . . . . . . . . . . . . . . . 14 84 5.2.6. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . 17 85 5.2.7. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . 18 86 5.2.8. MAX_PUSH_ID . . . . . . . . . . . . . . . . . . . . . 20 87 6. Connection Management . . . . . . . . . . . . . . . . . . . . 20 88 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 21 89 7.1. HTTP-Defined QUIC Error Codes . . . . . . . . . . . . . . 21 90 8. Considerations for Transitioning from HTTP/2 . . . . . . . . 22 91 8.1. HTTP Frame Types . . . . . . . . . . . . . . . . . . . . 23 92 8.2. HTTP/2 SETTINGS Parameters . . . . . . . . . . . . . . . 24 93 8.3. HTTP/2 Error Codes . . . . . . . . . . . . . . . . . . . 25 95 9. Security Considerations . . . . . . . . . . . . . . . . . . . 26 96 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 97 10.1. Registration of HTTP/QUIC Identification String . . . . 26 98 10.2. Registration of QUIC Version Hint Alt-Svc Parameter . . 27 99 10.3. Frame Types . . . . . . . . . . . . . . . . . . . . . . 27 100 10.4. Settings Parameters . . . . . . . . . . . . . . . . . . 28 101 10.5. Error Codes . . . . . . . . . . . . . . . . . . . . . . 29 102 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 31 103 11.1. Normative References . . . . . . . . . . . . . . . . . . 31 104 11.2. Informative References . . . . . . . . . . . . . . . . . 32 105 Appendix A. Contributors . . . . . . . . . . . . . . . . . . . . 32 106 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 33 107 B.1. Since draft-ietf-quic-http-05 . . . . . . . . . . . . . . 33 108 B.2. Since draft-ietf-quic-http-04 . . . . . . . . . . . . . . 33 109 B.3. Since draft-ietf-quic-http-03 . . . . . . . . . . . . . . 33 110 B.4. Since draft-ietf-quic-http-02 . . . . . . . . . . . . . . 33 111 B.5. Since draft-ietf-quic-http-01 . . . . . . . . . . . . . . 33 112 B.6. Since draft-ietf-quic-http-00 . . . . . . . . . . . . . . 34 113 B.7. Since draft-shade-quic-http2-mapping-00 . . . . . . . . . 34 114 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 34 116 1. Introduction 118 The QUIC transport protocol has several features that are desirable 119 in a transport for HTTP, such as stream multiplexing, per-stream flow 120 control, and low-latency connection establishment. This document 121 describes a mapping of HTTP semantics over QUIC, drawing heavily on 122 the existing TCP mapping, HTTP/2. Specifically, this document 123 identifies HTTP/2 features that are subsumed by QUIC, and describes 124 how the other features can be implemented atop QUIC. 126 QUIC is described in [QUIC-TRANSPORT]. For a full description of 127 HTTP/2, see [RFC7540]. 129 1.1. Notational Conventions 131 The words "MUST", "MUST NOT", "SHOULD", and "MAY" are used in this 132 document. It's not shouting; when they are capitalized, they have 133 the special meaning defined in [RFC2119]. 135 Field definitions are given in Augmented Backus-Naur Form (ABNF), as 136 defined in [RFC5234]. 138 2. QUIC Advertisement 140 An HTTP origin advertises the availability of an equivalent HTTP/QUIC 141 endpoint via the Alt-Svc HTTP response header or the HTTP/2 ALTSVC 142 frame ([RFC7838]), using the ALPN token defined in Section 3. 144 For example, an origin could indicate in an HTTP/1.1 or HTTP/2 145 response that HTTP/QUIC was available on UDP port 50781 at the same 146 hostname by including the following header in any response: 148 Alt-Svc: hq=":50781" 150 On receipt of an Alt-Svc header indicating HTTP/QUIC support, a 151 client MAY attempt to establish a QUIC connection to the indicated 152 host and port and, if successful, send HTTP requests using the 153 mapping described in this document. 155 Connectivity problems (e.g. firewall blocking UDP) can result in QUIC 156 connection establishment failure, in which case the client SHOULD 157 continue using the existing connection or try another alternative 158 endpoint offered by the origin. 160 Servers MAY serve HTTP/QUIC on any UDP port. Servers MUST use the 161 same port across all IP addresses that serve a single domain, and 162 SHOULD NOT change this port. 164 2.1. QUIC Version Hints 166 This document defines the "quic" parameter for Alt-Svc, which MAY be 167 used to provide version-negotiation hints to HTTP/QUIC clients. QUIC 168 versions are four-octet sequences with no additional constraints on 169 format. Syntax: 171 quic = version-number 172 version-number = 1*8HEXDIG; hex-encoded QUIC version 174 Leading zeros SHOULD be omitted for brevity. When multiple versions 175 are supported, the "quic" parameter MAY be repeated multiple times in 176 a single Alt-Svc entry. For example, if a server supported both 177 version 0x00000001 and the version rendered in ASCII as "Q034", it 178 could specify the following header: 180 Alt-Svc: hq=":49288";quic=1;quic=51303334 182 Where multiple versions are listed, the order of the values reflects 183 the server's preference (with the first value being the most 184 preferred version). Origins SHOULD list only versions which are 185 supported by the alternative, but MAY omit supported versions for any 186 reason. 188 3. Connection Establishment 190 HTTP/QUIC connections are established as described in 191 [QUIC-TRANSPORT]. During connection establishment, HTTP/QUIC support 192 is indicated by selecting the ALPN token "hq" in the crypto 193 handshake. 195 While connection-level options pertaining to the core QUIC protocol 196 are set in the initial crypto handshake, HTTP-specific settings are 197 conveyed in the SETTINGS frame. After the QUIC connection is 198 established, a SETTINGS frame (Section 5.2.5) MUST be sent as the 199 initial frame of the HTTP control stream (Stream ID 1, see 200 Section 4). The server MUST NOT send data on any other stream until 201 the client's SETTINGS frame has been received. 203 3.1. Draft Version Identification 205 *RFC Editor's Note:* Please remove this section prior to 206 publication of a final version of this document. 208 Only implementations of the final, published RFC can identify 209 themselves as "hq". Until such an RFC exists, implementations MUST 210 NOT identify themselves using this string. 212 Implementations of draft versions of the protocol MUST add the string 213 "-" and the corresponding draft number to the identifier. For 214 example, draft-ietf-quic-http-01 is identified using the string "hq- 215 01". 217 Non-compatible experiments that are based on these draft versions 218 MUST append the string "-" and an experiment name to the identifier. 219 For example, an experimental implementation based on draft-ietf-quic- 220 http-09 which reserves an extra stream for unsolicited transmission 221 of 1980s pop music might identify itself as "hq-09-rickroll". Note 222 that any label MUST conform to the "token" syntax defined in 223 Section 3.2.6 of [RFC7230]. Experimenters are encouraged to 224 coordinate their experiments on the quic@ietf.org mailing list. 226 4. Stream Mapping and Usage 228 A QUIC stream provides reliable in-order delivery of bytes, but makes 229 no guarantees about order of delivery with regard to bytes on other 230 streams. On the wire, data is framed into QUIC STREAM frames, but 231 this framing is invisible to the HTTP framing layer. A QUIC receiver 232 buffers and orders received STREAM frames, exposing the data 233 contained within as a reliable byte stream to the application. 235 QUIC reserves Stream 0 for crypto operations (the handshake, crypto 236 config updates). Stream 1 is reserved for sending and receiving HTTP 237 control frames, and is analogous to HTTP/2's Stream 0. This control 238 stream is considered critical to the HTTP connection. If the control 239 stream is closed for any reason, this MUST be treated as a connection 240 error of type QUIC_CLOSED_CRITICAL_STREAM. 242 When HTTP headers and data are sent over QUIC, the QUIC layer handles 243 most of the stream management. An HTTP request/response consumes a 244 single stream: This means that the client's first request occurs on 245 QUIC stream 3, the second on stream 5, and so on. The server's first 246 push consumes stream 2. 248 This stream carries frames related to the request/response (see 249 Section 5.2). When a stream terminates cleanly, if the last frame on 250 the stream was truncated, this MUST be treated as a connection error 251 (see HTTP_MALFORMED_* in Section 7.1). Streams which terminate 252 abruptly may be reset at any point in the frame. 254 Streams SHOULD be used sequentially, with no gaps. Streams used for 255 pushed resources MAY be initiated out-of-order, but stream IDs SHOULD 256 be allocated to promised resources sequentially. 258 HTTP does not need to do any separate multiplexing when using QUIC - 259 data sent over a QUIC stream always maps to a particular HTTP 260 transaction. Requests and responses are considered complete when the 261 corresponding QUIC stream is closed in the appropriate direction. 263 4.1. Stream 1: Control Stream 265 Since most connection-level concerns will be managed by QUIC, the 266 primary use of Stream 1 will be for the SETTINGS frame when the 267 connection opens and for PRIORITY frames subsequently. 269 4.2. HTTP Message Exchanges 271 A client sends an HTTP request on a new QUIC stream. A server sends 272 an HTTP response on the same stream as the request. 274 An HTTP message (request or response) consists of: 276 1. one header block (see Section 5.2.2) containing the message 277 headers (see [RFC7230], Section 3.2), 279 2. the payload body (see [RFC7230], Section 3.3), sent as a series 280 of DATA frames (see Section 5.2.1), 282 3. optionally, one header block containing the trailer-part, if 283 present (see [RFC7230], Section 4.1.2). 285 In addition, prior to sending the message header block indicated 286 above, a response may contain zero or more header blocks containing 287 the message headers of informational (1xx) HTTP responses (see 288 [RFC7230], Section 3.2 and [RFC7231], Section 6.2). 290 PUSH_PROMISE frames MAY be interleaved with the frames of a response 291 message indicating a pushed resource related to the response. These 292 PUSH_PROMISE frames are not part of the response, but carry the 293 headers of a separate HTTP request message. See Section 4.4 for more 294 details. 296 The "chunked" transfer encoding defined in Section 4.1 of [RFC7230] 297 MUST NOT be used. 299 Trailing header fields are carried in an additional header block 300 following the body. Such a header block is a sequence of HEADERS 301 frames with End Header Block set on the last frame. Senders MUST 302 send only one header block in the trailers section; receivers MUST 303 discard any subsequent header blocks. 305 An HTTP request/response exchange fully consumes a QUIC stream. 306 After sending a request, a client closes the stream for sending; 307 after sending a response, the server closes the stream for sending 308 and the QUIC stream is fully closed. 310 A server can send a complete response prior to the client sending an 311 entire request if the response does not depend on any portion of the 312 request that has not been sent and received. When this is true, a 313 server MAY request that the client abort transmission of a request 314 without error by triggering a QUIC STOP_SENDING with error code 315 HTTP_EARLY_RESPONSE, sending a complete response, and cleanly closing 316 its streams. Clients MUST NOT discard complete responses as a result 317 of having their request terminated abruptly, though clients can 318 always discard responses at their discretion for other reasons. 319 Servers MUST NOT abort a response in progress as a result of 320 receiving a solicited RST_STREAM. 322 4.2.1. Header Compression 324 HTTP/QUIC uses HPACK header compression as described in [RFC7541]. 325 HPACK was designed for HTTP/2 with the assumption of in-order 326 delivery such as that provided by TCP. A sequence of encoded header 327 blocks must arrive (and be decoded) at an endpoint in the same order 328 in which they were encoded. This ensures that the dynamic state at 329 the two endpoints remains in sync. 331 QUIC streams provide in-order delivery of data sent on those streams, 332 but there are no guarantees about order of delivery between streams. 333 QUIC anticipates moving to a modified version of HPACK without this 334 assumption. In the meantime, by fixing the size of the dynamic table 335 at zero, HPACK can be used in an unordered environment. 337 4.2.2. The CONNECT Method 339 The pseudo-method CONNECT ([RFC7231], Section 4.3.6) is primarily 340 used with HTTP proxies to establish a TLS session with an origin 341 server for the purposes of interacting with "https" resources. In 342 HTTP/1.x, CONNECT is used to convert an entire HTTP connection into a 343 tunnel to a remote host. In HTTP/2, the CONNECT method is used to 344 establish a tunnel over a single HTTP/2 stream to a remote host for 345 similar purposes. 347 A CONNECT request in HTTP/QUIC functions in the same manner as in 348 HTTP/2. The request MUST be formatted as described in [RFC7540], 349 Section 8.3. A CONNECT request that does not conform to these 350 restrictions is malformed. The message data stream MUST NOT be 351 closed at the end of the request. 353 A proxy that supports CONNECT establishes a TCP connection 354 ([RFC0793]) to the server identified in the ":authority" pseudo- 355 header field. Once this connection is successfully established, the 356 proxy sends a HEADERS frame containing a 2xx series status code to 357 the client, as defined in [RFC7231], Section 4.3.6. 359 All DATA frames on the request stream correspond to data sent on the 360 TCP connection. Any DATA frame sent by the client is transmitted by 361 the proxy to the TCP server; data received from the TCP server is 362 packaged into DATA frames by the proxy. Note that the size and 363 number of TCP segments is not guaranteed to map predictably to the 364 size and number of HTTP DATA or QUIC STREAM frames. 366 The TCP connection can be closed by either peer. When the client 367 half-closes the request stream, the proxy will set the FIN bit on its 368 connection to the TCP server. When the proxy receives a packet with 369 the FIN bit set, it will half-close the corresponding stream. TCP 370 connections which remain half-closed in a single direction are not 371 invalid, but are often handled poorly by servers, so clients SHOULD 372 NOT half-close connections on which they are still expecting data. 374 A TCP connection error is signaled with RST_STREAM. A proxy treats 375 any error in the TCP connection, which includes receiving a TCP 376 segment with the RST bit set, as a stream error of type 377 HTTP_CONNECT_ERROR (Section 7.1). Correspondingly, a proxy MUST send 378 a TCP segment with the RST bit set if it detects an error with the 379 stream or the QUIC connection. 381 4.3. Request Prioritization 383 HTTP/QUIC uses the priority scheme described in [RFC7540], 384 Section 5.3. In this priority scheme, a given request can be 385 designated as dependent upon another request, which expresses the 386 preference that the latter stream (the "parent" request) be allocated 387 resources before the former stream (the "dependent" request). Taken 388 together, the dependencies across all requests in a connection form a 389 dependency tree. The structure of the dependency tree changes as 390 PRIORITY frames add, remove, or change the dependency links between 391 requests. 393 HTTP/2 defines its priorities in terms of streams whereas HTTP over 394 QUIC identifies requests. The PRIORITY frame Section 5.2.3 395 identifies a request either by identifying the stream that carries a 396 request or by using a Push ID (Section 5.2.6). Other than the means 397 of identifying requests, the prioritization system is identical to 398 that in HTTP/2. 400 Only a client can send PRIORITY frames. A server MUST NOT send a 401 PRIORITY frame. 403 4.4. Server Push 405 HTTP/QUIC supports server push as described in [RFC7540]. During 406 connection establishment, the client enables server push by sending a 407 MAX_PUSH_ID frame (see Section 5.2.8). A server cannot use server 408 push until it receives a MAX_PUSH_ID frame. 410 As with server push for HTTP/2, the server initiates a server push by 411 sending a PUSH_PROMISE frame that includes request header fields 412 attributed to the request. The PUSH_PROMISE frame is sent on a 413 response stream. Unlike HTTP/2, the PUSH_PROMISE does not reference 414 a stream; when a server fulfills a promise, the stream that carries 415 the stream headers references the PUSH_PROMISE. This allows a server 416 to fulfill promises in the order that best suits its needs. 418 The server push response is conveyed on a push stream. A push stream 419 is a server-initiated stream. A push stream includes a header (see 420 Figure 1) that identifies the PUSH_PROMISE that it fulfills. This 421 header consists of a 32-bit Push ID, which identifies a server push 422 (see Section 5.2.6). 424 0 1 2 3 425 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 426 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 427 | Push ID (32) | 428 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 430 Figure 1: Push Stream Header 432 A push stream always starts with a 32-bit Push ID. A client MUST 433 treat receiving a push stream that contains fewer than 4 octets as a 434 connection error of type HTTP_MALFORMED_PUSH. 436 A server SHOULD use Push IDs sequentially, starting at 0. A client 437 uses the MAX_PUSH_ID frame (Section 5.2.8) to limit the number of 438 pushes that a server can promise. A client MUST treat receipt of a 439 push stream with a Push ID that is greater than the maximum Push ID 440 as a connection error of type HTTP_MALFORMED_PUSH. 442 Each Push ID MUST only be used once in a push stream header. If a 443 push stream header includes a Push ID that was used in another push 444 stream header, the client MUST treat this as a connection error of 445 type HTTP_MALFORMED_PUSH. The same Push ID can be used in multiple 446 PUSH_PROMISE frames (see Section 5.2.6). 448 After the push stream header, a push contains a response 449 (Section 4.2), with response headers, a response body (if any) 450 carried by DATA frames, then trailers (if any) carried by HEADERS 451 frames. 453 If a promised server push is not needed by the client, the client 454 SHOULD send a CANCEL_PUSH frame; if the push stream is already open, 455 a QUIC STOP_SENDING frame with an appropriate error code can be used 456 instead (e.g., HTTP_PUSH_REFUSED, HTTP_PUSH_ALREADY_IN_CACHE; see 457 Section 7). This asks the server not to transfer the data and 458 indicates that it will be discarded upon receipt. 460 5. HTTP Framing Layer 462 Frames are used on each stream. This section describes HTTP framing 463 in QUIC and highlights some differences from HTTP/2 framing. For 464 more detail on differences from HTTP/2, see Section 8.1. 466 5.1. Frame Layout 468 All frames have the following format: 470 0 1 2 3 471 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 472 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 473 | Length (16) | Type (8) | Flags (8) | 474 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 475 | Frame Payload (*) ... 476 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 478 Figure 2: HTTP/QUIC frame format 480 5.2. Frame Definitions 482 5.2.1. DATA 484 DATA frames (type=0x0) convey arbitrary, variable-length sequences of 485 octets associated with an HTTP request or response payload. 487 The DATA frame defines no flags. 489 DATA frames MUST be associated with an HTTP request or response. If 490 a DATA frame is received on the control stream, the recipient MUST 491 respond with a connection error (Section 7) of type 492 HTTP_WRONG_STREAM. 494 DATA frames MUST contain a non-zero-length payload. If a DATA frame 495 is received with a payload length of zero, the recipient MUST respond 496 with a stream error (Section 7) of type HTTP_MALFORMED_DATA. 498 5.2.2. HEADERS 500 The HEADERS frame (type=0x1) is used to carry part of a header set, 501 compressed using HPACK Section 4.2.1. 503 One flag is defined: 505 End Header Block (0x4): This frame concludes a header block. 507 A HEADERS frame with any other flags set MUST be treated as a 508 connection error of type HTTP_MALFORMED_HEADERS. 510 The next frame on the same stream after a HEADERS frame without the 511 EHB flag set MUST be another HEADERS frame. A receiver MUST treat 512 the receipt of any other type of frame as a stream error of type 513 HTTP_INTERRUPTED_HEADERS. (Note that QUIC can intersperse data from 514 other streams between frames, or even during transmission of frames, 515 so multiplexing is not blocked by this requirement.) 516 A full header block is contained in a sequence of zero or more 517 HEADERS frames without EHB set, followed by a HEADERS frame with EHB 518 set. 520 5.2.3. PRIORITY 522 The PRIORITY (type=0x02) frame specifies the sender-advised priority 523 of a stream and is substantially different in format from [RFC7540]. 524 In order to ensure that prioritization is processed in a consistent 525 order, PRIORITY frames MUST be sent on the control stream. A 526 PRIORITY frame sent on any other stream MUST be treated as a 527 HTTP_WRONG_STREAM error. 529 The format has been modified to accommodate not being sent on a 530 request stream, to allow for identification of server pushes, and the 531 larger stream ID space of QUIC. The semantics of the Stream 532 Dependency, Weight, and E flag are otherwise the same as in HTTP/2. 534 The flags defined are: 536 PUSH_PRIORITIZED (0x04): Indicates that the Prioritized Stream is a 537 server push rather than a request. 539 PUSH_DEPENDENT (0x02): Indicates a dependency on a server push. 541 E (0x01): Indicates that the stream dependency is exclusive (see 542 [RFC7540], Section 5.3). 544 0 1 2 3 545 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 546 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 547 | Prioritized Request ID (32) | 548 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 549 | Stream Dependency ID (32) | 550 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 551 | Weight (8) | 552 +-+-+-+-+-+-+-+-+ 554 Figure 3: PRIORITY frame payload 556 The PRIORITY frame payload has the following fields: 558 Prioritized Request ID: A 32-bit identifier for a request. This 559 contains the stream ID of a request stream when the 560 PUSH_PRIORITIZED flag is clear, or a Push ID when the 561 PUSH_PRIORITIZED flag is set. 563 Stream Dependency ID: A 32-bit stream identifier for a dependent 564 request. This contains the stream ID of a request stream when the 565 PUSH_DEPENDENT flag is clear, or a Push ID when the PUSH_DEPENDENT 566 flag is set. A request stream ID of 0 indicates a dependency on 567 the root stream. For details of dependencies, see Section 4.3 and 568 [RFC7540], Section 5.3. 570 Weight: An unsigned 8-bit integer representing a priority weight for 571 the stream (see [RFC7540], Section 5.3). Add one to the value to 572 obtain a weight between 1 and 256. 574 A PRIORITY frame identifies a request to priotize, and a request upon 575 which that request is dependent. A Prioritized Request ID or Stream 576 Dependency ID identifies a client-initiated request using the 577 corresponding stream ID when the corresponding PUSH_PRIORITIZED or 578 PUSH_DEPENDENT flag is not set. Setting the PUSH_PRIORITIZED or 579 PUSH_DEPENDENT flag causes the Prioritized Request ID or Stream 580 Dependency ID (respectively) to identify a server push using a Push 581 ID (see Section 5.2.6 for details). 583 A PRIORITY frame MAY identify a Stream Dependency ID using a stream 584 ID of 0; as in [RFC7540], this makes the request dependent on the 585 root of the dependency tree. 587 Stream ID 0 and stream ID 1 cannot be reprioritized. A Prioritized 588 Request ID that identifies Stream 0 or 1 MUST be treated as a 589 connection error of type HTTP_MALFORMED_PRIORITY. 591 A PRIORITY frame that does not reference a request MUST be treated as 592 a HTTP_MALFORMED_PRIORITY error, unless it references stream ID 0. A 593 PRIORITY that sets a PUSH_PRIORITIZED or PUSH_DEPENDENT flag, but 594 then references a non-existent Push ID MUST be treated as a 595 HTTP_MALFORMED_PRIORITY error. 597 The length of a PRIORITY frame is 9 octets. A PRIORITY frame with 598 any other length MUST be treated as a connection error of type 599 HTTP_MALFORMED_PRIORITY. 601 5.2.4. CANCEL_PUSH 603 The CANCEL_PUSH frame (type=0x3) is used to request cancellation of 604 server push prior to the push stream being created. The CANCEL_PUSH 605 frame identifies a server push request by Push ID (see 606 Section 5.2.6). 608 When a server receives this frame, it aborts sending the response for 609 the identified server push. If the server has not yet started to 610 send the server push, it can use the receipt of a CANCEL_PUSH frame 611 to avoid opening a stream. If the push stream has been opened by the 612 server, the server SHOULD sent a QUIC RST_STREAM frame on those 613 streams and cease transmission of the response. 615 A server can send this frame to indicate that it won't be sending a 616 response prior to creation of a push stream. Once the push stream 617 has been created, sending CANCEL_PUSH has no effect on the state of 618 the push stream. A QUIC RST_STREAM frame SHOULD be used instead to 619 cancel transmission of the server push response. 621 A CANCEL_PUSH frame is sent on the control stream. Sending a 622 CANCEL_PUSH frame on a stream other than the control stream MUST be 623 treated as a stream error of type HTTP_WRONG_STREAM. 625 The CANCEL_PUSH frame has no defined flags. 627 The CANCEL_PUSH frame carries a 32-bit Push ID that identifies the 628 server push that is being cancelled (see Section 5.2.6). 630 If the client receives a CANCEL_PUSH frame, that frame might identify 631 a Push ID that has not yet been mentioned by a PUSH_PROMISE frame. 633 A server MUST treat a CANCEL_PUSH frame payload that is other than 4 634 octets in length as a connection error of type 635 HTTP_MALFORMED_CANCEL_PUSH. 637 5.2.5. SETTINGS 639 The SETTINGS frame (type=0x4) conveys configuration parameters that 640 affect how endpoints communicate, such as preferences and constraints 641 on peer behavior, and is different from [RFC7540]. Individually, a 642 SETTINGS parameter can also be referred to as a "setting". 644 SETTINGS parameters are not negotiated; they describe characteristics 645 of the sending peer, which can be used by the receiving peer. 646 However, a negotiation can be implied by the use of SETTINGS - a peer 647 uses SETTINGS to advertise a set of supported values. The recipient 648 can then choose which entries from this list are also acceptable and 649 proceed with the value it has chosen. (This choice could be 650 announced in a field of an extension frame, or in its own value in 651 SETTINGS.) 653 Different values for the same parameter can be advertised by each 654 peer. For example, a client might be willing to consume very large 655 response headers, while servers are more cautious about request size. 657 Parameters MUST NOT occur more than once. A receiver MAY treat the 658 presence of the same parameter more than once as a connection error 659 of type HTTP_MALFORMED_SETTINGS. 661 The SETTINGS frame defines no flags. 663 The payload of a SETTINGS frame consists of zero or more parameters, 664 each consisting of an unsigned 16-bit setting identifier and a 665 length-prefixed binary value. 667 0 1 2 3 668 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 669 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 670 | Identifier (16) | Length (16) | 671 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 672 | Contents (?) ... 673 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 675 Figure 4: SETTINGS value format 677 A zero-length content indicates that the setting value is a Boolean 678 and true. False is indicated by the absence of the setting. 680 Non-zero-length values MUST be compared against the remaining length 681 of the SETTINGS frame. Any value which purports to cross the end of 682 the frame MUST cause the SETTINGS frame to be considered malformed 683 and trigger a connection error of type HTTP_MALFORMED_SETTINGS. 685 An implementation MUST ignore the contents for any SETTINGS 686 identifier it does not understand. 688 SETTINGS frames always apply to a connection, never a single stream. 689 A SETTINGS frame MUST be sent as the first frame of the control 690 stream (see Section 4) by each peer, and MUST NOT be sent 691 subsequently or on any other stream. If an endpoint receives an 692 SETTINGS frame on a different stream, the endpoint MUST respond with 693 a connection error of type HTTP_WRONG_STREAM. If an endpoint 694 receives a second SETTINGS frame, the endpoint MUST respond with a 695 connection error of type HTTP_MULTIPLE_SETTINGS. 697 The SETTINGS frame affects connection state. A badly formed or 698 incomplete SETTINGS frame MUST be treated as a connection error 699 (Section 7) of type HTTP_MALFORMED_SETTINGS. 701 5.2.5.1. Integer encoding 703 Settings which are integers are transmitted in network byte order. 704 Leading zero octets are permitted, but implementations SHOULD use 705 only as many bytes as are needed to represent the value. An integer 706 MUST NOT be represented in more bytes than would be used to transfer 707 the maximum permitted value. 709 5.2.5.2. Defined SETTINGS Parameters 711 The following settings are defined in HTTP/QUIC: 713 SETTINGS_HEADER_TABLE_SIZE (0x1): An integer with a maximum value of 714 2^32 - 1. This value MUST be zero. 716 SETTINGS_MAX_HEADER_LIST_SIZE (0x6): An integer with a maximum value 717 of 2^32 - 1 719 5.2.5.3. Usage in 0-RTT 721 When a 0-RTT QUIC connection is being used, the client's initial 722 requests will be sent before the arrival of the server's SETTINGS 723 frame. Clients SHOULD cache at least the following settings about 724 servers: 726 o SETTINGS_HEADER_TABLE_SIZE 728 o SETTINGS_MAX_HEADER_LIST_SIZE 730 Clients MUST comply with cached settings until the server's current 731 settings are received. If a client does not have cached values, it 732 SHOULD assume the following values: 734 o SETTINGS_HEADER_TABLE_SIZE: 0 octets 736 o SETTINGS_MAX_HEADER_LIST_SIZE: 16,384 octets 738 Servers MAY continue processing data from clients which exceed its 739 current configuration during the initial flight. In this case, the 740 client MUST apply the new settings immediately upon receipt. 742 If the connection is closed because these or other constraints were 743 violated during the 0-RTT flight (e.g. with 744 HTTP_HPACK_DECOMPRESSION_FAILED), clients MAY establish a new 745 connection and retry any 0-RTT requests using the settings sent by 746 the server on the closed connection. (This assumes that only 747 requests that are safe to retry are sent in 0-RTT.) If the 748 connection was closed before the SETTINGS frame was received, clients 749 SHOULD discard any cached values and use the defaults above on the 750 next connection. 752 5.2.6. PUSH_PROMISE 754 The PUSH_PROMISE frame (type=0x05) is used to carry a request header 755 set from server to client, as in HTTP/2. The PUSH_PROMISE frame 756 defines no flags. 758 0 1 2 3 759 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 760 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 761 | Push ID (32) | 762 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 763 | Header Block (*) ... 764 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 766 Figure 5: PUSH_PROMISE frame payload 768 The payload consists of: 770 Push ID: A 32-bit identifier for the server push request. A push ID 771 is used in push stream header (Section 4.4), CANCEL_PUSH frames 772 (Section 5.2.4), and PRIORITY frames (Section 5.2.3). 774 Header Block: HPACK-compressed request headers for the promised 775 response. 777 A server MUST NOT use a Push ID that is larger than the client has 778 provided in a MAX_PUSH_ID frame (Section 5.2.8). A client MUST treat 779 receipt of a PUSH_PROMISE that contains a larger Push ID than the 780 client has advertised as a connection error of type 781 HTTP_MALFORMED_PUSH_PROMISE. 783 A server MAY use the same Push ID in multiple PUSH_PROMISE frames. 784 This allows the server to use the same server push in response to 785 multiple concurrent requests. Referencing the same server push 786 ensures that a PUSH_PROMISE can be made in relation to every response 787 in which server push might be needed without duplicating pushes. 789 A server that uses the same Push ID in multiple PUSH_PROMISE frames 790 MUST include the same header fields each time. The octets of the 791 header block MAY be different due to differing encoding, but the 792 header fields and their values MUST be identical. Note that ordering 793 of header fields is significant. A client MUST treat receipt of a 794 PUSH_PROMISE with conflicting header field values for the same Push 795 ID as a connection error of type HTTP_MALFORMED_PUSH_PROMISE. 797 Allowing duplicate references to the same Push ID is primarily to 798 reduce duplication caused by concurrent requests. A server SHOULD 799 avoid reusing a Push ID over a long period. Clients are likely to 800 consume server push responses and not retain them for reuse over 801 time. Clients that see a PUSH_PROMISE that uses a Push ID that they 802 have since consumed and discarded are forced to ignore the 803 PUSH_PROMISE. 805 5.2.7. GOAWAY 807 The GOAWAY frame (type=0x7) is used to initiate graceful shutdown of 808 a connection by a server. GOAWAY allows a server to stop accepting 809 new requests while still finishing processing of previously received 810 requests. This enables administrative actions, like server 811 maintenance. GOAWAY by itself does not close a connection. (Note 812 that clients do not need to send GOAWAY to gracefully close a 813 connection; they simply stop making new requests.) 815 The GOAWAY frame does not define any flags, and the payload is a QUIC 816 stream identifier. The GOAWAY frame applies to the connection, not a 817 specific stream. An endpoint MUST treat a GOAWAY frame on a stream 818 other than the control stream as a connection error (Section 7) of 819 type HTTP_WRONG_STREAM. 821 New client requests might already have been sent before the client 822 receives the server's GOAWAY frame. The GOAWAY frame contains the 823 stream identifier of the last client-initiated request that was or 824 might be processed in this connection, which enables client and 825 server to agree on which requests were accepted prior to the 826 connection shutdown. This identifier MAY be lower than the stream 827 limit identified by a QUIC MAX_STREAM_ID frame, and MAY be zero if no 828 requests were processed. Servers SHOULD NOT increase the 829 MAX_STREAM_ID limit after sending a GOAWAY frame. 831 Note: In this context, "processed" means that some data from the 832 stream was passed to some higher layer of software that might have 833 taken some action as a result. 835 Once sent, the server will refuse requests sent on streams with an 836 identifier higher than the included last stream identifier. Clients 837 MUST NOT send new requests on the connection after receiving GOAWAY, 838 although requests might already be in transit. A new connection can 839 be established for new requests. 841 If the client has sent requests on streams with a higher stream 842 identifier than indicated in the GOAWAY frame, those requests were 843 not and will not be processed. Endpoints SHOULD reset any streams 844 above this ID with the error code HTTP_REQUEST_CANCELLED. Servers 845 MAY also reset streams below the indicated ID with 846 HTTP_REQUEST_CANCELLED if the associated requests were not processed. 847 Servers MUST NOT use the HTTP_REQUEST_CANCELLED status for requests 848 which were partially or fully processed. 850 The client can treat requests cancelled by the server as though they 851 had never been sent at all, thereby allowing them to be retried later 852 on a new connection. If a stream is cancelled after receiving a 853 complete response, the client MAY ignore the cancellation and use the 854 response. However, if a stream is cancelled after receiving a 855 partial response, the response SHOULD NOT be used. Automatically 856 retrying such requests is not possible, unless this is otherwise 857 permitted (e.g. idempotent actions like GET, PUT, or DELETE). 858 Requests on stream IDs less than or equal to the stream ID in the 859 GOAWAY frame might have been processed; their status cannot be known 860 until they are completed successfully, reset individually, or the 861 connection terminates. 863 Servers SHOULD send a GOAWAY frame when the closing of a connection 864 is known in advance, even if the advance notice is small, so that the 865 remote peer can know whether a stream has been partially processed or 866 not. For example, if an HTTP client sends a POST at the same time 867 that a server closes a QUIC connection, the client cannot know if the 868 server started to process that POST request if the server does not 869 send a GOAWAY frame to indicate what streams it might have acted on. 871 For unexpected closures caused by error conditions, a QUIC 872 CONNECTION_CLOSE frame MUST be used. However, a GOAWAY MAY be sent 873 first to provide additional detail to clients. If a connection 874 terminates without a GOAWAY frame, the last stream identifier is 875 effectively the highest possible stream identifier (as determined by 876 QUIC's MAX_STREAM_ID). 878 An endpoint MAY send multiple GOAWAY frames if circumstances change. 879 For instance, an endpoint that sends GOAWAY without an error code 880 during graceful shutdown could subsequently encounter an error 881 condition. The last stream identifier from the last GOAWAY frame 882 received indicates which streams could have been acted upon. 883 Endpoints MUST NOT increase the value they send in the last stream 884 identifier, since the peers might already have retried unprocessed 885 requests on another connection. 887 A client that is unable to retry requests loses all requests that are 888 in flight when the server closes the connection. A server that is 889 attempting to gracefully shut down a connection SHOULD send an 890 initial GOAWAY frame with the last stream identifier set to the 891 current value of QUIC's MAX_STREAM_ID and SHOULD NOT increase the 892 MAX_STREAM_ID thereafter. This signals to the client that a shutdown 893 is imminent and that initiating further requests is prohibited. 894 After allowing time for any in-flight requests (at least one round- 895 trip time), the server MAY send another GOAWAY frame with an updated 896 last stream identifier. This ensures that a connection can be 897 cleanly shut down without losing requests. 899 5.2.8. MAX_PUSH_ID 901 The MAX_PUSH_ID frame (type=0xD) is used by clients to control the 902 number of server pushes that the server can initiate. This sets the 903 maximum value for a Push ID that the server can use in a PUSH_PROMISE 904 frame. Consequently, this also limits the number of push streams 905 that the server can initiate in addition to the limit set by the QUIC 906 MAX_STREAM_ID frame. 908 The MAX_PUSH_ID frame is always sent on the control stream. Receipt 909 of a MAX_PUSH_ID frame on any other stream MUST be treated as a 910 connection error of type HTTP_WRONG_STREAM. 912 A server MUST NOT send a MAX_PUSH_ID frame. A client MUST treat the 913 receipt of a MAX_PUSH_ID frame as a connection error of type 914 HTTP_MALFORMED_MAX_PUSH_ID. 916 The maximum Push ID is unset when a connection is created, meaning 917 that a server cannot push until it receives a MAX_PUSH_ID frame. A 918 client that wishes to manage the number of promised server pushes can 919 increase the maximum Push ID by sending a MAX_PUSH_ID frame as the 920 server fulfills or cancels server pushes. 922 The MAX_PUSH_ID frame has no defined flags. 924 The MAX_PUSH_ID frame carries a 32-bit Push ID that identifies the 925 maximum value for a Push ID that the server can use (see 926 Section 5.2.6). A MAX_PUSH_ID frame cannot reduce the maximum Push 927 ID; receipt of a MAX_PUSH_ID that contains a smaller value than 928 previously received MUST be treated as a connection error of type 929 HTTP_MALFORMED_MAX_PUSH_ID. 931 A server MUST treat a MAX_PUSH_ID frame payload that is other than 4 932 octets in length as a connection error of type 933 HTTP_MALFORMED_MAX_PUSH_ID. 935 6. Connection Management 937 QUIC connections are persistent. All of the considerations in 938 Section 9.1 of [RFC7540] apply to the management of QUIC connections. 940 HTTP clients are expected to use QUIC PING frames to keep connections 941 open. Servers SHOULD NOT use PING frames to keep a connection open. 942 A client SHOULD NOT use PING frames for this purpose unless there are 943 responses outstanding for requests or server pushes. If the client 944 is not expecting a response from the server, allowing an idle 945 connection to time out (based on the idle_timeout transport 946 parameter) is preferred over expending effort maintaining a 947 connection that might not be needed. A gateway MAY use PING to 948 maintain connections in anticipation of need rather than incur the 949 latency cost of connection establishment to servers. 951 7. Error Handling 953 QUIC allows the application to abruptly terminate (reset) individual 954 streams or the entire connection when an error is encountered. These 955 are referred to as "stream errors" or "connection errors" and are 956 described in more detail in [QUIC-TRANSPORT]. 958 This section describes HTTP-specific error codes which can be used to 959 express the cause of a connection or stream error. 961 7.1. HTTP-Defined QUIC Error Codes 963 QUIC allocates error codes 0x0000-0x3FFF to application protocol 964 definition. The following error codes are defined by HTTP for use in 965 QUIC RST_STREAM and CONNECTION_CLOSE frames. 967 HTTP_PUSH_REFUSED (0x01): The server has attempted to push content 968 which the client will not accept on this connection. 970 HTTP_INTERNAL_ERROR (0x02): An internal error has occurred in the 971 HTTP stack. 973 HTTP_PUSH_ALREADY_IN_CACHE (0x03): The server has attempted to push 974 content which the client has cached. 976 HTTP_REQUEST_CANCELLED (0x04): The client no longer needs the 977 requested data. 979 HTTP_HPACK_DECOMPRESSION_FAILED (0x05): HPACK failed to decompress a 980 frame and cannot continue. 982 HTTP_CONNECT_ERROR (0x06): The connection established in response to 983 a CONNECT request was reset or abnormally closed. 985 HTTP_EXCESSIVE_LOAD (0x07): The endpoint detected that its peer is 986 exhibiting a behavior that might be generating excessive load. 988 HTTP_VERSION_FALLBACK (0x08): The requested operation cannot be 989 served over HTTP/QUIC. The peer should retry over HTTP/2. 991 HTTP_MALFORMED_HEADERS (0x09): A HEADERS frame has been received 992 with an invalid format. 994 HTTP_MALFORMED_PRIORITY (0x0A): A PRIORITY frame has been received 995 with an invalid format. 997 HTTP_MALFORMED_SETTINGS (0x0B): A SETTINGS frame has been received 998 with an invalid format. 1000 HTTP_MALFORMED_PUSH_PROMISE (0x0C): A PUSH_PROMISE frame has been 1001 received with an invalid format. 1003 HTTP_MALFORMED_DATA (0x0D): A DATA frame has been received with an 1004 invalid format. 1006 HTTP_INTERRUPTED_HEADERS (0x0E): A HEADERS frame without the End 1007 Header Block flag was followed by a frame other than HEADERS. 1009 HTTP_WRONG_STREAM (0x0F): A frame was received on stream where it is 1010 not permitted. 1012 HTTP_MULTIPLE_SETTINGS (0x10): More than one SETTINGS frame was 1013 received. 1015 HTTP_MALFORMED_PUSH (0x11): A push stream header was malformed or 1016 included an invalid Push ID. 1018 HTTP_MALFORMED_MAX_PUSH_ID (0x12): A MAX_PUSH_ID frame has been 1019 received with an invalid format. 1021 8. Considerations for Transitioning from HTTP/2 1023 HTTP/QUIC is strongly informed by HTTP/2, and bears many 1024 similarities. This section describes the approach taken to design 1025 HTTP/QUIC, points out important differences from HTTP/2, and 1026 describes how to map HTTP/2 extensions into HTTP/QUIC. 1028 HTTP/QUIC begins from the premise that HTTP/2 code reuse is a useful 1029 feature, but not a hard requirement. HTTP/QUIC departs from HTTP/2 1030 primarily where necessary to accommodate the differences in behavior 1031 between QUIC and TCP (lack of ordering, support for streams). We 1032 intend to avoid gratuitous changes which make it difficult or 1033 impossible to build extensions with the same semantics applicable to 1034 both protocols at once. 1036 These departures are noted in this section. 1038 8.1. HTTP Frame Types 1040 Many framing concepts from HTTP/2 can be elided away on QUIC, because 1041 the transport deals with them. Because frames are already on a 1042 stream, they can omit the stream number. Because frames do not block 1043 multiplexing (QUIC's multiplexing occurs below this layer), the 1044 support for variable-maximum-length packets can be removed. Because 1045 stream termination is handled by QUIC, an END_STREAM flag is not 1046 required. 1048 Frame payloads are largely drawn from [RFC7540]. However, QUIC 1049 includes many features (e.g. flow control) which are also present in 1050 HTTP/2. In these cases, the HTTP mapping does not re-implement them. 1051 As a result, several HTTP/2 frame types are not required in HTTP/ 1052 QUIC. Where an HTTP/2-defined frame is no longer used, the frame ID 1053 has been reserved in order to maximize portability between HTTP/2 and 1054 HTTP/QUIC implementations. However, even equivalent frames between 1055 the two mappings are not identical. 1057 Many of the differences arise from the fact that HTTP/2 provides an 1058 absolute ordering between frames across all streams, while QUIC 1059 provides this guarantee on each stream only. As a result, if a frame 1060 type makes assumptions that frames from different streams will still 1061 be received in the order sent, HTTP/QUIC will break them. 1063 For example, implicit in the HTTP/2 prioritization scheme is the 1064 notion of in-order delivery of priority changes (i.e., dependency 1065 tree mutations): since operations on the dependency tree such as 1066 reparenting a subtree are not commutative, both sender and receiver 1067 must apply them in the same order to ensure that both sides have a 1068 consistent view of the stream dependency tree. HTTP/2 specifies 1069 priority assignments in PRIORITY frames and (optionally) in HEADERS 1070 frames. To achieve in-order delivery of priority changes in HTTP/ 1071 QUIC, PRIORITY frames are sent on the control stream and the PRIORITY 1072 section is removed from the HEADERS frame. 1074 Other than this issue, frame type HTTP/2 extensions are typically 1075 portable to QUIC simply by replacing Stream 0 in HTTP/2 with Stream 1 1076 in HTTP/QUIC. HTTP/QUIC extensions will not assume ordering, but 1077 would not be harmed by ordering, and would be portable to HTTP/2 in 1078 the same manner. 1080 Below is a listing of how each HTTP/2 frame type is mapped: 1082 DATA (0x0): Padding is not defined in HTTP/QUIC frames. See 1083 Section 5.2.1. 1085 HEADERS (0x1): As described above, the PRIORITY region of HEADERS is 1086 not supported. A separate PRIORITY frame MUST be used. Padding 1087 is not defined in HTTP/QUIC frames. See Section 5.2.2. 1089 PRIORITY (0x2): As described above, the PRIORITY frame is sent on 1090 the control stream. See Section 5.2.3. 1092 RST_STREAM (0x3): RST_STREAM frames do not exist, since QUIC 1093 provides stream lifecycle management. The same code point is used 1094 for the CANCEL_PUSH frame (Section 5.2.4). 1096 SETTINGS (0x4): SETTINGS frames are sent only at the beginning of 1097 the connection. See Section 5.2.5 and Section 8.2. 1099 PUSH_PROMISE (0x5): The PUSH_PROMISE does not reference a stream; 1100 instead the push stream references the PUSH_PROMISE frame using a 1101 Push ID. See Section 5.2.6. 1103 PING (0x6): PING frames do not exist, since QUIC provides equivalent 1104 functionality. 1106 GOAWAY (0x7): GOAWAY is sent only from server to client and does not 1107 contain an error code. See Section 5.2.7. 1109 WINDOW_UPDATE (0x8): WINDOW_UPDATE frames do not exist, since QUIC 1110 provides flow control. 1112 CONTINUATION (0x9): CONTINUATION frames do not exist; instead, 1113 larger HEADERS/PUSH_PROMISE frames than HTTP/2 are permitted, and 1114 HEADERS frames can be used in series. 1116 Frame types defined by extensions to HTTP/2 need to be separately 1117 registered for HTTP/QUIC if still applicable. The IDs of frames 1118 defined in [RFC7540] have been reserved for simplicity. See 1119 Section 10.3. 1121 8.2. HTTP/2 SETTINGS Parameters 1123 An important difference from HTTP/2 is that settings are sent once, 1124 at the beginning of the connection, and thereafter cannot change. 1125 This eliminates many corner cases around synchronization of changes. 1127 Some transport-level options that HTTP/2 specifies via the SETTINGS 1128 frame are superseded by QUIC transport parameters in HTTP/QUIC. The 1129 HTTP-level options that are retained in HTTP/QUIC have the same value 1130 as in HTTP/2. 1132 Below is a listing of how each HTTP/2 SETTINGS parameter is mapped: 1134 SETTINGS_HEADER_TABLE_SIZE: See Section 5.2.5.2. 1136 SETTINGS_ENABLE_PUSH: This is removed in favor of the MAX_PUSH_ID 1137 which provides a more granular control over server push. 1139 SETTINGS_MAX_CONCURRENT_STREAMS: QUIC controls the largest open 1140 stream ID as part of its flow control logic. Specifying 1141 SETTINGS_MAX_CONCURRENT_STREAMS in the SETTINGS frame is an error. 1143 SETTINGS_INITIAL_WINDOW_SIZE: QUIC requires both stream and 1144 connection flow control window sizes to be specified in the 1145 initial transport handshake. Specifying 1146 SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS frame is an error. 1148 SETTINGS_MAX_FRAME_SIZE: This setting has no equivalent in HTTP/ 1149 QUIC. Specifying it in the SETTINGS frame is an error. 1151 SETTINGS_MAX_HEADER_LIST_SIZE: See Section 5.2.5.2. 1153 Settings need to be defined separately for HTTP/2 and HTTP/QUIC. The 1154 IDs of settings defined in [RFC7540] have been reserved for 1155 simplicity. See Section 10.4. 1157 8.3. HTTP/2 Error Codes 1159 QUIC has the same concepts of "stream" and "connection" errors that 1160 HTTP/2 provides. However, because the error code space is shared 1161 between multiple components, there is no direct portability of HTTP/2 1162 error codes. 1164 The HTTP/2 error codes defined in Section 7 of [RFC7540] map to QUIC 1165 error codes as follows: 1167 NO_ERROR (0x0): QUIC_NO_ERROR 1169 PROTOCOL_ERROR (0x1): No single mapping. See new HTTP_MALFORMED_* 1170 error codes defined in Section 7.1. 1172 INTERNAL_ERROR (0x2): HTTP_INTERNAL_ERROR in Section 7.1. 1174 FLOW_CONTROL_ERROR (0x3): Not applicable, since QUIC handles flow 1175 control. Would provoke a QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA 1176 from the QUIC layer. 1178 SETTINGS_TIMEOUT (0x4): Not applicable, since no acknowledgement of 1179 SETTINGS is defined. 1181 STREAM_CLOSED (0x5): Not applicable, since QUIC handles stream 1182 management. Would provoke a QUIC_STREAM_DATA_AFTER_TERMINATION 1183 from the QUIC layer. 1185 FRAME_SIZE_ERROR (0x6) No single mapping. See new error codes 1186 defined in Section 7.1. 1188 REFUSED_STREAM (0x7): Not applicable, since QUIC handles stream 1189 management. Would provoke a QUIC_TOO_MANY_OPEN_STREAMS from the 1190 QUIC layer. 1192 CANCEL (0x8): HTTP_REQUEST_CANCELLED in Section 7.1. 1194 COMPRESSION_ERROR (0x9): HTTP_HPACK_DECOMPRESSION_FAILED in 1195 Section 7.1. 1197 CONNECT_ERROR (0xa): HTTP_CONNECT_ERROR in Section 7.1. 1199 ENHANCE_YOUR_CALM (0xb): HTTP_EXCESSIVE_LOAD in Section 7.1. 1201 INADEQUATE_SECURITY (0xc): Not applicable, since QUIC is assumed to 1202 provide sufficient security on all connections. 1204 HTTP_1_1_REQUIRED (0xd): HTTP_VERSION_FALLBACK in Section 7.1. 1206 Error codes need to be defined for HTTP/2 and HTTP/QUIC separately. 1207 See Section 10.5. 1209 9. Security Considerations 1211 The security considerations of HTTP over QUIC should be comparable to 1212 those of HTTP/2. 1214 The modified SETTINGS format contains nested length elements, which 1215 could pose a security risk to an uncautious implementer. A SETTINGS 1216 frame parser MUST ensure that the length of the frame exactly matches 1217 the length of the settings it contains. 1219 10. IANA Considerations 1221 10.1. Registration of HTTP/QUIC Identification String 1223 This document creates a new registration for the identification of 1224 HTTP/QUIC in the "Application Layer Protocol Negotiation (ALPN) 1225 Protocol IDs" registry established in [RFC7301]. 1227 The "hq" string identifies HTTP/QUIC: 1229 Protocol: HTTP over QUIC 1231 Identification Sequence: 0x68 0x71 ("hq") 1233 Specification: This document 1235 10.2. Registration of QUIC Version Hint Alt-Svc Parameter 1237 This document creates a new registration for version-negotiation 1238 hints in the "Hypertext Transfer Protocol (HTTP) Alt-Svc Parameter" 1239 registry established in [RFC7838]. 1241 Parameter: "quic" 1243 Specification: This document, Section 2.1 1245 10.3. Frame Types 1247 This document establishes a registry for HTTP/QUIC frame type codes. 1248 The "HTTP/QUIC Frame Type" registry manages an 8-bit space. The 1249 "HTTP/QUIC Frame Type" registry operates under either of the "IETF 1250 Review" or "IESG Approval" policies [RFC5226] for values between 0x00 1251 and 0xef, with values between 0xf0 and 0xff being reserved for 1252 Experimental Use. 1254 While this registry is separate from the "HTTP/2 Frame Type" registry 1255 defined in [RFC7540], it is preferable that the assignments parallel 1256 each other. If an entry is present in only one registry, every 1257 effort SHOULD be made to avoid assigning the corresponding value to 1258 an unrelated operation. 1260 New entries in this registry require the following information: 1262 Frame Type: A name or label for the frame type. 1264 Code: The 8-bit code assigned to the frame type. 1266 Specification: A reference to a specification that includes a 1267 description of the frame layout, its semantics, and flags that the 1268 frame type uses, including any parts of the frame that are 1269 conditionally present based on the value of flags. 1271 The entries in the following table are registered by this document. 1273 +--------------+------+---------------+ 1274 | Frame Type | Code | Specification | 1275 +--------------+------+---------------+ 1276 | DATA | 0x0 | Section 5.2.1 | 1277 | | | | 1278 | HEADERS | 0x1 | Section 5.2.2 | 1279 | | | | 1280 | PRIORITY | 0x2 | Section 5.2.3 | 1281 | | | | 1282 | CANCEL_PUSH | 0x3 | Section 5.2.4 | 1283 | | | | 1284 | SETTINGS | 0x4 | Section 5.2.5 | 1285 | | | | 1286 | PUSH_PROMISE | 0x5 | Section 5.2.6 | 1287 | | | | 1288 | Reserved | 0x6 | N/A | 1289 | | | | 1290 | GOAWAY | 0x7 | Section 5.2.7 | 1291 | | | | 1292 | Reserved | 0x8 | N/A | 1293 | | | | 1294 | Reserved | 0x9 | N/A | 1295 | | | | 1296 | MAX_PUSH_ID | 0xD | Section 5.2.8 | 1297 +--------------+------+---------------+ 1299 10.4. Settings Parameters 1301 This document establishes a registry for HTTP/QUIC settings. The 1302 "HTTP/QUIC Settings" registry manages a 16-bit space. The "HTTP/QUIC 1303 Settings" registry operates under the "Expert Review" policy 1304 [RFC5226] for values in the range from 0x0000 to 0xefff, with values 1305 between and 0xf000 and 0xffff being reserved for Experimental Use. 1306 The designated experts are the same as those for the "HTTP/2 1307 Settings" registry defined in [RFC7540]. 1309 While this registry is separate from the "HTTP/2 Settings" registry 1310 defined in [RFC7540], it is preferable that the assignments parallel 1311 each other. If an entry is present in only one registry, every 1312 effort SHOULD be made to avoid assigning the corresponding value to 1313 an unrelated operation. 1315 New registrations are advised to provide the following information: 1317 Name: A symbolic name for the setting. Specifying a setting name is 1318 optional. 1320 Code: The 16-bit code assigned to the setting. 1322 Specification: An optional reference to a specification that 1323 describes the use of the setting. 1325 The entries in the following table are registered by this document. 1327 +----------------------+------+-----------------+ 1328 | Setting Name | Code | Specification | 1329 +----------------------+------+-----------------+ 1330 | HEADER_TABLE_SIZE | 0x1 | Section 5.2.5.2 | 1331 | | | | 1332 | Reserved | 0x2 | N/A | 1333 | | | | 1334 | Reserved | 0x3 | N/A | 1335 | | | | 1336 | Reserved | 0x4 | N/A | 1337 | | | | 1338 | Reserved | 0x5 | N/A | 1339 | | | | 1340 | MAX_HEADER_LIST_SIZE | 0x6 | Section 5.2.5.2 | 1341 +----------------------+------+-----------------+ 1343 10.5. Error Codes 1345 This document establishes a registry for HTTP/QUIC error codes. The 1346 "HTTP/QUIC Error Code" registry manages a 30-bit space. The "HTTP/ 1347 QUIC Error Code" registry operates under the "Expert Review" policy 1348 [RFC5226]. 1350 Registrations for error codes are required to include a description 1351 of the error code. An expert reviewer is advised to examine new 1352 registrations for possible duplication with existing error codes. 1353 Use of existing registrations is to be encouraged, but not mandated. 1355 New registrations are advised to provide the following information: 1357 Name: A name for the error code. Specifying an error code name is 1358 optional. 1360 Code: The 30-bit error code value. 1362 Description: A brief description of the error code semantics, longer 1363 if no detailed specification is provided. 1365 Specification: An optional reference for a specification that 1366 defines the error code. 1368 The entries in the following table are registered by this document. 1370 +------------------------------+-----+--------------+---------------+ 1371 | Name | Cod | Description | Specification | 1372 | | e | | | 1373 +------------------------------+-----+--------------+---------------+ 1374 | HTTP_PUSH_REFUSED | 0x0 | Client | Section 7.1 | 1375 | | 1 | refused | | 1376 | | | pushed | | 1377 | | | content | | 1378 | | | | | 1379 | HTTP_INTERNAL_ERROR | 0x0 | Internal | Section 7.1 | 1380 | | 2 | error | | 1381 | | | | | 1382 | HTTP_PUSH_ALREADY_IN_CACHE | 0x0 | Pushed | Section 7.1 | 1383 | | 3 | content | | 1384 | | | already | | 1385 | | | cached | | 1386 | | | | | 1387 | HTTP_REQUEST_CANCELLED | 0x0 | Data no | Section 7.1 | 1388 | | 4 | longer | | 1389 | | | needed | | 1390 | | | | | 1391 | HTTP_HPACK_DECOMPRESSION_FAI | 0x0 | HPACK cannot | Section 7.1 | 1392 | LED | 5 | continue | | 1393 | | | | | 1394 | HTTP_CONNECT_ERROR | 0x0 | TCP reset or | Section 7.1 | 1395 | | 6 | error on | | 1396 | | | CONNECT | | 1397 | | | request | | 1398 | | | | | 1399 | HTTP_EXCESSIVE_LOAD | 0x0 | Peer | Section 7.1 | 1400 | | 7 | generating | | 1401 | | | excessive | | 1402 | | | load | | 1403 | | | | | 1404 | HTTP_VERSION_FALLBACK | 0x0 | Retry over | Section 7.1 | 1405 | | 8 | HTTP/2 | | 1406 | | | | | 1407 | HTTP_MALFORMED_HEADERS | 0x0 | Invalid | Section 7.1 | 1408 | | 9 | HEADERS | | 1409 | | | frame | | 1410 | | | | | 1411 | HTTP_MALFORMED_PRIORITY | 0x0 | Invalid | Section 7.1 | 1412 | | A | PRIORITY | | 1413 | | | frame | | 1414 | | | | | 1415 | HTTP_MALFORMED_SETTINGS | 0x0 | Invalid | Section 7.1 | 1416 | | B | SETTINGS | | 1417 | | | frame | | 1418 | | | | | 1419 | HTTP_MALFORMED_PUSH_PROMISE | 0x0 | Invalid | Section 7.1 | 1420 | | C | PUSH_PROMISE | | 1421 | | | frame | | 1422 | | | | | 1423 | HTTP_MALFORMED_DATA | 0x0 | Invalid DATA | Section 7.1 | 1424 | | D | frame | | 1425 | | | | | 1426 | HTTP_INTERRUPTED_HEADERS | 0x0 | Incomplete | Section 7.1 | 1427 | | E | HEADERS | | 1428 | | | block | | 1429 | | | | | 1430 | HTTP_WRONG_STREAM | 0x0 | A frame was | Section 7.1 | 1431 | | F | sent on the | | 1432 | | | wrong stream | | 1433 | | | | | 1434 | HTTP_MULTIPLE_SETTINGS | 0x1 | Multiple | Section 7.1 | 1435 | | 0 | SETTINGS | | 1436 | | | frames | | 1437 | | | | | 1438 | HTTP_MALFORMED_PUSH | 0x1 | Invalid push | Section 7.1 | 1439 | | 1 | stream | | 1440 | | | header | | 1441 | | | | | 1442 | HTTP_MALFORMED_MAX_PUSH_ID | 0x1 | Invalid | Section 7.1 | 1443 | | 2 | MAX_PUSH_ID | | 1444 | | | frame | | 1445 +------------------------------+-----+--------------+---------------+ 1447 11. References 1449 11.1. Normative References 1451 [QUIC-TRANSPORT] 1452 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 1453 Multiplexed and Secure Transport", draft-ietf-quic- 1454 transport (work in progress), September 2017. 1456 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 1457 RFC 793, DOI 10.17487/RFC0793, September 1981, 1458 . 1460 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1461 Requirement Levels", BCP 14, RFC 2119, 1462 DOI 10.17487/RFC2119, March 1997, . 1465 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 1466 Specifications: ABNF", STD 68, RFC 5234, 1467 DOI 10.17487/RFC5234, January 2008, . 1470 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1471 Protocol (HTTP/1.1): Message Syntax and Routing", 1472 RFC 7230, DOI 10.17487/RFC7230, June 2014, 1473 . 1475 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1476 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1477 DOI 10.17487/RFC7231, June 2014, . 1480 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 1481 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 1482 DOI 10.17487/RFC7540, May 2015, . 1485 [RFC7541] Peon, R. and H. Ruellan, "HPACK: Header Compression for 1486 HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015, 1487 . 1489 [RFC7838] Nottingham, M., McManus, P., and J. Reschke, "HTTP 1490 Alternative Services", RFC 7838, DOI 10.17487/RFC7838, 1491 April 2016, . 1493 11.2. Informative References 1495 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1496 IANA Considerations Section in RFCs", RFC 5226, 1497 DOI 10.17487/RFC5226, May 2008, . 1500 [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, 1501 "Transport Layer Security (TLS) Application-Layer Protocol 1502 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 1503 July 2014, . 1505 Appendix A. Contributors 1507 The original authors of this specification were Robbie Shade and Mike 1508 Warres. 1510 Appendix B. Change Log 1512 *RFC Editor's Note:* Please remove this section prior to 1513 publication of a final version of this document. 1515 B.1. Since draft-ietf-quic-http-05 1517 o Made push ID sequential, add MAX_PUSH_ID, remove 1518 SETTINGS_ENABLE_PUSH (#709) 1520 o Guidance about keep-alive and QUIC PINGs (#729) 1522 o Expanded text on GOAWAY and cancellation (#757) 1524 B.2. Since draft-ietf-quic-http-04 1526 o Cite RFC 5234 (#404) 1528 o Return to a single stream per request (#245,#557) 1530 o Use separate frame type and settings registries from HTTP/2 (#81) 1532 o SETTINGS_ENABLE_PUSH instead of SETTINGS_DISABLE_PUSH (#477) 1534 o Restored GOAWAY (#696) 1536 o Identify server push using Push ID rather than a stream ID 1537 (#702,#281) 1539 o DATA frames cannot be empty (#700) 1541 B.3. Since draft-ietf-quic-http-03 1543 None. 1545 B.4. Since draft-ietf-quic-http-02 1547 o Track changes in transport draft 1549 B.5. Since draft-ietf-quic-http-01 1551 o SETTINGS changes (#181): 1553 * SETTINGS can be sent only once at the start of a connection; no 1554 changes thereafter 1556 * SETTINGS_ACK removed 1557 * Settings can only occur in the SETTINGS frame a single time 1559 * Boolean format updated 1561 o Alt-Svc parameter changed from "v" to "quic"; format updated 1562 (#229) 1564 o Closing the connection control stream or any message control 1565 stream is a fatal error (#176) 1567 o HPACK Sequence counter can wrap (#173) 1569 o 0-RTT guidance added 1571 o Guide to differences from HTTP/2 and porting HTTP/2 extensions 1572 added (#127,#242) 1574 B.6. Since draft-ietf-quic-http-00 1576 o Changed "HTTP/2-over-QUIC" to "HTTP/QUIC" throughout (#11,#29) 1578 o Changed from using HTTP/2 framing within Stream 3 to new framing 1579 format and two-stream-per-request model (#71,#72,#73) 1581 o Adopted SETTINGS format from draft-bishop-httpbis-extended- 1582 settings-01 1584 o Reworked SETTINGS_ACK to account for indeterminate inter-stream 1585 order (#75) 1587 o Described CONNECT pseudo-method (#95) 1589 o Updated ALPN token and Alt-Svc guidance (#13,#87) 1591 o Application-layer-defined error codes (#19,#74) 1593 B.7. Since draft-shade-quic-http2-mapping-00 1595 o Adopted as base for draft-ietf-quic-http 1597 o Updated authors/editors list 1599 Author's Address 1601 Mike Bishop (editor) 1602 Microsoft 1604 Email: Michael.Bishop@microsoft.com