idnits 2.17.1
draft-ietf-httpbis-http2-12.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 date (April 23, 2014) is 3656 days in the past. Is this
intentional?
Checking references for intended status: Proposed Standard
----------------------------------------------------------------------------
(See RFCs 3967 and 4897 for information about using normative references
to lower-maturity documents in RFCs)
== Outdated reference: A later version (-14) exists of
draft-ietf-httpbis-alt-svc-01
== Outdated reference: A later version (-12) exists of
draft-ietf-httpbis-header-compression-07
** Downref: Normative reference to an Informational RFC: RFC 1952 (ref.
'GZIP')
** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110)
** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126)
** Obsolete normative reference: RFC 793 (ref. 'TCP') (Obsoleted by RFC
9293)
** Obsolete normative reference: RFC 5246 (ref. 'TLS12') (Obsoleted by RFC
8446)
-- Obsolete informational reference (is this intentional?): RFC 1323
(Obsoleted by RFC 7323)
Summary: 5 errors (**), 0 flaws (~~), 3 warnings (==), 2 comments (--).
Run idnits with the --verbose option for more detailed information about
the items above.
--------------------------------------------------------------------------------
2 HTTPbis Working Group M. Belshe
3 Internet-Draft Twist
4 Intended status: Standards Track R. Peon
5 Expires: October 25, 2014 Google, Inc
6 M. Thomson, Ed.
7 Mozilla
8 April 23, 2014
10 Hypertext Transfer Protocol version 2
11 draft-ietf-httpbis-http2-12
13 Abstract
15 This specification describes an optimized expression of the syntax of
16 the Hypertext Transfer Protocol (HTTP). HTTP/2 enables a more
17 efficient use of network resources and a reduced perception of
18 latency by introducing header field compression and allowing multiple
19 concurrent messages on the same connection. It also introduces
20 unsolicited push of representations from servers to clients.
22 This document is an alternative to, but does not obsolete, the
23 HTTP/1.1 message syntax. HTTP's existing semantics remain unchanged.
25 Editorial Note (To be removed by RFC Editor)
27 Discussion of this draft takes place on the HTTPBIS working group
28 mailing list (ietf-http-wg@w3.org), which is archived at
29 .
31 Working Group information can be found at
32 ; that specific to HTTP/2 are at
33 .
35 The changes in this draft are summarized in Appendix A.
37 This version of HTTP/2, identified as "h2-12" or "h2c-12", is
38 intended for implementation. An interoperability event will be
39 conducted 2014-06-05, see .
42 Status of This Memo
44 This Internet-Draft is submitted in full conformance with the
45 provisions of BCP 78 and BCP 79.
47 Internet-Drafts are working documents of the Internet Engineering
48 Task Force (IETF). Note that other groups may also distribute
49 working documents as Internet-Drafts. The list of current Internet-
50 Drafts is at http://datatracker.ietf.org/drafts/current/.
52 Internet-Drafts are draft documents valid for a maximum of six months
53 and may be updated, replaced, or obsoleted by other documents at any
54 time. It is inappropriate to use Internet-Drafts as reference
55 material or to cite them other than as "work in progress."
57 This Internet-Draft will expire on October 25, 2014.
59 Copyright Notice
61 Copyright (c) 2014 IETF Trust and the persons identified as the
62 document authors. All rights reserved.
64 This document is subject to BCP 78 and the IETF Trust's Legal
65 Provisions Relating to IETF Documents
66 (http://trustee.ietf.org/license-info) in effect on the date of
67 publication of this document. Please review these documents
68 carefully, as they describe your rights and restrictions with respect
69 to this document. Code Components extracted from this document must
70 include Simplified BSD License text as described in Section 4.e of
71 the Trust Legal Provisions and are provided without warranty as
72 described in the Simplified BSD License.
74 Table of Contents
76 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
77 2. HTTP/2 Protocol Overview . . . . . . . . . . . . . . . . . . . 5
78 2.1. Document Organization . . . . . . . . . . . . . . . . . . 6
79 2.2. Conventions and Terminology . . . . . . . . . . . . . . . 7
80 3. Starting HTTP/2 . . . . . . . . . . . . . . . . . . . . . . . 8
81 3.1. HTTP/2 Version Identification . . . . . . . . . . . . . . 8
82 3.2. Starting HTTP/2 for "http" URIs . . . . . . . . . . . . . 9
83 3.2.1. HTTP2-Settings Header Field . . . . . . . . . . . . . 10
84 3.3. Starting HTTP/2 for "https" URIs . . . . . . . . . . . . . 11
85 3.4. Starting HTTP/2 with Prior Knowledge . . . . . . . . . . . 11
86 3.5. HTTP/2 Connection Preface . . . . . . . . . . . . . . . . 11
87 4. HTTP Frames . . . . . . . . . . . . . . . . . . . . . . . . . 12
88 4.1. Frame Format . . . . . . . . . . . . . . . . . . . . . . . 12
89 4.2. Frame Size . . . . . . . . . . . . . . . . . . . . . . . . 14
90 4.3. Header Compression and Decompression . . . . . . . . . . . 14
91 5. Streams and Multiplexing . . . . . . . . . . . . . . . . . . . 15
92 5.1. Stream States . . . . . . . . . . . . . . . . . . . . . . 16
93 5.1.1. Stream Identifiers . . . . . . . . . . . . . . . . . . 20
94 5.1.2. Stream Concurrency . . . . . . . . . . . . . . . . . . 20
95 5.2. Flow Control . . . . . . . . . . . . . . . . . . . . . . . 21
96 5.2.1. Flow Control Principles . . . . . . . . . . . . . . . 21
97 5.2.2. Appropriate Use of Flow Control . . . . . . . . . . . 22
98 5.3. Stream priority . . . . . . . . . . . . . . . . . . . . . 23
99 5.3.1. Stream Dependencies . . . . . . . . . . . . . . . . . 23
100 5.3.2. Dependency Weighting . . . . . . . . . . . . . . . . . 24
101 5.3.3. Reprioritization . . . . . . . . . . . . . . . . . . . 24
102 5.3.4. Prioritization State Management . . . . . . . . . . . 25
103 5.3.5. Default Priorities . . . . . . . . . . . . . . . . . . 26
104 5.4. Error Handling . . . . . . . . . . . . . . . . . . . . . . 26
105 5.4.1. Connection Error Handling . . . . . . . . . . . . . . 27
106 5.4.2. Stream Error Handling . . . . . . . . . . . . . . . . 27
107 5.4.3. Connection Termination . . . . . . . . . . . . . . . . 28
108 6. Frame Definitions . . . . . . . . . . . . . . . . . . . . . . 28
109 6.1. DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
110 6.2. HEADERS . . . . . . . . . . . . . . . . . . . . . . . . . 30
111 6.3. PRIORITY . . . . . . . . . . . . . . . . . . . . . . . . . 32
112 6.4. RST_STREAM . . . . . . . . . . . . . . . . . . . . . . . . 33
113 6.5. SETTINGS . . . . . . . . . . . . . . . . . . . . . . . . . 34
114 6.5.1. SETTINGS Format . . . . . . . . . . . . . . . . . . . 35
115 6.5.2. Defined SETTINGS Parameters . . . . . . . . . . . . . 35
116 6.5.3. Settings Synchronization . . . . . . . . . . . . . . . 37
117 6.6. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . . . . 37
118 6.7. PING . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
119 6.8. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . . . . 40
120 6.9. WINDOW_UPDATE . . . . . . . . . . . . . . . . . . . . . . 42
121 6.9.1. The Flow Control Window . . . . . . . . . . . . . . . 43
122 6.9.2. Initial Flow Control Window Size . . . . . . . . . . . 44
123 6.9.3. Reducing the Stream Window Size . . . . . . . . . . . 45
124 6.10. CONTINUATION . . . . . . . . . . . . . . . . . . . . . . . 46
125 6.11. ALTSVC . . . . . . . . . . . . . . . . . . . . . . . . . . 47
126 6.12. BLOCKED . . . . . . . . . . . . . . . . . . . . . . . . . 49
127 7. Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . 49
128 8. HTTP Message Exchanges . . . . . . . . . . . . . . . . . . . . 51
129 8.1. HTTP Request/Response Exchange . . . . . . . . . . . . . . 51
130 8.1.1. Informational Responses . . . . . . . . . . . . . . . 52
131 8.1.2. Examples . . . . . . . . . . . . . . . . . . . . . . . 53
132 8.1.3. HTTP Header Fields . . . . . . . . . . . . . . . . . . 55
133 8.1.4. Request Reliability Mechanisms in HTTP/2 . . . . . . . 59
134 8.2. Server Push . . . . . . . . . . . . . . . . . . . . . . . 60
135 8.2.1. Push Requests . . . . . . . . . . . . . . . . . . . . 61
136 8.2.2. Push Responses . . . . . . . . . . . . . . . . . . . . 62
137 8.3. The CONNECT Method . . . . . . . . . . . . . . . . . . . . 63
138 9. Additional HTTP Requirements/Considerations . . . . . . . . . 64
139 9.1. Connection Management . . . . . . . . . . . . . . . . . . 64
140 9.2. Use of TLS Features . . . . . . . . . . . . . . . . . . . 65
141 9.3. GZip Content-Encoding . . . . . . . . . . . . . . . . . . 65
142 10. Security Considerations . . . . . . . . . . . . . . . . . . . 66
143 10.1. Server Authority . . . . . . . . . . . . . . . . . . . . . 66
144 10.2. Cross-Protocol Attacks . . . . . . . . . . . . . . . . . . 66
145 10.3. Intermediary Encapsulation Attacks . . . . . . . . . . . . 67
146 10.4. Cacheability of Pushed Responses . . . . . . . . . . . . . 67
147 10.5. Denial of Service Considerations . . . . . . . . . . . . . 67
148 10.6. Use of Compression . . . . . . . . . . . . . . . . . . . . 68
149 10.7. Use of Padding . . . . . . . . . . . . . . . . . . . . . . 69
150 10.8. Privacy Considerations . . . . . . . . . . . . . . . . . . 70
151 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 70
152 11.1. Registration of HTTP/2 Identification Strings . . . . . . 70
153 11.2. Error Code Registry . . . . . . . . . . . . . . . . . . . 71
154 11.3. HTTP2-Settings Header Field Registration . . . . . . . . . 71
155 11.4. PRI Method Registration . . . . . . . . . . . . . . . . . 72
156 12. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 72
157 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 73
158 13.1. Normative References . . . . . . . . . . . . . . . . . . . 73
159 13.2. Informative References . . . . . . . . . . . . . . . . . . 74
160 Appendix A. Change Log (to be removed by RFC Editor before
161 publication) . . . . . . . . . . . . . . . . . . . . 75
162 A.1. Since draft-ietf-httpbis-http2-11 . . . . . . . . . . . . 75
163 A.2. Since draft-ietf-httpbis-http2-10 . . . . . . . . . . . . 75
164 A.3. Since draft-ietf-httpbis-http2-09 . . . . . . . . . . . . 76
165 A.4. Since draft-ietf-httpbis-http2-08 . . . . . . . . . . . . 76
166 A.5. Since draft-ietf-httpbis-http2-07 . . . . . . . . . . . . 76
167 A.6. Since draft-ietf-httpbis-http2-06 . . . . . . . . . . . . 76
168 A.7. Since draft-ietf-httpbis-http2-05 . . . . . . . . . . . . 77
169 A.8. Since draft-ietf-httpbis-http2-04 . . . . . . . . . . . . 77
170 A.9. Since draft-ietf-httpbis-http2-03 . . . . . . . . . . . . 77
171 A.10. Since draft-ietf-httpbis-http2-02 . . . . . . . . . . . . 78
172 A.11. Since draft-ietf-httpbis-http2-01 . . . . . . . . . . . . 78
173 A.12. Since draft-ietf-httpbis-http2-00 . . . . . . . . . . . . 79
174 A.13. Since draft-mbelshe-httpbis-spdy-00 . . . . . . . . . . . 79
176 1. Introduction
178 The Hypertext Transfer Protocol (HTTP) is a wildly successful
179 protocol. However, the HTTP/1.1 message format ([HTTP-p1], Section
180 3) was designed to be implemented with the tools at hand in the
181 1990s, not modern Web application performance. As such it has
182 several characteristics that have a negative overall effect on
183 application performance today.
185 In particular, HTTP/1.0 only allows one request to be outstanding at
186 a time on a given connection. HTTP/1.1 pipelining only partially
187 addressed request concurrency and suffers from head-of-line blocking.
188 Therefore, clients that need to make many requests typically use
189 multiple connections to a server in order to reduce latency.
191 Furthermore, HTTP/1.1 header fields are often repetitive and verbose,
192 which, in addition to generating more or larger network packets, can
193 cause the small initial TCP congestion window to quickly fill. This
194 can result in excessive latency when multiple requests are made on a
195 single new TCP connection.
197 This document addresses these issues by defining an optimized mapping
198 of HTTP's semantics to an underlying connection. Specifically, it
199 allows interleaving of request and response messages on the same
200 connection and uses an efficient coding for HTTP header fields. It
201 also allows prioritization of requests, letting more important
202 requests complete more quickly, further improving performance.
204 The resulting protocol is designed to be more friendly to the
205 network, because fewer TCP connections can be used in comparison to
206 HTTP/1.x. This means less competition with other flows, and longer-
207 lived connections, which in turn leads to better utilization of
208 available network capacity.
210 Finally, this encapsulation also enables more scalable processing of
211 messages through use of binary message framing.
213 2. HTTP/2 Protocol Overview
215 HTTP/2 provides an optimized transport for HTTP semantics. HTTP/2
216 supports all of the core features of HTTP/1.1, but aims to be more
217 efficient in several ways.
219 The basic protocol unit in HTTP/2 is a frame (Section 4.1). Each
220 frame has a different type and purpose. For example, HEADERS and
221 DATA frames form the basis of HTTP requests and responses
222 (Section 8.1); other frame types like SETTINGS, WINDOW_UPDATE, and
223 PUSH_PROMISE are used in support of other HTTP/2 features.
225 Multiplexing of requests is achieved by having each HTTP request-
226 response exchanged assigned to a single stream (Section 5). Streams
227 are largely independent of each other, so a blocked or stalled
228 request does not prevent progress on other requests.
230 Flow control and prioritization ensure that it is possible to
231 properly use multiplexed streams. Flow control (Section 5.2) helps
232 to ensure that only data that can be used by a receiver is
233 transmitted. Prioritization (Section 5.3) ensures that limited
234 resources can be directed to the most important requests first.
236 HTTP/2 adds a new interaction mode, whereby a server can push
237 responses to a client (Section 8.2). Server push allows a server to
238 speculatively send a client data that the server anticipates the
239 client will need, trading off some network usage against a potential
240 latency gain. The server does this by synthesizing a request, which
241 it sends as a PUSH_PROMISE frame. The server is then able to send a
242 response to the synthetic request on a separate stream.
244 Frames that contain HTTP header fields are compressed (Section 4.3).
245 HTTP requests can be highly redundant, so compression can reduce the
246 size of requests and responses significantly.
248 HTTP/2 also supports HTTP Alternative Services (see [ALT-SVC]) using
249 the ALTSVC frame type (Section 6.11), to allow servers more control
250 over traffic to them.
252 2.1. Document Organization
254 The HTTP/2 specification is split into four parts:
256 o Starting HTTP/2 (Section 3) covers how an HTTP/2 connection is
257 initiated.
259 o The framing (Section 4) and streams (Section 5) layers describe
260 the way HTTP/2 frames are structured and formed into multiplexed
261 streams.
263 o Frame (Section 6) and error (Section 7) definitions include
264 details of the frame and error types used in HTTP/2.
266 o HTTP mappings (Section 8) and additional requirements (Section 9)
267 describe how HTTP semantics are expressed using frames and
268 streams.
270 While some of the frame and stream layer concepts are isolated from
271 HTTP, the intent is not to define a completely generic framing layer.
272 The framing and streams layers are tailored to the needs of the HTTP
273 protocol and server push.
275 2.2. Conventions and Terminology
277 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
278 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
279 document are to be interpreted as described in RFC 2119 [RFC2119].
281 All numeric values are in network byte order. Values are unsigned
282 unless otherwise indicated. Literal values are provided in decimal
283 or hexadecimal as appropriate. Hexadecimal literals are prefixed
284 with "0x" to distinguish them from decimal literals.
286 The following terms are used:
288 client: The endpoint initiating the HTTP/2 connection.
290 connection: A transport-level connection between two endpoints.
292 connection error: An error that affects the entire HTTP/2
293 connection.
295 endpoint: Either the client or server of the connection.
297 frame: The smallest unit of communication within an HTTP/2
298 connection, consisting of a header and a variable-length sequence
299 of bytes structured according to the frame type.
301 intermediary: A "proxy", "gateway" or other intermediary as defined
302 in Section 2.3 of [HTTP-p1].
304 peer: An endpoint. When discussing a particular endpoint, "peer"
305 refers to the endpoint that is remote to the primary subject of
306 discussion.
308 receiver: An endpoint that is receiving frames.
310 sender: An endpoint that is transmitting frames.
312 server: The endpoint which did not initiate the HTTP/2 connection.
314 stream: A bi-directional flow of frames across a virtual channel
315 within the HTTP/2 connection.
317 stream error: An error on the individual HTTP/2 stream.
319 3. Starting HTTP/2
321 An HTTP/2 connection is an application level protocol running on top
322 of a TCP connection ([TCP]). The client is the TCP connection
323 initiator.
325 HTTP/2 uses the same "http" and "https" URI schemes used by HTTP/1.1.
326 HTTP/2 shares the same default port numbers: 80 for "http" URIs and
327 443 for "https" URIs. As a result, implementations processing
328 requests for target resource URIs like "http://example.org/foo" or
329 "https://example.com/bar" are required to first discover whether the
330 upstream server (the immediate peer to which the client wishes to
331 establish a connection) supports HTTP/2.
333 The means by which support for HTTP/2 is determined is different for
334 "http" and "https" URIs. Discovery for "http" URIs is described in
335 Section 3.2. Discovery for "https" URIs is described in Section 3.3.
337 3.1. HTTP/2 Version Identification
339 The protocol defined in this document has two identifiers.
341 o The string "h2" identifies the protocol where HTTP/2 uses TLS
342 [TLS12]. This identifier is used in the TLS application layer
343 protocol negotiation extension [TLSALPN] field and any place that
344 HTTP/2 over TLS is identified.
346 When serialised into an ALPN protocol identifier (which is a
347 sequence of octets), the HTTP/2 protocol identifier string is
348 encoded using UTF-8 [UTF-8].
350 o The string "h2c" identifies the protocol where HTTP/2 is run over
351 cleartext TCP. This identifier is used in the HTTP/1.1 Upgrade
352 header field and any place that HTTP/2 over TCP is identified.
354 Negotiating "h2" or "h2c" implies the use of the transport, security,
355 framing and message semantics described in this document.
357 [[anchor3: RFC Editor's Note: please remove the remainder of this
358 section prior to the publication of a final version of this
359 document.]]
361 Only implementations of the final, published RFC can identify
362 themselves as "h2" or "h2c". Until such an RFC exists,
363 implementations MUST NOT identify themselves using these strings.
365 Examples and text throughout the rest of this document use "h2" as a
366 matter of editorial convenience only. Implementations of draft
367 versions MUST NOT identify using this string.
369 Implementations of draft versions of the protocol MUST add the string
370 "-" and the corresponding draft number to the identifier. For
371 example, draft-ietf-httpbis-http2-11 over TLS is identified using the
372 string "h2-11".
374 Non-compatible experiments that are based on these draft versions
375 MUST append the string "-" and an experiment name to the identifier.
376 For example, an experimental implementation of packet mood-based
377 encoding based on draft-ietf-httpbis-http2-09 might identify itself
378 as "h2-09-emo". Note that any label MUST conform to the "token"
379 syntax defined in Section 3.2.6 of [HTTP-p1]. Experimenters are
380 encouraged to coordinate their experiments on the ietf-http-wg@w3.org
381 mailing list.
383 3.2. Starting HTTP/2 for "http" URIs
385 A client that makes a request to an "http" URI without prior
386 knowledge about support for HTTP/2 uses the HTTP Upgrade mechanism
387 (Section 6.7 of [HTTP-p1]). The client makes an HTTP/1.1 request
388 that includes an Upgrade header field identifying HTTP/2 with the
389 "h2c" token. The HTTP/1.1 request MUST include exactly one HTTP2-
390 Settings (Section 3.2.1) header field.
392 For example:
394 GET /default.htm HTTP/1.1
395 Host: server.example.com
396 Connection: Upgrade, HTTP2-Settings
397 Upgrade: h2c
398 HTTP2-Settings:
400 Requests that contain an entity body MUST be sent in their entirety
401 before the client can send HTTP/2 frames. This means that a large
402 request entity can block the use of the connection until it is
403 completely sent.
405 If concurrency of an initial request with subsequent requests is
406 important, a small request can be used to perform the upgrade to
407 HTTP/2, at the cost of an additional round-trip.
409 A server that does not support HTTP/2 can respond to the request as
410 though the Upgrade header field were absent:
412 HTTP/1.1 200 OK
413 Content-Length: 243
414 Content-Type: text/html
416 ...
418 A server that supports HTTP/2 can accept the upgrade with a 101
419 (Switching Protocols) response. After the empty line that terminates
420 the 101 response, the server can begin sending HTTP/2 frames. These
421 frames MUST include a response to the request that initiated the
422 Upgrade.
424 HTTP/1.1 101 Switching Protocols
425 Connection: Upgrade
426 Upgrade: h2c
428 [ HTTP/2 connection ...
430 The first HTTP/2 frame sent by the server is a SETTINGS frame
431 (Section 6.5). Upon receiving the 101 response, the client sends a
432 connection preface (Section 3.5), which includes a SETTINGS frame.
434 The HTTP/1.1 request that is sent prior to upgrade is assigned stream
435 identifier 1 and is assigned default priority values (Section 5.3.5).
436 Stream 1 is implicitly half closed from the client toward the server,
437 since the request is completed as an HTTP/1.1 request. After
438 commencing the HTTP/2 connection, stream 1 is used for the response.
440 3.2.1. HTTP2-Settings Header Field
442 A request that upgrades from HTTP/1.1 to HTTP/2 MUST include exactly
443 one "HTTP2-Settings" header field. The "HTTP2-Settings" header field
444 is a hop-by-hop header field that includes parameters that govern the
445 HTTP/2 connection, provided in anticipation of the server accepting
446 the request to upgrade. A server MUST reject an attempt to upgrade
447 if this header field is not present.
449 HTTP2-Settings = token68
451 The content of the "HTTP2-Settings" header field is the payload of a
452 SETTINGS frame (Section 6.5), encoded as a base64url string (that is,
453 the URL- and filename-safe Base64 encoding described in Section 5 of
454 [RFC4648], with any trailing '=' characters omitted). The ABNF
455 [RFC5234] production for "token68" is defined in Section 2.1 of
456 [HTTP-p7].
458 As a hop-by-hop header field, the "Connection" header field MUST
459 include a value of "HTTP2-Settings" in addition to "Upgrade" when
460 upgrading to HTTP/2.
462 A server decodes and interprets these values as it would any other
463 SETTINGS frame. Acknowledgement of the SETTINGS parameters
464 (Section 6.5.3) is not necessary, since a 101 response serves as
465 implicit acknowledgment. Providing these values in the Upgrade
466 request ensures that the protocol does not require default values for
467 the above SETTINGS parameters, and gives a client an opportunity to
468 provide other parameters prior to receiving any frames from the
469 server.
471 3.3. Starting HTTP/2 for "https" URIs
473 A client that makes a request to an "https" URI without prior
474 knowledge about support for HTTP/2 uses TLS [TLS12] with the
475 application layer protocol negotiation extension [TLSALPN].
477 Once TLS negotiation is complete, both the client and the server send
478 a connection preface (Section 3.5).
480 3.4. Starting HTTP/2 with Prior Knowledge
482 A client can learn that a particular server supports HTTP/2 by other
483 means. For example, [ALT-SVC] describes a mechanism for advertising
484 this capability in an HTTP header field; the ALTSVC frame
485 (Section 6.11) describes a similar mechanism in HTTP/2.
487 A client MAY immediately send HTTP/2 frames to a server that is known
488 to support HTTP/2, after the connection preface (Section 3.5). A
489 server can identify such a connection by the use of the "PRI" method
490 in the connection preface. This only affects the resolution of
491 "http" URIs; servers supporting HTTP/2 are required to support
492 protocol negotiation in TLS [TLSALPN] for "https" URIs.
494 Prior support for HTTP/2 is not a strong signal that a given server
495 will support HTTP/2 for future connections. It is possible for
496 server configurations to change; for configurations to differ between
497 instances in clustered server; or network conditions to change.
499 3.5. HTTP/2 Connection Preface
501 Upon establishment of a TCP connection and determination that HTTP/2
502 will be used by both peers, each endpoint MUST send a connection
503 preface as a final confirmation and to establish the initial SETTINGS
504 parameters for the HTTP/2 connection.
506 The client connection preface starts with a sequence of 24 octets,
507 which in hex notation are:
509 0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
511 (the string "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"). This sequence is
512 followed by a SETTINGS frame (Section 6.5). The SETTINGS frame MAY
513 be empty. The client sends the client connection preface immediately
514 upon receipt of a 101 Switching Protocols response (indicating a
515 successful upgrade), or as the first application data octets of a TLS
516 connection. If starting an HTTP/2 connection with prior knowledge of
517 server support for the protocol, the client connection preface is
518 sent upon connection establishment.
520 The client connection preface is selected so that a large
521 proportion of HTTP/1.1 or HTTP/1.0 servers and intermediaries do
522 not attempt to process further frames. Note that this does not
523 address the concerns raised in [TALKING].
525 The server connection preface consists of a potentially empty
526 SETTINGS frame (Section 6.5) that MUST be the first frame the server
527 sends in the HTTP/2 connection.
529 To avoid unnecessary latency, clients are permitted to send
530 additional frames to the server immediately after sending the client
531 connection preface, without waiting to receive the server connection
532 preface. It is important to note, however, that the server
533 connection preface SETTINGS frame might include parameters that
534 necessarily alter how a client is expected to communicate with the
535 server. Upon receiving the SETTINGS frame, the client is expected to
536 honor any parameters established.
538 Clients and servers MUST terminate the TCP connection if either peer
539 does not begin with a valid connection preface. A GOAWAY frame
540 (Section 6.8) MAY be omitted if it is clear that the peer is not
541 using HTTP/2.
543 4. HTTP Frames
545 Once the HTTP/2 connection is established, endpoints can begin
546 exchanging frames.
548 4.1. Frame Format
550 All frames begin with an 8-octet header followed by a payload of
551 between 0 and 16,383 octets.
553 0 1 2 3
554 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
555 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
556 | R | Length (14) | Type (8) | Flags (8) |
557 +-+-+-----------+---------------+-------------------------------+
558 |R| Stream Identifier (31) |
559 +-+-------------------------------------------------------------+
560 | Frame Payload (0...) ...
561 +---------------------------------------------------------------+
563 Frame Header
565 The fields of the frame header are defined as:
567 R: A reserved 2-bit field. The semantics of these bits are undefined
568 and the bits MUST remain unset (0) when sending and MUST be
569 ignored when receiving.
571 Length: The length of the frame payload expressed as an unsigned 14-
572 bit integer. The 8 octets of the frame header are not included in
573 this value.
575 Type: The 8-bit type of the frame. The frame type determines how
576 the remainder of the frame header and payload are interpreted.
577 Implementations MUST treat the receipt of an unknown frame type
578 (any frame types not defined in this document) as a connection
579 error (Section 5.4.1) of type PROTOCOL_ERROR.
581 Flags: An 8-bit field reserved for frame-type specific boolean
582 flags.
584 Flags are assigned semantics specific to the indicated frame type.
585 Flags that have no defined semantics for a particular frame type
586 MUST be ignored, and MUST be left unset (0) when sending.
588 R: A reserved 1-bit field. The semantics of this bit are undefined
589 and the bit MUST remain unset (0) when sending and MUST be ignored
590 when receiving.
592 Stream Identifier: A 31-bit stream identifier (see Section 5.1.1).
593 The value 0 is reserved for frames that are associated with the
594 connection as a whole as opposed to an individual stream.
596 The structure and content of the frame payload is dependent entirely
597 on the frame type.
599 4.2. Frame Size
601 The maximum size of a frame payload varies by frame type. The
602 absolute maximum size of a frame payload is 2^14-1 (16,383) octets,
603 meaning that the maximum frame size is 16,391 octets. All
604 implementations SHOULD be capable of receiving and minimally
605 processing frames up to this maximum size.
607 Certain frame types, such as PING (see Section 6.7), impose
608 additional limits on the amount of payload data allowed. Likewise,
609 additional size limits can be set by specific application uses (see
610 Section 9).
612 If a frame size exceeds any defined limit, or is too small to contain
613 mandatory frame data, the endpoint MUST send a FRAME_SIZE_ERROR
614 error. A frame size error in a frame that could alter the state of
615 the entire connection MUST be treated as a connection error
616 (Section 5.4.1); this includes any frame carrying a header block
617 (Section 4.3) (that is, HEADERS, PUSH_PROMISE, and CONTINUATION),
618 SETTINGS, and any WINDOW_UPDATE frame with a stream identifier of 0.
620 4.3. Header Compression and Decompression
622 A header field in HTTP/2 is a name-value pair with one or more
623 associated values. They are used within HTTP request and response
624 messages as well as server push operations (see Section 8.2).
626 Header sets are collections of zero or more header fields. When
627 transmitted over a connection, a header set is serialized into a
628 header block using HTTP Header Compression [COMPRESSION]. The
629 serialized header block is then divided into one or more octet
630 sequences, called header block fragments, and transmitted within the
631 payload of HEADERS (Section 6.2), PUSH_PROMISE (Section 6.6) or
632 CONTINUATION (Section 6.10) frames.
634 HTTP Header Compression does not preserve the relative ordering of
635 header fields. Header fields with multiple values are encoded into a
636 single header field using a special delimiter; see Section 8.1.3.3.
638 The Cookie header field [COOKIE] is treated specially by the HTTP
639 mapping; see Section 8.1.3.4.
641 A receiving endpoint reassembles the header block by concatenating
642 its fragments, then decompresses the block to reconstruct the header
643 set.
645 A complete header block consists of either:
647 o a single HEADERS or PUSH_PROMISE frame, with the END_HEADERS flag
648 set, or
650 o a HEADERS or PUSH_PROMISE frame with the END_HEADERS flag cleared
651 and one or more CONTINUATION frames, where the last CONTINUATION
652 frame has the END_HEADERS flag set.
654 Header compression is stateful, using a single compression context
655 for the entire connection. Each header block is processed as a
656 discrete unit. Header blocks MUST be transmitted as a contiguous
657 sequence of frames, with no interleaved frames of any other type or
658 from any other stream. The last frame in a sequence of HEADERS or
659 CONTINUATION frames MUST have the END_HEADERS flag set. The last
660 frame in a sequence of PUSH_PROMISE or CONTINUATION frames MUST have
661 the END_HEADERS flag set.
663 Header block fragments can only be sent as the payload of HEADERS,
664 PUSH_PROMISE or CONTINUATION frames, because these frames carry data
665 that can modify the compression context maintained by a receiver. An
666 endpoint receiving HEADERS, PUSH_PROMISE or CONTINUATION frames MUST
667 reassemble header blocks and perform decompression even if the frames
668 are to be discarded. A receiver MUST terminate the connection with a
669 connection error (Section 5.4.1) of type COMPRESSION_ERROR if it does
670 not decompress a header block.
672 5. Streams and Multiplexing
674 A "stream" is an independent, bi-directional sequence of frames
675 exchanged between the client and server within an HTTP/2 connection.
676 Streams have several important characteristics:
678 o A single HTTP/2 connection can contain multiple concurrently open
679 streams, with either endpoint interleaving frames from multiple
680 streams.
682 o Streams can be established and used unilaterally or shared by
683 either the client or server.
685 o Streams can be closed by either endpoint.
687 o The order in which frames are sent within a stream is significant.
688 Recipients process frames in the order they are received.
690 o Streams are identified by an integer. Stream identifiers are
691 assigned to streams by the endpoint initiating the stream.
693 5.1. Stream States
695 The lifecycle of a stream is shown in Figure 1.
697 +--------+
698 PP | | PP
699 ,--------| idle |--------.
700 / | | \
701 v +--------+ v
702 +----------+ | +----------+
703 | | | H | |
704 ,---| reserved | | | reserved |---.
705 | | (local) | v | (remote) | |
706 | +----------+ +--------+ +----------+ |
707 | | ES | | ES | |
708 | | H ,-------| open |-------. | H |
709 | | / | | \ | |
710 | v v +--------+ v v |
711 | +----------+ | +----------+ |
712 | | half | | | half | |
713 | | closed | | R | closed | |
714 | | (remote) | | | (local) | |
715 | +----------+ | +----------+ |
716 | | v | |
717 | | ES / R +--------+ ES / R | |
718 | `----------->| |<-----------' |
719 | R | closed | R |
720 `-------------------->| |<--------------------'
721 +--------+
723 H: HEADERS frame (with implied CONTINUATIONs)
724 PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
725 ES: END_STREAM flag
726 R: RST_STREAM frame
728 Figure 1: Stream States
730 Both endpoints have a subjective view of the state of a stream that
731 could be different when frames are in transit. Endpoints do not
732 coordinate the creation of streams; they are created unilaterally by
733 either endpoint. The negative consequences of a mismatch in states
734 are limited to the "closed" state after sending RST_STREAM, where
735 frames might be received for some time after closing.
737 Streams have the following states:
739 idle:
740 All streams start in the "idle" state. In this state, no frames
741 have been exchanged.
743 The following transitions are valid from this state:
745 * Sending or receiving a HEADERS frame causes the stream to
746 become "open". The stream identifier is selected as described
747 in Section 5.1.1. The same HEADERS frame can also cause a
748 stream to immediately become "half closed".
750 * Sending a PUSH_PROMISE frame marks the associated stream for
751 later use. The stream state for the reserved stream
752 transitions to "reserved (local)".
754 * Receiving a PUSH_PROMISE frame marks the associated stream as
755 reserved by the remote peer. The state of the stream becomes
756 "reserved (remote)".
758 reserved (local):
759 A stream in the "reserved (local)" state is one that has been
760 promised by sending a PUSH_PROMISE frame. A PUSH_PROMISE frame
761 reserves an idle stream by associating the stream with an open
762 stream that was initiated by the remote peer (see Section 8.2).
764 In this state, only the following transitions are possible:
766 * The endpoint can send a HEADERS frame. This causes the stream
767 to open in a "half closed (remote)" state.
769 * Either endpoint can send a RST_STREAM frame to cause the stream
770 to become "closed". This releases the stream reservation.
772 An endpoint MUST NOT send frames other than HEADERS or RST_STREAM
773 in this state.
775 A PRIORITY frame MAY be received in this state. Receiving any
776 frames other than RST_STREAM, or PRIORITY MUST be treated as a
777 connection error (Section 5.4.1) of type PROTOCOL_ERROR.
779 reserved (remote):
780 A stream in the "reserved (remote)" state has been reserved by a
781 remote peer.
783 In this state, only the following transitions are possible:
785 * Receiving a HEADERS frame causes the stream to transition to
786 "half closed (local)".
788 * Either endpoint can send a RST_STREAM frame to cause the stream
789 to become "closed". This releases the stream reservation.
791 An endpoint MAY send a PRIORITY frame in this state to
792 reprioritize the reserved stream. An endpoint MUST NOT send any
793 other type of frame other than RST_STREAM or PRIORITY.
795 Receiving any other type of frame other than HEADERS or RST_STREAM
796 MUST be treated as a connection error (Section 5.4.1) of type
797 PROTOCOL_ERROR.
799 open:
800 A stream in the "open" state may be used by both peers to send
801 frames of any type. In this state, sending peers observe
802 advertised stream level flow control limits (Section 5.2).
804 From this state either endpoint can send a frame with an
805 END_STREAM flag set, which causes the stream to transition into
806 one of the "half closed" states: an endpoint sending an END_STREAM
807 flag causes the stream state to become "half closed (local)"; an
808 endpoint receiving an END_STREAM flag causes the stream state to
809 become "half closed (remote)". A HEADERS frame bearing an
810 END_STREAM flag can be followed by CONTINUATION frames.
812 Either endpoint can send a RST_STREAM frame from this state,
813 causing it to transition immediately to "closed".
815 half closed (local):
816 A stream that is in the "half closed (local)" state cannot be used
817 for sending frames.
819 A stream transitions from this state to "closed" when a frame that
820 contains an END_STREAM flag is received, or when either peer sends
821 a RST_STREAM frame. A HEADERS frame bearing an END_STREAM flag
822 can be followed by CONTINUATION frames.
824 A receiver can ignore WINDOW_UPDATE or PRIORITY frames in this
825 state. These frame types might arrive for a short period after a
826 frame bearing the END_STREAM flag is sent.
828 half closed (remote):
829 A stream that is "half closed (remote)" is no longer being used by
830 the peer to send frames. In this state, an endpoint is no longer
831 obligated to maintain a receiver flow control window if it
832 performs flow control.
834 If an endpoint receives additional frames for a stream that is in
835 this state, other than CONTINUATION frames, it MUST respond with a
836 stream error (Section 5.4.2) of type STREAM_CLOSED.
838 A stream can transition from this state to "closed" by sending a
839 frame that contains an END_STREAM flag, or when either peer sends
840 a RST_STREAM frame.
842 closed:
843 The "closed" state is the terminal state.
845 An endpoint MUST NOT send frames on a closed stream. An endpoint
846 that receives any frame after receiving a RST_STREAM MUST treat
847 that as a stream error (Section 5.4.2) of type STREAM_CLOSED.
848 Similarly, an endpoint that receives any frames after receiving a
849 DATA frame with the END_STREAM flag set, or any frames except a
850 CONTINUATION frame after receiving a HEADERS frame with an
851 END_STREAM flag set MUST treat that as a stream error
852 (Section 5.4.2) of type STREAM_CLOSED.
854 WINDOW_UPDATE, PRIORITY, or RST_STREAM frames can be received in
855 this state for a short period after a DATA or HEADERS frame
856 containing an END_STREAM flag is sent. Until the remote peer
857 receives and processes the frame bearing the END_STREAM flag, it
858 might send frame of any of these types. Endpoints MUST ignore
859 WINDOW_UPDATE, PRIORITY, or RST_STREAM frames received in this
860 state, though endpoints MAY choose to treat frames that arrive a
861 significant time after sending END_STREAM as a connection error
862 (Section 5.4.1) of type PROTOCOL_ERROR.
864 If this state is reached as a result of sending a RST_STREAM
865 frame, the peer that receives the RST_STREAM might have already
866 sent - or enqueued for sending - frames on the stream that cannot
867 be withdrawn. An endpoint MUST ignore frames that it receives on
868 closed streams after it has sent a RST_STREAM frame. An endpoint
869 MAY choose to limit the period over which it ignores frames and
870 treat frames that arrive after this time as being in error.
872 Flow controlled frames (i.e., DATA) received after sending
873 RST_STREAM are counted toward the connection flow control window.
874 Even though these frames might be ignored, because they are sent
875 before the sender receives the RST_STREAM, the sender will
876 consider the frames to count against the flow control window.
878 An endpoint might receive a PUSH_PROMISE frame after it sends
879 RST_STREAM. PUSH_PROMISE causes a stream to become "reserved"
880 even if the associated stream has been reset. Therefore, a
881 RST_STREAM is needed to close an unwanted promised streams.
883 In the absence of more specific guidance elsewhere in this document,
884 implementations SHOULD treat the receipt of a message that is not
885 expressly permitted in the description of a state as a connection
886 error (Section 5.4.1) of type PROTOCOL_ERROR.
888 5.1.1. Stream Identifiers
890 Streams are identified with an unsigned 31-bit integer. Streams
891 initiated by a client MUST use odd-numbered stream identifiers; those
892 initiated by the server MUST use even-numbered stream identifiers. A
893 stream identifier of zero (0x0) is used for connection control
894 messages; the stream identifier zero MUST NOT be used to establish a
895 new stream.
897 HTTP/1.1 requests that are upgraded to HTTP/2 (see Section 3.2) are
898 responded to with a stream identifier of one (0x1). After the
899 upgrade completes, stream 0x1 is "half closed (local)" to the client.
900 Therefore, stream 0x1 cannot be selected as a new stream identifier
901 by a client that upgrades from HTTP/1.1.
903 The identifier of a newly established stream MUST be numerically
904 greater than all streams that the initiating endpoint has opened or
905 reserved. This governs streams that are opened using a HEADERS frame
906 and streams that are reserved using PUSH_PROMISE. An endpoint that
907 receives an unexpected stream identifier MUST respond with a
908 connection error (Section 5.4.1) of type PROTOCOL_ERROR.
910 The first use of a new stream identifier implicitly closes all
911 streams in the "idle" state that might have been initiated by that
912 peer with a lower-valued stream identifier. For example, if a client
913 sends a HEADERS frame on stream 7 without ever sending a frame on
914 stream 5, then stream 5 transitions to the "closed" state when the
915 first frame for stream 7 is sent or received.
917 Stream identifiers cannot be reused. Long-lived connections can
918 result in endpoint exhausting the available range of stream
919 identifiers. A client that is unable to establish a new stream
920 identifier can establish a new connection for new streams.
922 5.1.2. Stream Concurrency
924 A peer can limit the number of concurrently active streams using the
925 SETTINGS_MAX_CONCURRENT_STREAMS parameters within a SETTINGS frame.
926 The maximum concurrent streams setting is specific to each endpoint
927 and applies only to the peer that receives the setting. That is,
928 clients specify the maximum number of concurrent streams the server
929 can initiate, and servers specify the maximum number of concurrent
930 streams the client can initiate. Endpoints MUST NOT exceed the limit
931 set by their peer.
933 Streams that are in the "open" state, or either of the "half closed"
934 states count toward the maximum number of streams that an endpoint is
935 permitted to open. Streams in any of these three states count toward
936 the limit advertised in the SETTINGS_MAX_CONCURRENT_STREAMS setting
937 (see Section 6.5.2).
939 An endpoint that receives a HEADERS frame that causes their
940 advertised concurrent stream limit to be exceeded MUST treat this as
941 a stream error (Section 5.4.2).
943 Streams in either of the "reserved" states do not count as open.
945 5.2. Flow Control
947 Using streams for multiplexing introduces contention over use of the
948 TCP connection, resulting in blocked streams. A flow control scheme
949 ensures that streams on the same connection do not destructively
950 interfere with each other. Flow control is used for both individual
951 streams and for the connection as a whole.
953 HTTP/2 provides for flow control through use of the WINDOW_UPDATE
954 frame type.
956 5.2.1. Flow Control Principles
958 HTTP/2 stream flow control aims to allow for future improvements to
959 flow control algorithms without requiring protocol changes. Flow
960 control in HTTP/2 has the following characteristics:
962 1. Flow control is hop-by-hop, not end-to-end.
964 2. Flow control is based on window update frames. Receivers
965 advertise how many bytes they are prepared to receive on a stream
966 and for the entire connection. This is a credit-based scheme.
968 3. Flow control is directional with overall control provided by the
969 receiver. A receiver MAY choose to set any window size that it
970 desires for each stream and for the entire connection. A sender
971 MUST respect flow control limits imposed by a receiver. Clients,
972 servers and intermediaries all independently advertise their flow
973 control window as a receiver and abide by the flow control limits
974 set by their peer when sending.
976 4. The initial value for the flow control window is 65,535 bytes for
977 both new streams and the overall connection.
979 5. The frame type determines whether flow control applies to a
980 frame. Of the frames specified in this document, only DATA
981 frames are subject to flow control; all other frame types do not
982 consume space in the advertised flow control window. This
983 ensures that important control frames are not blocked by flow
984 control.
986 6. Flow control cannot be disabled.
988 7. HTTP/2 standardizes only the format of the WINDOW_UPDATE frame
989 (Section 6.9). This does not stipulate how a receiver decides
990 when to send this frame or the value that it sends. Nor does it
991 specify how a sender chooses to send packets. Implementations
992 are able to select any algorithm that suits their needs.
994 Implementations are also responsible for managing how requests and
995 responses are sent based on priority; choosing how to avoid head of
996 line blocking for requests; and managing the creation of new streams.
997 Algorithm choices for these could interact with any flow control
998 algorithm.
1000 5.2.2. Appropriate Use of Flow Control
1002 Flow control is defined to protect endpoints that are operating under
1003 resource constraints. For example, a proxy needs to share memory
1004 between many connections, and also might have a slow upstream
1005 connection and a fast downstream one. Flow control addresses cases
1006 where the receiver is unable process data on one stream, yet wants to
1007 continue to process other streams in the same connection.
1009 Deployments that do not require this capability can advertise a flow
1010 control window of the maximum size, incrementing the available space
1011 when new data is received. Sending data is always subject to the
1012 flow control window advertised by the receiver.
1014 Deployments with constrained resources (for example, memory) MAY
1015 employ flow control to limit the amount of memory a peer can consume.
1016 Note, however, that this can lead to suboptimal use of available
1017 network resources if flow control is enabled without knowledge of the
1018 bandwidth-delay product (see [RFC1323]).
1020 Even with full awareness of the current bandwidth-delay product,
1021 implementation of flow control can be difficult. When using flow
1022 control, the receiver MUST read from the TCP receive buffer in a
1023 timely fashion. Failure to do so could lead to a deadlock when
1024 critical frames, such as WINDOW_UPDATE, are not available to HTTP/2.
1025 However, flow control can ensure that constrained resources are
1026 protected without any reduction in connection utilization.
1028 5.3. Stream priority
1030 A client can assign a priority for a new stream by including
1031 prioritization information in the HEADERS frame (Section 6.2) that
1032 opens the stream. For an existing stream, the PRIORITY frame
1033 (Section 6.3) can be used to change the priority.
1035 The purpose of prioritization is to allow an endpoint to express how
1036 it would prefer its peer allocate resources when managing concurrent
1037 streams. Most importantly, priority can be used to select streams
1038 for transmitting frames when there is limited capacity for sending.
1040 Streams can be prioritized by marking them as dependent on the
1041 completion of other streams (Section 5.3.1). Each dependency is
1042 assigned a relative weight, a number that is used to determine the
1043 relative proportion of available resources that are assigned to
1044 streams dependent on the same stream.
1046 Explicitly setting the priority for a stream is input to a
1047 prioritization process. It does not guarantee any particular
1048 processing or transmission order for the stream relative to any other
1049 stream. An endpoint cannot force a peer to process concurrent
1050 streams in a particular order using priority. Expressing priority is
1051 therefore only ever a suggestion.
1053 Prioritization information can be specified explicitly for streams as
1054 they are created using the HEADERS frame, or changed using the
1055 PRIORITY frame. Providing prioritization information is optional, so
1056 default values are used if no explicit indicator is provided
1057 (Section 5.3.5).
1059 5.3.1. Stream Dependencies
1061 Each stream can be given an explicit dependency on another stream.
1062 Including a dependency expresses a preference to allocate resources
1063 to the identified stream rather than to the dependent stream.
1065 A stream that is not dependent on any other stream can given a stream
1066 dependency of 0x0.
1068 When assigning a dependency on another stream, by default, the stream
1069 is added as a new dependency of the stream it depends on. For
1070 example, if streams B and C are dependent on stream A, and if stream
1071 D is created with a dependency on stream A, this results in a
1072 dependency order of A followed by B, C, and D.
1074 A A
1075 / \ ==> /|\
1076 B C B D C
1078 Example of Default Dependency Creation
1080 An exclusive flag allows for the insertion of a new level of
1081 dependencies. The exclusive flag causes the stream to become the
1082 sole dependency of the stream it depends on, causing other
1083 dependencies to become dependencies of the stream. In the previous
1084 example, if stream D is created with an exclusive dependency on
1085 stream A, this results in a dependency order of A followed by D
1086 followed by B and C.
1088 A
1089 A |
1090 / \ ==> D
1091 B C / \
1092 B C
1094 Example of Exclusive Dependency Creation
1096 Inside the dependency tree, a dependent stream SHOULD only be
1097 allocated resources if the streams that it depends on are either
1098 closed, or it is not possible to make progress on them.
1100 5.3.2. Dependency Weighting
1102 Each dependency is allocated an integer weight between 1 to 256
1103 (inclusive).
1105 Streams with the same dependencies SHOULD be allocated resources
1106 proportionally based on their weight. Thus, if stream B depends on
1107 stream A with weight 4, and C depends on stream A with weight 12, and
1108 if no progress can be made on A, stream B ideally receives one third
1109 of the resources allocated to stream C.
1111 A stream MUST NOT depend on itself. An endpoint MAY either treat
1112 this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR, or
1113 assign default priority values (Section 5.3.5) to the stream.
1115 5.3.3. Reprioritization
1117 Stream priorities are changed using the PRIORITY frame. Setting a
1118 dependency causes a stream to become dependent on the identified
1119 stream.
1121 All streams that are dependent on a reprioritized stream move with
1122 it. Setting a dependency with the exclusive flag for a reprioritized
1123 stream moves all the dependencies of the stream it depends on to
1124 become dependencies of the reprioritized stream.
1126 If a stream is made dependent on one of its own dependencies, the
1127 formerly dependent stream is first moved to be depedent on the
1128 reprioritized streams previous dependency, retaining its weight.
1130 For example, for an original dependency tree where B and C depend on
1131 A, D and E depend on C, and F depends on D; if A is made dependent on
1132 D, then D takes the place of A with A dependent on D and all other
1133 dependency relationships staying the same.
1135 0
1136 A / \ D D
1137 / \ D A / \ OR |
1138 B C ==> / / \ ==> F A ==> A
1139 / \ F B C / \ /|\
1140 D E | B C B C F
1141 | E | |
1142 F E F
1143 (intermediate) (non-exclusive) (exclusive)
1145 Example of Dependency Reordering
1147 5.3.4. Prioritization State Management
1149 When a stream is removed from the dependency tree, its dependencies
1150 can be moved to become dependent on the stream the closed stream
1151 depends on. The weights of new dependencies SHOULD be assigned by
1152 distributing the weight of the dependency of the closed stream
1153 proportionally based on the weights of its dependencies.
1155 Streams that are removed from the dependency tree cause some
1156 prioritization information to be lost. Resources are shared between
1157 streams that depend on the same stream, which means that if a stream
1158 in that set closes or becomes blocked, any spare capacity allocated
1159 to a stream is distributed to the immediate neighbors of the stream.
1160 However, if the common dependency is removed from the tree, those
1161 streams share resources with streams at the next highest level. For
1162 example, assume streams A and B share a dependency, and C and D both
1163 depend on A. Prior to the removal of A, if stream A and D are unable
1164 to proceed, then C receives all the resources dedicated to A. If A is
1165 removed from the tree, the weight of A is divided equally between D
1166 and E, which results in stream C receiving a reduced proportion of
1167 resources (one third, rather than one half).
1169 It is possible for a stream to become closed while prioritization
1170 information that creates a dependency on that stream is in transit.
1171 If a stream identified in a dependency has been closed and any
1172 associated priority information destroyed then the dependent stream
1173 is instead assigned a default priority. This potentially creates
1174 suboptimal prioritization, since the stream can be given an effective
1175 priority that is higher than expressed by a peer.
1177 To avoid these problems, endpoints SHOULD maintain prioritization
1178 state for closed streams for a period after streams close.
1180 An endpoint SHOULD retain stream prioritization state for a period
1181 after streams become closed. The longer state is retained, the lower
1182 the chance that streams are assigned incorrect or default priority
1183 values.
1185 This could create a large state burden for an endpoint, so this state
1186 MAY be limited. An endpoint MAY apply a fixed upper limit on the
1187 number of closed streams for which prioritization state is tracked to
1188 limit state exposure. The amount of additional state an endpoint
1189 maintains could be dependent on load; under high load, prioritization
1190 state can be discarded to limit resource commitments. In extreme
1191 cases, an endpoint could even discard prioritization state for active
1192 or reserved streams. If a fixed limit is applied, endpoints SHOULD
1193 maintain state for at least as many streams as allowed by their
1194 setting for SETTINGS_MAX_CONCURRENT_STREAMS.
1196 An endpoint receiving a PRIORITY frame that changes the priority of a
1197 closed stream SHOULD alter the dependencies of the streams that
1198 depend on it, if it has retained enough state to do so.
1200 5.3.5. Default Priorities
1202 Providing priority information is optional. Streams are assigned a
1203 dependency on stream 0x0. Pushed streams (Section 8.2) initially
1204 depend on their associated stream. In both cases, streams are
1205 assigned a default weight of 16.
1207 5.4. Error Handling
1209 HTTP/2 framing permits two classes of error:
1211 o An error condition that renders the entire connection unusable is
1212 a connection error.
1214 o An error in an individual stream is a stream error.
1216 A list of error codes is included in Section 7.
1218 5.4.1. Connection Error Handling
1220 A connection error is any error which prevents further processing of
1221 the framing layer, or which corrupts any connection state.
1223 An endpoint that encounters a connection error SHOULD first send a
1224 GOAWAY frame (Section 6.8) with the stream identifier of the last
1225 stream that it successfully received from its peer. The GOAWAY frame
1226 includes an error code that indicates why the connection is
1227 terminating. After sending the GOAWAY frame, the endpoint MUST close
1228 the TCP connection.
1230 It is possible that the GOAWAY will not be reliably received by the
1231 receiving endpoint. In the event of a connection error, GOAWAY only
1232 provides a best-effort attempt to communicate with the peer about why
1233 the connection is being terminated.
1235 An endpoint can end a connection at any time. In particular, an
1236 endpoint MAY choose to treat a stream error as a connection error.
1237 Endpoints SHOULD send a GOAWAY frame when ending a connection, as
1238 long as circumstances permit it.
1240 5.4.2. Stream Error Handling
1242 A stream error is an error related to a specific stream identifier
1243 that does not affect processing of other streams.
1245 An endpoint that detects a stream error sends a RST_STREAM frame
1246 (Section 6.4) that contains the stream identifier of the stream where
1247 the error occurred. The RST_STREAM frame includes an error code that
1248 indicates the type of error.
1250 A RST_STREAM is the last frame that an endpoint can send on a stream.
1251 The peer that sends the RST_STREAM frame MUST be prepared to receive
1252 any frames that were sent or enqueued for sending by the remote peer.
1253 These frames can be ignored, except where they modify connection
1254 state (such as the state maintained for header compression
1255 (Section 4.3)).
1257 Normally, an endpoint SHOULD NOT send more than one RST_STREAM frame
1258 for any stream. However, an endpoint MAY send additional RST_STREAM
1259 frames if it receives frames on a closed stream after more than a
1260 round-trip time. This behavior is permitted to deal with misbehaving
1261 implementations.
1263 An endpoint MUST NOT send a RST_STREAM in response to an RST_STREAM
1264 frame, to avoid looping.
1266 5.4.3. Connection Termination
1268 If the TCP connection is torn down while streams remain in open or
1269 half closed states, then the endpoint MUST assume that those streams
1270 were abnormally interrupted and could be incomplete.
1272 6. Frame Definitions
1274 This specification defines a number of frame types, each identified
1275 by a unique 8-bit type code. Each frame type serves a distinct
1276 purpose either in the establishment and management of the connection
1277 as a whole, or of individual streams.
1279 The transmission of specific frame types can alter the state of a
1280 connection. If endpoints fail to maintain a synchronized view of the
1281 connection state, successful communication within the connection will
1282 no longer be possible. Therefore, it is important that endpoints
1283 have a shared comprehension of how the state is affected by the use
1284 any given frame.
1286 6.1. DATA
1288 DATA frames (type=0x0) convey arbitrary, variable-length sequences of
1289 octets associated with a stream. One or more DATA frames are used,
1290 for instance, to carry HTTP request or response payloads.
1292 DATA frames MAY also contain arbitrary padding. Padding can be added
1293 to DATA frames to hide the size of messages.
1295 0 1 2 3
1296 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
1297 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1298 | Pad High? (8) | Pad Low? (8) |
1299 +---------------+---------------+-------------------------------+
1300 | Data (*) ...
1301 +---------------------------------------------------------------+
1302 | Padding (*) ...
1303 +---------------------------------------------------------------+
1305 DATA Frame Payload
1307 The DATA frame contains the following fields:
1309 Pad High: An 8-bit field containing an amount of padding in units of
1310 256 octets. This field is optional and is only present if the
1311 PAD_HIGH flag is set. This field, in combination with Pad Low,
1312 determines how much padding there is on a frame.
1314 Pad Low: An 8-bit field containing an amount of padding in units of
1315 single octets. This field is optional and is only present if the
1316 PAD_LOW flag is set. This field, in combination with Pad High,
1317 determines how much padding there is on a frame.
1319 Data: Application data. The amount of data is the remainder of the
1320 frame payload after subtracting the length of the other fields
1321 that are present.
1323 Padding: Padding octets that contain no application semantic value.
1324 Padding octets MUST be set to zero when sending and ignored when
1325 receiving.
1327 The DATA frame defines the following flags:
1329 END_STREAM (0x1): Bit 1 being set indicates that this frame is the
1330 last that the endpoint will send for the identified stream.
1331 Setting this flag causes the stream to enter one of the "half
1332 closed" states or the "closed" state (Section 5.1).
1334 END_SEGMENT (0x2): Bit 2 being set indicates that this frame is the
1335 last for the current segment. Intermediaries MUST NOT coalesce
1336 frames across a segment boundary and MUST preserve segment
1337 boundaries when forwarding frames.
1339 PAD_LOW (0x8): Bit 4 being set indicates that the Pad Low field is
1340 present.
1342 PAD_HIGH (0x10): Bit 5 being set indicates that the Pad High field
1343 is present. This bit MUST NOT be set unless the PAD_LOW flag is
1344 also set. Endpoints that receive a frame with PAD_HIGH set and
1345 PAD_LOW cleared MUST treat this as a connection error
1346 (Section 5.4.1) of type PROTOCOL_ERROR.
1348 COMPRESSED (0x20): Bit 6 being set indicates that the data in the
1349 frame has been compressed with GZIP compression ([GZIP]).
1351 DATA frames MUST be associated with a stream. If a DATA frame is
1352 received whose stream identifier field is 0x0, the recipient MUST
1353 respond with a connection error (Section 5.4.1) of type
1354 PROTOCOL_ERROR.
1356 Data frames are optionally compressed using GZip compression [GZIP].
1357 Each frame is individually compressed; the state of the compressor is
1358 reset for each frame.
1360 An endpoint MUST NOT send a DATA frame with the COMPRESSED flag set
1361 unless the SETTINGS_COMPRESS_DATA setting is enabled, that is, set to
1362 1. An endpoint that has not enabled DATA frame compression MUST
1363 treat the receipt of a DATA frame with the COMPRESSED flag set as a
1364 connection error (Section 5.4.1) of type PROTOCOL_ERROR.
1366 DATA frames are subject to flow control and can only be sent when a
1367 stream is in the "open" or "half closed (remote)" states. Padding is
1368 included in flow control. If a DATA frame is received whose stream
1369 is not in "open" or "half closed (local)" state, the recipient MUST
1370 respond with a stream error (Section 5.4.2) of type STREAM_CLOSED.
1372 The total number of padding octets is determined by multiplying the
1373 value of the Pad High field by 256 and adding the value of the Pad
1374 Low field. Both Pad High and Pad Low fields assume a value of zero
1375 if absent. If the length of the padding is greater than the length
1376 of the remainder of the frame payload, the recipient MUST treat this
1377 as a connection error (Section 5.4.1) of type PROTOCOL_ERROR.
1379 Note: A frame can be increased in size by one octet by including a
1380 Pad Low field with a value of zero.
1382 Use of padding is a security feature; as such, its use demands some
1383 care, see Section 10.7.
1385 6.2. HEADERS
1387 The HEADERS frame (type=0x1) carries name-value pairs. It is used to
1388 open a stream (Section 5.1). HEADERS frames can be sent on a stream
1389 in the "open" or "half closed (remote)" states.
1391 0 1 2 3
1392 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
1393 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1394 | Pad High? (8) | Pad Low? (8) |
1395 +-+-------------+---------------+-------------------------------+
1396 |E| Stream Dependency? (31) |
1397 +-+-------------+-----------------------------------------------+
1398 | Weight? (8) |
1399 +-+-------------+-----------------------------------------------+
1400 | Header Block Fragment (*) ...
1401 +---------------------------------------------------------------+
1402 | Padding (*) ...
1403 +---------------------------------------------------------------+
1405 HEADERS Frame Payload
1407 The HEADERS frame payload has the following fields:
1409 Pad High: Padding size high bits. This field is only present if the
1410 PAD_HIGH flag is set.
1412 Pad Low: Padding size low bits. This field is only present if the
1413 PAD_LOW flag is set.
1415 E: A single bit flag indicates that the stream dependency is
1416 exclusive, see Section 5.3. This field is optional and is only
1417 present if the PRIORITY flag is set.
1419 Stream Dependency: A 31-bit stream identifier for the stream that
1420 this stream depends on, see Section 5.3. This field is optional
1421 and is only present if the PRIORITY flag is set.
1423 Weight: An 8-bit weight for the stream, see Section 5.3. Add one to
1424 the value to obtain a weight between 1 and 256. This field is
1425 optional and is only present if the PRIORITY flag is set.
1427 Header Block Fragment: A header block fragment (Section 4.3).
1429 Padding: Padding octets.
1431 The HEADERS frame defines the following flags:
1433 END_STREAM (0x1): Bit 1 being set indicates that the header block
1434 (Section 4.3) is the last that the endpoint will send for the
1435 identified stream. Setting this flag causes the stream to enter
1436 one of "half closed" states (Section 5.1).
1438 A HEADERS frame that is followed by CONTINUATION frames carries
1439 the END_STREAM flag that signals the end of a stream. A
1440 CONTINUATION frame cannot be used to terminate a stream.
1442 END_SEGMENT (0x2): Bit 2 being set indicates that this frame is the
1443 last for the current segment. Intermediaries MUST NOT coalesce
1444 frames across a segment boundary and MUST preserve segment
1445 boundaries when forwarding frames.
1447 END_HEADERS (0x4): Bit 3 being set indicates that this frame
1448 contains an entire header block (Section 4.3) and is not followed
1449 by any CONTINUATION frames.
1451 A HEADERS frame without the END_HEADERS flag set MUST be followed
1452 by a CONTINUATION frame for the same stream. A receiver MUST
1453 treat the receipt of any other type of frame or a frame on a
1454 different stream as a connection error (Section 5.4.1) of type
1455 PROTOCOL_ERROR.
1457 PAD_LOW (0x8): Bit 4 being set indicates that the Pad Low field is
1458 present.
1460 PAD_HIGH (0x10): Bit 5 being set indicates that the Pad High field
1461 is present. This bit MUST NOT be set unless the PAD_LOW flag is
1462 also set. Endpoints that receive a frame with PAD_HIGH set and
1463 PAD_LOW cleared MUST treat this as a connection error
1464 (Section 5.4.1) of type PROTOCOL_ERROR.
1466 PRIORITY (0x20): Bit 6 being set indicates that the Exclusive Flag
1467 (E), Stream Dependency, and Weight fields are present; see
1468 Section 5.3.
1470 The payload of a HEADERS frame contains a header block fragment
1471 (Section 4.3). A header block that does not fit within a HEADERS
1472 frame is continued in a CONTINUATION frame (Section 6.10).
1474 HEADERS frames MUST be associated with a stream. If a HEADERS frame
1475 is received whose stream identifier field is 0x0, the recipient MUST
1476 respond with a connection error (Section 5.4.1) of type
1477 PROTOCOL_ERROR.
1479 The HEADERS frame changes the connection state as described in
1480 Section 4.3.
1482 The HEADERS frame includes optional padding. Padding fields and
1483 flags are identical to those defined for DATA frames (Section 6.1).
1485 6.3. PRIORITY
1487 The PRIORITY frame (type=0x2) specifies the sender-advised priority
1488 of a stream (Section 5.3). It can be sent at any time for an
1489 existing stream. This enables reprioritization of existing streams.
1491 0 1 2 3
1492 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
1493 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1494 |E| Stream Dependency (31) |
1495 +-+-------------+-----------------------------------------------+
1496 | Weight (8) |
1497 +-+-------------+
1499 PRIORITY Frame Payload
1501 The payload of a PRIORITY frame contains the following fields:
1503 E: A single bit flag indicates that the stream dependency is
1504 exclusive, see Section 5.3.
1506 Stream Dependency: A 31-bit stream identifier for the stream that
1507 this stream depends on, see Section 5.3.
1509 Weight: An 8-bit weight for the identified stream dependency, see
1510 Section 5.3. Add one to the value to obtain a weight between 1
1511 and 256.
1513 The PRIORITY frame does not define any flags.
1515 The PRIORITY frame is associated with an existing stream. If a
1516 PRIORITY frame is received with a stream identifier of 0x0, the
1517 recipient MUST respond with a connection error (Section 5.4.1) of
1518 type PROTOCOL_ERROR.
1520 The PRIORITY frame can be sent on a stream in any of the "reserved
1521 (remote)", "open", "half-closed (local)", or "half closed (remote)"
1522 states, though it cannot be sent between consecutive frames that
1523 comprise a single header block (Section 4.3). Note that this frame
1524 could arrive after processing or frame sending has completed, which
1525 would cause it to have no effect. For a stream that is in the "half
1526 closed (remote)" state, this frame can only affect processing of the
1527 stream and not frame transmission.
1529 6.4. RST_STREAM
1531 The RST_STREAM frame (type=0x3) allows for abnormal termination of a
1532 stream. When sent by the initiator of a stream, it indicates that
1533 they wish to cancel the stream or that an error condition has
1534 occurred. When sent by the receiver of a stream, it indicates that
1535 either the receiver is rejecting the stream, requesting that the
1536 stream be cancelled or that an error condition has occurred.
1538 0 1 2 3
1539 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
1540 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1541 | Error Code (32) |
1542 +---------------------------------------------------------------+
1544 RST_STREAM Frame Payload
1546 The RST_STREAM frame contains a single unsigned, 32-bit integer
1547 identifying the error code (Section 7). The error code indicates why
1548 the stream is being terminated.
1550 The RST_STREAM frame does not define any flags.
1552 The RST_STREAM frame fully terminates the referenced stream and
1553 causes it to enter the closed state. After receiving a RST_STREAM on
1554 a stream, the receiver MUST NOT send additional frames for that
1555 stream. However, after sending the RST_STREAM, the sending endpoint
1556 MUST be prepared to receive and process additional frames sent on the
1557 stream that might have been sent by the peer prior to the arrival of
1558 the RST_STREAM.
1560 RST_STREAM frames MUST be associated with a stream. If a RST_STREAM
1561 frame is received with a stream identifier of 0x0, the recipient MUST
1562 treat this as a connection error (Section 5.4.1) of type
1563 PROTOCOL_ERROR.
1565 RST_STREAM frames MUST NOT be sent for a stream in the "idle" state.
1566 If a RST_STREAM frame identifying an idle stream is received, the
1567 recipient MUST treat this as a connection error (Section 5.4.1) of
1568 type PROTOCOL_ERROR.
1570 6.5. SETTINGS
1572 The SETTINGS frame (type=0x4) conveys configuration parameters (such
1573 as preferences and constraints on peer behavior) that affect how
1574 endpoints communicate, and is also used to acknowledge the receipt of
1575 those parameters. Individually, a SETTINGS parameter can also be
1576 referred to as a "setting".
1578 SETTINGS parameters are not negotiated; they describe characteristics
1579 of the sending peer, which are used by the receiving peer. Different
1580 values for the same parameter can be advertised by each peer. For
1581 example, a client might set a high initial flow control window,
1582 whereas a server might set a lower value to conserve resources.
1584 A SETTINGS frame MUST be sent by both endpoints at the start of a
1585 connection, and MAY be sent at any other time by either endpoint over
1586 the lifetime of the connection. Implementations MUST support all of
1587 the parameters defined by this specification.
1589 Each parameter in a SETTINGS frame replaces any existing value for
1590 that parameter. Parameters are processed in the order in which they
1591 appear, and a receiver of a SETTINGS frame does not need to maintain
1592 any state other than the current value of its parameters. Therefore,
1593 the value of a SETTINGS parameter is the last value that is seen by a
1594 receiver.
1596 SETTINGS parameters are acknowledged by the receiving peer. To
1597 enable this, the SETTINGS frame defines the following flag:
1599 ACK (0x1): Bit 1 being set indicates that this frame acknowledges
1600 receipt and application of the peer's SETTINGS frame. When this
1601 bit is set, the payload of the SETTINGS frame MUST be empty.
1602 Receipt of a SETTINGS frame with the ACK flag set and a length
1603 field value other than 0 MUST be treated as a connection error
1604 (Section 5.4.1) of type FRAME_SIZE_ERROR. For more info, see
1605 Settings Synchronization (Section 6.5.3).
1607 SETTINGS frames always apply to a connection, never a single stream.
1608 The stream identifier for a SETTINGS frame MUST be zero. If an
1609 endpoint receives a SETTINGS frame whose stream identifier field is
1610 anything other than 0x0, the endpoint MUST respond with a connection
1611 error (Section 5.4.1) of type PROTOCOL_ERROR.
1613 The SETTINGS frame affects connection state. A badly formed or
1614 incomplete SETTINGS frame MUST be treated as a connection error
1615 (Section 5.4.1) of type PROTOCOL_ERROR.
1617 6.5.1. SETTINGS Format
1619 The payload of a SETTINGS frame consists of zero or more parameters,
1620 each consisting of an unsigned 8-bit identifier and an unsigned 32-
1621 bit value.
1623 0 1 2 3
1624 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
1625 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1626 | Identifier (8)|
1627 +---------------+-----------------------------------------------+
1628 | Value (32) |
1629 +---------------------------------------------------------------+
1631 Setting Format
1633 6.5.2. Defined SETTINGS Parameters
1635 The following parameters are defined:
1637 SETTINGS_HEADER_TABLE_SIZE (1): Allows the sender to inform the
1638 remote endpoint of the size of the header compression table used
1639 to decode header blocks. The encoder can reduce this size by
1640 using signaling specific to the header compression format inside a
1641 header block. The initial value is 4,096 bytes.
1643 SETTINGS_ENABLE_PUSH (2): This setting can be use to disable server
1644 push (Section 8.2). An endpoint MUST NOT send a PUSH_PROMISE
1645 frame if it receives this parameter set to a value of 0. An
1646 endpoint that has both set this parameter to 0 and had it
1647 acknowledged MUST treat the receipt of a PUSH_PROMISE frame as a
1648 connection error (Section 5.4.1) of type PROTOCOL_ERROR.
1650 The initial value is 1, which indicates that push is permitted.
1651 Any value other than 0 or 1 MUST be treated as a connection error
1652 (Section 5.4.1) of type PROTOCOL_ERROR.
1654 SETTINGS_MAX_CONCURRENT_STREAMS (3): Indicates the maximum number of
1655 concurrent streams that the sender will allow. This limit is
1656 directional: it applies to the number of streams that the sender
1657 permits the receiver to create. Initially there is no limit to
1658 this value. It is recommended that this value be no smaller than
1659 100, so as to not unnecessarily limit parallelism.
1661 A value of 0 for SETTINGS_MAX_CONCURRENT_STREAMS SHOULD NOT be
1662 treated as special by endpoints. A zero value does prevent the
1663 creation of new streams, however this can also happen for any
1664 limit that is exhausted with active streams. Servers SHOULD only
1665 set a zero value for short durations; if a server does not wish to
1666 accept requests, closing the connection could be preferable.
1668 SETTINGS_INITIAL_WINDOW_SIZE (4): Indicates the sender's initial
1669 window size (in bytes) for stream level flow control. The initial
1670 value is 65,535.
1672 This setting affects the window size of all streams, including
1673 existing streams, see Section 6.9.2.
1675 Values above the maximum flow control window size of 2^31 - 1 MUST
1676 be treated as a connection error (Section 5.4.1) of type
1677 FLOW_CONTROL_ERROR.
1679 SETTINGS_COMPRESS_DATA (5): This setting is used to enable GZip
1680 compression of DATA frames.
1682 A value of 1 indicates that DATA frames MAY be compressed. A
1683 value of 0 indicates that compression is not permitted. The
1684 initial value is 0.
1686 Values other than 0 or 1 are invalid. An endpoint MUST treat the
1687 receipt of any other value as a connection error (Section 5.4.1)
1688 of type PROTOCOL_ERROR.
1690 An endpoint that receives a SETTINGS frame with any other identifier
1691 MUST treat this as a connection error (Section 5.4.1) of type
1692 PROTOCOL_ERROR.
1694 6.5.3. Settings Synchronization
1696 Most values in SETTINGS benefit from or require an understanding of
1697 when the peer has received and applied the changed the communicated
1698 parameter values. In order to provide such synchronization
1699 timepoints, the recipient of a SETTINGS frame in which the ACK flag
1700 is not set MUST apply the updated parameters as soon as possible upon
1701 receipt.
1703 The values in the SETTINGS frame MUST be applied in the order they
1704 appear, with no other frame processing between values. Once all
1705 values have been applied, the recipient MUST immediately emit a
1706 SETTINGS frame with the ACK flag set. Upon receiving a SETTINGS
1707 frame with the ACK flag set, the sender of the altered parameters can
1708 rely upon their application.
1710 If the sender of a SETTINGS frame does not receive an acknowledgement
1711 within a reasonable amount of time, it MAY issue a connection error
1712 (Section 5.4.1) of type SETTINGS_TIMEOUT.
1714 6.6. PUSH_PROMISE
1716 The PUSH_PROMISE frame (type=0x5) is used to notify the peer endpoint
1717 in advance of streams the sender intends to initiate. The
1718 PUSH_PROMISE frame includes the unsigned 31-bit identifier of the
1719 stream the endpoint plans to create along with a set of headers that
1720 provide additional context for the stream. Section 8.2 contains a
1721 thorough description of the use of PUSH_PROMISE frames.
1723 PUSH_PROMISE MUST NOT be sent if the SETTINGS_ENABLE_PUSH setting of
1724 the peer endpoint is set to 0.
1726 0 1 2 3
1727 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
1728 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1729 | Pad High? (8) | Pad Low? (8) |
1730 +-+-------------+---------------+-------------------------------+
1731 |R| Promised Stream ID (31) |
1732 +-+-----------------------------+-------------------------------+
1733 | Header Block Fragment (*) ...
1734 +---------------------------------------------------------------+
1735 | Padding (*) ...
1736 +---------------------------------------------------------------+
1738 PUSH_PROMISE Payload Format
1740 The PUSH_PROMISE frame payload has the following fields:
1742 Pad High: Padding size high bits. This field is only present if the
1743 PAD_HIGH flag is set.
1745 Pad Low: Padding size low bits. This field is only present if the
1746 PAD_LOW flag is set.
1748 R: A single reserved bit.
1750 Promised Stream ID: This unsigned 31-bit integer identifies the
1751 stream the endpoint intends to start sending frames for. The
1752 promised stream identifier MUST be a valid choice for the next
1753 stream sent by the sender (see new stream identifier
1754 (Section 5.1.1)).
1756 Header Block Fragment: A header block fragment (Section 4.3)
1757 containing request header fields.
1759 Padding: Padding octets.
1761 The PUSH_PROMISE frame defines the following flags:
1763 END_HEADERS (0x4): Bit 3 being set indicates that this frame
1764 contains an entire header block (Section 4.3) and is not followed
1765 by any CONTINUATION frames.
1767 A PUSH_PROMISE frame without the END_HEADERS flag set MUST be
1768 followed by a CONTINUATION frame for the same stream. A receiver
1769 MUST treat the receipt of any other type of frame or a frame on a
1770 different stream as a connection error (Section 5.4.1) of type
1771 PROTOCOL_ERROR.
1773 PAD_LOW (0x8): Bit 4 being set indicates that the Pad Low field is
1774 present.
1776 PAD_HIGH (0x10): Bit 5 being set indicates that the Pad High field
1777 is present. This bit MUST NOT be set unless the PAD_LOW flag is
1778 also set. Endpoints that receive a frame with PAD_HIGH set and
1779 PAD_LOW cleared MUST treat this as a connection error
1780 (Section 5.4.1) of type PROTOCOL_ERROR.
1782 PUSH_PROMISE frames MUST be associated with an existing, peer-
1783 initiated stream. The stream identifier of a PUSH_PROMISE frame
1784 indicates the stream it is associated with. If the stream identifier
1785 field specifies the value 0x0, a recipient MUST respond with a
1786 connection error (Section 5.4.1) of type PROTOCOL_ERROR.
1788 Promised streams are not required to be used in order promised. The
1789 PUSH_PROMISE only reserves stream identifiers for later use.
1791 Recipients of PUSH_PROMISE frames can choose to reject promised
1792 streams by returning a RST_STREAM referencing the promised stream
1793 identifier back to the sender of the PUSH_PROMISE.
1795 The PUSH_PROMISE frame modifies the connection state as defined in
1796 Section 4.3.
1798 A PUSH_PROMISE frame modifies the connection state in two ways. The
1799 inclusion of a header block (Section 4.3) potentially modifies the
1800 state maintained for header compression. PUSH_PROMISE also reserves
1801 a stream for later use, causing the promised stream to enter the
1802 "reserved" state. A sender MUST NOT send a PUSH_PROMISE on a stream
1803 unless that stream is either "open" or "half closed (remote)"; the
1804 sender MUST ensure that the promised stream is a valid choice for a
1805 new stream identifier (Section 5.1.1) (that is, the promised stream
1806 MUST be in the "idle" state).
1808 Since PUSH_PROMISE reserves a stream, ignoring a PUSH_PROMISE frame
1809 causes the stream state to become indeterminate. A receiver MUST
1810 treat the receipt of a PUSH_PROMISE on a stream that is neither
1811 "open" nor "half-closed (local)" as a connection error
1812 (Section 5.4.1) of type PROTOCOL_ERROR. Similarly, a receiver MUST
1813 treat the receipt of a PUSH_PROMISE that promises an illegal stream
1814 identifier (Section 5.1.1) (that is, an identifier for a stream that
1815 is not currently in the "idle" state) as a connection error
1816 (Section 5.4.1) of type PROTOCOL_ERROR.
1818 The PUSH_PROMISE frame includes optional padding. Padding fields and
1819 flags are identical to those defined for DATA frames (Section 6.1).
1821 6.7. PING
1823 The PING frame (type=0x6) is a mechanism for measuring a minimal
1824 round-trip time from the sender, as well as determining whether an
1825 idle connection is still functional. PING frames can be sent from
1826 any endpoint.
1828 0 1 2 3
1829 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
1830 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1831 | |
1832 | Opaque Data (64) |
1833 | |
1834 +---------------------------------------------------------------+
1836 PING Payload Format
1838 In addition to the frame header, PING frames MUST contain 8 octets of
1839 data in the payload. A sender can include any value it chooses and
1840 use those bytes in any fashion.
1842 Receivers of a PING frame that does not include an ACK flag MUST send
1843 a PING frame with the ACK flag set in response, with an identical
1844 payload. PING responses SHOULD be given higher priority than any
1845 other frame.
1847 The PING frame defines the following flags:
1849 ACK (0x1): Bit 1 being set indicates that this PING frame is a PING
1850 response. An endpoint MUST set this flag in PING responses. An
1851 endpoint MUST NOT respond to PING frames containing this flag.
1853 PING frames are not associated with any individual stream. If a PING
1854 frame is received with a stream identifier field value other than
1855 0x0, the recipient MUST respond with a connection error
1856 (Section 5.4.1) of type PROTOCOL_ERROR.
1858 Receipt of a PING frame with a length field value other than 8 MUST
1859 be treated as a connection error (Section 5.4.1) of type
1860 FRAME_SIZE_ERROR.
1862 6.8. GOAWAY
1864 The GOAWAY frame (type=0x7) informs the remote peer to stop creating
1865 streams on this connection. GOAWAY can be sent by either the client
1866 or the server. Once sent, the sender will ignore frames sent on new
1867 streams for the remainder of the connection. Receivers of a GOAWAY
1868 frame MUST NOT open additional streams on the connection, although a
1869 new connection can be established for new streams. The purpose of
1870 this frame is to allow an endpoint to gracefully stop accepting new
1871 streams (perhaps for a reboot or maintenance), while still finishing
1872 processing of previously established streams.
1874 There is an inherent race condition between an endpoint starting new
1875 streams and the remote sending a GOAWAY frame. To deal with this
1876 case, the GOAWAY contains the stream identifier of the last stream
1877 which was processed on the sending endpoint in this connection. If
1878 the receiver of the GOAWAY used streams that are newer than the
1879 indicated stream identifier, they were not processed by the sender
1880 and the receiver may treat the streams as though they had never been
1881 created at all (hence the receiver may want to re-create the streams
1882 later on a new connection).
1884 Endpoints SHOULD always send a GOAWAY frame before closing a
1885 connection so that the remote can know whether a stream has been
1886 partially processed or not. For example, if an HTTP client sends a
1887 POST at the same time that a server closes a connection, the client
1888 cannot know if the server started to process that POST request if the
1889 server does not send a GOAWAY frame to indicate where it stopped
1890 working. An endpoint might choose to close a connection without
1891 sending GOAWAY for misbehaving peers.
1893 0 1 2 3
1894 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
1895 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1896 |R| Last-Stream-ID (31) |
1897 +-+-------------------------------------------------------------+
1898 | Error Code (32) |
1899 +---------------------------------------------------------------+
1900 | Additional Debug Data (*) |
1901 +---------------------------------------------------------------+
1903 GOAWAY Payload Format
1905 The GOAWAY frame does not define any flags.
1907 The GOAWAY frame applies to the connection, not a specific stream.
1908 An endpoint MUST treat a GOAWAY frame with a stream identifier other
1909 than 0x0 as a connection error (Section 5.4.1) of type
1910 PROTOCOL_ERROR.
1912 The last stream identifier in the GOAWAY frame contains the highest
1913 numbered stream identifier for which the sender of the GOAWAY frame
1914 has received frames and might have taken some action on. All streams
1915 up to and including the identified stream might have been processed
1916 in some way. The last stream identifier can be set to 0 if no
1917 streams were processed.
1919 Note: In this context, "processed" means that some data from the
1920 stream was passed to some higher layer of software that might have
1921 taken some action as a result.
1923 If a connection terminates without a GOAWAY frame, this value is
1924 effectively the highest possible stream identifier.
1926 On streams with lower or equal numbered identifiers that were not
1927 closed completely prior to the connection being closed, re-attempting
1928 requests, transactions, or any protocol activity is not possible
1929 (with the exception of idempotent actions like HTTP GET, PUT, or
1930 DELETE). Any protocol activity that uses higher numbered streams can
1931 be safely retried using a new connection.
1933 Activity on streams numbered lower or equal to the last stream
1934 identifier might still complete successfully. The sender of a GOAWAY
1935 frame might gracefully shut down a connection by sending a GOAWAY
1936 frame, maintaining the connection in an open state until all in-
1937 progress streams complete.
1939 An endpoint MAY send multiple GOAWAY frames if circumstances change.
1940 For instance, an endpoint that sends GOAWAY with NO_ERROR during
1941 graceful shutdown could subsequently encounter an condition that
1942 requires immediate termination of the connection. The last stream
1943 identifier from the last GOAWAY frame received applies.
1945 After sending a GOAWAY frame, the sender can discard frames for
1946 streams with identifiers higher than the identified last stream.
1947 However, any frames that alter connection state cannot be completely
1948 ignored. For instance, HEADERS, PUSH_PROMISE and CONTINUATION frames
1949 MUST be minimally processed to ensure the state maintained for header
1950 compression is consistent (see Section 4.3); similarly DATA frames
1951 MUST be counted toward the connection flow control window. Failure
1952 to process these frames can cause flow control or header compression
1953 state to become unsynchronized.
1955 The GOAWAY frame also contains a 32-bit error code (Section 7) that
1956 contains the reason for closing the connection.
1958 Endpoints MAY append opaque data to the payload of any GOAWAY frame.
1959 Additional debug data is intended for diagnostic purposes only and
1960 carries no semantic value. Debug information could contain security-
1961 or privacy-sensitive data. Logged or otherwise persistently stored
1962 debug data MUST have adequate safeguards to prevent unauthorized
1963 access.
1965 6.9. WINDOW_UPDATE
1967 The WINDOW_UPDATE frame (type=0x8) is used to implement flow control;
1968 see Section 5.2 for an overview.
1970 Flow control operates at two levels: on each individual stream and on
1971 the entire connection.
1973 Both types of flow control are hop-by-hop; that is, only between the
1974 two endpoints. Intermediaries do not forward WINDOW_UPDATE frames
1975 between dependent connections. However, throttling of data transfer
1976 by any receiver can indirectly cause the propagation of flow control
1977 information toward the original sender.
1979 Flow control only applies to frames that are identified as being
1980 subject to flow control. Of the frame types defined in this
1981 document, this includes only DATA frame. Frames that are exempt from
1982 flow control MUST be accepted and processed, unless the receiver is
1983 unable to assign resources to handling the frame. A receiver MAY
1984 respond with a stream error (Section 5.4.2) or connection error
1985 (Section 5.4.1) of type FLOW_CONTROL_ERROR if it is unable to accept
1986 a frame.
1988 0 1 2 3
1989 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
1990 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1991 |R| Window Size Increment (31) |
1992 +-+-------------------------------------------------------------+
1994 WINDOW_UPDATE Payload Format
1996 The payload of a WINDOW_UPDATE frame is one reserved bit, plus an
1997 unsigned 31-bit integer indicating the number of bytes that the
1998 sender can transmit in addition to the existing flow control window.
1999 The legal range for the increment to the flow control window is 1 to
2000 2^31 - 1 (0x7fffffff) bytes.
2002 The WINDOW_UPDATE frame does not define any flags.
2004 The WINDOW_UPDATE frame can be specific to a stream or to the entire
2005 connection. In the former case, the frame's stream identifier
2006 indicates the affected stream; in the latter, the value "0" indicates
2007 that the entire connection is the subject of the frame.
2009 WINDOW_UPDATE can be sent by a peer that has sent a frame bearing the
2010 END_STREAM flag. This means that a receiver could receive a
2011 WINDOW_UPDATE frame on a "half closed (remote)" or "closed" stream.
2012 A receiver MUST NOT treat this as an error, see Section 5.1.
2014 A receiver that receives a flow controlled frame MUST always account
2015 for its contribution against the connection flow control window,
2016 unless the receiver treats this as a connection error
2017 (Section 5.4.1). This is necessary even if the frame is in error.
2018 Since the sender counts the frame toward the flow control window, if
2019 the receiver does not, the flow control window at sender and receiver
2020 can become different.
2022 6.9.1. The Flow Control Window
2024 Flow control in HTTP/2 is implemented using a window kept by each
2025 sender on every stream. The flow control window is a simple integer
2026 value that indicates how many bytes of data the sender is permitted
2027 to transmit; as such, its size is a measure of the buffering
2028 capability of the receiver.
2030 Two flow control windows are applicable: the stream flow control
2031 window and the connection flow control window. The sender MUST NOT
2032 send a flow controlled frame with a length that exceeds the space
2033 available in either of the flow control windows advertised by the
2034 receiver. Frames with zero length with the END_STREAM flag set (for
2035 example, an empty data frame) MAY be sent if there is no available
2036 space in either flow control window.
2038 For flow control calculations, the 8 byte frame header is not
2039 counted.
2041 After sending a flow controlled frame, the sender reduces the space
2042 available in both windows by the length of the transmitted frame.
2044 The receiver of a frame sends a WINDOW_UPDATE frame as it consumes
2045 data and frees up space in flow control windows. Separate
2046 WINDOW_UPDATE frames are sent for the stream and connection level
2047 flow control windows.
2049 A sender that receives a WINDOW_UPDATE frame updates the
2050 corresponding window by the amount specified in the frame.
2052 A sender MUST NOT allow a flow control window to exceed 2^31 - 1
2053 bytes. If a sender receives a WINDOW_UPDATE that causes a flow
2054 control window to exceed this maximum it MUST terminate either the
2055 stream or the connection, as appropriate. For streams, the sender
2056 sends a RST_STREAM with the error code of FLOW_CONTROL_ERROR code;
2057 for the connection, a GOAWAY frame with a FLOW_CONTROL_ERROR code.
2059 Flow controlled frames from the sender and WINDOW_UPDATE frames from
2060 the receiver are completely asynchronous with respect to each other.
2061 This property allows a receiver to aggressively update the window
2062 size kept by the sender to prevent streams from stalling.
2064 A sender that is unable to send data on a stream due to either flow
2065 control window being zero or lower MAY send a BLOCKED frame
2066 (Section 6.12) in order to inform the receiver of a potential flow
2067 control problem.
2069 6.9.2. Initial Flow Control Window Size
2071 When an HTTP/2 connection is first established, new streams are
2072 created with an initial flow control window size of 65,535 bytes.
2073 The connection flow control window is 65,535 bytes. Both endpoints
2074 can adjust the initial window size for new streams by including a
2075 value for SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS frame that
2076 forms part of the connection preface. The connection flow control
2077 window initial size cannot be changed.
2079 Prior to receiving a SETTINGS frame that sets a value for
2080 SETTINGS_INITIAL_WINDOW_SIZE, an endpoint can only use the default
2081 initial window size when sending flow controlled frames. Similarly,
2082 the connection flow control window is set to the default initial
2083 window size until a WINDOW_UPDATE frame is received.
2085 A SETTINGS frame can alter the initial flow control window size for
2086 all current streams. When the value of SETTINGS_INITIAL_WINDOW_SIZE
2087 changes, a receiver MUST adjust the size of all stream flow control
2088 windows that it maintains by the difference between the new value and
2089 the old value. A SETTINGS frame cannot alter the connection flow
2090 control window.
2092 An endpoint MUST treat a change to SETTINGS_INITIAL_WINDOW_SIZE that
2093 causes any flow control window to exceed the maximum size as a
2094 connection error (Section 5.4.1) of type FLOW_CONTROL_ERROR.
2096 A change to SETTINGS_INITIAL_WINDOW_SIZE can cause the available
2097 space in a flow control window to become negative. A sender MUST
2098 track the negative flow control window, and MUST NOT send new flow
2099 controlled frames until it receives WINDOW_UPDATE frames that cause
2100 the flow control window to become positive.
2102 For example, if the client sends 60KB immediately on connection
2103 establishment, and the server sets the initial window size to be
2104 16KB, the client will recalculate the available flow control window
2105 to be -44KB on receipt of the SETTINGS frame. The client retains a
2106 negative flow control window until WINDOW_UPDATE frames restore the
2107 window to being positive, after which the client can resume sending.
2109 6.9.3. Reducing the Stream Window Size
2111 A receiver that wishes to use a smaller flow control window than the
2112 current size can send a new SETTINGS frame. However, the receiver
2113 MUST be prepared to receive data that exceeds this window size, since
2114 the sender might send data that exceeds the lower limit prior to
2115 processing the SETTINGS frame.
2117 After sending a SETTINGS frame that reduces the initial flow control
2118 window size, a receiver has two options for handling streams that
2119 exceed flow control limits:
2121 1. The receiver can immediately send RST_STREAM with
2122 FLOW_CONTROL_ERROR error code for the affected streams.
2124 2. The receiver can accept the streams and tolerate the resulting
2125 head of line blocking, sending WINDOW_UPDATE frames as it
2126 consumes data.
2128 6.10. CONTINUATION
2130 The CONTINUATION frame (type=0x9) is used to continue a sequence of
2131 header block fragments (Section 4.3). Any number of CONTINUATION
2132 frames can be sent on an existing stream, as long as the preceding
2133 frame is on the same stream and is a HEADERS, PUSH_PROMISE or
2134 CONTINUATION frame without the END_HEADERS flag set.
2136 0 1 2 3
2137 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
2138 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2139 | Pad High? (8) | Pad Low? (8) |
2140 +---------------+---------------+-------------------------------+
2141 | Header Block Fragment (*) ...
2142 +---------------------------------------------------------------+
2143 | Padding (*) ...
2144 +---------------------------------------------------------------+
2146 CONTINUATION Frame Payload
2148 The CONTINUATION frame payload has the following fields:
2150 Pad High: Padding size high bits. This field is only present if the
2151 PAD_HIGH flag is set.
2153 Pad Low: Padding size low bits. This field is only present if the
2154 PAD_LOW flag is set.
2156 Header Block Fragment: A header block fragment (Section 4.3).
2158 Padding: Padding octets.
2160 The CONTINUATION frame defines the following flags:
2162 END_HEADERS (0x4): Bit 3 being set indicates that this frame ends a
2163 header block (Section 4.3).
2165 If the END_HEADERS bit is not set, this frame MUST be followed by
2166 another CONTINUATION frame. A receiver MUST treat the receipt of
2167 any other type of frame or a frame on a different stream as a
2168 connection error (Section 5.4.1) of type PROTOCOL_ERROR.
2170 PAD_LOW (0x8): Bit 4 being set indicates that the Pad Low field is
2171 present.
2173 PAD_HIGH (0x10): Bit 5 being set indicates that the Pad High field
2174 is present. This bit MUST NOT be set unless the PAD_LOW flag is
2175 also set. Endpoints that receive a frame with PAD_HIGH set and
2176 PAD_LOW cleared MUST treat this as a connection error
2177 (Section 5.4.1) of type PROTOCOL_ERROR.
2179 The payload of a CONTINUATION frame contains a header block fragment
2180 (Section 4.3).
2182 The CONTINUATION frame changes the connection state as defined in
2183 Section 4.3.
2185 CONTINUATION frames MUST be associated with a stream. If a
2186 CONTINUATION frame is received whose stream identifier field is 0x0,
2187 the recipient MUST respond with a connection error (Section 5.4.1) of
2188 type PROTOCOL_ERROR.
2190 A CONTINUATION frame MUST be preceded by a HEADERS, PUSH_PROMISE or
2191 CONTINUATION frame without the END_HEADERS flag set. A recipient
2192 that observes violation of this rule MUST respond with a connection
2193 error (Section 5.4.1) of type PROTOCOL_ERROR.
2195 The CONTINUATION frame includes optional padding. Padding fields and
2196 flags are identical to those defined for DATA frames (Section 6.1).
2198 6.11. ALTSVC
2200 The ALTSVC frame (type=0xA) advertises the availability of an
2201 alternative service to the client. It can be sent at any time for an
2202 existing client-initiated stream or stream 0, and is intended to
2203 allow servers to load balance or otherwise segment traffic; see
2204 [ALT-SVC] for details (in particular, Section 2.4, which outlines
2205 client handling of alternative services).
2207 An ALTSVC frame on a client-initiated stream indicates that the
2208 conveyed alternative service is associated with the origin of that
2209 stream.
2211 An ALTSVC frame on stream 0 indicates that the conveyed alternative
2212 service is associated with the origin contained in the Origin field
2213 of the frame. An association with an origin that the client does not
2214 consider authoritative for the current connection MUST be ignored.
2216 0 1 2 3
2217 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
2218 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2219 | Max-Age (32) |
2220 +-------------------------------+---------------+---------------+
2221 | Port (16) | Reserved (8) | Proto-Len (8) |
2222 +-------------------------------+---------------+---------------+
2223 | Protocol-ID (*) |
2224 +---------------+-----------------------------------------------+
2225 | Host-Len (8) | Host (*) ...
2226 +---------------+-----------------------------------------------+
2227 | Origin? (*) ...
2228 +---------------------------------------------------------------+
2230 ALTSVC Frame Payload
2232 The ALTSVC frame contains the following fields:
2234 Max-Age: An unsigned, 32-bit integer indicating the freshness
2235 lifetime of the alternative service association, as per [ALT-SVC],
2236 Section 2.2.
2238 Port: An unsigned, 16-bit integer indicating the port that the
2239 alternative service is available upon.
2241 Reserved: For future use. Senders MUST set these bits to '0', and
2242 recipients MUST ignore them.
2244 Proto-Len: An unsigned, 8-bit integer indicating the length, in
2245 octets, of the Protocol-ID field.
2247 Protocol-ID: A sequence of bytes (length determined by "Proto-Len")
2248 containing the ALPN protocol identifier of the alternative
2249 service.
2251 Host-Len: An unsigned, 8-bit integer indicating the length, in
2252 octets, of the Host field.
2254 Host: A sequence of characters (length determined by "Host-Len")
2255 containing an ASCII string indicating the host that the
2256 alternative service is available upon. An internationalized
2257 domain name [IDNA] MUST be expressed using A-labels.
2259 Origin: An optional sequence of characters (length determined by
2260 subtracting the length of all preceding fields from the frame
2261 length) containing the ASCII serialisation of an origin
2262 ([RFC6454], Section 6.2) that the alternate service is applicable
2263 to.
2265 The ALTSVC frame does not define any flags.
2267 The ALTSVC frame is intended for receipt by clients; a server that
2268 receives an ALTSVC frame MUST treat it as a connection error
2269 (Section 5.4.1) of type PROTOCOL_ERROR.
2271 The ALTSVC frame is processed hop-by-hop. An intermediary MUST NOT
2272 forward ALTSVC frames, though it can use the information contained in
2273 ALTSVC frames in forming new ALTSVC frames to send to its own
2274 clients.
2276 6.12. BLOCKED
2278 The BLOCKED frame (type=0xB) indicates that the sender is unable to
2279 send data due to a closed flow control window.
2281 [[anchor12: The BLOCKED frame is included in this draft version to
2282 facilitate experimentation. If the results of the experiment do not
2283 provide positive feedback, it could be removed.]]
2285 The BLOCKED frame is used to provide feedback about the performance
2286 of flow control for the purposes of performance tuning and debugging.
2287 The BLOCKED frame can be sent by a peer when flow controlled data
2288 cannot be sent due to the connection- or stream-level flow control.
2289 This frame MUST NOT be sent if there are other reasons preventing
2290 data from being sent, either a lack of available data, or the
2291 underlying transport being blocked.
2293 The BLOCKED frame is sent on the stream that is blocked, that is, the
2294 stream with a non-positive number of bytes available in the flow
2295 control window. A BLOCKED frame can be sent on stream 0x0 to
2296 indicate that connection-level flow control is blocked.
2298 An endpoint MUST NOT send any subsequent BLOCKED frames until the
2299 affected flow control window becomes positive. This means that
2300 WINDOW_UPDATE frames are received or SETTINGS_INITIAL_WINDOW_SIZE is
2301 increased before more BLOCKED frames can be sent.
2303 The BLOCKED frame defines no flags and contains no payload. A
2304 receiver MUST treat the receipt of a BLOCKED frame with a payload as
2305 a connection error (Section 5.4.1) of type FRAME_SIZE_ERROR.
2307 7. Error Codes
2309 Error codes are 32-bit fields that are used in RST_STREAM and GOAWAY
2310 frames to convey the reasons for the stream or connection error.
2312 Error codes share a common code space. Some error codes only apply
2313 to specific conditions and have no defined semantics in certain frame
2314 types.
2316 The following error codes are defined:
2318 NO_ERROR (0): The associated condition is not as a result of an
2319 error. For example, a GOAWAY might include this code to indicate
2320 graceful shutdown of a connection.
2322 PROTOCOL_ERROR (1): The endpoint detected an unspecific protocol
2323 error. This error is for use when a more specific error code is
2324 not available.
2326 INTERNAL_ERROR (2): The endpoint encountered an unexpected internal
2327 error.
2329 FLOW_CONTROL_ERROR (3): The endpoint detected that its peer violated
2330 the flow control protocol.
2332 SETTINGS_TIMEOUT (4): The endpoint sent a SETTINGS frame, but did
2333 not receive a response in a timely manner. See Settings
2334 Synchronization (Section 6.5.3).
2336 STREAM_CLOSED (5): The endpoint received a frame after a stream was
2337 half closed.
2339 FRAME_SIZE_ERROR (6): The endpoint received a frame that was larger
2340 than the maximum size that it supports.
2342 REFUSED_STREAM (7): The endpoint refuses the stream prior to
2343 performing any application processing, see Section 8.1.4 for
2344 details.
2346 CANCEL (8): Used by the endpoint to indicate that the stream is no
2347 longer needed.
2349 COMPRESSION_ERROR (9): The endpoint is unable to maintain the
2350 compression context for the connection.
2352 CONNECT_ERROR (10): The connection established in response to a
2353 CONNECT request (Section 8.3) was reset or abnormally closed.
2355 ENHANCE_YOUR_CALM (11): The endpoint detected that its peer is
2356 exhibiting a behavior over a given amount of time that has caused
2357 it to refuse to process further frames.
2359 INADEQUATE_SECURITY (12): The underlying transport has properties
2360 that do not meet the minimum requirements imposed by this document
2361 (see Section 9.2) or the endpoint.
2363 8. HTTP Message Exchanges
2365 HTTP/2 is intended to be as compatible as possible with current uses
2366 of HTTP. This means that, from the perspective of the server and
2367 client applications, the features of the protocol are unchanged. To
2368 achieve this, all request and response semantics are preserved,
2369 although the syntax of conveying those semantics has changed.
2371 Thus, the specification and requirements of HTTP/1.1 Semantics and
2372 Content [HTTP-p2], Conditional Requests [HTTP-p4], Range Requests
2373 [HTTP-p5], Caching [HTTP-p6] and Authentication [HTTP-p7] are
2374 applicable to HTTP/2. Selected portions of HTTP/1.1 Message Syntax
2375 and Routing [HTTP-p1], such as the HTTP and HTTPS URI schemes, are
2376 also applicable in HTTP/2, but the expression of those semantics for
2377 this protocol are defined in the sections below.
2379 8.1. HTTP Request/Response Exchange
2381 A client sends an HTTP request on a new stream, using a previously
2382 unused stream identifier (Section 5.1.1). A server sends an HTTP
2383 response on the same stream as the request.
2385 An HTTP message (request or response) consists of:
2387 1. one HEADERS frame, followed by zero or more CONTINUATION frames
2388 (containing the message headers; see [HTTP-p1], Section 3.2), and
2390 2. zero or more DATA frames (containing the message payload; see
2391 [HTTP-p1], Section 3.3), and
2393 3. optionally, one HEADERS frame, followed by zero or more
2394 CONTINUATION frames (containing the trailer-part, if present; see
2395 [HTTP-p1], Section 4.1.2).
2397 The last frame in the sequence bears an END_STREAM flag, though a
2398 HEADERS frame bearing the END_STREAM flag can be followed by
2399 CONTINUATION frames that carry any remaining portions of the header
2400 block.
2402 Other frames (from any stream) MUST NOT occur between either HEADERS
2403 frame and the following CONTINUATION frames (if present), nor between
2404 CONTINUATION frames.
2406 Otherwise, frames MAY be interspersed on the stream between these
2407 frames, but those frames do not carry HTTP semantics. In particular,
2408 HEADERS frames (and any CONTINUATION frames that follow) other than
2409 the first and optional last frames in this sequence do not carry HTTP
2410 semantics.
2412 Trailing header fields are carried in a header block that also
2413 terminates the stream. That is, a sequence starting with a HEADERS
2414 frame, followed by zero or more CONTINUATION frames, where the
2415 HEADERS frame bears an END_STREAM flag. Header blocks after the
2416 first that do not terminate the stream are not part of an HTTP
2417 request or response.
2419 An HTTP request/response exchange fully consumes a single stream. A
2420 request starts with the HEADERS frame that puts the stream into an
2421 "open" state and ends with a frame bearing END_STREAM, which causes
2422 the stream to become "half closed" for the client. A response starts
2423 with a HEADERS frame and ends with a frame bearing END_STREAM,
2424 optionally followed by CONTINUATION frames, which places the stream
2425 in the "closed" state.
2427 8.1.1. Informational Responses
2429 The 1xx series of HTTP response status codes ([HTTP-p2], Section 6.2)
2430 are not supported in HTTP/2.
2432 The most common use case for 1xx is using an Expect header field with
2433 a "100-continue" token (colloquially, "Expect/continue") to indicate
2434 that the client expects a 100 (Continue) non-final response status
2435 code, receipt of which indicates that the client should continue
2436 sending the request body if it has not already done so.
2438 Typically, Expect/continue is used by clients wishing to avoid
2439 sending a large amount of data in a request body, only to have the
2440 request rejected by the origin server (thus leaving the connection
2441 potentially unusable).
2443 HTTP/2 does not enable the Expect/continue mechanism; if the server
2444 sends a final status code to reject the request, it can do so without
2445 making the underlying connection unusable.
2447 Note that this means HTTP/2 clients sending requests with bodies may
2448 waste at least one round trip of sent data when the request is
2449 rejected. This can be mitigated by restricting the amount of data
2450 sent for the first round trip by bandwidth-constrained clients, in
2451 anticipation of a final status code.
2453 Other defined 1xx status codes are not applicable to HTTP/2. For
2454 example, the semantics of 101 (Switching Protocols) aren't suitable
2455 to a multiplexed protocol. Likewise, 102 (Processing) is no longer
2456 necessary, because HTTP/2 has a separate means of keeping the
2457 connection alive.
2459 This difference between protocol versions necessitates special
2460 handling by intermediaries that translate between them:
2462 o An intermediary that gateways HTTP/1.1 to HTTP/2 MUST generate a
2463 100 (Continue) response if a received request includes and Expect
2464 header field with a "100-continue" token ([HTTP-p2], Section
2465 5.1.1), unless it can immediately generate a final status code.
2466 It MUST NOT forward the "100-continue" expectation in the request
2467 header fields.
2469 o An intermediary that gateways HTTP/2 to HTTP/1.1 MAY add an Expect
2470 header field with a "100-continue" expectation when forwarding a
2471 request that has a body; see [HTTP-p2], Section 5.1.1 for specific
2472 requirements.
2474 o An intermediary that gateways HTTP/2 to HTTP/1.1 MUST discard all
2475 other 1xx informational responses.
2477 8.1.2. Examples
2479 This section shows HTTP/1.1 requests and responses, with
2480 illustrations of equivalent HTTP/2 requests and responses.
2482 An HTTP GET request includes request header fields and no body and is
2483 therefore transmitted as a single HEADERS frame, followed by zero or
2484 more CONTINUATION frames containing the serialized block of request
2485 header fields. The HEADERS frame in the following has both the
2486 END_HEADERS and END_STREAM flags set; no CONTINUATION frames are
2487 sent:
2489 GET /resource HTTP/1.1 HEADERS
2490 Host: example.org ==> + END_STREAM
2491 Accept: image/jpeg + END_HEADERS
2492 :method = GET
2493 :scheme = https
2494 :path = /resource
2495 host = example.org
2496 accept = image/jpeg
2498 Similarly, a response that includes only response header fields is
2499 transmitted as a HEADERS frame (again, followed by zero or more
2500 CONTINUATION frames) containing the serialized block of response
2501 header fields.
2503 HTTP/1.1 304 Not Modified HEADERS
2504 ETag: "xyzzy" ==> + END_STREAM
2505 Expires: Thu, 23 Jan ... + END_HEADERS
2506 :status = 304
2507 etag: "xyzzy"
2508 expires: Thu, 23 Jan ...
2510 An HTTP POST request that includes request header fields and payload
2511 data is transmitted as one HEADERS frame, followed by zero or more
2512 CONTINUATION frames containing the request header fields, followed by
2513 one or more DATA frames, with the last CONTINUATION (or HEADERS)
2514 frame having the END_HEADERS flag set and the final DATA frame having
2515 the END_STREAM flag set:
2517 POST /resource HTTP/1.1 HEADERS
2518 Host: example.org ==> - END_STREAM
2519 Content-Type: image/jpeg - END_HEADERS
2520 Content-Length: 123 :method = POST
2521 :path = /resource
2522 {binary data} content-type = image/jpeg
2524 CONTINUATION
2525 + END_HEADERS
2526 :authority = example.org
2527 :scheme = https
2528 content-length = 123
2530 DATA
2531 + END_STREAM
2532 {binary data}
2534 Note that data contributing to any given header field could be spread
2535 between header block fragments. The allocation of header fields to
2536 frames in this example is illustrative only.
2538 A response that includes header fields and payload data is
2539 transmitted as a HEADERS frame, followed by zero or more CONTINUATION
2540 frames, followed by one or more DATA frames, with the last DATA frame
2541 in the sequence having the END_STREAM flag set:
2543 HTTP/1.1 200 OK HEADERS
2544 Content-Type: image/jpeg ==> - END_STREAM
2545 Content-Length: 123 + END_HEADERS
2546 :status = 200
2547 {binary data} content-type = image/jpeg
2548 content-length = 123
2550 DATA
2551 + END_STREAM
2552 {binary data}
2554 Trailing header fields are sent as a header block after both the
2555 request or response header block and all the DATA frames have been
2556 sent. The HEADERS frame starting the trailers header block has the
2557 END_STREAM flag set.
2559 HTTP/1.1 200 OK HEADERS
2560 Content-Type: image/jpeg ==> - END_STREAM
2561 Transfer-Encoding: chunked + END_HEADERS
2562 Trailer: Foo :status = 200
2563 content-length = 123
2564 123 content-type = image/jpeg
2565 {binary data} trailer = Foo
2566 0
2567 Foo: bar DATA
2568 - END_STREAM
2569 {binary data}
2571 HEADERS
2572 + END_STREAM
2573 + END_HEADERS
2574 foo: bar
2576 8.1.3. HTTP Header Fields
2578 HTTP header fields carry information as a series of key-value pairs.
2579 For a listing of registered HTTP headers, see the Message Header
2580 Field Registry maintained at
2581 .
2583 While HTTP/1.x used the message start-line (see [HTTP-p1], Section
2584 3.1) to convey the target URI and method of the request, and the
2585 status code for the response, HTTP/2 uses special pseudo-headers
2586 beginning with ":" for these tasks.
2588 Just as in HTTP/1.x, header field names are strings of ASCII
2589 characters that are compared in a case-insensitive fashion. However,
2590 header field names MUST be converted to lowercase prior to their
2591 encoding in HTTP/2. A request or response containing uppercase
2592 header field names MUST be treated as malformed (Section 8.1.3.5).
2594 HTTP/2 does not use the Connection header field to indicate "hop-by-
2595 hop" header fields; in this protocol, connection-specific metadata is
2596 conveyed by other means. As such, a HTTP/2 message containing
2597 Connection MUST be treated as malformed (Section 8.1.3.5).
2599 This means that an intermediary transforming an HTTP/1.x message to
2600 HTTP/2 will need to remove any header fields nominated by the
2601 Connection header field, along with the Connection header field
2602 itself. Such intermediaries SHOULD also remove other connection-
2603 specific header fields, such as Keep-Alive, Proxy-Connection,
2604 Transfer-Encoding and Upgrade, even if they are not nominated by
2605 Connection.
2607 One exception to this is the TE header field, which MAY be present in
2608 an HTTP/2 request, but when it is MUST NOT contain any value other
2609 than "trailers".
2611 Note: HTTP/2 purposefully does not support upgrade to another
2612 protocol. The handshake methods described in Section 3 are
2613 believed sufficient to negotiate the use of alternative protocols.
2615 8.1.3.1. Request Header Fields
2617 HTTP/2 defines a number of header fields starting with a colon ':'
2618 character that carry information about the request target:
2620 o The ":method" header field includes the HTTP method ([HTTP-p2],
2621 Section 4).
2623 o The ":scheme" header field includes the scheme portion of the
2624 target URI ([RFC3986], Section 3.1).
2626 ":scheme" is not restricted to "http" and "https" schemed URIs. A
2627 proxy or gateway can translate requests for non-HTTP schemes,
2628 enabling the use of HTTP to interact with non-HTTP services.
2630 o The ":authority" header field includes the authority portion of
2631 the target URI ([RFC3986], Section 3.2). The authority MUST NOT
2632 include the deprecated "userinfo" subcomponent for "http" or
2633 "https" schemed URIs.
2635 To ensure that the HTTP/1.1 request line can be reproduced
2636 accurately, this header field MUST be omitted when translating
2637 from an HTTP/1.1 request that has a request target in origin or
2638 asterisk form (see [HTTP-p1], Section 5.3). Clients that generate
2639 HTTP/2 requests directly SHOULD instead omit the "Host" header
2640 field. An intermediary that converts an HTTP/2 request to
2641 HTTP/1.1 MUST create a "Host" header field if one is not present
2642 in a request by copying the value of the ":authority" header
2643 field.
2645 o The ":path" header field includes the path and query parts of the
2646 target URI (the "path-absolute" production from [RFC3986] and
2647 optionally a '?' character followed by the "query" production, see
2648 [RFC3986], Section 3.3 and [RFC3986], Section 3.4). This field
2649 MUST NOT be empty; URIs that do not contain a path component MUST
2650 include a value of '/', unless the request is an OPTIONS request
2651 in asterisk form, in which case the ":path" header field MUST
2652 include '*'.
2654 All HTTP/2 requests MUST include exactly one valid value for the
2655 ":method", ":scheme", and ":path" header fields, unless this is a
2656 CONNECT request (Section 8.3). An HTTP request that omits mandatory
2657 header fields is malformed (Section 8.1.3.5).
2659 Header field names that start with a colon are only valid in the
2660 HTTP/2 context. These are not HTTP header fields. Implementations
2661 MUST NOT generate header fields that start with a colon, but they
2662 MUST ignore any header field that starts with a colon. In
2663 particular, header fields with names starting with a colon MUST NOT
2664 be exposed as HTTP header fields.
2666 HTTP/2 does not define a way to carry the version identifier that is
2667 included in the HTTP/1.1 request line.
2669 8.1.3.2. Response Header Fields
2671 A single ":status" header field is defined that carries the HTTP
2672 status code field (see [HTTP-p2], Section 6). This header field MUST
2673 be included in all responses, otherwise the response is malformed
2674 (Section 8.1.3.5).
2676 HTTP/2 does not define a way to carry the version or reason phrase
2677 that is included in an HTTP/1.1 status line.
2679 8.1.3.3. Header Field Ordering
2681 HTTP Header Compression [COMPRESSION] does not preserve the order of
2682 header fields, because the relative order of header fields with
2683 different names is not important. However, the same header field can
2684 be repeated to form a list (see [HTTP-p1], Section 3.2.2), where the
2685 relative order of header field values is significant. This
2686 repetition can occur either as a single header field with a comma-
2687 separated list of values, or as several header fields with a single
2688 value, or any combination thereof. Therefore, in the latter case,
2689 ordering needs to be preserved before compression takes place.
2691 To preserve the order of multiple occurrences of a header field with
2692 the same name, its ordered values are concatenated into a single
2693 value using a zero-valued octet (0x0) to delimit them.
2695 After decompression, header fields that have values containing zero
2696 octets (0x0) MUST be split into multiple header fields before being
2697 processed.
2699 For example, the following HTTP/1.x header block:
2701 Content-Type: text/html
2702 Cache-Control: max-age=60, private
2703 Cache-Control: must-revalidate
2705 contains three Cache-Control directives; two in the first Cache-
2706 Control header field, and the last one in the second Cache-Control
2707 field. Before compression, they would need to be converted to a form
2708 similar to this (with 0x0 represented as "\0"):
2710 cache-control: max-age=60, private\0must-revalidate
2711 content-type: text/html
2713 Note here that the ordering between Content-Type and Cache-Control is
2714 not preserved, but the relative ordering of the Cache-Control
2715 directives -- as well as the fact that the first two were comma-
2716 separated, while the last was on a different line -- is.
2718 Header fields containing multiple values MUST be concatenated into a
2719 single value unless the ordering of that header field is known to be
2720 insignificant.
2722 The special case of "set-cookie" - which does not form a comma-
2723 separated list, but can have multiple values - does not depend on
2724 ordering. The "set-cookie" header field MAY be encoded as multiple
2725 header field values, or as a single concatenated value.
2727 8.1.3.4. Compressing the Cookie Header Field
2729 The Cookie header field [COOKIE] can carry a significant amount of
2730 redundant data.
2732 The Cookie header field uses a semi-colon (";") to delimit cookie-
2733 pairs (or "crumbs"). This header field doesn't follow the list
2734 construction rules in HTTP (see [HTTP-p1], Section 3.2.2), which
2735 prevents cookie-pairs from being separated into different name-value
2736 pairs. This can significantly reduce compression efficiency as
2737 individual cookie-pairs are updated.
2739 To allow for better compression efficiency, the Cookie header field
2740 MAY be split into separate header fields, each with one or more
2741 cookie-pairs. If there are multiple Cookie header fields after
2742 decompression, these MUST be concatenated into a single octet string
2743 using the two octet delimiter of 0x3B, 0x20 (the ASCII string "; ").
2745 The Cookie header field MAY be split using a zero octet (0x0), as
2746 defined in Section 8.1.3.3. When decoding, zero octets MUST be
2747 replaced with the cookie delimiter ("; ").
2749 8.1.3.5. Malformed Messages
2751 A malformed request or response is one that uses a valid sequence of
2752 HTTP/2 frames, but is otherwise invalid due to the presence of
2753 prohibited header fields, the absence of mandatory header fields, or
2754 the inclusion of uppercase header field names.
2756 A request or response that includes an entity body can include a
2757 "content-length" header field. A request or response is also
2758 malformed if the value of a "content-length" header field does not
2759 equal the sum of the uncompressed DATA frame payload lengths that
2760 form the body.
2762 Note: The "Content-Length" header field is set to the length of an
2763 entity body. Compression of DATA frames is a function of HTTP/2
2764 that does not alter entities.
2766 Intermediaries that process HTTP requests or responses (i.e., all
2767 intermediaries other than those acting as tunnels) MUST NOT forward a
2768 malformed request or response.
2770 Implementations that detect malformed requests or responses need to
2771 ensure that the stream ends. For malformed requests, a server MAY
2772 send an HTTP response prior to closing or resetting the stream.
2773 Clients MUST NOT accept a malformed response. Note that these
2774 requirements are intended to protect against several types of common
2775 attacks against HTTP; they are deliberately strict, because being
2776 permissive can expose implementations to these vulnerabilites.
2778 8.1.4. Request Reliability Mechanisms in HTTP/2
2780 In HTTP/1.1, an HTTP client is unable to retry a non-idempotent
2781 request when an error occurs, because there is no means to determine
2782 the nature of the error. It is possible that some server processing
2783 occurred prior to the error, which could result in undesirable
2784 effects if the request were reattempted.
2786 HTTP/2 provides two mechanisms for providing a guarantee to a client
2787 that a request has not been processed:
2789 o The GOAWAY frame indicates the highest stream number that might
2790 have been processed. Requests on streams with higher numbers are
2791 therefore guaranteed to be safe to retry.
2793 o The REFUSED_STREAM error code can be included in a RST_STREAM
2794 frame to indicate that the stream is being closed prior to any
2795 processing having occurred. Any request that was sent on the
2796 reset stream can be safely retried.
2798 Requests that have not been processed have not failed; clients MAY
2799 automatically retry them, even those with non-idempotent methods.
2801 A server MUST NOT indicate that a stream has not been processed
2802 unless it can guarantee that fact. If frames that are on a stream
2803 are passed to the application layer for any stream, then
2804 REFUSED_STREAM MUST NOT be used for that stream, and a GOAWAY frame
2805 MUST include a stream identifier that is greater than or equal to the
2806 given stream identifier.
2808 In addition to these mechanisms, the PING frame provides a way for a
2809 client to easily test a connection. Connections that remain idle can
2810 become broken as some middleboxes (for instance, network address
2811 translators, or load balancers) silently discard connection bindings.
2812 The PING frame allows a client to safely test whether a connection is
2813 still active without sending a request.
2815 8.2. Server Push
2817 HTTP/2 enables a server to pre-emptively send (or "push") one or more
2818 associated responses to a client in response to a single request.
2819 This feature becomes particularly helpful when the server knows the
2820 client will need to have those responses available in order to fully
2821 process the response to the original request.
2823 Pushing additional responses is optional, and is negotiated between
2824 individual endpoints. The SETTINGS_ENABLE_PUSH setting can be set to
2825 0 to indicate that server push is disabled.
2827 Because pushing responses is effectively hop-by-hop, an intermediary
2828 could receive pushed responses from the server and choose not to
2829 forward those on to the client. In other words, how to make use of
2830 the pushed responses is up to that intermediary. Equally, the
2831 intermediary might choose to push additional responses to the client,
2832 without any action taken by the server.
2834 A client cannot push. Thus, servers MUST treat the receipt of a
2835 PUSH_PROMISE frame as a connection error (Section 5.4.1) of type
2836 PROTOCOL_ERROR. Clients MUST reject any attempt to change the
2837 SETTINGS_ENABLE_PUSH setting to a value other than "0" by treating
2838 the message as a connection error (Section 5.4.1) of type
2839 PROTOCOL_ERROR.
2841 A server can only push responses that are cacheable (see [HTTP-p6],
2842 Section 3); promised requests MUST be safe (see [HTTP-p2], Section
2843 4.2.1) and MUST NOT include a request body.
2845 8.2.1. Push Requests
2847 Server push is semantically equivalent to a server responding to a
2848 request; however, in this case that request is also sent by the
2849 server, as a PUSH_PROMISE frame.
2851 The PUSH_PROMISE frame includes a header block that contains a
2852 complete set of request header fields that the server attributes to
2853 the request. It is not possible to push a response to a request that
2854 includes a request body.
2856 Pushed responses are always associated with an explicit request from
2857 the client. The PUSH_PROMISE frames sent by the server are sent on
2858 that explicit request's stream. The PUSH_PROMISE frame also includes
2859 a promised stream identifier, chosen from the stream identifiers
2860 available to the server (see Section 5.1.1).
2862 The header fields in PUSH_PROMISE and any subsequent CONTINUATION
2863 frames MUST be a valid and complete set of request header fields
2864 (Section 8.1.3.1). The server MUST include a method in the ":method"
2865 header field that is safe and cacheable. If a client receives a
2866 PUSH_PROMISE that does not include a complete and valid set of header
2867 fields, or the ":method" header field identifies a method that is not
2868 safe, it MUST respond with a stream error (Section 5.4.2) of type
2869 PROTOCOL_ERROR.
2871 The server SHOULD send PUSH_PROMISE (Section 6.6) frames prior to
2872 sending any frames that reference the promised responses. This
2873 avoids a race where clients issue requests prior to receiving any
2874 PUSH_PROMISE frames.
2876 For example, if the server receives a request for a document
2877 containing embedded links to multiple image files, and the server
2878 chooses to push those additional images to the client, sending push
2879 promises before the DATA frames that contain the image links ensures
2880 that the client is able to see the promises before discovering
2881 embedded links. Similarly, if the server pushes responses referenced
2882 by the header block (for instance, in Link header fields), sending
2883 the push promises before sending the header block ensures that
2884 clients do not request them.
2886 PUSH_PROMISE frames MUST NOT be sent by the client. PUSH_PROMISE
2887 frames can be sent by the server on any stream that was opened by the
2888 client. They MUST be sent on a stream that is in either the "open"
2889 or "half closed (remote)" state to the server. PUSH_PROMISE frames
2890 are interspersed with the frames that comprise a response, though
2891 they cannot be interspersed with HEADERS and CONTINUATION frames that
2892 comprise a single header block.
2894 8.2.2. Push Responses
2896 After sending the PUSH_PROMISE frame, the server can begin delivering
2897 the pushed response as a response (Section 8.1.3.2) on a server-
2898 initiated stream that uses the promised stream identifier. The
2899 server uses this stream to transmit an HTTP response, using the same
2900 sequence of frames as defined in Section 8.1. This stream becomes
2901 "half closed" to the client (Section 5.1) after the initial HEADERS
2902 frame is sent.
2904 Once a client receives a PUSH_PROMISE frame and chooses to accept the
2905 pushed response, the client SHOULD NOT issue any requests for the
2906 promised response until after the promised stream has closed.
2908 If the client determines, for any reason, that it does not wish to
2909 receive the pushed response from the server, or if the server takes
2910 too long to begin sending the promised response, the client can send
2911 an RST_STREAM frame, using either the CANCEL or REFUSED_STREAM codes,
2912 and referencing the pushed stream's identifier.
2914 A client can use the SETTINGS_MAX_CONCURRENT_STREAMS setting to limit
2915 the number of responses that can be concurrently pushed by a server.
2916 Advertising a SETTINGS_MAX_CONCURRENT_STREAMS value of zero disables
2917 server push by preventing the server from creating the necessary
2918 streams. This does not prohibit a server from sending PUSH_PROMISE
2919 frames; clients need to reset any promised streams that are not
2920 wanted.
2922 Clients receiving a pushed response MUST validate that the server is
2923 authorized to provide the response, see Section 10.1. For example, a
2924 server that offers a certificate for only the "example.com" DNS-ID or
2925 Common Name is not permitted to push a response for
2926 "https://www.example.org/doc".
2928 8.3. The CONNECT Method
2930 In HTTP/1.x, the pseudo-method CONNECT ([HTTP-p2], Section 4.3.6) is
2931 used to convert an HTTP connection into a tunnel to a remote host.
2932 CONNECT is primarily used with HTTP proxies to establish a TLS
2933 session with an origin server for the purposes of interacting with
2934 "https" resources.
2936 In HTTP/2, the CONNECT method is used to establish a tunnel over a
2937 single HTTP/2 stream to a remote host, for similar purposes. The
2938 HTTP header field mapping works as mostly as defined in Request
2939 Header Fields (Section 8.1.3.1), with a few differences.
2940 Specifically:
2942 o The ":method" header field is set to "CONNECT".
2944 o The ":scheme" and ":path" header fields MUST be omitted.
2946 o The ":authority" header field contains the host and port to
2947 connect to (equivalent to the authority-form of the request-target
2948 of CONNECT requests, see [HTTP-p1], Section 5.3).
2950 A proxy that supports CONNECT establishes a TCP connection [TCP] to
2951 the server identified in the ":authority" header field. Once this
2952 connection is successfully established, the proxy sends a HEADERS
2953 frame containing a 2xx series status code to the client, as defined
2954 in [HTTP-p2], Section 4.3.6.
2956 After the initial HEADERS frame sent by each peer, all subsequent
2957 DATA frames correspond to data sent on the TCP connection. The
2958 payload of any DATA frames sent by the client are transmitted by the
2959 proxy to the TCP server; data received from the TCP server is
2960 assembled into DATA frames by the proxy. Frame types other than DATA
2961 or stream management frames (RST_STREAM, WINDOW_UPDATE, and PRIORITY)
2962 MUST NOT be sent on a connected stream, and MUST be treated as a
2963 stream error (Section 5.4.2) if received.
2965 The TCP connection can be closed by either peer. The END_STREAM flag
2966 on a DATA frame is treated as being equivalent to the TCP FIN bit. A
2967 client is expected to send a DATA frame with the END_STREAM flag set
2968 after receiving a frame bearing the END_STREAM flag. A proxy that
2969 receives a DATA frame with the END_STREAM flag set sends the attached
2970 data with the FIN bit set on the last TCP segment. A proxy that
2971 receives a TCP segment with the FIN bit set sends a DATA frame with
2972 the END_STREAM flag set. Note that the final TCP segment or DATA
2973 frame could be empty.
2975 A TCP connection error is signaled with RST_STREAM. A proxy treats
2976 any error in the TCP connection, which includes receiving a TCP
2977 segment with the RST bit set, as a stream error (Section 5.4.2) of
2978 type CONNECT_ERROR. Correspondingly, a proxy MUST send a TCP segment
2979 with the RST bit set if it detects an error with the stream or the
2980 HTTP/2 connection.
2982 9. Additional HTTP Requirements/Considerations
2984 This section outlines attributes of the HTTP protocol that improve
2985 interoperability, reduce exposure to known security vulnerabilities,
2986 or reduce the potential for implementation variation.
2988 9.1. Connection Management
2990 HTTP/2 connections are persistent. For best performance, it is
2991 expected clients will not close connections until it is determined
2992 that no further communication with a server is necessary (for
2993 example, when a user navigates away from a particular web page), or
2994 until the server closes the connection.
2996 Clients SHOULD NOT open more than one HTTP/2 connection to a given
2997 destination, where a destination is the IP address and port that is
2998 derived from a URI, a selected alternative service [ALT-SVC], or a
2999 configured proxy. A client can create additional connections as
3000 replacements, either to replace connections that are near to
3001 exhausting the available stream identifier space (Section 5.1.1), or
3002 to replace connections that have encountered errors (Section 5.4.1).
3004 A client MAY open multiple connections to the same IP address and TCP
3005 port using different Server Name Indication [TLS-EXT] values or to
3006 provide different TLS client certificates, but SHOULD avoid creating
3007 multiple connections with the same configuration. [[anchor17: Need
3008 more text on how client certificates relate here, see issue #363.]]
3010 Clients MAY use a single server connection to send requests for URIs
3011 with multiple different authority components as long as the server is
3012 authoritative (Section 10.1).
3014 Servers are encouraged to maintain open connections for as long as
3015 possible, but are permitted to terminate idle connections if
3016 necessary. When either endpoint chooses to close the transport-level
3017 TCP connection, the terminating endpoint SHOULD first send a GOAWAY
3018 (Section 6.8) frame so that both endpoints can reliably determine
3019 whether previously sent frames have been processed and gracefully
3020 complete or terminate any necessary remaining tasks.
3022 9.2. Use of TLS Features
3024 Implementations of HTTP/2 MUST support TLS 1.2 [TLS12]. The general
3025 TLS usage guidance in [TLSBCP] SHOULD be followed, with some
3026 additional restrictions that are specific to HTTP/2.
3028 The TLS implementation MUST support the Server Name Indication (SNI)
3029 [TLS-EXT] extension to TLS. HTTP/2 clients MUST indicate the target
3030 domain name when negotiating TLS.
3032 The TLS implementation MUST disable compression. TLS compression can
3033 lead to the exposure of information that would not otherwise be
3034 revealed [RFC3749]. Generic compression is unnecessary since HTTP/2
3035 provides compression features that are more aware of context and
3036 therefore likely to be more appropriate for use for performance,
3037 security or other reasons.
3039 Implementations MUST negotiate - and therefore use - ephemeral cipher
3040 suites, such as ephemeral Diffie-Hellman (DHE) or the elliptic curve
3041 variant (ECDHE) with a minimum size of 2048 bits (DHE) or security
3042 level of 128 bits (ECDHE). Clients MUST accept DHE sizes of up to
3043 4096 bits.
3045 Implementations are encouraged not to negotiate TLS cipher suites
3046 with known vulnerabilities, such as [RC4].
3048 An implementation that negotiates a TLS connection that does not meet
3049 the requirements in this section, or any policy-based constraints,
3050 SHOULD NOT negotiate HTTP/2. Removing HTTP/2 protocols from
3051 consideration could result in the removal of all protocols from the
3052 set of protocols offered by the client. This causes protocol
3053 negotiation failure, as described in Section 3.2 of [TLSALPN].
3055 Due to implementation limitations, it might not be possible to fail
3056 TLS negotiation based on all of these requirements. An endpoint MUST
3057 terminate an HTTP/2 connection that is opened on a TLS session that
3058 does not meet these minimum requirements with a connection error
3059 (Section 5.4.1) of type INADEQUATE_SECURITY.
3061 9.3. GZip Content-Encoding
3063 Clients MUST support gzip compression for HTTP response bodies.
3064 Regardless of the value of the accept-encoding header field, a server
3065 MAY send responses with gzip encoding. A compressed response MUST
3066 still bear an appropriate content-encoding header field.
3068 This effectively changes the implicit value of the Accept-Encoding
3069 header field ([HTTP-p2], Section 5.3.4) from "identity" to "identity,
3070 gzip", however gzip encoding cannot be suppressed by including
3071 ";q=0". Intermediaries that perform translation from HTTP/2 to
3072 HTTP/1.1 MUST decompress payloads unless the request includes an
3073 Accept-Encoding value that includes "gzip".
3075 10. Security Considerations
3077 10.1. Server Authority
3079 A client is only able to accept HTTP/2 responses from servers that
3080 are authoritative for those resources. This is particularly
3081 important for server push (Section 8.2), where the client validates
3082 the PUSH_PROMISE before accepting the response.
3084 HTTP/2 relies on the HTTP/1.1 definition of authority for determining
3085 whether a server is authoritative in providing a given response, see
3086 [HTTP-p1], Section 9.1. This relies on local name resolution for the
3087 "http" URI scheme, and the offered server identity for the "https"
3088 scheme (see [RFC2818], Section 3).
3090 A client MUST NOT use, in any way, resources provided by a server
3091 that is not authoritative for those resources.
3093 10.2. Cross-Protocol Attacks
3095 In a cross-protocol attack, an attacker causes a client to initiate a
3096 transaction in one protocol toward a server that understands a
3097 different protocol. An attacker might be able to cause the
3098 transaction to appear as valid transaction in the second protocol.
3099 In combination with the capabilities of the web context, this can be
3100 used to interact with poorly protected servers in private networks.
3102 Completing a TLS handshake with an ALPN identifier for HTTP/2 can be
3103 considered sufficient. ALPN provides a positive indication that a
3104 server is willing to proceed with HTTP/2, which prevents attacks on
3105 other TLS-based protocols.
3107 The encryption in TLS makes it difficult for attackers to control the
3108 data which could be used in a cross-protocol attack on a cleartext
3109 protocol.
3111 The cleartext version of HTTP/2 has minimal protection against cross-
3112 protocol attacks. The connection preface (Section 3.5) contains a
3113 string that is designed to confuse HTTP/1.1 servers, but no special
3114 protection is offered for other protocols. A server that is willing
3115 to ignore parts of an HTTP/1.1 request containing an Upgrade header
3116 field could be exposed to a cross-protocol attack.
3118 10.3. Intermediary Encapsulation Attacks
3120 HTTP/2 header field names and values are encoded as sequences of
3121 octets with a length prefix. This enables HTTP/2 to carry any string
3122 of octets as the name or value of a header field. An intermediary
3123 that translates HTTP/2 requests or responses into HTTP/1.1 directly
3124 could permit the creation of corrupted HTTP/1.1 messages. An
3125 attacker might exploit this behavior to cause the intermediary to
3126 create HTTP/1.1 messages with illegal header fields, extra header
3127 fields, or even new messages that are entirely falsified.
3129 Header field names or values that contain characters not permitted by
3130 HTTP/1.1, including carriage return (U+000D) or line feed (U+000A)
3131 MUST NOT be translated verbatim by an intermediary, as stipulated in
3132 [HTTP-p1], Section 3.2.4.
3134 Translation from HTTP/1.x to HTTP/2 does not produce the same
3135 opportunity to an attacker. Intermediaries that perform translation
3136 to HTTP/2 MUST remove any instances of the "obs-fold" production from
3137 header field values.
3139 10.4. Cacheability of Pushed Responses
3141 Pushed responses do not have an explicit request from the client; the
3142 request is provided by the server in the PUSH_PROMISE frame.
3144 Caching responses that are pushed is possible based on the guidance
3145 provided by the origin server in the Cache-Control header field.
3146 However, this can cause issues if a single server hosts more than one
3147 tenant. For example, a server might offer multiple users each a
3148 small portion of its URI space.
3150 Where multiple tenants share space on the same server, that server
3151 MUST ensure that tenants are not able to push representations of
3152 resources that they do not have authority over. Failure to enforce
3153 this would allow a tenant to provide a representation that would be
3154 served out of cache, overriding the actual representation that the
3155 authoritative tenant provides.
3157 Pushed responses for which an origin server is not authoritative (see
3158 Section 10.1) are never cached or used.
3160 10.5. Denial of Service Considerations
3162 An HTTP/2 connection can demand a greater commitment of resources to
3163 operate than a HTTP/1.1 connection. The use of header compression
3164 and flow control depend on a commitment of resources for storing a
3165 greater amount of state. Settings for these features ensure that
3166 memory commitments for these features are strictly bounded.
3167 Processing capacity cannot be guarded in the same fashion.
3169 The SETTINGS frame can be abused to cause a peer to expend additional
3170 processing time. This might be done by pointlessly changing SETTINGS
3171 parameters, setting multiple undefined parameters, or changing the
3172 same setting multiple times in the same frame. WINDOW_UPDATE,
3173 PRIORITY, or BLOCKED frames can be abused to cause an unnecessary
3174 waste of resources. A server might erroneously issue ALTSVC frames
3175 for origins on which it cannot be authoritative to generate excess
3176 work for clients.
3178 Large numbers of small or empty frames can be abused to cause a peer
3179 to expend time processing frame headers. Note however that some uses
3180 are entirely legitimate, such as the sending of an empty DATA frame
3181 to end a stream.
3183 Header compression also offers some opportunities to waste processing
3184 resources; see [COMPRESSION] for more details on potential abuses.
3186 Limits in SETTINGS parameters cannot be reduced instantaneously,
3187 which leaves an endpoint exposed to behavior from a peer that could
3188 exceed the new limits. In particular, immediately after establishing
3189 a connection, limits set by a server are not known to clients and
3190 could be exceeded without being an obvious protocol violation.
3192 All these features - i.e., SETTINGS changes, small frames, header
3193 compression - have legitimate uses. These features become a burden
3194 only when they are used unnecessarily or to excess.
3196 An endpoint that doesn't monitor this behavior exposes itself to a
3197 risk of denial of service attack. Implementations SHOULD track the
3198 use of these features and set limits on their use. An endpoint MAY
3199 treat activity that is suspicious as a connection error
3200 (Section 5.4.1) of type ENHANCE_YOUR_CALM.
3202 10.6. Use of Compression
3204 HTTP/2 enables greater use of compression for both header fields
3205 (Section 4.3) and response bodies (Section 9.3). Compression can
3206 allow an attacker to recover secret data when it is compressed in the
3207 same context as data under attacker control.
3209 There are demonstrable attacks on compression that exploit the
3210 characteristics of the web (e.g., [BREACH]). The attacker induces
3211 multiple requests containing varying plaintext, observing the length
3212 of the resulting ciphertext in each, which reveals a shorter length
3213 when a guess about the secret is correct.
3215 Implementations communicating on a secure channel MUST NOT compress
3216 content that includes both confidential and attacker-controlled data
3217 unless separate compression dictionaries are used for each source of
3218 data. Compression MUST NOT be used if the source of data cannot be
3219 reliably determined.
3221 Intermediaries MUST NOT alter the compression of DATA frames unless
3222 additional information is available that allows the intermediary to
3223 identify the source of data. In particular, frames that are not
3224 compressed cannot be compressed, and frames that are separately
3225 compressed cannot be merged into a single frame. Compressed frames
3226 MAY be decompressed or split into multiple frames.
3228 Further considerations regarding the compression of header fields are
3229 described in [COMPRESSION].
3231 10.7. Use of Padding
3233 Padding within HTTP/2 is not intended as a replacement for general
3234 purpose padding, such as might be provided by TLS [TLS12]. Redundant
3235 padding could even be counterproductive. Correct application can
3236 depend on having specific knowledge of the data that is being padded.
3238 To mitigate attacks that rely on compression, disabling compression
3239 might be preferable to padding as a countermeasure.
3241 Padding can be used to obscure the exact size of frame content, and
3242 is provided to mitigate specific attacks within HTTP. For example,
3243 attacks where compressed content includes both attacker-controlled
3244 plaintext and secret data (see for example, [BREACH]).
3246 Use of padding can result in less protection than might seem
3247 immediately obvious. At best, padding only makes it more difficult
3248 for an attacker to infer length information by increasing the number
3249 of frames an attacker has to observe. Incorrectly implemented
3250 padding schemes can be easily defeated. In particular, randomized
3251 padding with a predictable distribution provides very little
3252 protection; or padding payloads to a fixed size exposes information
3253 as payload sizes cross the fixed size boundary, which could be
3254 possible if an attacker can control plaintext.
3256 Intermediaries SHOULD NOT remove padding, though an intermediary MAY
3257 remove padding and add differing amounts if the intent is to improve
3258 the protections padding affords.
3260 10.8. Privacy Considerations
3262 Several characteristics of HTTP/2 provide an observer an opportunity
3263 to correlate actions of a single client or server over time. This
3264 includes the value of settings, the manner in which flow control
3265 windows are managed, the way priorities are allocated to streams,
3266 timing of reactions to stimulus, and handling of any optional
3267 features.
3269 As far as this creates observable differences in behavior, they could
3270 be used as a basis for fingerprinting a specific client, as defined
3271 in .
3273 11. IANA Considerations
3275 A string for identifying HTTP/2 is entered into the "Application
3276 Layer Protocol Negotiation (ALPN) Protocol IDs" registry established
3277 in [TLSALPN].
3279 This document establishes a registry for error codes. This new
3280 registry is entered into a new "Hypertext Transfer Protocol (HTTP) 2
3281 Parameters" section.
3283 This document registers the "HTTP2-Settings" header field for use in
3284 HTTP.
3286 This document registers the "PRI" method for use in HTTP, to avoid
3287 collisions with the connection preface (Section 3.5).
3289 11.1. Registration of HTTP/2 Identification Strings
3291 This document creates two registrations for the identification of
3292 HTTP/2 in the "Application Layer Protocol Negotiation (ALPN) Protocol
3293 IDs" registry established in [TLSALPN].
3295 The "h2" string identifies HTTP/2 when used over TLS:
3297 Protocol: HTTP/2 over TLS
3299 Identification Sequence: 0x68 0x32 ("h2")
3301 Specification: This document (RFCXXXX)
3303 The "h2c" string identifies HTTP/2 when used over cleartext TCP:
3305 Protocol: HTTP/2 over TCP
3307 Identification Sequence: 0x68 0x32 0x63 ("h2c")
3309 Specification: This document (RFCXXXX)
3311 11.2. Error Code Registry
3313 This document establishes a registry for HTTP/2 error codes. The
3314 "HTTP/2 Error Code" registry manages a 32-bit space. The "HTTP/2
3315 Error Code" registry operates under the "Expert Review" policy
3316 [RFC5226].
3318 Registrations for error codes are required to include a description
3319 of the error code. An expert reviewer is advised to examine new
3320 registrations for possible duplication with existing error codes.
3321 Use of existing registrations is to be encouraged, but not mandated.
3323 New registrations are advised to provide the following information:
3325 Error Code: The 32-bit error code value.
3327 Name: A name for the error code. Specifying an error code name is
3328 optional.
3330 Description: A description of the conditions where the error code is
3331 applicable.
3333 Specification: An optional reference for a specification that
3334 defines the error code.
3336 An initial set of error code registrations can be found in Section 7.
3338 11.3. HTTP2-Settings Header Field Registration
3340 This section registers the "HTTP2-Settings" header field in the
3341 Permanent Message Header Field Registry [BCP90].
3343 Header field name: HTTP2-Settings
3345 Applicable protocol: http
3347 Status: standard
3349 Author/Change controller: IETF
3350 Specification document(s): Section 3.2.1 of this document
3352 Related information: This header field is only used by an HTTP/2
3353 client for Upgrade-based negotiation.
3355 11.4. PRI Method Registration
3357 This section registers the "PRI" method in the HTTP Method Registry
3358 [HTTP-p2].
3360 Method Name: PRI
3362 Safe No
3364 Idempotent No
3366 Specification document(s) Section 3.5 of this document
3368 Related information: This method is never used by an actual client.
3369 This method will appear to be used when an HTTP/1.1 server or
3370 intermediary attempts to parse an HTTP/2 connection preface.
3372 12. Acknowledgements
3374 This document includes substantial input from the following
3375 individuals:
3377 o Adam Langley, Wan-Teh Chang, Jim Morrison, Mark Nottingham, Alyssa
3378 Wilk, Costin Manolache, William Chan, Vitaliy Lvin, Joe Chan, Adam
3379 Barth, Ryan Hamilton, Gavin Peters, Kent Alstad, Kevin Lindsay,
3380 Paul Amer, Fan Yang, Jonathan Leighton (SPDY contributors).
3382 o Gabriel Montenegro and Willy Tarreau (Upgrade mechanism).
3384 o William Chan, Salvatore Loreto, Osama Mazahir, Gabriel Montenegro,
3385 Jitu Padhye, Roberto Peon, Rob Trace (Flow control).
3387 o Mark Nottingham, Julian Reschke, James Snell, Jeff Pinner, Mike
3388 Bishop, Herve Ruellan (Substantial editorial contributions).
3390 o Alexey Melnikov was an editor of this document during 2013.
3392 o A substantial proportion of Martin's contribution was supported by
3393 Microsoft during his employment there.
3395 13. References
3396 13.1. Normative References
3398 [ALT-SVC] Nottingham, M., McManus, P., and J. Reschke, "HTTP
3399 Alternative Services", draft-ietf-httpbis-alt-svc-01
3400 (work in progress), April 2014.
3402 [COMPRESSION] Ruellan, H. and R. Peon, "HPACK - Header Compression
3403 for HTTP/2", draft-ietf-httpbis-header-compression-07
3404 (work in progress), April 2014.
3406 [COOKIE] Barth, A., "HTTP State Management Mechanism",
3407 RFC 6265, April 2011.
3409 [GZIP] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and
3410 G. Randers-Pehrson, "GZIP file format specification
3411 version 4.3", RFC 1952, May 1996.
3413 [HTTP-p1] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext
3414 Transfer Protocol (HTTP/1.1): Message Syntax and
3415 Routing", draft-ietf-httpbis-p1-messaging-26 (work in
3416 progress), February 2014.
3418 [HTTP-p2] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext
3419 Transfer Protocol (HTTP/1.1): Semantics and Content",
3420 draft-ietf-httpbis-p2-semantics-26 (work in progress),
3421 February 2014.
3423 [HTTP-p4] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext
3424 Transfer Protocol (HTTP/1.1): Conditional Requests",
3425 draft-ietf-httpbis-p4-conditional-26 (work in
3426 progress), February 2014.
3428 [HTTP-p5] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke,
3429 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Range
3430 Requests", draft-ietf-httpbis-p5-range-26 (work in
3431 progress), February 2014.
3433 [HTTP-p6] Fielding, R., Ed., Nottingham, M., Ed., and J.
3434 Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1):
3435 Caching", draft-ietf-httpbis-p6-cache-26 (work in
3436 progress), February 2014.
3438 [HTTP-p7] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext
3439 Transfer Protocol (HTTP/1.1): Authentication",
3440 draft-ietf-httpbis-p7-auth-26 (work in progress),
3441 February 2014.
3443 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
3444 Requirement Levels", BCP 14, RFC 2119, March 1997.
3446 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
3448 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter,
3449 "Uniform Resource Identifier (URI): Generic Syntax",
3450 STD 66, RFC 3986, January 2005.
3452 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
3453 Encodings", RFC 4648, October 2006.
3455 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing
3456 an IANA Considerations Section in RFCs", BCP 26,
3457 RFC 5226, May 2008.
3459 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
3460 Specifications: ABNF", STD 68, RFC 5234, January 2008.
3462 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454,
3463 December 2011.
3465 [TCP] Postel, J., "Transmission Control Protocol", STD 7,
3466 RFC 793, September 1981.
3468 [TLS-EXT] Eastlake, D., "Transport Layer Security (TLS)
3469 Extensions: Extension Definitions", RFC 6066,
3470 January 2011.
3472 [TLS12] Dierks, T. and E. Rescorla, "The Transport Layer
3473 Security (TLS) Protocol Version 1.2", RFC 5246,
3474 August 2008.
3476 [TLSALPN] Friedl, S., Popov, A., Langley, A., and E. Stephan,
3477 "Transport Layer Security (TLS) Application Layer
3478 Protocol Negotiation Extension",
3479 draft-ietf-tls-applayerprotoneg-05 (work in progress),
3480 March 2014.
3482 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO
3483 10646", STD 63, RFC 3629, November 2003.
3485 13.2. Informative References
3487 [BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration
3488 Procedures for Message Header Fields", BCP 90,
3489 RFC 3864, September 2004.
3491 [BREACH] Gluck, Y., Harris, N., and A. Prado, "BREACH: Reviving
3492 the CRIME Attack", July 2013, .
3496 [IDNA] Klensin, J., "Internationalized Domain Names for
3497 Applications (IDNA): Definitions and Document
3498 Framework", RFC 5890, August 2010.
3500 [RC4] Rivest, R., "The RC4 encryption algorithm", RSA Data
3501 Security, Inc. , March 1992.
3503 [RFC1323] Jacobson, V., Braden, B., and D. Borman, "TCP
3504 Extensions for High Performance", RFC 1323, May 1992.
3506 [RFC3749] Hollenbeck, S., "Transport Layer Security Protocol
3507 Compression Methods", RFC 3749, May 2004.
3509 [TALKING] Huang, L-S., Chen, E., Barth, A., Rescorla, E., and C.
3510 Jackson, "Talking to Yourself for Fun and Profit",
3511 2011, .
3513 [TLSBCP] Sheffer, Y., Holz, R., and P. Saint-Andre,
3514 "Recommendations for Secure Use of TLS and DTLS",
3515 draft-sheffer-tls-bcp-02 (work in progress),
3516 February 2014.
3518 Appendix A. Change Log (to be removed by RFC Editor before publication)
3520 A.1. Since draft-ietf-httpbis-http2-11
3522 Added BLOCKED frame (at risk).
3524 Simplified priority scheme.
3526 Added DATA per-frame GZip compression.
3528 A.2. Since draft-ietf-httpbis-http2-10
3530 Changed "connection header" to "connection preface" to avoid
3531 confusion.
3533 Added dependency-based stream prioritization.
3535 Added "h2c" identifier to distinguish between cleartext and secured
3536 HTTP/2.
3538 Adding missing padding to PUSH_PROMISE.
3540 Integrate ALTSVC frame and supporting text.
3542 Dropping requirement on "deflate" Content-Encoding.
3544 Improving security considerations around use of compression.
3546 A.3. Since draft-ietf-httpbis-http2-09
3548 Adding padding for data frames.
3550 Renumbering frame types, error codes, and settings.
3552 Adding INADEQUATE_SECURITY error code.
3554 Updating TLS usage requirements to 1.2; forbidding TLS compression.
3556 Removing extensibility for frames and settings.
3558 Changing setting identifier size.
3560 Removing the ability to disable flow control.
3562 Changing the protocol identification token to "h2".
3564 Changing the use of :authority to make it optional and to allow
3565 userinfo in non-HTTP cases.
3567 Allowing split on 0x0 for Cookie.
3569 Reserved PRI method in HTTP/1.1 to avoid possible future collisions.
3571 A.4. Since draft-ietf-httpbis-http2-08
3573 Added cookie crumbling for more efficient header compression.
3575 Added header field ordering with the value-concatenation mechanism.
3577 A.5. Since draft-ietf-httpbis-http2-07
3579 Marked draft for implementation.
3581 A.6. Since draft-ietf-httpbis-http2-06
3583 Adding definition for CONNECT method.
3585 Constraining the use of push to safe, cacheable methods with no
3586 request body.
3588 Changing from :host to :authority to remove any potential confusion.
3590 Adding setting for header compression table size.
3592 Adding settings acknowledgement.
3594 Removing unnecessary and potentially problematic flags from
3595 CONTINUATION.
3597 Added denial of service considerations.
3599 A.7. Since draft-ietf-httpbis-http2-05
3601 Marking the draft ready for implementation.
3603 Renumbering END_PUSH_PROMISE flag.
3605 Editorial clarifications and changes.
3607 A.8. Since draft-ietf-httpbis-http2-04
3609 Added CONTINUATION frame for HEADERS and PUSH_PROMISE.
3611 PUSH_PROMISE is no longer implicitly prohibited if
3612 SETTINGS_MAX_CONCURRENT_STREAMS is zero.
3614 Push expanded to allow all safe methods without a request body.
3616 Clarified the use of HTTP header fields in requests and responses.
3617 Prohibited HTTP/1.1 hop-by-hop header fields.
3619 Requiring that intermediaries not forward requests with missing or
3620 illegal routing :-headers.
3622 Clarified requirements around handling different frames after stream
3623 close, stream reset and GOAWAY.
3625 Added more specific prohibitions for sending of different frame types
3626 in various stream states.
3628 Making the last received setting value the effective value.
3630 Clarified requirements on TLS version, extension and ciphers.
3632 A.9. Since draft-ietf-httpbis-http2-03
3634 Committed major restructuring atrocities.
3636 Added reference to first header compression draft.
3638 Added more formal description of frame lifecycle.
3640 Moved END_STREAM (renamed from FINAL) back to HEADERS/DATA.
3642 Removed HEADERS+PRIORITY, added optional priority to HEADERS frame.
3644 Added PRIORITY frame.
3646 A.10. Since draft-ietf-httpbis-http2-02
3648 Added continuations to frames carrying header blocks.
3650 Replaced use of "session" with "connection" to avoid confusion with
3651 other HTTP stateful concepts, like cookies.
3653 Removed "message".
3655 Switched to TLS ALPN from NPN.
3657 Editorial changes.
3659 A.11. Since draft-ietf-httpbis-http2-01
3661 Added IANA considerations section for frame types, error codes and
3662 settings.
3664 Removed data frame compression.
3666 Added PUSH_PROMISE.
3668 Added globally applicable flags to framing.
3670 Removed zlib-based header compression mechanism.
3672 Updated references.
3674 Clarified stream identifier reuse.
3676 Removed CREDENTIALS frame and associated mechanisms.
3678 Added advice against naive implementation of flow control.
3680 Added session header section.
3682 Restructured frame header. Removed distinction between data and
3683 control frames.
3685 Altered flow control properties to include session-level limits.
3687 Added note on cacheability of pushed resources and multiple tenant
3688 servers.
3690 Changed protocol label form based on discussions.
3692 A.12. Since draft-ietf-httpbis-http2-00
3694 Changed title throughout.
3696 Removed section on Incompatibilities with SPDY draft#2.
3698 Changed INTERNAL_ERROR on GOAWAY to have a value of 2 .
3701 Replaced abstract and introduction.
3703 Added section on starting HTTP/2.0, including upgrade mechanism.
3705 Removed unused references.
3707 Added flow control principles (Section 5.2.1) based on .
3710 A.13. Since draft-mbelshe-httpbis-spdy-00
3712 Adopted as base for draft-ietf-httpbis-http2.
3714 Updated authors/editors list.
3716 Added status note.
3718 Authors' Addresses
3720 Mike Belshe
3721 Twist
3723 EMail: mbelshe@chromium.org
3725 Roberto Peon
3726 Google, Inc
3728 EMail: fenix@google.com
3729 Martin Thomson (editor)
3730 Mozilla
3731 Suite 300
3732 650 Castro Street
3733 Mountain View, CA 94041
3734 US
3736 EMail: martin.thomson@gmail.com