idnits 2.17.1
draft-ietf-httpbis-http2-02.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
== Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD',
or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please
use uppercase 'NOT' together with RFC 2119 keywords (if that is what you
mean).
Found 'MUST not' in this paragraph:
The message is intentionally extensible for future information
which may improve client-server communications. The sender does not need
to send every type of ID/value. It must only send those for which it has
accurate values to convey. When multiple ID/value pairs are sent, they
should be sent in order of lowest id to highest id. A single SETTINGS
frame MUST not contain multiple values for the same ID. If the recipient
of a SETTINGS frame discovers multiple values for the same ID, it MUST
ignore all values except the first one.
== Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD',
or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please
use uppercase 'NOT' together with RFC 2119 keywords (if that is what you
mean).
Found 'MUST not' in this paragraph:
The Connection, Host, Keep-Alive, Proxy-Connection, and
Transfer-Encoding header fields are not valid and MUST not be sent.
== Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD',
or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please
use uppercase 'NOT' together with RFC 2119 keywords (if that is what you
mean).
Found 'MUST not' in this paragraph:
The Connection, Keep-Alive, Proxy-Connection, and Transfer-Encoding
header fields are not valid and MUST not be sent.
-- The document date (April 3, 2013) is 4040 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 (-26) exists of
draft-ietf-httpbis-p1-messaging-22
== Outdated reference: A later version (-26) exists of
draft-ietf-httpbis-p2-semantics-22
== Outdated reference: A later version (-26) exists of
draft-ietf-httpbis-p4-conditional-22
== Outdated reference: A later version (-26) exists of
draft-ietf-httpbis-p5-range-22
== Outdated reference: A later version (-26) exists of
draft-ietf-httpbis-p6-cache-22
== Outdated reference: A later version (-26) exists of
draft-ietf-httpbis-p7-auth-22
** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293)
** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126)
** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446)
-- Possible downref: Normative reference to a draft: ref. 'TLSNPN'
-- Obsolete informational reference (is this intentional?): RFC 1323
(Obsoleted by RFC 7323)
Summary: 3 errors (**), 0 flaws (~~), 10 warnings (==), 3 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 5, 2013 Google, Inc
6 M. Thomson, Ed.
7 Microsoft
8 A. Melnikov, Ed.
9 Isode Ltd
10 April 3, 2013
12 Hypertext Transfer Protocol version 2.0
13 draft-ietf-httpbis-http2-02
15 Abstract
17 This specification describes an optimised expression of the syntax of
18 the Hypertext Transfer Protocol (HTTP). The HTTP/2.0 encapsulation
19 enables more efficient transfer of representations by providing
20 compressed header fields, simultaneous requests, and also introduces
21 unsolicited push of representations from server to client.
23 This document is an alternative to, but does not obsolete the HTTP
24 message format. HTTP semantics remain unchanged.
26 Editorial Note (To be removed by RFC Editor)
28 Discussion of this draft takes place on the HTTPBIS working group
29 mailing list (ietf-http-wg@w3.org), which is archived at
30 .
32 Working Group information and related documents can be found at
33 (Wiki) and
34 (source code and issues
35 tracker).
37 The changes in this draft are summarized in Appendix A.1.
39 Status of This Memo
41 This Internet-Draft is submitted in full conformance with the
42 provisions of BCP 78 and BCP 79.
44 Internet-Drafts are working documents of the Internet Engineering
45 Task Force (IETF). Note that other groups may also distribute
46 working documents as Internet-Drafts. The list of current Internet-
47 Drafts is at http://datatracker.ietf.org/drafts/current/.
49 Internet-Drafts are draft documents valid for a maximum of six months
50 and may be updated, replaced, or obsoleted by other documents at any
51 time. It is inappropriate to use Internet-Drafts as reference
52 material or to cite them other than as "work in progress."
54 This Internet-Draft will expire on October 5, 2013.
56 Copyright Notice
58 Copyright (c) 2013 IETF Trust and the persons identified as the
59 document authors. All rights reserved.
61 This document is subject to BCP 78 and the IETF Trust's Legal
62 Provisions Relating to IETF Documents
63 (http://trustee.ietf.org/license-info) in effect on the date of
64 publication of this document. Please review these documents
65 carefully, as they describe your rights and restrictions with respect
66 to this document. Code Components extracted from this document must
67 include Simplified BSD License text as described in Section 4.e of
68 the Trust Legal Provisions and are provided without warranty as
69 described in the Simplified BSD License.
71 Table of Contents
73 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
74 1.1. Document Organization . . . . . . . . . . . . . . . . . . 5
75 1.2. Conventions and Terminology . . . . . . . . . . . . . . . 6
76 2. Starting HTTP/2.0 . . . . . . . . . . . . . . . . . . . . . . 7
77 2.1. HTTP/2.0 Version Identification . . . . . . . . . . . . . 7
78 2.2. Starting HTTP/2.0 for "http:" URIs . . . . . . . . . . . . 8
79 2.3. Starting HTTP/2.0 for "https:" URIs . . . . . . . . . . . 8
80 2.4. Starting HTTP/2.0 with Prior Knowledge . . . . . . . . . . 9
81 3. HTTP/2.0 Framing Layer . . . . . . . . . . . . . . . . . . . . 9
82 3.1. Session . . . . . . . . . . . . . . . . . . . . . . . . . 9
83 3.2. Session Header . . . . . . . . . . . . . . . . . . . . . . 9
84 3.3. Framing . . . . . . . . . . . . . . . . . . . . . . . . . 10
85 3.3.1. Frame Header . . . . . . . . . . . . . . . . . . . . . 10
86 3.3.2. Frame Processing . . . . . . . . . . . . . . . . . . . 11
87 3.4. Streams . . . . . . . . . . . . . . . . . . . . . . . . . 11
88 3.4.1. Stream Creation . . . . . . . . . . . . . . . . . . . 12
89 3.4.2. Stream priority . . . . . . . . . . . . . . . . . . . 12
90 3.4.3. Stream headers . . . . . . . . . . . . . . . . . . . . 13
91 3.4.4. Stream data exchange . . . . . . . . . . . . . . . . . 13
92 3.4.5. Stream half-close . . . . . . . . . . . . . . . . . . 13
93 3.4.6. Stream close . . . . . . . . . . . . . . . . . . . . . 13
94 3.5. Error Handling . . . . . . . . . . . . . . . . . . . . . . 14
95 3.5.1. Session Error Handling . . . . . . . . . . . . . . . . 14
96 3.5.2. Stream Error Handling . . . . . . . . . . . . . . . . 15
97 3.5.3. Error Codes . . . . . . . . . . . . . . . . . . . . . 15
98 3.6. Stream Flow Control . . . . . . . . . . . . . . . . . . . 16
99 3.6.1. Flow Control Principles . . . . . . . . . . . . . . . 16
100 3.6.2. Appropriate Use of Flow Control . . . . . . . . . . . 17
101 3.7. Frame Types . . . . . . . . . . . . . . . . . . . . . . . 18
102 3.7.1. DATA Frames . . . . . . . . . . . . . . . . . . . . . 18
103 3.7.2. HEADERS+PRIORITY . . . . . . . . . . . . . . . . . . . 18
104 3.7.3. RST_STREAM . . . . . . . . . . . . . . . . . . . . . . 18
105 3.7.4. SETTINGS . . . . . . . . . . . . . . . . . . . . . . . 19
106 3.7.5. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . . 22
107 3.7.6. PING . . . . . . . . . . . . . . . . . . . . . . . . . 23
108 3.7.7. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . . 23
109 3.7.8. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 24
110 3.7.9. WINDOW_UPDATE . . . . . . . . . . . . . . . . . . . . 25
111 3.7.10. Header Block . . . . . . . . . . . . . . . . . . . . . 28
112 4. HTTP Message Exchanges . . . . . . . . . . . . . . . . . . . . 28
113 4.1. Connection Management . . . . . . . . . . . . . . . . . . 28
114 4.1.1. Use of GOAWAY . . . . . . . . . . . . . . . . . . . . 29
115 4.2. HTTP Request/Response . . . . . . . . . . . . . . . . . . 29
116 4.2.1. HTTP Header Fields and HTTP/2.0 Headers . . . . . . . 29
117 4.2.2. Request . . . . . . . . . . . . . . . . . . . . . . . 29
118 4.2.3. Response . . . . . . . . . . . . . . . . . . . . . . . 31
119 4.3. Server Push Transactions . . . . . . . . . . . . . . . . . 32
120 4.3.1. Server implementation . . . . . . . . . . . . . . . . 33
121 4.3.2. Client implementation . . . . . . . . . . . . . . . . 34
122 5. Design Rationale and Notes . . . . . . . . . . . . . . . . . . 35
123 5.1. Separation of Framing Layer and Application Layer . . . . 35
124 5.2. Error handling - Framing Layer . . . . . . . . . . . . . . 35
125 5.3. One Connection Per Domain . . . . . . . . . . . . . . . . 36
126 5.4. Fixed vs Variable Length Fields . . . . . . . . . . . . . 36
127 5.5. Server Push . . . . . . . . . . . . . . . . . . . . . . . 36
128 6. Security Considerations . . . . . . . . . . . . . . . . . . . 37
129 6.1. Use of Same-origin constraints . . . . . . . . . . . . . . 37
130 6.2. Cross-Protocol Attacks . . . . . . . . . . . . . . . . . . 37
131 6.3. Cacheability of Pushed Resources . . . . . . . . . . . . . 37
132 7. Privacy Considerations . . . . . . . . . . . . . . . . . . . . 37
133 7.1. Long Lived Connections . . . . . . . . . . . . . . . . . . 38
134 7.2. SETTINGS frame . . . . . . . . . . . . . . . . . . . . . . 38
135 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 38
136 8.1. Frame Type Registry . . . . . . . . . . . . . . . . . . . 38
137 8.2. Error Code Registry . . . . . . . . . . . . . . . . . . . 39
138 8.3. Settings Registry . . . . . . . . . . . . . . . . . . . . 39
139 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 40
140 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 41
141 10.1. Normative References . . . . . . . . . . . . . . . . . . . 41
142 10.2. Informative References . . . . . . . . . . . . . . . . . . 42
143 Appendix A. Change Log (to be removed by RFC Editor before
144 publication) . . . . . . . . . . . . . . . . . . . . 42
146 A.1. Since draft-ietf-httpbis-http2-01 . . . . . . . . . . . . 42
147 A.2. Since draft-ietf-httpbis-http2-00 . . . . . . . . . . . . 43
148 A.3. Since draft-mbelshe-httpbis-spdy-00 . . . . . . . . . . . 43
150 1. Introduction
152 The Hypertext Transfer Protocol (HTTP) is a wildly successful
153 protocol. The HTTP/1.1 message encapsulation ([HTTP-p1], Section 3)
154 is optimized for implementation simplicity and accessibility, not
155 application performance. As such it has several characteristics that
156 have a negative overall effect on application performance.
158 The HTTP/1.1 encapsulation ensures that only one request can be
159 delivered at a time on a given connection. HTTP/1.1 pipelining,
160 which is not widely deployed, only partially addresses these
161 concerns. Clients that need to make multiple requests therefore use
162 commonly multiple connections to a server or servers in order to
163 reduce the overall latency of those requests. [[anchor1: Need to tune
164 the anti-pipelining comments here.]]
166 Furthermore, HTTP/1.1 header fields are represented in an inefficient
167 fashion, which, in addition to generating more or larger network
168 packets, can cause the small initial TCP window to fill more quickly
169 than is ideal. This results in excessive latency where multiple
170 requests are made on a new TCP connection.
172 This document defines an optimized mapping of the HTTP semantics to a
173 TCP connection. This optimization reduces the latency costs of HTTP
174 by allowing parallel requests on the same connection and by using an
175 efficient coding for HTTP header fields. Prioritization of requests
176 lets more important requests complete faster, further improving
177 application performance.
179 HTTP/2.0 applications have an improved impact on network congestion
180 due to the use of fewer TCP connections to achieve the same effect.
181 Fewer TCP connections compete more fairly with other flows. Long-
182 lived connections are also more able to take better advantage of the
183 available network capacity, rather than operating in the slow start
184 phase of TCP.
186 The HTTP/2.0 encapsulation also enables more efficient processing of
187 messages by providing efficient message framing. Processing of
188 header fields in HTTP/2.0 messages is more efficient (for entities
189 that process many messages).
191 1.1. Document Organization
193 The HTTP/2.0 Specification is split into three parts: starting
194 HTTP/2.0 (Section 2), which covers how a HTTP/2.0 is started; a
195 framing layer (Section 3), which multiplexes a TCP connection into
196 independent, length-prefixed frames; and an HTTP layer (Section 4),
197 which specifies the mechanism for overlaying HTTP request/response
198 pairs on top of the framing layer. While some of the framing layer
199 concepts are isolated from the HTTP layer, building a generic framing
200 layer has not been a goal. The framing layer is tailored to the
201 needs of the HTTP protocol and server push.
203 1.2. Conventions and Terminology
205 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
206 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
207 document are to be interpreted as described in RFC 2119 [RFC2119].
209 All numeric values are in network byte order. Values are unsigned
210 unless otherwise indicated. Literal values are provided in decimal
211 or hexadecimal as appropriate. Hexadecimal literals are prefixed
212 with "0x" to distinguish them from decimal literals.
214 The following terms are used:
216 client: The endpoint initiating the HTTP/2.0 session.
218 connection: A transport-level connection between two endpoints.
220 endpoint: Either the client or server of a connection.
222 frame: The smallest unit of communication, each containing a frame
223 header.
225 message: A complete sequence of frames.
227 receiver: An endpoint that is receiving frames.
229 sender: An endpoint that is transmitting frames.
231 server: The endpoint which did not initiate the HTTP/2.0 session.
233 session: A synonym for a connection.
235 session error: An error on the HTTP/2.0 session.
237 stream: A bi-directional flow of bytes across a virtual channel
238 within a HTTP/2.0 session.
240 stream error: An error on an individual HTTP/2.0 stream.
242 2. Starting HTTP/2.0
244 Just as HTTP/1.1 does, HTTP/2.0 uses the "http:" and "https:" URI
245 schemes. An HTTP/2.0-capable client is therefore required to
246 discover whether a server (or intermediary) supports HTTP/2.0.
248 Different discovery mechanisms are defined for "http:" and "https:"
249 URIs. Discovery for "http:" URIs is described in Section 2.2;
250 discovery for "https:" URIs is described in Section 2.3.
252 2.1. HTTP/2.0 Version Identification
254 HTTP/2.0 is identified using the string "HTTP/2.0". This
255 identification is used in the HTTP/1.1 Upgrade header field, in the
256 TLS-NPN [TLSNPN] [[anchor4: TBD]] field and other places where
257 protocol identification is required.
259 Negotiating "HTTP/2.0" implies the use of the transport, security,
260 framing and message semantics described in this document.
262 [[anchor5: Editor's Note: please remove the following text prior to
263 the publication of a final version of this document.]]
265 Only implementations of the final, published RFC can identify
266 themselves as "HTTP/2.0". Until such an RFC exists, implementations
267 MUST NOT identify themselves using "HTTP/2.0".
269 Examples and text throughout the rest of this document use "HTTP/2.0"
270 as a matter of editorial convenience only. Implementations of draft
271 versions MUST NOT identify using this string.
273 Implementations of draft versions of the protocol MUST add the string
274 "-draft-" and the corresponding draft number to the identifier before
275 the separator ('/'). For example, draft-ietf-httpbis-http2-03 is
276 identified using the string "HTTP-draft-03/2.0".
278 Non-compatible experiments that are based on these draft versions
279 MUST instead replace the string "draft" with a different identifier.
280 For example, an experimental implementation of packet mood-based
281 encoding based on draft-ietf-httpbis-http2-07 might identify itself
282 as "HTTP-emo-07/2.0". Note that any label MUST conform with the
283 "token" syntax defined in Section 3.2.6 of [HTTP-p1]. Experimenters
284 are encouraged to coordinate their experiments on the
285 ietf-http-wg@w3.org mailing list.
287 2.2. Starting HTTP/2.0 for "http:" URIs
289 A client that makes a request to an "http:" URI without prior
290 knowledge about support for HTTP/2.0 uses the HTTP Upgrade mechanism
291 (Section 6.7 of [HTTP-p1]). The client makes an HTTP/1.1 request
292 that includes an Upgrade header field identifying HTTP/2.0.
294 For example:
296 GET /default.htm HTTP/1.1
297 Host: server.example.com
298 Connection: Upgrade
299 Upgrade: HTTP/2.0
301 A server that does not support HTTP/2.0 can respond to the request as
302 though the Upgrade header field were absent:
304 HTTP/1.1 200 OK
305 Content-length: 243
306 Content-type: text/html
307 ...
309 A server that supports HTTP/2.0 can accept the upgrade with a 101
310 (Switching Protocols) status code. After the empty line that
311 terminates the 101 response, the server can begin sending HTTP/2.0
312 frames. These frames MUST include a response to the request that
313 initiated the Upgrade.
315 HTTP/1.1 101 Switching Protocols
316 Connection: Upgrade
317 Upgrade: HTTP/2.0
319 [ HTTP/2.0 session ...
321 Once the server returns the 101 response, both the client and the
322 server send a session header (Section 3.2).
324 2.3. Starting HTTP/2.0 for "https:" URIs
326 A client that makes a request to an "https:" URI without prior
327 knowledge about support for HTTP/2.0 uses TLS [RFC5246] with TLS-NPN
328 [TLSNPN] extension. [[anchor6: TBD, maybe ALPN]]
330 Once TLS negotiation is complete, both the client and the server send
331 a session header (Section 3.2).
333 2.4. Starting HTTP/2.0 with Prior Knowledge
335 A client can learn that a particular server supports HTTP/2.0 by
336 other means. A client MAY immediately send HTTP/2.0 frames to a
337 server that is known to support HTTP/2.0. This only affects the
338 resolution of "http:" URIs, servers supporting HTTP/2.0 are required
339 to support protocol negotiation in TLS [TLSNPN].
341 Prior support for HTTP/2.0 is not a strong signal that a given server
342 will support HTTP/2.0 for future sessions. It is possible for server
343 configurations to change or for configurations to differ between
344 instances in clustered server. Different "transparent"
345 intermediaries - intermediaries that are not explicitly selected by
346 either client or server - are another source of variability.
348 3. HTTP/2.0 Framing Layer
350 3.1. Session
352 The HTTP/2.0 session runs atop TCP ([RFC0793]). The client is the
353 TCP connection initiator.
355 HTTP/2.0 connections are persistent connections. For best
356 performance, it is expected that clients will not close open
357 connections until the user navigates away from all web pages
358 referencing a connection, or until the server closes the connection.
359 Servers are encouraged to leave connections open for as long as
360 possible, but can terminate idle connections if necessary. When
361 either endpoint closes the transport-level connection, it MUST first
362 send a GOAWAY (Section 3.7.7) frame so that the endpoints can
363 reliably determine if requests finished before the close.
365 3.2. Session Header
367 After opening a TCP connection and performing either an HTTP/1.1
368 Upgrade or TLS handshake, the client sends the client session header.
369 The server replies with a server session header.
371 The session header provides a final confirmation that both peers
372 agree to use the HTTP/2.0 protocol. The SETTINGS frame ensures that
373 client or server configuration is known as quickly as possible.
375 The client session header is the 25 byte sequence
376 0x464f4f202a20485454502f322e300d0a0d0a4241520d0a0d0a (the string "FOO
377 * HTTP/2.0\r\n\r\nBAR\r\n\r\n") followed by a SETTINGS frame
378 (Section 3.7.4). The client sends the client session header
379 immediately after receiving an HTTP/1.1 Upgrade, or after receiving a
380 TLS Finished message from the server.
382 The client session header is selected so that a large proportion
383 of HTTP/1.1 or HTTP/1.0 servers and intermediaries do not attempt
384 to process further frames. This doesn't address the concerns
385 raised in [TALKING].
387 The server session header is a SETTINGS frame (Section 3.7.4). The
388 server sends the server session header immediately after receiving
389 and validating the client session header.
391 The client sends requests immediately after sending the session
392 header, without waiting to receive a server session header. This
393 ensures that confirming session headers does not add latency.
395 Both client and server MUST close the connection if it does not begin
396 with a valid session header. A GOAWAY frame (Section 3.7.7) MAY be
397 omitted if it is clear that the peer is not using HTTP/2.0.
399 3.3. Framing
401 Once the connection is established, clients and servers exchange
402 HTTP/2.0 frames. Frames are the basic unit of communication.
404 3.3.1. Frame Header
406 HTTP/2.0 frames share a common header format. Frames have an 8 byte
407 header with between 0 and 65535 bytes of data.
409 0 1 2 3
410 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
411 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
412 | Length (16) | Type (8) | Flags (8) |
413 +-+-------------+---------------+-------------------------------+
414 |R| Stream Identifier (31) |
415 +-+-------------------------------------------------------------+
416 | Frame Data (0...) ...
417 +---------------------------------------------------------------+
419 Frame Header
421 The fields of the frame header are defined as:
423 Length: The 16-bit length of the frame payload in bytes. The length
424 of the frame header is not included in this sum.
426 Type: The 8-bit type of the frame. The frame type determines how
427 the remainder of the frame header and payload are interpreted.
428 Implementations MUST ignore frames that use types that they do not
429 support.
431 Flags: An 8-bit field reserved for flags. Bits that have undefined
432 semantics are reserved. The following flags are defined for all
433 frame types:
435 FINAL (0x1): Bit 1 (the least significant bit) indicates that
436 this is the last frame in a stream. This places the stream
437 into a half-closed state (Section 3.4.5). No further frames
438 follow in the direction of the carrying frame.
440 Frame types can define semantics for frame-specific flags.
442 R: A reserved 1-bit field. The semantics of this bit are not
443 defined.
445 Stream Identifier: A 31-bit stream identifier (see Section 3.4.1).
446 A value 0 is reserved for frames that are directed at the session
447 as a whole instead of a single stream.
449 Frame Data: Frames contain between 0 and 65535 bytes of data.
451 Reserved bits in the frame header MUST be set to zero when sending
452 and MUST be ignored when receiving frames, unless the semantics of
453 the bit are known.
455 3.3.2. Frame Processing
457 A frame of the maximum size might be too large for implementations
458 with limited resources to process. Implementations MAY choose to
459 support frames smaller than the maximum possible size. However,
460 implementations MUST be able to receive frames containing at least
461 8192 octets of payload.
463 An implementation MUST immediately close a stream if it is unable to
464 process a frame related to that stream due to it exceeding a size
465 limit. The implementation MUST send a RST_STREAM frame
466 (Section 3.7.3) containing FRAME_TOO_LARGE error code if the frame
467 size limit is exceeded.
469 [[anchor9: : Need a
470 way to signal the maximum frame size; no way to RST_STREAM on non-
471 stream-related frames.]]
473 3.4. Streams
475 Streams are independent sequences of bi-directional data divided into
476 frames with several properties:
478 o Streams can be created by either the client or server.
480 o Streams optionally carry a set of name-value header pairs.
482 o Streams can concurrently send data interleaved with other streams.
484 o Streams can be established and used unilaterally.
486 o Streams can be cancelled.
488 3.4.1. Stream Creation
490 Use of streams does not require negotiation. A stream is not
491 created, streams are used by sending a frame on the stream.
493 Streams are identified by a 31-bit numeric identifier. Streams
494 initiated by a client use odd numbered stream identifiers. Streams
495 initiated by the server use odd numbered stream identifiers. A
496 stream identifier of zero MUST NOT be used to create a new stream.
498 The stream identifier of a new stream MUST be greater than all other
499 streams from that endpoint, unless the stream identifier was
500 previously reserved (such as the promised stream identifier in a
501 PUSH_PROMISE (Section 3.7.5) frame). An endpoint that receives an
502 unexpected stream identifier MUST treat this as a session error
503 (Section 3.5.1) of type PROTOCOL_ERROR.
505 A long-lived session can result in available stream identifiers being
506 exhausted. An endpoint that is unable to create a new stream
507 identifier can establish a new session for any new streams.
509 An endpoint cannot prevent the creation of a new stream, but it can
510 request the early termination of an unwanted stream. Upon receipt of
511 a frame, the recipient can terminate the corresponding stream by
512 sending a stream error (Section 3.5.2) of type REFUSED_STREAM. This
513 cannot prevent the initiating endpoint from sending frames for that
514 stream prior to receiving this request.
516 3.4.2. Stream priority
518 The creator of a stream assigns a priority for that stream. Priority
519 is represented as a 31 bit integer. 0 represents the highest priority
520 and 2^31-1 represents the lowest priority.
522 The sender and recipient SHOULD use best-effort to process streams in
523 the order of highest priority to lowest priority. [[anchor11: ED:
524 toothless, useless "SHOULD": reword]]
526 3.4.3. Stream headers
528 Streams carry optional sets of header fields which carry metadata
529 about the stream. After the stream has been created, and as long as
530 the sender is not closed (Section 3.4.6) or half-closed
531 (Section 3.4.5), each side may send HEADERS frame(s) containing the
532 header data. Header data can be sent in multiple HEADERS frames, and
533 HEADERS frames may be interleaved with data frames.
535 3.4.4. Stream data exchange
537 Once a stream is created, it can be used to send arbitrary amounts of
538 data. Generally this means that a series of data frames will be sent
539 on the stream until a frame containing the FINAL flag (Section 3.3.1)
540 is set. Once the FINAL flag has been set on any frame, the stream is
541 considered to be half-closed.
543 3.4.5. Stream half-close
545 When one side of the stream sends a frame with the FINAL flag set,
546 the stream is half-closed from that endpoint. The sender of the
547 FINAL flag MUST NOT send further frames on that stream. When both
548 sides have half-closed, the stream is closed.
550 An endpoint MUST treat the receipt of a data frame on a half-closed
551 stream as a stream error (Section 3.5.2) of type STREAM_CLOSED.
553 Streams that have never received packets can be considered to be
554 half-closed in the direction that is silent. This allows either peer
555 to create a unidirectional stream, which does not require an explicit
556 close from the peer that does not transmit frames.
558 3.4.6. Stream close
560 Streams can be terminated in the following ways:
562 Normal termination: Normal stream termination occurs when both
563 sender and recipient have half-closed the stream by sending a
564 frame containing a FINAL flag (Section 3.3.1).
566 Half-close on unidirectional stream: A stream that only has frames
567 sent in one direction can be tentatively considered to be closed
568 once a frame containing a FINAL flag is sent. The active sender
569 on the stream MUST be prepared to receive frames after closing the
570 stream.
572 Abrupt termination: Either the peer can send a RST_STREAM control
573 frame at any time to terminate an active stream. RST_STREAM
574 contains an error code to indicate the reason for termination. A
575 RST_STREAM indicates that the sender will transmit no further data
576 on the stream and that the receiver is requested to cease
577 transmission.
579 The sender of a RST_STREAM frame MUST allow for frames that have
580 already been sent by the peer prior to the RST_STREAM being
581 processed. If in-transit frames alter session state, these frames
582 cannot be safely discarded. See Stream Error Handling
583 (Section 3.5.2) for more details.
585 TCP connection teardown: If the TCP connection is torn down while
586 un-closed streams exist, then the endpoint must assume that the
587 stream was abnormally interrupted and may be incomplete.
589 If an endpoint receives a data frame after the stream is closed, it
590 MAY send a RST_STREAM to the sender with the status PROTOCOL_ERROR.
592 3.5. Error Handling
594 HTTP/2.0 framing permits two classes of error:
596 o An error condition that renders the entire session unusable is a
597 session error.
599 o An error in an individual stream is a stream error.
601 3.5.1. Session Error Handling
603 A session error is any error which prevents further processing of the
604 framing layer or which corrupts any session state.
606 An endpoint that encounters a session error MUST first send a GOAWAY
607 (Section 3.7.7) frame with the stream identifier of the last stream
608 that it successfully received from its peer. The GOAWAY frame
609 includes an error code that indicates why the session is terminating.
610 After sending the GOAWAY frame, the endpoint MUST close the TCP
611 connection.
613 It is possible that the GOAWAY will not be reliably received by the
614 receiving endpoint. In the event of a session error, GOAWAY only
615 provides a best-effort attempt to communicate with the peer about why
616 the session is going down.
618 An endpoint can end a session at any time. In particular, an
619 endpoint MAY choose to treat a stream error as a session error if the
620 error is recurrent. Endpoints SHOULD send a GOAWAY frame when ending
621 a session, as long as circumstances permit it.
623 3.5.2. Stream Error Handling
625 A stream error is an error related to a specific stream identifier
626 that does not affect processing of other streams at the framing
627 layer.
629 An endpoint that detects a stream error sends a RST_STREAM
630 (Section 3.7.3) frame that contains the stream identifier of the
631 stream where the error occurred. The RST_STREAM frame includes an
632 error code that indicates the type of error.
634 A RST_STREAM is the last frame that an endpoint can send on a stream.
635 The peer that sends the RST_STREAM frame MUST be prepared to receive
636 any frames that were sent or enqueued for sending by the remote peer.
637 These frames can be ignored, except where they modify session state
638 (such as the header compression state).
640 An endpoint SHOULD NOT send more than one RST_STREAM frame for any
641 stream. An endpoint MAY send additional RST_STREAM frames if it
642 receives frames on a closed stream after more than a round trip time.
643 This behaviour is permitted to deal with misbehaving implementations
644 where treating this as a session error is inappropriate.
646 An endpoint MUST NOT send a RST_STREAM in response to an RST_STREAM
647 frame. This could trigger infinite loops of RST_STREAM frames.
649 3.5.3. Error Codes
651 Error codes are 32-bit fields that are used in RST_STREAM and GOAWAY
652 frames to convey the reasons for the stream or session error.
654 Error codes share a common code space. Some error codes only apply
655 to specific conditions and have no defined semantics in certain frame
656 types.
658 The following error codes are defined:
660 NO_ERROR (0): The associated condition is not as a result of an
661 error. For example, a GOAWAY might include this code to indicate
662 graceful shutdown of a session.
664 PROTOCOL_ERROR (1): An unspecific protocol error was detected. This
665 error is for use when a more specific error code is not available.
667 INTERNAL_ERROR (2): The implementation encountered an unexpected
668 internal error.
670 FLOW_CONTROL_ERROR (3): The endpoint detected that its peer violated
671 the flow control protocol.
673 INVALID_STREAM (4): A frame was received for an inactive stream.
675 STREAM_CLOSED (5): The endpoint received a frame after a stream was
676 half-closed.
678 FRAME_TOO_LARGE (6): The endpoint received a frame that was larger
679 than the maximum size that it supports.
681 REFUSED_STREAM (7): Indicates that the stream was refused before any
682 processing has been done on the stream.
684 CANCEL (8): Used by the creator of a stream to indicate that the
685 stream is no longer needed.
687 3.6. Stream Flow Control
689 Multiplexing streams introduces contention for access to the shared
690 TCP connection. Stream contention can result in streams being
691 blocked by other streams. A flow control scheme ensures that streams
692 do not destructively interfere with other streams on the same TCP
693 connection.
695 3.6.1. Flow Control Principles
697 Experience with TCP congestion control has shown that algorithms can
698 evolve over time to become more sophisticated without requiring
699 protocol changes. TCP congestion control and its evolution is
700 clearly different from HTTP/2.0 flow control, though the evolution of
701 TCP congestion control algorithms shows that a similar approach could
702 be feasible for HTTP/2.0 flow control.
704 HTTP/2.0 stream flow control aims to allow for future improvements to
705 flow control algorithms without requiring protocol changes. Flow
706 control in HTTP/2.0 has the following characteristics:
708 1. Flow control is hop-by-hop, not end-to-end.
710 2. Flow control is based on window update messages. Receivers
711 advertise how many octets they are prepared to receive on a
712 stream. This is a credit-based scheme.
714 3. Flow control is directional with overall control provided by the
715 receiver. A receiver MAY choose to set any window size that it
716 desires for each stream and for the entire connection. A sender
717 MUST respect flow control limits imposed by a receiver. Clients,
718 servers and intermediaries all independently advertise their flow
719 control preferences as a receiver and abide by the flow control
720 limits set by their peer when sending.
722 4. The initial value for the flow control window is 65536 bytes for
723 both new streams and the overall connection.
725 5. The frame type determines whether flow control applies to a
726 frame. Of the frames specified in this document, only data
727 frames are subject to flow control; all other frame types do not
728 consume space in the advertised flow control window. This
729 ensures that important control frames are not blocked by flow
730 control.
732 6. Flow control can be disabled by a receiver. A receiver can
733 choose to either disable flow control for a stream or connection
734 by declaring an infinite flow control limit.
736 7. HTTP/2.0 standardizes only the format of the window update
737 message (Section 3.7.9). This does not stipulate how a receiver
738 decides when to send this message or the value that it sends.
739 Nor does it specify how a sender chooses to send packets.
740 Implementations are able to select any algorithm that suits their
741 needs.
743 Implementations are also responsible for managing how requests and
744 responses are sent based on priority; choosing how to avoid head of
745 line blocking for requests; and managing the creation of new streams.
746 Algorithm choices for these could interact with any flow control
747 algorithm.
749 3.6.2. Appropriate Use of Flow Control
751 Flow control is defined to protect deployments (client, server or
752 intermediary) that are operating under constraints. For example, a
753 proxy must share memory between many connections. Flow control
754 addresses cases where the receiver is unable process data on one
755 stream, yet wants to be continue to process other streams.
757 Deployments that do not rely on this capability SHOULD disable flow
758 control for data that is being received. Note that flow control
759 cannot be disabled for sending. Sending data is always subject to
760 the flow control window advertised by the receiver.
762 Deployments with constrained resources (for example, memory), MAY
763 employ flow control to limit the amount of memory a peer can consume.
764 This can lead to suboptimal use of available network resources if
765 flow control is enabled without knowledge of the bandwidth-delay
766 product (see [RFC1323]).
768 Implementation of flow control in full awareness of the current
769 bandwidth-delay product is difficult, but it can ensure that
770 constrained resources are protected without any reduction in
771 connection utilization.
773 3.7. Frame Types
775 3.7.1. DATA Frames
777 DATA frames (type=0) are used to convey HTTP message bodies. The
778 payload of a data frame contains either a request or response body.
780 No frame-specific flags are defined for DATA frames.
782 3.7.2. HEADERS+PRIORITY
784 The HEADERS+PRIORITY frame (type=1) allows the sender to set header
785 fields and stream priority at the same time. This MUST be used for
786 each stream that is created.
788 0 1 2 3
789 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
790 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
791 |X| Priority (31) |
792 +-+-------------------------------------------------------------+
793 | Header Block (*) ...
794 +---------------------------------------------------------------+
796 HEADERS+PRIORITY Frame Payload
798 The HEADERS+PRIORITY frame is identical to the HEADERS frame
799 (Section 3.7.8), with a 32-bit field containing priority included
800 before the header block.
802 The most significant bit of the priority is reserved. The 31-bit
803 priority indicates the priority for the stream, as assigned by the
804 sender, see Section 3.4.2.
806 3.7.3. RST_STREAM
808 The RST_STREAM frame (type=3) allows for abnormal termination of a
809 stream. When sent by the creator of a stream, it indicates the
810 creator wishes to cancel the stream. When sent by the recipient of a
811 stream, it indicates an error or that the recipient did not want to
812 accept the stream, so the stream should be closed.
814 0 1 2 3
815 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
816 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
817 | Error Code (32) |
818 +---------------------------------------------------------------+
820 RST_STREAM Frame Payload
822 The RST_STREAM frame does not define any valid flags.
824 The RST_STREAM frame contains a single 32-bit error code
825 (Section 3.5.3). The error code indicates why the stream is being
826 terminated.
828 After receiving a RST_STREAM on a stream, the recipient must not send
829 additional frames for that stream, and the stream moves into the
830 closed state.
832 3.7.4. SETTINGS
834 A SETTINGS frame (type=4) contains a set of id/value pairs for
835 communicating configuration data about how the two endpoints may
836 communicate. SETTINGS frames MUST be sent at the start of a session,
837 but they can be sent at any other time by either endpoint. Settings
838 are declarative, not negotiated, each peer indicates their own
839 configuration.
841 [[anchor17: Note that persistence of settings is under discussion in
842 the WG and might be removed in a future version of this document.]]
844 When the server is the sender, the sender can request that
845 configuration data be persisted by the client across HTTP/2.0
846 sessions and returned to the server in future communications.
848 Clients persist settings on a per origin basis (see [RFC6454] for a
849 definition of web origins). That is, when a client connects to a
850 server, and the server persists settings within the client, the
851 client SHOULD return the persisted settings on future connections to
852 the same origin AND IP address and TCP port. Clients MUST NOT
853 request servers to use the persistence features of the SETTINGS
854 frames, and servers MUST ignore persistence related flags sent by a
855 client.
857 Valid frame-specific flags for the SETTINGS frame are:
859 CLEAR_PERSISTED (0x2): Bit 2 being set indicates a request to clear
860 any previously persisted settings before processing the settings.
861 Clients MUST NOT set this flag.
863 SETTINGS frames always apply to a session, never a single stream.
864 The stream identifier for a settings frame MUST be zero.
866 0 1 2 3
867 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
868 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
869 |SettingFlags(8)| Setting Identifier (24) |
870 +---------------+-----------------------------------------------+
871 | Value (32) |
872 +---------------------------------------------------------------+
874 SETTINGS ID/Value Pair
876 The payload of a SETTINGS frame contains zero or more settings. Each
877 setting is comprised of the following
879 Settings Flags: An 8-bit flags field containing per-setting
880 instructions. The following flags are valid:
882 PERSIST_VALUE (0x1): Bit 1 (the least significant bit) being set
883 indicates a request from the server to the client to persist
884 this setting. A client MUST NOT set this flag.
886 PERSISTED (0x2): Bit 2 being set indicates that this setting is a
887 persisted setting being returned by the client to the server.
888 This also indicates that this setting is not a client setting,
889 but a value previously set by the server. A server MUST NOT
890 set this flag.
892 All other settings flags are reserved.
894 Setting Identifier: A 24-bit field that identifies the setting.
896 Value: A 32-bit value for the setting.
898 The following settings are defined:
900 SETTINGS_UPLOAD_BANDWIDTH (1): allows the sender to send its
901 expected upload bandwidth on this channel. This number is an
902 estimate. The value should be the integral number of kilobytes
903 per second that the sender predicts as an expected maximum upload
904 channel capacity.
906 SETTINGS_DOWNLOAD_BANDWIDTH (2): allows the sender to send its
907 expected download bandwidth on this channel. This number is an
908 estimate. The value should be the integral number of kilobytes
909 per second that the sender predicts as an expected maximum
910 download channel capacity.
912 SETTINGS_ROUND_TRIP_TIME (3): allows the sender to send its expected
913 round-trip-time on this channel. The round trip time is defined
914 as the minimum amount of time to send a control frame from this
915 client to the remote and receive a response. The value is
916 represented in milliseconds.
918 SETTINGS_MAX_CONCURRENT_STREAMS (4): allows the sender to inform the
919 remote endpoint the maximum number of concurrent streams which it
920 will allow. This limit is directional: it applies to the number
921 of streams that the sender permits the receiver to create. By
922 default there is no limit. For implementers it is recommended
923 that this value be no smaller than 100, so as to not unnecessarily
924 limit parallelism.
926 SETTINGS_CURRENT_CWND (5): allows the sender to inform the remote
927 endpoint of the current TCP CWND value.
929 SETTINGS_DOWNLOAD_RETRANS_RATE (6): allows the sender to inform the
930 remote endpoint the retransmission rate (bytes retransmitted /
931 total bytes transmitted).
933 SETTINGS_INITIAL_WINDOW_SIZE (7): allows the sender to inform the
934 remote endpoint the initial window size (in bytes) for new
935 streams.
937 SETTINGS_FLOW_CONTROL_OPTIONS (10): This setting allows an endpoint
938 to indicate that streams directed to them will not be subject to
939 flow control. The least significant bit (0x1) is set to indicate
940 that new streams are not flow controlled. Bit 2 (0x2) is set to
941 indicate that the session is not flow controlled. All other bits
942 are reserved.
944 This setting applies to all streams, including existing streams.
946 These bits cannot be cleared once set, see Section 3.7.9.4.
948 The message is intentionally extensible for future information which
949 may improve client-server communications. The sender does not need
950 to send every type of ID/value. It must only send those for which it
951 has accurate values to convey. When multiple ID/value pairs are
952 sent, they should be sent in order of lowest id to highest id. A
953 single SETTINGS frame MUST not contain multiple values for the same
954 ID. If the recipient of a SETTINGS frame discovers multiple values
955 for the same ID, it MUST ignore all values except the first one.
957 A server may send multiple SETTINGS frames containing different ID/
958 Value pairs. When the same ID/Value is sent twice, the most recent
959 value overrides any previously sent values. If the server sends IDs
960 1, 2, and 3 with the FLAG_SETTINGS_PERSIST_VALUE in a first SETTINGS
961 frame, and then sends IDs 4 and 5 with the
962 FLAG_SETTINGS_PERSIST_VALUE, when the client returns the persisted
963 state on its next SETTINGS frame, it SHOULD send all 5 settings (1,
964 2, 3, 4, and 5 in this example) to the server.
966 3.7.5. PUSH_PROMISE
968 The PUSH_PROMISE frame (type=5) allows the sender to signal a promise
969 to create a stream and serve the referenced resource. Minimal data
970 allowing the receiver to understand which resource(s) are to be
971 pushed are to be included.
973 PUSH_PROMISE frames are sent on an existing stream. They declare the
974 intent to use another stream for the pushing of a resource. The
975 PUSH_PROMISE allows the client an opportunity to reject pushed
976 resources.
978 0 1 2 3
979 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
980 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
981 |X| Promised-Stream-ID (31) |
982 +-+-------------------------------------------------------------+
983 | Header Block (*) ...
984 +---------------------------------------------------------------+
986 PUSH_PROMISE Payload Format
988 There are no frame-specific flags for the PUSH_PROMISE frame.
990 The body of a PUSH_PROMISE includes a "Promised-Stream-ID". This 31-
991 bit identifier indicates the stream on which the resource will be
992 pushed. The promised stream identifier MUST be a valid choice for
993 the next stream sent by the sender (see new stream identifier
994 (Section 3.4.1)).
996 There is no requirement that the streams referred to by this frame
997 are created in the order referenced. The PUSH_PROMISE reserves
998 stream identifiers for later use; these reserved identifiers can be
999 used as prioritization needs dictate.
1001 The PUSH_PROMISE also includes a header block (Section 3.7.10), which
1002 describes the resource that will be pushed.
1004 3.7.6. PING
1006 The PING frame (type=6) is a mechanism for measuring a minimal round-
1007 trip time from the sender. PING frames can be sent from the client
1008 or the server.
1010 Recipients of a PING frame send an identical frame to the sender as
1011 soon as possible. PING should take highest priority if there is
1012 other data waiting to be sent.
1014 The PING frame defines a frame-specific flag:
1016 PONG (0x2): Bit 2 being set indicates that this ping frame is a ping
1017 response. An endpoint MUST set this flag in ping responses. An
1018 endpoint MUST NOT respond to ping frames containing this flag.
1020 The payload of a PING frame contains any value. A PING response MUST
1021 contain the contents of the PING request.
1023 3.7.7. GOAWAY
1025 The GOAWAY frame (type=7) informs the remote side of the connection
1026 to stop creating streams on this session. It can be sent from the
1027 client or the server. Once sent, the sender will ignore frames sent
1028 on new streams for the remainder of the session. Recipients of a
1029 GOAWAY frame MUST NOT open additional streams on the session,
1030 although a new session can be established for new streams. The
1031 purpose of this message is to allow an endpoint to gracefully stop
1032 accepting new streams (perhaps for a reboot or maintenance), while
1033 still finishing processing of previously established streams.
1035 There is an inherent race condition between an endpoint starting new
1036 streams and the remote sending a GOAWAY message. To deal with this
1037 case, the GOAWAY contains the stream identifier of the last stream
1038 which was processed on the sending endpoint in this session. If the
1039 receiver of the GOAWAY used streams that are newer than the indicated
1040 stream identifier, they were not processed by the sender and the
1041 receiver may treat the streams as though they had never been created
1042 at all (hence the receiver may want to re-create the streams later on
1043 a new session).
1045 Endpoints should always send a GOAWAY message before closing a
1046 connection so that the remote can know whether a stream has been
1047 partially processed or not. (For example, if an HTTP client sends a
1048 POST at the same time that a server closes a connection, the client
1049 cannot know if the server started to process that POST request if the
1050 server does not send a GOAWAY frame to indicate where it stopped
1051 working).
1053 After sending a GOAWAY message, the sender can ignore frames for new
1054 streams.
1056 [[anchor18: Issue: session state that is established by those
1057 "ignored" messages cannot be ignored without the state in the two
1058 peers becoming unsynchronized.]]
1060 0 1 2 3
1061 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
1062 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1063 |X| Last-Stream-ID (31) |
1064 +-+-------------------------------------------------------------+
1065 | Error Code (32) |
1066 +---------------------------------------------------------------+
1068 GOAWAY Payload Format
1070 The GOAWAY frame does not define any valid flags.
1072 The GOAWAY frame applies to the session, not a specific stream. The
1073 stream identifier MUST be zero.
1075 The GOAWAY frame contains an identifier of the last stream that the
1076 sender of the GOAWAY is prepared to act upon, which can include
1077 processing and replies. This allows an endpoint to discover what
1078 streams might have had some effect or what might be safe to
1079 automatically retry. If no streams were acted upon, the last stream
1080 ID MUST be 0.
1082 The GOAWAY frame contains a 32-bit error code (Section 3.5.3) that
1083 contains the reason for closing the session.
1085 3.7.8. HEADERS
1087 The HEADERS frame (type=8) provides header fields for a stream. It
1088 may be optionally sent on an existing stream at any time. Specific
1089 application of the headers in this frame is application-dependent.
1091 No frame-specific flags are defined for the HEADERS frame.
1093 The body of a HEADERS frame contains a Headers Block
1094 (Section 3.7.10).
1096 3.7.9. WINDOW_UPDATE
1098 The WINDOW_UPDATE frame (type=9) is used to implement flow control in
1099 HTTP/2.0.
1101 Flow control in HTTP/2.0 operates at two levels: on each individual
1102 stream and on the entire session.
1104 Flow control in HTTP/2.0 is hop by hop, that is, only between the two
1105 endpoints of a HTTP/2.0 connection. Intermediaries do not forward
1106 WINDOW_UPDATE messages between dependent sessions. However,
1107 throttling of data transfer by any recipient can indirectly cause the
1108 propagation of flow control information toward the original sender.
1110 Flow control only applies to frames that are identified as being
1111 subject to flow control. Of the frames defined in this document,
1112 only data frames are subject to flow control. Receivers MUST either
1113 buffer or process all other frames, terminate the corresponding
1114 stream, or terminate the session. The stream or session is
1115 terminated with a FLOW_CONTROL_ERROR code.
1117 Valid flags for the WINDOW_UPDATE frame are:
1119 END_FLOW_CONTROL (0x2): Bit 2 being set indicates that flow control
1120 for the identified stream or session is ended and subsequent
1121 frames do not need to be flow controlled.
1123 The WINDOW_UPDATE frame can be stream related or session related.
1124 The stream identifier in the WINDOW_UPDATE frame header identifies
1125 the affected stream, or includes a value of 0 to indicate that the
1126 session flow control window is updated.
1128 The payload of a WINDOW_UPDATE frame contains a 32-bit value. This
1129 value is the additional number of bytes that the sender can transmit
1130 in addition to the existing flow control window. The legal range for
1131 this field is 1 to 2^31 - 1 (0x7fffffff) bytes; the most significant
1132 bit of this value is reserved.
1134 3.7.9.1. The Flow Control Window
1136 Flow control in HTTP/2.0 is implemented by a flow control window kept
1137 by the sender of each stream. The flow control window is a simple
1138 integer value that indicates how many bytes of data the sender is
1139 permitted to transmit. The flow control window size is a measure of
1140 the buffering capability of the recipient.
1142 Two flow control windows apply to the sending of every message: the
1143 stream flow control window and the session flow control window. The
1144 sender MUST NOT send a flow controlled frame with a length that
1145 exceeds the space available in either of the flow control windows
1146 advertised by the receiver. Frames with zero length with the FINAL
1147 flag set (for example, an empty data frame) MAY be sent if there is
1148 no available space in either flow control window.
1150 For flow control calculations, the 8 byte frame header is not
1151 counted.
1153 After sending a flow controlled frame, the sender reduces the space
1154 available in both windows by the length of the transmitted frame.
1156 The receiver of a message sends a WINDOW_UPDATE frame as it consumes
1157 data and frees up space in flow control windows. Separate
1158 WINDOW_UPDATE messages are sent for the stream and session level flow
1159 control windows.
1161 A sender that receives a WINDOW_UPDATE frame updates the
1162 corresponding window by the amount specified in the frame.
1164 A sender MUST NOT allow a flow control window to exceed 2^31 - 1
1165 bytes. If a sender receives a WINDOW_UPDATE that causes a flow
1166 control window to exceed this maximum it MUST terminate either the
1167 stream or the session, as appropriate. For streams, the sender sends
1168 a RST_STREAM with the error code of FLOW_CONTROL_ERROR code; for the
1169 session, a GOAWAY message with a FLOW_CONTROL_ERROR code.
1171 Flow controlled frames from the sender and WINDOW_UPDATE frames from
1172 the receiver are completely asynchronous with respect to each other.
1173 This property allows a receiver to aggressively update the window
1174 size kept by the sender to prevent streams from stalling.
1176 3.7.9.2. Initial Flow Control Window Size
1178 When a HTTP/2.0 connection is first established, new streams are
1179 created with an initial flow control window size of 65535 bytes. The
1180 session flow control window is 65536 bytes. Both endpoints can
1181 adjust the initial window size for new streams by including a value
1182 for SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS frame that forms
1183 part of the session header.
1185 Prior to receiving a SETTINGS frame that sets a value for
1186 SETTINGS_INITIAL_WINDOW_SIZE, a client can only use the default
1187 initial window size when sending flow controlled frames. Similarly,
1188 the session flow control window is set to the default initial window
1189 size until a WINDOW_UPDATE message is received.
1191 A SETTINGS frame can alter the initial flow control window size for
1192 all current streams. When the value of SETTINGS_INITIAL_WINDOW_SIZE
1193 changes, a receiver MUST adjust the size of all flow control windows
1194 that it maintains by the difference between the new value and the old
1195 value.
1197 A change to SETTINGS_INITIAL_WINDOW_SIZE could cause the available
1198 space in a flow control window to become negative. A sender MUST
1199 track the negative flow control window and not send new flow
1200 controlled frames until it receives WINDOW_UPDATE messages that cause
1201 the flow control window to become positive.
1203 For example, if the server sets the initial window size to be 16KB,
1204 and the client sends 64KB immediately on connection establishment,
1205 the client will recalculate the available flow control window to be
1206 -48KB on receipt of the SETTINGS frame. The client retains a
1207 negative flow control window until WINDOW_UPDATE frames restore the
1208 window to being positive, after which the client can resume sending.
1210 3.7.9.3. Reducing the Stream Window Size
1212 A receiver that wishes to use a smaller flow control window than the
1213 current size sends a new SETTINGS frame. However, the receiver MUST
1214 be prepared to receive data that exceeds this window size, since the
1215 sender might send data that exceeds the lower limit prior to
1216 processing the SETTINGS frame.
1218 A receiver has two options for handling streams that exceed flow
1219 control limits:
1221 1. The receiver can immediately send RST_STREAM with
1222 FLOW_CONTROL_ERROR error code for the affected streams.
1224 2. The receiver can accept the streams and tolerate the resulting
1225 head of line blocking, sending WINDOW_UPDATE messages as it
1226 consumes data.
1228 If a receiver decides to accept streams, both sides must recompute
1229 the available flow control window based on the initial window size
1230 sent in the SETTINGS.
1232 3.7.9.4. Ending Flow Control
1234 After a recipient reads in a frame that marks the end of a stream
1235 (for example, a data stream with a FINAL flag set), it ceases
1236 transmission of WINDOW_UPDATE frames. A sender is not required to
1237 maintain the available flow control window for streams that it is no
1238 longer sending on.
1240 Flow control can be disabled for all streams or the session using the
1241 SETTINGS_FLOW_CONTROL_OPTIONS setting. An implementation that does
1242 not wish to perform flow control can use this in the initial SETTINGS
1243 exchange.
1245 Flow control can be disabled for an individual stream or the overall
1246 session by sending a WINDOW_UPDATE with the END_FLOW_CONTROL flag
1247 set. The payload of a WINDOW_UPDATE frame that has the
1248 END_FLOW_CONTROL flag set is ignored.
1250 Flow control cannot be enabled again once disabled. Any attempt to
1251 re-enable flow control - by sending a WINDOW_UPDATE or by clearing
1252 the bits on the SETTINGS_FLOW_CONTROL_OPTIONS setting - MUST be
1253 rejected with a FLOW_CONTROL_ERROR error code.
1255 3.7.10. Header Block
1257 The header block is found in the HEADERS, HEADERS+PRIORITY and
1258 PUSH_PROMISE frames. The header block consists of a set of header
1259 fields, which are name-value pairs. Headers are compressed using
1260 black magic.
1262 Compression of header fields is a work in progress, as is the format
1263 of this block.
1265 4. HTTP Message Exchanges
1267 HTTP/2.0 is intended to be as compatible as possible with current
1268 web-based applications. This means that, from the perspective of the
1269 server business logic or application API, the features of HTTP are
1270 unchanged. To achieve this, all of the application request and
1271 response header semantics are preserved, although the syntax of
1272 conveying those semantics has changed. Thus, the rules from HTTP/1.1
1273 ([HTTP-p1], [HTTP-p2], [HTTP-p4], [HTTP-p5], [HTTP-p6], and
1274 [HTTP-p7]) apply with the changes in the sections below.
1276 4.1. Connection Management
1278 Clients SHOULD NOT open more than one HTTP/2.0 session to a given
1279 origin ([RFC6454]) concurrently.
1281 Note that it is possible for one HTTP/2.0 session to be finishing
1282 (e.g. a GOAWAY message has been sent, but not all streams have
1283 finished), while another HTTP/2.0 session is starting.
1285 4.1.1. Use of GOAWAY
1287 HTTP/2.0 provides a GOAWAY message which can be used when closing a
1288 connection from either the client or server. Without a server GOAWAY
1289 message, HTTP has a race condition where the client sends a request
1290 just as the server is closing the connection, and the client cannot
1291 know if the server received the stream or not. By using the last-
1292 stream-id in the GOAWAY, servers can indicate to the client if a
1293 request was processed or not.
1295 Note that some servers will choose to send the GOAWAY and immediately
1296 terminate the connection without waiting for active streams to
1297 finish. The client will be able to determine this because HTTP/2.0
1298 streams are deterministically closed. This abrupt termination will
1299 force the client to heuristically decide whether to retry the pending
1300 requests. Clients always need to be capable of dealing with this
1301 case because they must deal with accidental connection termination
1302 cases, which are the same as the server never having sent a GOAWAY.
1304 More sophisticated servers will use GOAWAY to implement a graceful
1305 teardown. They will send the GOAWAY and provide some time for the
1306 active streams to finish before terminating the connection.
1308 If a HTTP/2.0 client closes the connection, it should also send a
1309 GOAWAY message. This allows the server to know if any server-push
1310 streams were received by the client.
1312 If the endpoint closing the connection has not received frames on any
1313 stream, the GOAWAY will contain a last-stream-id of 0.
1315 4.2. HTTP Request/Response
1317 4.2.1. HTTP Header Fields and HTTP/2.0 Headers
1319 At the application level, HTTP uses name-value pairs in its header
1320 fields. Because HTTP/2.0 merges the existing HTTP header fields with
1321 HTTP/2.0 headers, there is a possibility that some HTTP applications
1322 already use a particular header field name. To avoid any conflicts,
1323 all header fields introduced for layering HTTP over HTTP/2.0 are
1324 prefixed with ":". ":" is not a valid sequence in HTTP/1.* header
1325 field naming, preventing any possible conflict.
1327 4.2.2. Request
1329 The client initiates a request by sending a HEADERS+PRIORITY frame.
1330 Requests that do not contain a body MUST set the FINAL flag,
1331 indicating that the client intends to send no further data on this
1332 stream, unless the server intends to push resources (see
1333 Section 4.3). HEADERS+PRIORITY frame does not contain the FINAL flag
1334 for requests that contain a body. The body of a request follows as a
1335 series of DATA frames. The last DATA frame sets the FINAL flag to
1336 indicate the end of the body.
1338 The header fields included in the HEADERS+PRIORITY frame contain all
1339 of the HTTP header fields that are associated with an HTTP request.
1340 The header block in HTTP/2.0 is mostly unchanged from today's HTTP
1341 header block, with the following differences:
1343 The following fields that are carried in the request line in
1344 HTTP/1.1 ([HTTP-p1], Section 3.1.1) are defined as special-valued
1345 name-value pairs:
1347 ":method": the HTTP method for this request (e.g. "GET", "POST",
1348 "HEAD", etc) ([HTTP-p2], Section 4)
1350 ":path": ":path" - the request-target for this URI with "/"
1351 prefixed (see [HTTP-p1], Section 3.1.1). For example, for
1352 "http://www.google.com/search?q=dogs" the path would be
1353 "/search?q=dogs". [[anchor26: what forms of the HTTPbis
1354 request-target are allowed here?]]
1356 These header fields MUST be present in HTTP requests.
1358 In addition, the following two name-value pairs MUST be present in
1359 every request:
1361 ":host": the host and optional port portions (see [RFC3986],
1362 Section 3.2) of the URI for this request (e.g. "www.google.com:
1363 1234"). This header field is the same as the HTTP 'Host'
1364 header field ([HTTP-p1], Section 5.4).
1366 ":scheme": the scheme portion of the URI for this request (e.g.
1367 "https")
1369 All header field names starting with ":" (whether defined in this
1370 document or future extensions to this document) MUST appear before
1371 any other header fields.
1373 Header field names MUST be all lowercase.
1375 The Connection, Host, Keep-Alive, Proxy-Connection, and Transfer-
1376 Encoding header fields are not valid and MUST not be sent.
1378 User-agents MUST support gzip compression. Regardless of the
1379 Accept-Encoding sent by the user-agent, the server may always send
1380 content encoded with gzip or deflate encoding. [[anchor27: Still
1381 valid?]]
1383 If a server receives a request where the sum of the data frame
1384 payload lengths does not equal the size of the Content-Length
1385 header field, the server MUST return a 400 (Bad Request) error.
1387 Although POSTs are inherently chunked, POST requests SHOULD also
1388 be accompanied by a Content-Length header field. First, it
1389 informs the server of how much data to expect, which the server
1390 can used to track overall progress and provide appropriate user
1391 feedback. More importantly, some HTTP server implementations fail
1392 to correctly process requests that omit the Content-Length header
1393 field. Many existing clients send a Content-Length header field,
1394 which caused server implementations have come to depend upon its
1395 presence.
1397 The user-agent is free to prioritize requests as it sees fit. If the
1398 user-agent cannot make progress without receiving a resource, it
1399 should attempt to raise the priority of that resource. Resources
1400 such as images, SHOULD generally use the lowest priority.
1402 If a client sends a HEADERS+PRIORITY frame that omits a mandatory
1403 header, the server MUST reply with a HTTP 400 Bad Request reply.
1404 [[anchor28: Ed: why PROTOCOL_ERROR on missing ":status" in the
1405 response, but HTTP 400 here?]]
1407 If the server receives a data frame prior to a HEADERS or HEADERS+
1408 PRIORITY frame the server MUST treat this as a stream error
1409 (Section 3.5.2) of type PROTOCOL_ERROR.
1411 4.2.3. Response
1413 The server responds to a client request with a HEADERS frame.
1414 Symmetric to the client's upload stream, server will send any
1415 response body in a series of DATA frames. The last data frame will
1416 contain the FINAL flag to indicate the end of the stream and the end
1417 of the response. A response that contains no body (such as a 204 or
1418 304 response) consists only of a HEADERS frame that contains the
1419 FINAL flag to indicate no further data will be sent on the stream.
1421 The response status line is unfolded into name-value pairs like
1422 other HTTP header fields and must be present:
1424 ":status": The HTTP response status code (e.g. "200" or "200 OK")
1426 All header field names starting with ":" (whether defined in this
1427 document or future extensions to this document) MUST appear before
1428 any other header fields.
1430 All header field names MUST be all lowercase.
1432 The Connection, Keep-Alive, Proxy-Connection, and Transfer-
1433 Encoding header fields are not valid and MUST not be sent.
1435 Responses MAY be accompanied by a Content-Length header field for
1436 advisory purposes. This allows clients to learn the full size of
1437 an entity prior to receiving all the data frames. This can help
1438 in, for example, reporting progress.
1440 If a client receives a response where the sum of the data frame
1441 payload length does not equal the size of the Content-Length
1442 header field, the client MUST ignore the content length header
1443 field. [[anchor29: Ed: See
1444 .]]
1446 If a client receives a response with an absent or duplicated status
1447 header, the client MUST treat this as a stream error (Section 3.5.2)
1448 of type PROTOCOL_ERROR.
1450 If the client receives a data frame prior to a HEADERS or HEADERS+
1451 PRIORITY frame the client MUST treat this as a stream error
1452 (Section 3.5.2) of type PROTOCOL_ERROR.
1454 4.3. Server Push Transactions
1456 HTTP/2.0 enables a server to send multiple replies to a client for a
1457 single request. The rationale for this feature is that sometimes a
1458 server knows that it will need to send multiple resources in response
1459 to a single request. Without server push features, the client must
1460 first download the primary resource, then discover the secondary
1461 resource(s), and request them. Pushing of resources avoids the
1462 round-trip delay, but also creates a potential race where a server
1463 can be pushing content which a user-agent is in the process of
1464 requesting. The following mechanics attempt to prevent the race
1465 condition while enabling the performance benefit.
1467 Server push is an optional feature. Server push can be disabled by
1468 clients that do not wish to receive pushed resources by advertising a
1469 SETTINGS_MAX_CONCURRENT_STREAMS SETTING (Section 3.7.4) of zero.
1470 This prevents servers from creating the streams necessary to push
1471 resources.
1473 Browsers receiving a pushed response MUST validate that the server is
1474 authorized to push the resource using the same-origin policy
1475 ([RFC6454], Section 3). For example, a HTTP/2.0 connection to
1476 "example.com" is generally [[anchor30: Ed: weaselly use of
1477 "generally", needs better definition]] not permitted to push a
1478 response for "www.example.org".
1480 A client that accepts pushed resources caches those resources as
1481 though they were responses to GET requests.
1483 Pushed responses are associated with a request at the HTTP/2.0
1484 framing layer. The PUSH_PROMISE includes a stream identifier for an
1485 associated request/response exchange that supplies request header
1486 fields. The pushed stream inherits all of the request header fields
1487 from the associated stream with the exception of resource
1488 identification header fields (":host", ":scheme", and ":path"), which
1489 are provided as part of the PUSH_PROMISE frame. Pushed resources
1490 always have an associated ":method" of "GET". A cache MUST store
1491 these inherited and implied request header fields with the cached
1492 resource.
1494 Implementation note: With server push, it is theoretically possible
1495 for servers to push unreasonable amounts of content or resources to
1496 the user-agent. Browsers MUST implement throttles to protect against
1497 unreasonable push attacks. [[anchor31: Ed: insufficiently specified
1498 to implement; would like to remove]]
1500 4.3.1. Server implementation
1502 A server pushes resources in association with a request from the
1503 client. Prior to closing the response stream, the server sends a
1504 PUSH_PROMISE for each resource that it intends to push. The
1505 PUSH_PROMISE includes header fields that allow the client to identify
1506 the resource (":scheme", ":host", and ":port").
1508 A server can push multiple resources in response to a request, but
1509 these can only be sent while the response stream remains open. A
1510 server MUST NOT send a PUSH_PROMISE on a half-closed stream.
1512 The server SHOULD include any header fields in a PUSH_PROMISE that
1513 would allow a cache to determine if the resource is already cached
1514 (see [HTTP-p6], Section 4).
1516 After sending a PUSH_PROMISE, the server commences transmission of a
1517 pushed resource. A pushed resource uses a server-initiated stream.
1518 The server sends frames on this stream in the same order as an HTTP
1519 response (Section 4.2.3): a HEADERS frame followed by DATA frames.
1521 Many uses of server push are to send content that a client is likely
1522 to discover a need for based on the content of a response
1523 representation. To minimize the chances that a client will make a
1524 request for resources that are being pushed - causing duplicate
1525 copies of a resource to be sent by the server - a PUSH_PROMISE frame
1526 SHOULD be sent prior to any content in the response representation
1527 that might allow a client to discover the pushed resource and request
1528 it.
1530 The server MUST only push resources that could have been returned
1531 from a GET request.
1533 Note: A server does not need to have all response header fields
1534 available at the time it issues a PUSH_PROMISE frame. All remaining
1535 header fields are included in the HEADERS frame. The HEADERS frame
1536 MUST NOT duplicate header fields from the PUSH_PROMISE frames.
1538 4.3.2. Client implementation
1540 When fetching a resource the client has 3 possibilities:
1542 1. the resource is not being pushed
1544 2. the resource is being pushed, but the data has not yet arrived
1546 3. the resource is being pushed, and the data has started to arrive
1548 When a HEADERS+PRIORITY frame that contains an
1549 Associated-To-Stream-ID is received, the client MUST NOT[[anchor34:
1550 SHOULD NOT?]] issue GET requests for the resource in the pushed
1551 stream, and instead wait for the pushed stream to arrive.
1553 A server MUST NOT push a resource with an Associated-To-Stream-ID of
1554 0. Clients MUST treat this as a session error (Section 3.5.1) of
1555 type PROTOCOL_ERROR.
1557 When a client receives a PUSH_PROMISE frame from the server without a
1558 the ":host", ":scheme", and ":path" header fields, it MUST treat this
1559 as a stream error (Section 3.5.2) of type PROTOCOL_ERROR.
1561 To cancel individual server push streams, the client can issue a
1562 stream error (Section 3.5.2) of type CANCEL. Upon receipt, the
1563 server ceases transmission of the pushed data.
1565 To cancel all server push streams related to a request, the client
1566 may issue a stream error (Section 3.5.2) of type CANCEL on the
1567 associated-stream-id. By cancelling that stream, the server MUST
1568 immediately stop sending frames for any streams with
1569 in-association-to for the original stream. [[anchor35: Ed: Triggering
1570 side-effects on stream reset is going to be problematic for the
1571 framing layer. Purely from a design perspective, it's a layering
1572 violation. More practically speaking, the base request stream might
1573 already be removed. Special handling logic would be required.]]
1574 If the server sends a HEADERS frame containing header fields that
1575 duplicate values on a previous HEADERS or PUSH_PROMISE frames on the
1576 same stream, the client MUST treat this as a stream error
1577 (Section 3.5.2) of type PROTOCOL_ERROR.
1579 If the server sends a HEADERS frame after sending a data frame for
1580 the same stream, the client MAY ignore the HEADERS frame. Ignoring
1581 the HEADERS frame after a data frame prevents handling of HTTP's
1582 trailing header fields (Section 4.1.1 of [HTTP-p1]).
1584 5. Design Rationale and Notes
1586 Authors' notes: The notes in this section have no bearing on the
1587 HTTP/2.0 protocol as specified within this document, and none of
1588 these notes should be considered authoritative about how the protocol
1589 works. However, these notes may prove useful in future debates about
1590 how to resolve protocol ambiguities or how to evolve the protocol
1591 going forward. They may be removed before the final draft.
1593 5.1. Separation of Framing Layer and Application Layer
1595 Readers may note that this specification sometimes blends the framing
1596 layer (Section 3) with requirements of a specific application - HTTP
1597 (Section 4). This is reflected in the request/response nature of the
1598 streams and the definition of the HEADERS which are very similar to
1599 HTTP, and other areas as well.
1601 This blending is intentional - the primary goal of this protocol is
1602 to create a low-latency protocol for use with HTTP. Isolating the
1603 two layers is convenient for description of the protocol and how it
1604 relates to existing HTTP implementations. However, the ability to
1605 reuse the HTTP/2.0 framing layer is a non goal.
1607 5.2. Error handling - Framing Layer
1609 Error handling at the HTTP/2.0 layer splits errors into two groups:
1610 Those that affect an individual HTTP/2.0 stream, and those that do
1611 not.
1613 When an error is confined to a single stream, but general framing is
1614 in tact, HTTP/2.0 attempts to use the RST_STREAM as a mechanism to
1615 invalidate the stream but move forward without aborting the
1616 connection altogether.
1618 For errors occurring outside of a single stream context, HTTP/2.0
1619 assumes the entire session is hosed. In this case, the endpoint
1620 detecting the error should initiate a connection close.
1622 5.3. One Connection Per Domain
1624 HTTP/2.0 attempts to use fewer connections than other protocols have
1625 traditionally used. The rationale for this behavior is because it is
1626 very difficult to provide a consistent level of service (e.g. TCP
1627 slow-start), prioritization, or optimal compression when the client
1628 is connecting to the server through multiple channels.
1630 Through lab measurements, we have seen consistent latency benefits by
1631 using fewer connections from the client. The overall number of
1632 packets sent by HTTP/2.0 can be as much as 40% less than HTTP.
1633 Handling large numbers of concurrent connections on the server also
1634 does become a scalability problem, and HTTP/2.0 reduces this load.
1636 The use of multiple connections is not without benefit, however.
1637 Because HTTP/2.0 multiplexes multiple, independent streams onto a
1638 single stream, it creates a potential for head-of-line blocking
1639 problems at the transport level. In tests so far, the negative
1640 effects of head-of-line blocking (especially in the presence of
1641 packet loss) is outweighed by the benefits of compression and
1642 prioritization.
1644 5.4. Fixed vs Variable Length Fields
1646 HTTP/2.0 favors use of fixed length 32bit fields in cases where
1647 smaller, variable length encodings could have been used. To some,
1648 this seems like a tragic waste of bandwidth. HTTP/2.0 chooses the
1649 simple encoding for speed and simplicity.
1651 The goal of HTTP/2.0 is to reduce latency on the network. The
1652 overhead of HTTP/2.0 frames is generally quite low. Each data frame
1653 is only an 8 byte overhead for a 1452 byte payload (~0.6%). At the
1654 time of this writing, bandwidth is already plentiful, and there is a
1655 strong trend indicating that bandwidth will continue to increase.
1656 With an average worldwide bandwidth of 1Mbps, and assuming that a
1657 variable length encoding could reduce the overhead by 50%, the
1658 latency saved by using a variable length encoding would be less than
1659 100 nanoseconds. More interesting are the effects when the larger
1660 encodings force a packet boundary, in which case a round-trip could
1661 be induced. However, by addressing other aspects of HTTP/2.0 and TCP
1662 interactions, we believe this is completely mitigated.
1664 5.5. Server Push
1666 A subtle but important point is that server push streams must be
1667 declared before the associated stream is closed. The reason for this
1668 is so that proxies have a lifetime for which they can discard
1669 information about previous streams. If a pushed stream could
1670 associate itself with an already-closed stream, then endpoints would
1671 not have a specific lifecycle for when they could disavow knowledge
1672 of the streams which went before.
1674 6. Security Considerations
1676 6.1. Use of Same-origin constraints
1678 This specification uses the same-origin policy ([RFC6454], Section 3)
1679 in all cases where verification of content is required.
1681 6.2. Cross-Protocol Attacks
1683 By utilizing TLS, we believe that HTTP/2.0 introduces no new cross-
1684 protocol attacks. TLS encrypts the contents of all transmission
1685 (except the handshake itself), making it difficult for attackers to
1686 control the data which could be used in a cross-protocol attack.
1687 [[anchor45: Issue: This is no longer true]]
1689 6.3. Cacheability of Pushed Resources
1691 Pushed resources do not have an associated request. In order for
1692 existing HTTP cache control validations (such as the Vary header
1693 field) to work, all cached resources must have a set of request
1694 header fields. For this reason, caches MUST be careful to inherit
1695 request header fields from the associated stream for the push. This
1696 includes the Cookie header field.
1698 Caching resources that are pushed is possible, based on the guidance
1699 provided by the origin server in the Cache-Control header field.
1700 However, this can cause issues if a single server hosts more than one
1701 tenant. For example, a server might offer multiple users each a
1702 small portion of its URI space.
1704 Where multiple tenants share space on the same server, that server
1705 MUST ensure that tenants are not able to push representations of
1706 resources that they do not have authority over. Failure to enforce
1707 this would allow a tenant to provide a representation that would be
1708 served out of cache, overriding the actual representation that the
1709 authoritative tenant provides.
1711 Pushed resources for which an origin server is not authoritative are
1712 never cached or used.
1714 7. Privacy Considerations
1715 7.1. Long Lived Connections
1717 HTTP/2.0 aims to keep connections open longer between clients and
1718 servers in order to reduce the latency when a user makes a request.
1719 The maintenance of these connections over time could be used to
1720 expose private information. For example, a user using a browser
1721 hours after the previous user stopped using that browser may be able
1722 to learn about what the previous user was doing. This is a problem
1723 with HTTP in its current form as well, however the short lived
1724 connections make it less of a risk.
1726 7.2. SETTINGS frame
1728 The HTTP/2.0 SETTINGS frame allows servers to store out-of-band
1729 transmitted information about the communication between client and
1730 server on the client. Although this is intended only to be used to
1731 reduce latency, renegade servers could use it as a mechanism to store
1732 identifying information about the client in future requests.
1734 Clients implementing privacy modes can disable client-persisted
1735 SETTINGS storage.
1737 Clients MUST clear persisted SETTINGS information when clearing the
1738 cookies.
1740 8. IANA Considerations
1742 This document establishes registries for frame types, error codes and
1743 settings.
1745 8.1. Frame Type Registry
1747 This document establishes a registry for HTTP/2.0 frame types. The
1748 "HTTP/2.0 Frame Type" registry operates under the "IETF Review"
1749 policy [RFC5226].
1751 Frame types are an 8-bit value. When reviewing new frame type
1752 registrations, special attention is advised for any frame type-
1753 specific flags that are defined. Frame flags can interact with
1754 existing flags and could prevent the creation of globally applicable
1755 flags.
1757 Initial values for the "HTTP/2.0 Frame Type" registry are shown in
1758 Table 1.
1760 +------------+------------------+---------------------+
1761 | Frame Type | Name | Flags |
1762 +------------+------------------+---------------------+
1763 | 0 | DATA | - |
1764 | 1 | HEADERS+PRIORITY | - |
1765 | 3 | RST_STREAM | - |
1766 | 4 | SETTINGS | CLEAR_PERSISTED(2) |
1767 | 5 | PUSH_PROMISE | - |
1768 | 6 | PING | PONG(2) |
1769 | 7 | GOAWAY | - |
1770 | 8 | HEADERS | - |
1771 | 9 | WINDOW_UPDATE | END_FLOW_CONTROL(2) |
1772 +------------+------------------+---------------------+
1774 Table 1
1776 8.2. Error Code Registry
1778 This document establishes a registry for HTTP/2.0 error codes. The
1779 "HTTP/2.0 Error Code" registry manages a 32-bit space. The "HTTP/2.0
1780 Error Code" registry operates under the "Expert Review" policy
1781 [RFC5226].
1783 Registrations for error codes are required to include a description
1784 of the error code. An expert reviewer is advised to examine new
1785 registrations for possible duplication with existing error codes.
1786 Use of existing registrations is to be encouraged, but not mandated.
1788 New registrations are advised to provide the following information:
1790 Error Code: The 32-bit error code value.
1792 Name: A name for the error code. Specifying an error code name is
1793 optional.
1795 Description: A description of the conditions where the error code is
1796 applicable.
1798 Specification: An optional reference for a specification that
1799 defines the error code.
1801 An initial set of error code registrations can be found in
1802 Section 3.5.3.
1804 8.3. Settings Registry
1806 This document establishes a registry for HTTP/2.0 settings. The
1807 "HTTP/2.0 Settings" registry manages a 24-bit space. The "HTTP/2.0
1808 Settings" registry operates under the "Expert Review" policy
1809 [RFC5226].
1811 Registrations for settings are required to include a description of
1812 the setting. An expert reviewer is advised to examine new
1813 registrations for possible duplication with existing settings. Use
1814 of existing registrations is to be encouraged, but not mandated.
1816 New registrations are advised to provide the following information:
1818 Setting: The 24-bit setting value.
1820 Name: A name for the setting. Specifying a name is optional.
1822 Flags: Any setting-specific flags that apply, including their value
1823 and semantics.
1825 Description: A description of the setting. This might include the
1826 range of values, any applicable units and how to act upon a value
1827 when it is provided.
1829 Specification: An optional reference for a specification that
1830 defines the setting.
1832 An initial set of settings registrations can be found in
1833 Section 3.7.4.
1835 9. Acknowledgements
1837 This document includes substantial input from the following
1838 individuals:
1840 o Adam Langley, Wan-Teh Chang, Jim Morrison, Mark Nottingham, Alyssa
1841 Wilk, Costin Manolache, William Chan, Vitaliy Lvin, Joe Chan, Adam
1842 Barth, Ryan Hamilton, Gavin Peters, Kent Alstad, Kevin Lindsay,
1843 Paul Amer, Fan Yang, Jonathan Leighton (SPDY contributors).
1845 o Gabriel Montenegro and Willy Tarreau (Upgrade mechanism)
1847 o William Chan, Salvatore Loreto, Osama Mazahir, Gabriel Montenegro,
1848 Jitu Padhye, Roberto Peon, Rob Trace (Flow control)
1850 o Mark Nottingham and Julian Reschke
1852 10. References
1853 10.1. Normative References
1855 [HTTP-p1] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
1856 (HTTP/1.1): Message Syntax and Routing",
1857 draft-ietf-httpbis-p1-messaging-22 (work in progress),
1858 February 2013.
1860 [HTTP-p2] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
1861 (HTTP/1.1): Semantics and Content",
1862 draft-ietf-httpbis-p2-semantics-22 (work in progress),
1863 February 2013.
1865 [HTTP-p4] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
1866 Protocol (HTTP/1.1): Conditional Requests",
1867 draft-ietf-httpbis-p4-conditional-22 (work in progress),
1868 February 2013.
1870 [HTTP-p5] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed.,
1871 "Hypertext Transfer Protocol (HTTP/1.1): Range Requests",
1872 draft-ietf-httpbis-p5-range-22 (work in progress),
1873 February 2013.
1875 [HTTP-p6] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
1876 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
1877 draft-ietf-httpbis-p6-cache-22 (work in progress),
1878 February 2013.
1880 [HTTP-p7] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
1881 Protocol (HTTP/1.1): Authentication",
1882 draft-ietf-httpbis-p7-auth-22 (work in progress),
1883 February 2013.
1885 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7,
1886 RFC 793, September 1981.
1888 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
1889 Requirement Levels", BCP 14, RFC 2119, March 1997.
1891 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
1892 Resource Identifier (URI): Generic Syntax", STD 66,
1893 RFC 3986, January 2005.
1895 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
1896 IANA Considerations Section in RFCs", BCP 26, RFC 5226,
1897 May 2008.
1899 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security
1900 (TLS) Protocol Version 1.2", RFC 5246, August 2008.
1902 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454,
1903 December 2011.
1905 [TLSNPN] Langley, A., "Transport Layer Security (TLS) Next Protocol
1906 Negotiation Extension", draft-agl-tls-nextprotoneg-04
1907 (work in progress), May 2012.
1909 10.2. Informative References
1911 [RFC1323] Jacobson, V., Braden, B., and D. Borman, "TCP Extensions
1912 for High Performance", RFC 1323, May 1992.
1914 [TALKING] Huang, L-S., Chen, E., Barth, A., Rescorla, E., and C.
1915 Jackson, "Talking to Yourself for Fun and Profit", 2011,
1916 .
1918 Appendix A. Change Log (to be removed by RFC Editor before publication)
1920 A.1. Since draft-ietf-httpbis-http2-01
1922 Added IANA considerations section for frame types, error codes and
1923 settings.
1925 Removed data frame compression.
1927 Added PUSH_PROMISE.
1929 Added globally applicable flags to framing.
1931 Removed zlib-based header compression mechanism.
1933 Updated references.
1935 Clarified stream identifier reuse.
1937 Removed CREDENTIALS frame and associated mechanisms.
1939 Added advice against naive implementation of flow control.
1941 Added session header section.
1943 Restructured frame header. Removed distinction between data and
1944 control frames.
1946 Altered flow control properties to include session-level limits.
1948 Added note on cacheability of pushed resources and multiple tenant
1949 servers.
1951 Changed protocol label form based on discussions.
1953 A.2. Since draft-ietf-httpbis-http2-00
1955 Changed title throughout.
1957 Removed section on Incompatibilities with SPDY draft#2.
1959 Changed INTERNAL_ERROR on GOAWAY to have a value of 2 .
1962 Replaced abstract and introduction.
1964 Added section on starting HTTP/2.0, including upgrade mechanism.
1966 Removed unused references.
1968 Added flow control principles (Section 3.6.1) based on .
1971 A.3. Since draft-mbelshe-httpbis-spdy-00
1973 Adopted as base for draft-ietf-httpbis-http2.
1975 Updated authors/editors list.
1977 Added status note.
1979 Authors' Addresses
1981 Mike Belshe
1982 Twist
1984 EMail: mbelshe@chromium.org
1986 Roberto Peon
1987 Google, Inc
1989 EMail: fenix@google.com
1990 Martin Thomson (editor)
1991 Microsoft
1992 3210 Porter Drive
1993 Palo Alto 94043
1994 US
1996 EMail: martin.thomson@skype.net
1998 Alexey Melnikov (editor)
1999 Isode Ltd
2000 5 Castle Business Village
2001 36 Station Road
2002 Hampton, Middlesex TW12 2BX
2003 UK
2005 EMail: Alexey.Melnikov@isode.com