1 | |
---|
2 | |
---|
3 | |
---|
4 | HTTPbis Working Group M. Belshe |
---|
5 | Internet-Draft Twist |
---|
6 | Expires: July 26, 2013 R. Peon |
---|
7 | Google, Inc |
---|
8 | M. Thomson, Ed. |
---|
9 | Microsoft |
---|
10 | A. Melnikov, Ed. |
---|
11 | Isode Ltd |
---|
12 | January 22, 2013 |
---|
13 | |
---|
14 | |
---|
15 | Hypertext Transfer Protocol version 2.0 |
---|
16 | draft-ietf-httpbis-http2-01 |
---|
17 | |
---|
18 | Abstract |
---|
19 | |
---|
20 | This document describes an optimised expression of the semantics of |
---|
21 | the HTTP protocol. The HTTP/2.0 encapsulation enables more efficient |
---|
22 | transfer of resources over HTTP by providing compressed headers, |
---|
23 | simultaneous requests, and unsolicited push of resources from server |
---|
24 | to client. |
---|
25 | |
---|
26 | This document is an alternative to, but does not obsolete |
---|
27 | RFC{http-p1}. The HTTP protocol semantics described in RFC{http- |
---|
28 | p2..p7} are unmodified. |
---|
29 | |
---|
30 | Editorial Note (To be removed by RFC Editor) |
---|
31 | |
---|
32 | This draft is a work-in-progress, and does not yet reflect Working |
---|
33 | Group consensus. |
---|
34 | |
---|
35 | This draft contains features from the SPDY Protocol as a starting |
---|
36 | point, as per the Working Group's charter. Future drafts will add, |
---|
37 | remove and change text, based upon the Working Group's decisions. |
---|
38 | |
---|
39 | Discussion of this draft takes place on the HTTPBIS working group |
---|
40 | mailing list (ietf-http-wg@w3.org), which is archived at |
---|
41 | <http://lists.w3.org/Archives/Public/ietf-http-wg/>. |
---|
42 | |
---|
43 | The current issues list is at |
---|
44 | <http://tools.ietf.org/wg/httpbis/trac/report/21> and related |
---|
45 | documents (including fancy diffs) can be found at |
---|
46 | <http://tools.ietf.org/wg/httpbis/>. |
---|
47 | |
---|
48 | The changes in this draft are summarized in Appendix A.1. |
---|
49 | |
---|
50 | Status of This Memo |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | Belshe, et al. Expires July 26, 2013 [Page 1] |
---|
56 | |
---|
57 | Internet-Draft HTTP/2.0 January 2013 |
---|
58 | |
---|
59 | |
---|
60 | This Internet-Draft is submitted in full conformance with the |
---|
61 | provisions of BCP 78 and BCP 79. |
---|
62 | |
---|
63 | Internet-Drafts are working documents of the Internet Engineering |
---|
64 | Task Force (IETF). Note that other groups may also distribute |
---|
65 | working documents as Internet-Drafts. The list of current Internet- |
---|
66 | Drafts is at http://datatracker.ietf.org/drafts/current/. |
---|
67 | |
---|
68 | Internet-Drafts are draft documents valid for a maximum of six months |
---|
69 | and may be updated, replaced, or obsoleted by other documents at any |
---|
70 | time. It is inappropriate to use Internet-Drafts as reference |
---|
71 | material or to cite them other than as "work in progress." |
---|
72 | |
---|
73 | This Internet-Draft will expire on July 26, 2013. |
---|
74 | |
---|
75 | Copyright Notice |
---|
76 | |
---|
77 | Copyright (c) 2013 IETF Trust and the persons identified as the |
---|
78 | document authors. All rights reserved. |
---|
79 | |
---|
80 | This document is subject to BCP 78 and the IETF Trust's Legal |
---|
81 | Provisions Relating to IETF Documents |
---|
82 | (http://trustee.ietf.org/license-info) in effect on the date of |
---|
83 | publication of this document. Please review these documents |
---|
84 | carefully, as they describe your rights and restrictions with respect |
---|
85 | to this document. Code Components extracted from this document must |
---|
86 | include Simplified BSD License text as described in Section 4.e of |
---|
87 | the Trust Legal Provisions and are provided without warranty as |
---|
88 | described in the Simplified BSD License. |
---|
89 | |
---|
90 | Table of Contents |
---|
91 | |
---|
92 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 |
---|
93 | 1.1. Document Organization . . . . . . . . . . . . . . . . . . 5 |
---|
94 | 1.2. Definitions . . . . . . . . . . . . . . . . . . . . . . . 6 |
---|
95 | 2. Starting HTTP/2.0 . . . . . . . . . . . . . . . . . . . . . . 6 |
---|
96 | 2.1. HTTP/2.0 Version Identification . . . . . . . . . . . . . 6 |
---|
97 | 2.2. Starting HTTP/2.0 for "http:" URIs . . . . . . . . . . . . 7 |
---|
98 | 2.3. Starting HTTP/2.0 for "https:" URIs . . . . . . . . . . . 8 |
---|
99 | 3. HTTP/2.0 Framing Layer . . . . . . . . . . . . . . . . . . . . 8 |
---|
100 | 3.1. Session (Connections) . . . . . . . . . . . . . . . . . . 8 |
---|
101 | 3.2. Framing . . . . . . . . . . . . . . . . . . . . . . . . . 8 |
---|
102 | 3.2.1. Control frames . . . . . . . . . . . . . . . . . . . . 9 |
---|
103 | 3.2.2. Data frames . . . . . . . . . . . . . . . . . . . . . 10 |
---|
104 | 3.3. Streams . . . . . . . . . . . . . . . . . . . . . . . . . 11 |
---|
105 | 3.3.1. Stream frames . . . . . . . . . . . . . . . . . . . . 11 |
---|
106 | 3.3.2. Stream creation . . . . . . . . . . . . . . . . . . . 11 |
---|
107 | 3.3.3. Stream priority . . . . . . . . . . . . . . . . . . . 12 |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | Belshe, et al. Expires July 26, 2013 [Page 2] |
---|
112 | |
---|
113 | Internet-Draft HTTP/2.0 January 2013 |
---|
114 | |
---|
115 | |
---|
116 | 3.3.4. Stream headers . . . . . . . . . . . . . . . . . . . . 12 |
---|
117 | 3.3.5. Stream data exchange . . . . . . . . . . . . . . . . . 13 |
---|
118 | 3.3.6. Stream half-close . . . . . . . . . . . . . . . . . . 13 |
---|
119 | 3.3.7. Stream close . . . . . . . . . . . . . . . . . . . . . 13 |
---|
120 | 3.4. Error Handling . . . . . . . . . . . . . . . . . . . . . . 14 |
---|
121 | 3.4.1. Session Error Handling . . . . . . . . . . . . . . . . 14 |
---|
122 | 3.4.2. Stream Error Handling . . . . . . . . . . . . . . . . 14 |
---|
123 | 3.5. Stream Flow Control . . . . . . . . . . . . . . . . . . . 15 |
---|
124 | 3.5.1. Flow Control Principles . . . . . . . . . . . . . . . 15 |
---|
125 | 3.5.2. Basic Flow Control Algorithm . . . . . . . . . . . . . 16 |
---|
126 | 3.6. Control frame types . . . . . . . . . . . . . . . . . . . 16 |
---|
127 | 3.6.1. SYN_STREAM . . . . . . . . . . . . . . . . . . . . . . 16 |
---|
128 | 3.6.2. SYN_REPLY . . . . . . . . . . . . . . . . . . . . . . 18 |
---|
129 | 3.6.3. RST_STREAM . . . . . . . . . . . . . . . . . . . . . . 19 |
---|
130 | 3.6.4. SETTINGS . . . . . . . . . . . . . . . . . . . . . . . 20 |
---|
131 | 3.6.5. PING . . . . . . . . . . . . . . . . . . . . . . . . . 23 |
---|
132 | 3.6.6. GOAWAY . . . . . . . . . . . . . . . . . . . . . . . . 24 |
---|
133 | 3.6.7. HEADERS . . . . . . . . . . . . . . . . . . . . . . . 25 |
---|
134 | 3.6.8. WINDOW_UPDATE . . . . . . . . . . . . . . . . . . . . 26 |
---|
135 | 3.6.9. CREDENTIAL . . . . . . . . . . . . . . . . . . . . . . 28 |
---|
136 | 3.6.10. Name/Value Header Block . . . . . . . . . . . . . . . 30 |
---|
137 | 4. HTTP Layering over HTTP/2.0 . . . . . . . . . . . . . . . . . 36 |
---|
138 | 4.1. Connection Management . . . . . . . . . . . . . . . . . . 36 |
---|
139 | 4.1.1. Use of GOAWAY . . . . . . . . . . . . . . . . . . . . 36 |
---|
140 | 4.2. HTTP Request/Response . . . . . . . . . . . . . . . . . . 37 |
---|
141 | 4.2.1. Request . . . . . . . . . . . . . . . . . . . . . . . 37 |
---|
142 | 4.2.2. Response . . . . . . . . . . . . . . . . . . . . . . . 39 |
---|
143 | 4.2.3. Authentication . . . . . . . . . . . . . . . . . . . . 39 |
---|
144 | 4.3. Server Push Transactions . . . . . . . . . . . . . . . . . 40 |
---|
145 | 4.3.1. Server implementation . . . . . . . . . . . . . . . . 41 |
---|
146 | 4.3.2. Client implementation . . . . . . . . . . . . . . . . 42 |
---|
147 | 5. Design Rationale and Notes . . . . . . . . . . . . . . . . . . 43 |
---|
148 | 5.1. Separation of Framing Layer and Application Layer . . . . 43 |
---|
149 | 5.2. Error handling - Framing Layer . . . . . . . . . . . . . . 43 |
---|
150 | 5.3. One Connection Per Domain . . . . . . . . . . . . . . . . 44 |
---|
151 | 5.4. Fixed vs Variable Length Fields . . . . . . . . . . . . . 44 |
---|
152 | 5.5. Compression Context(s) . . . . . . . . . . . . . . . . . . 45 |
---|
153 | 5.6. Unidirectional streams . . . . . . . . . . . . . . . . . . 45 |
---|
154 | 5.7. Data Compression . . . . . . . . . . . . . . . . . . . . . 45 |
---|
155 | 5.8. Server Push . . . . . . . . . . . . . . . . . . . . . . . 46 |
---|
156 | 6. Security Considerations . . . . . . . . . . . . . . . . . . . 46 |
---|
157 | 6.1. Use of Same-origin constraints . . . . . . . . . . . . . . 46 |
---|
158 | 6.2. HTTP Headers and HTTP/2.0 Headers . . . . . . . . . . . . 46 |
---|
159 | 6.3. Cross-Protocol Attacks . . . . . . . . . . . . . . . . . . 46 |
---|
160 | 6.4. Server Push Implicit Headers . . . . . . . . . . . . . . . 46 |
---|
161 | 7. Privacy Considerations . . . . . . . . . . . . . . . . . . . . 47 |
---|
162 | 7.1. Long Lived Connections . . . . . . . . . . . . . . . . . . 47 |
---|
163 | 7.2. SETTINGS frame . . . . . . . . . . . . . . . . . . . . . . 47 |
---|
164 | |
---|
165 | |
---|
166 | |
---|
167 | Belshe, et al. Expires July 26, 2013 [Page 3] |
---|
168 | |
---|
169 | Internet-Draft HTTP/2.0 January 2013 |
---|
170 | |
---|
171 | |
---|
172 | 8. Requirements Notation . . . . . . . . . . . . . . . . . . . . 47 |
---|
173 | 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 47 |
---|
174 | 10. Normative References . . . . . . . . . . . . . . . . . . . . . 48 |
---|
175 | Appendix A. Change Log (to be removed by RFC Editor before |
---|
176 | publication) . . . . . . . . . . . . . . . . . . . . 49 |
---|
177 | A.1. Since draft-ietf-httpbis-http2-00 . . . . . . . . . . . . 49 |
---|
178 | A.2. Since draft-mbelshe-httpbis-spdy-00 . . . . . . . . . . . 49 |
---|
179 | |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | |
---|
184 | |
---|
185 | |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | |
---|
195 | |
---|
196 | |
---|
197 | |
---|
198 | |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | |
---|
212 | |
---|
213 | |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | |
---|
221 | |
---|
222 | |
---|
223 | Belshe, et al. Expires July 26, 2013 [Page 4] |
---|
224 | |
---|
225 | Internet-Draft HTTP/2.0 January 2013 |
---|
226 | |
---|
227 | |
---|
228 | 1. Introduction |
---|
229 | |
---|
230 | HTTP is a wildly successful protocol. HTTP/1.1 message encapsulation |
---|
231 | [HTTP-p1] is optimized for implementation simplicity and |
---|
232 | accessibility, not application performance. As such it has several |
---|
233 | characteristics that have a negative overall effect on application |
---|
234 | performance. |
---|
235 | |
---|
236 | The HTTP/1.1 encapsulation ensures that only one request can be |
---|
237 | delivered at a time on a given connection. HTTP/1.1 pipelining, |
---|
238 | which is not widely deployed, only partially addresses these |
---|
239 | concerns. Clients that need to make multiple requests therefore use |
---|
240 | commonly multiple connections to a server or servers in order to |
---|
241 | reduce the overall latency of those requests. |
---|
242 | |
---|
243 | Furthermore, HTTP/1.1 headers are represented in an inefficient |
---|
244 | fashion, which, in addition to generating more or larger network |
---|
245 | packets, can cause the small initial TCP window to fill more quickly |
---|
246 | than is ideal. This results in excessive latency where multiple |
---|
247 | requests are made on a new TCP connection. |
---|
248 | |
---|
249 | This document defines an optimized mapping of the HTTP semantics to a |
---|
250 | TCP connection. This optimization reduces the latency costs of HTTP |
---|
251 | by allowing parallel requests on the same connection and by using an |
---|
252 | efficient coding for HTTP headers. Prioritization of requests lets |
---|
253 | more important requests complete faster, further improving |
---|
254 | application performance. |
---|
255 | |
---|
256 | HTTP/2.0 applications have an improved impact on network congestion |
---|
257 | due to the use of fewer TCP connections to achieve the same effect. |
---|
258 | Fewer TCP connections compete more fairly with other flows. Long- |
---|
259 | lived connections are also more able to take better advantage of the |
---|
260 | available network capacity, rather than operating in the slow start |
---|
261 | phase of TCP. |
---|
262 | |
---|
263 | The HTTP/2.0 encapsulation also enables more efficient processing of |
---|
264 | messages by providing efficient message framing. Processing of |
---|
265 | headers in HTTP/2.0 messages is more efficient (for entities that |
---|
266 | process many messages). |
---|
267 | |
---|
268 | 1.1. Document Organization |
---|
269 | |
---|
270 | The HTTP/2.0 Specification is split into three parts: starting |
---|
271 | HTTP/2.0 (Section 2), which covers how a HTTP/2.0 is started; a |
---|
272 | framing layer (Section 3), which multiplexes a TCP connection into |
---|
273 | independent, length-prefixed frames; and an HTTP layer (Section 4), |
---|
274 | which specifies the mechanism for overlaying HTTP request/response |
---|
275 | pairs on top of the framing layer. While some of the framing layer |
---|
276 | |
---|
277 | |
---|
278 | |
---|
279 | Belshe, et al. Expires July 26, 2013 [Page 5] |
---|
280 | |
---|
281 | Internet-Draft HTTP/2.0 January 2013 |
---|
282 | |
---|
283 | |
---|
284 | concepts are isolated from the HTTP layer, building a generic framing |
---|
285 | layer has not been a goal. The framing layer is tailored to the |
---|
286 | needs of the HTTP protocol and server push. |
---|
287 | |
---|
288 | 1.2. Definitions |
---|
289 | |
---|
290 | client: The endpoint initiating the HTTP/2.0 session. |
---|
291 | |
---|
292 | connection: A transport-level connection between two endpoints. |
---|
293 | |
---|
294 | endpoint: Either the client or server of a connection. |
---|
295 | |
---|
296 | frame: A header-prefixed sequence of bytes sent over a HTTP/2.0 |
---|
297 | session. |
---|
298 | |
---|
299 | server: The endpoint which did not initiate the HTTP/2.0 session. |
---|
300 | |
---|
301 | session: A synonym for a connection. |
---|
302 | |
---|
303 | session error: An error on the HTTP/2.0 session. |
---|
304 | |
---|
305 | stream: A bi-directional flow of bytes across a virtual channel |
---|
306 | within a HTTP/2.0 session. |
---|
307 | |
---|
308 | stream error: An error on an individual HTTP/2.0 stream. |
---|
309 | |
---|
310 | 2. Starting HTTP/2.0 |
---|
311 | |
---|
312 | Just as HTTP/1.1 does, HTTP/2.0 uses the "http:" and "https:" URI |
---|
313 | schemes. An HTTP/2.0-capable client is therefore required to |
---|
314 | discover whether a server (or intermediary) supports HTTP/2.0. |
---|
315 | |
---|
316 | Different discovery mechanisms are defined for "http:" and "https:" |
---|
317 | URIs. Discovery for "http:" URIs is described in Section 2.2; |
---|
318 | discovery for "https:" URIs is described in Section 2.3. |
---|
319 | |
---|
320 | 2.1. HTTP/2.0 Version Identification |
---|
321 | |
---|
322 | HTTP/2.0 is identified in using the string "HTTP/2.0". This |
---|
323 | identification is used in the HTTP/1.1 Upgrade header, in the TLS-NPN |
---|
324 | [TLSNPN] [[TBD]] field and other places where protocol identification |
---|
325 | is required. |
---|
326 | |
---|
327 | [[Editor's Note: please remove the following text prior to the |
---|
328 | publication of a final version of this document.]] |
---|
329 | |
---|
330 | Only implementations of the final, published RFC can identify |
---|
331 | themselves as "HTTP/2.0". Until such an RFC exists, implementations |
---|
332 | |
---|
333 | |
---|
334 | |
---|
335 | Belshe, et al. Expires July 26, 2013 [Page 6] |
---|
336 | |
---|
337 | Internet-Draft HTTP/2.0 January 2013 |
---|
338 | |
---|
339 | |
---|
340 | MUST NOT identify themselves using "HTTP/2.0". |
---|
341 | |
---|
342 | Examples and text throughout the rest of this document use "HTTP/2.0" |
---|
343 | as a matter of editorial convenience only. Implementations of draft |
---|
344 | versions MUST NOT identify using this string. |
---|
345 | |
---|
346 | Implementations of draft versions of the protocol MUST add the |
---|
347 | corresponding draft number to the identifier before the separator |
---|
348 | ('/'). For example, draft-ietf-httpbis-http2-03 is identified using |
---|
349 | the string "HTTP-03/2.0". |
---|
350 | |
---|
351 | Non-compatible experiments that are based on these draft versions |
---|
352 | MUST include a further identifier. For example, an experimental |
---|
353 | implementation of packet mood-based encoding based on |
---|
354 | draft-ietf-httpbis-http2-07 might identify itself as "HTTP-07- |
---|
355 | emo/2.0". Note that any label MUST conform with the "token" syntax |
---|
356 | defined in Section 3.2.4 of [HTTP-p1]. Experimenters are encouraged |
---|
357 | to coordinate their experiments on the ietf-http-wg@w3.org mailing |
---|
358 | list. |
---|
359 | |
---|
360 | 2.2. Starting HTTP/2.0 for "http:" URIs |
---|
361 | |
---|
362 | A client that makes a request to an "http:" URI without prior |
---|
363 | knowledge about support for HTTP/2.0 uses the HTTP Upgrade mechanism |
---|
364 | [HTTP-p2]. The client makes an HTTP/1.1 request that includes an |
---|
365 | Upgrade header field identifying HTTP/2.0. |
---|
366 | |
---|
367 | For example: |
---|
368 | |
---|
369 | GET /default.htm HTTP/1.1 |
---|
370 | Host: server.example.com |
---|
371 | Connection: Upgrade |
---|
372 | Upgrade: HTTP/2.0 |
---|
373 | |
---|
374 | A server that does not support HTTP/2.0 can respond to the request as |
---|
375 | though the Upgrade header field were absent: |
---|
376 | |
---|
377 | HTTP/1.1 200 OK |
---|
378 | Content-length: 243 |
---|
379 | Content-type: text/html |
---|
380 | ... |
---|
381 | |
---|
382 | A server that supports HTTP/2.0 can accept the upgrade with a 101 |
---|
383 | (Switching Protocols) status code. After the empty line that |
---|
384 | terminates the 101 response, the server can begin sending HTTP/2.0 |
---|
385 | frames. These frames MUST include a response to the request that |
---|
386 | initiated the Upgrade. |
---|
387 | |
---|
388 | |
---|
389 | |
---|
390 | |
---|
391 | Belshe, et al. Expires July 26, 2013 [Page 7] |
---|
392 | |
---|
393 | Internet-Draft HTTP/2.0 January 2013 |
---|
394 | |
---|
395 | |
---|
396 | HTTP/1.1 101 Switching Protocols |
---|
397 | Connection: Upgrade |
---|
398 | Upgrade: HTTP/2.0 |
---|
399 | |
---|
400 | [ HTTP/2.0 frames ... |
---|
401 | |
---|
402 | A client can learn that a particular server supports HTTP/2.0 by |
---|
403 | other means. A client MAY immediately send HTTP/2.0 frames to a |
---|
404 | server that is known to support HTTP/2.0. [[Open Issue: This is not |
---|
405 | definite. We may yet choose to perform negotiation for every |
---|
406 | connection. Reasons include intermediaries; phased upgrade of load- |
---|
407 | balanced server farms; etc...]] [[Open Issue: We need to enumerate |
---|
408 | the ways that clients can learn of HTTP/2.0 support.]] |
---|
409 | |
---|
410 | 2.3. Starting HTTP/2.0 for "https:" URIs |
---|
411 | |
---|
412 | [[TBD, maybe NPN]] |
---|
413 | |
---|
414 | 3. HTTP/2.0 Framing Layer |
---|
415 | |
---|
416 | 3.1. Session (Connections) |
---|
417 | |
---|
418 | The HTTP/2.0 framing layer (or "session") runs atop a reliable |
---|
419 | transport layer such as TCP [RFC0793]. The client is the TCP |
---|
420 | connection initiator. HTTP/2.0 connections are persistent |
---|
421 | connections. |
---|
422 | |
---|
423 | For best performance, it is expected that clients will not close open |
---|
424 | connections until the user navigates away from all web pages |
---|
425 | referencing a connection, or until the server closes the connection. |
---|
426 | Servers are encouraged to leave connections open for as long as |
---|
427 | possible, but can terminate idle connections if necessary. When |
---|
428 | either endpoint closes the transport-level connection, it MUST first |
---|
429 | send a GOAWAY (Section 3.6.6) frame so that the endpoints can |
---|
430 | reliably determine if requests finished before the close. |
---|
431 | |
---|
432 | 3.2. Framing |
---|
433 | |
---|
434 | Once the connection is established, clients and servers exchange |
---|
435 | framed messages. There are two types of frames: control frames |
---|
436 | (Section 3.2.1) and data frames (Section 3.2.2). Frames always have |
---|
437 | a common header which is 8 bytes in length. |
---|
438 | |
---|
439 | The first bit is a control bit indicating whether a frame is a |
---|
440 | control frame or data frame. Control frames carry a version number, |
---|
441 | a frame type, flags, and a length. Data frames contain the stream |
---|
442 | ID, flags, and the length for the payload carried after the common |
---|
443 | header. The simple header is designed to make reading and writing of |
---|
444 | |
---|
445 | |
---|
446 | |
---|
447 | Belshe, et al. Expires July 26, 2013 [Page 8] |
---|
448 | |
---|
449 | Internet-Draft HTTP/2.0 January 2013 |
---|
450 | |
---|
451 | |
---|
452 | frames easy. |
---|
453 | |
---|
454 | All integer values, including length, version, and type, are in |
---|
455 | network byte order. HTTP/2.0 does not enforce alignment of types in |
---|
456 | dynamically sized frames. |
---|
457 | |
---|
458 | 3.2.1. Control frames |
---|
459 | |
---|
460 | +----------------------------------+ |
---|
461 | |C| Version(15bits) | Type(16bits) | |
---|
462 | +----------------------------------+ |
---|
463 | | Flags (8) | Length (24 bits) | |
---|
464 | +----------------------------------+ |
---|
465 | | Data | |
---|
466 | +----------------------------------+ |
---|
467 | |
---|
468 | Control bit: The 'C' bit is a single bit indicating if this is a |
---|
469 | control message. For control frames this value is always 1. |
---|
470 | |
---|
471 | Version: The version number of the HTTP/2.0 protocol. This document |
---|
472 | describes HTTP/2.0 version 3. |
---|
473 | |
---|
474 | Type: The type of control frame. See Control Frames for the complete |
---|
475 | list of control frames. |
---|
476 | |
---|
477 | Flags: Flags related to this frame. Flags for control frames and |
---|
478 | data frames are different. |
---|
479 | |
---|
480 | Length: An unsigned 24-bit value representing the number of bytes |
---|
481 | after the length field. |
---|
482 | |
---|
483 | Data: data associated with this control frame. The format and length |
---|
484 | of this data is controlled by the control frame type. |
---|
485 | |
---|
486 | Control frame processing requirements: |
---|
487 | |
---|
488 | Note that full length control frames (16MB) can be large for |
---|
489 | implementations running on resource-limited hardware. In such |
---|
490 | cases, implementations MAY limit the maximum length frame |
---|
491 | supported. However, all implementations MUST be able to receive |
---|
492 | control frames of at least 8192 octets in length. |
---|
493 | |
---|
494 | |
---|
495 | |
---|
496 | |
---|
497 | |
---|
498 | |
---|
499 | |
---|
500 | |
---|
501 | |
---|
502 | |
---|
503 | Belshe, et al. Expires July 26, 2013 [Page 9] |
---|
504 | |
---|
505 | Internet-Draft HTTP/2.0 January 2013 |
---|
506 | |
---|
507 | |
---|
508 | 3.2.2. Data frames |
---|
509 | |
---|
510 | +----------------------------------+ |
---|
511 | |C| Stream-ID (31bits) | |
---|
512 | +----------------------------------+ |
---|
513 | | Flags (8) | Length (24 bits) | |
---|
514 | +----------------------------------+ |
---|
515 | | Data | |
---|
516 | +----------------------------------+ |
---|
517 | |
---|
518 | Control bit: For data frames this value is always 0. |
---|
519 | |
---|
520 | Stream-ID: A 31-bit value identifying the stream. |
---|
521 | |
---|
522 | Flags: Flags related to this frame. Valid flags are: |
---|
523 | |
---|
524 | 0x01 = FLAG_FIN - signifies that this frame represents the last |
---|
525 | frame to be transmitted on this stream. See Stream Close |
---|
526 | (Section 3.3.7) below. |
---|
527 | |
---|
528 | 0x02 = FLAG_COMPRESS - indicates that the data in this frame has |
---|
529 | been compressed. |
---|
530 | |
---|
531 | Length: An unsigned 24-bit value representing the number of bytes |
---|
532 | after the length field. The total size of a data frame is 8 bytes + |
---|
533 | length. It is valid to have a zero-length data frame. |
---|
534 | |
---|
535 | Data: The variable-length data payload; the length was defined in the |
---|
536 | length field. |
---|
537 | |
---|
538 | Data frame processing requirements: |
---|
539 | |
---|
540 | If an endpoint receives a data frame for a stream-id which is not |
---|
541 | open and the endpoint has not sent a GOAWAY (Section 3.6.6) frame, |
---|
542 | it MUST send issue a stream error (Section 3.4.2) with the error |
---|
543 | code INVALID_STREAM for the stream-id. |
---|
544 | |
---|
545 | If the endpoint which created the stream receives a data frame |
---|
546 | before receiving a SYN_REPLY on that stream, it is a protocol |
---|
547 | error, and the recipient MUST issue a stream error (Section 3.4.2) |
---|
548 | with the status code PROTOCOL_ERROR for the stream-id. |
---|
549 | |
---|
550 | Implementors note: If an endpoint receives multiple data frames |
---|
551 | for invalid stream-ids, it MAY close the session. |
---|
552 | |
---|
553 | All HTTP/2.0 endpoints MUST accept compressed data frames. |
---|
554 | Compression of data frames is always done using zlib compression. |
---|
555 | Each stream initializes and uses its own compression context |
---|
556 | |
---|
557 | |
---|
558 | |
---|
559 | Belshe, et al. Expires July 26, 2013 [Page 10] |
---|
560 | |
---|
561 | Internet-Draft HTTP/2.0 January 2013 |
---|
562 | |
---|
563 | |
---|
564 | dedicated to use within that stream. Endpoints are encouraged to |
---|
565 | use application level compression rather than HTTP/2.0 stream |
---|
566 | level compression. |
---|
567 | |
---|
568 | Each HTTP/2.0 stream sending compressed frames creates its own |
---|
569 | zlib context for that stream, and these compression contexts MUST |
---|
570 | be distinct from the compression contexts used with SYN_STREAM/ |
---|
571 | SYN_REPLY/HEADER compression. (Thus, if both endpoints of a |
---|
572 | stream are compressing data on the stream, there will be two zlib |
---|
573 | contexts, one for sending and one for receiving). |
---|
574 | |
---|
575 | 3.3. Streams |
---|
576 | |
---|
577 | Streams are independent sequences of bi-directional data divided into |
---|
578 | frames with several properties: |
---|
579 | |
---|
580 | Streams may be created by either the client or server. |
---|
581 | |
---|
582 | Streams optionally carry a set of name/value header pairs. |
---|
583 | |
---|
584 | Streams can concurrently send data interleaved with other streams. |
---|
585 | |
---|
586 | Streams may be cancelled. |
---|
587 | |
---|
588 | 3.3.1. Stream frames |
---|
589 | |
---|
590 | HTTP/2.0 defines 3 control frames to manage the lifecycle of a |
---|
591 | stream: |
---|
592 | |
---|
593 | SYN_STREAM - Open a new stream |
---|
594 | |
---|
595 | SYN_REPLY - Remote acknowledgement of a new, open stream |
---|
596 | |
---|
597 | RST_STREAM - Close a stream |
---|
598 | |
---|
599 | 3.3.2. Stream creation |
---|
600 | |
---|
601 | A stream is created by sending a control frame with the type set to |
---|
602 | SYN_STREAM (Section 3.6.1). If the server is initiating the stream, |
---|
603 | the Stream-ID must be even. If the client is initiating the stream, |
---|
604 | the Stream-ID must be odd. 0 is not a valid Stream-ID. Stream-IDs |
---|
605 | from each side of the connection must increase monotonically as new |
---|
606 | streams are created. E.g. Stream 2 may be created after stream 3, |
---|
607 | but stream 7 must not be created after stream 9. Stream IDs do not |
---|
608 | wrap: when a client or server cannot create a new stream id without |
---|
609 | exceeding a 31 bit value, it MUST NOT create a new stream. |
---|
610 | |
---|
611 | The stream-id MUST increase with each new stream. If an endpoint |
---|
612 | |
---|
613 | |
---|
614 | |
---|
615 | Belshe, et al. Expires July 26, 2013 [Page 11] |
---|
616 | |
---|
617 | Internet-Draft HTTP/2.0 January 2013 |
---|
618 | |
---|
619 | |
---|
620 | receives a SYN_STREAM with a stream id which is less than any |
---|
621 | previously received SYN_STREAM, it MUST issue a session error |
---|
622 | (Section 3.4.1) with the status PROTOCOL_ERROR. |
---|
623 | |
---|
624 | It is a protocol error to send two SYN_STREAMs with the same |
---|
625 | stream-id. If a recipient receives a second SYN_STREAM for the same |
---|
626 | stream, it MUST issue a stream error (Section 3.4.2) with the status |
---|
627 | code PROTOCOL_ERROR. |
---|
628 | |
---|
629 | Upon receipt of a SYN_STREAM, the recipient can reject the stream by |
---|
630 | sending a stream error (Section 3.4.2) with the error code |
---|
631 | REFUSED_STREAM. Note, however, that the creating endpoint may have |
---|
632 | already sent additional frames for that stream which cannot be |
---|
633 | immediately stopped. |
---|
634 | |
---|
635 | Once the stream is created, the creator may immediately send HEADERS |
---|
636 | or DATA frames for that stream, without needing to wait for the |
---|
637 | recipient to acknowledge. |
---|
638 | |
---|
639 | 3.3.2.1. Unidirectional streams |
---|
640 | |
---|
641 | When an endpoint creates a stream with the FLAG_UNIDIRECTIONAL flag |
---|
642 | set, it creates a unidirectional stream which the creating endpoint |
---|
643 | can use to send frames, but the receiving endpoint cannot. The |
---|
644 | receiving endpoint is implicitly already in the half-closed |
---|
645 | (Section 3.3.6) state. |
---|
646 | |
---|
647 | 3.3.2.2. Bidirectional streams |
---|
648 | |
---|
649 | SYN_STREAM frames which do not use the FLAG_UNIDIRECTIONAL flag are |
---|
650 | bidirectional streams. Both endpoints can send data on a bi- |
---|
651 | directional stream. |
---|
652 | |
---|
653 | 3.3.3. Stream priority |
---|
654 | |
---|
655 | The creator of a stream assigns a priority for that stream. Priority |
---|
656 | is represented as an integer from 0 to 7. 0 represents the highest |
---|
657 | priority and 7 represents the lowest priority. |
---|
658 | |
---|
659 | The sender and recipient SHOULD use best-effort to process streams in |
---|
660 | the order of highest priority to lowest priority. |
---|
661 | |
---|
662 | 3.3.4. Stream headers |
---|
663 | |
---|
664 | Streams carry optional sets of name/value pair headers which carry |
---|
665 | metadata about the stream. After the stream has been created, and as |
---|
666 | long as the sender is not closed (Section 3.3.7) or half-closed |
---|
667 | (Section 3.3.6), each side may send HEADERS frame(s) containing the |
---|
668 | |
---|
669 | |
---|
670 | |
---|
671 | Belshe, et al. Expires July 26, 2013 [Page 12] |
---|
672 | |
---|
673 | Internet-Draft HTTP/2.0 January 2013 |
---|
674 | |
---|
675 | |
---|
676 | header data. Header data can be sent in multiple HEADERS frames, and |
---|
677 | HEADERS frames may be interleaved with data frames. |
---|
678 | |
---|
679 | 3.3.5. Stream data exchange |
---|
680 | |
---|
681 | Once a stream is created, it can be used to send arbitrary amounts of |
---|
682 | data. Generally this means that a series of data frames will be sent |
---|
683 | on the stream until a frame containing the FLAG_FIN flag is set. The |
---|
684 | FLAG_FIN can be set on a SYN_STREAM (Section 3.6.1), SYN_REPLY |
---|
685 | (Section 3.6.2), HEADERS (Section 3.6.7) or a DATA (Section 3.2.2) |
---|
686 | frame. Once the FLAG_FIN has been sent, the stream is considered to |
---|
687 | be half-closed. |
---|
688 | |
---|
689 | 3.3.6. Stream half-close |
---|
690 | |
---|
691 | When one side of the stream sends a frame with the FLAG_FIN flag set, |
---|
692 | the stream is half-closed from that endpoint. The sender of the |
---|
693 | FLAG_FIN MUST NOT send further frames on that stream. When both |
---|
694 | sides have half-closed, the stream is closed. |
---|
695 | |
---|
696 | If an endpoint receives a data frame after the stream is half-closed |
---|
697 | from the sender (e.g. the endpoint has already received a prior frame |
---|
698 | for the stream with the FIN flag set), it MUST send a RST_STREAM to |
---|
699 | the sender with the status STREAM_ALREADY_CLOSED. |
---|
700 | |
---|
701 | 3.3.7. Stream close |
---|
702 | |
---|
703 | There are 3 ways that streams can be terminated: |
---|
704 | |
---|
705 | Normal termination: Normal stream termination occurs when both |
---|
706 | sender and recipient have half-closed the stream by sending a |
---|
707 | FLAG_FIN. |
---|
708 | |
---|
709 | Abrupt termination: Either the client or server can send a |
---|
710 | RST_STREAM control frame at any time. A RST_STREAM contains an |
---|
711 | error code to indicate the reason for failure. When a RST_STREAM |
---|
712 | is sent from the stream originator, it indicates a failure to |
---|
713 | complete the stream and that no further data will be sent on the |
---|
714 | stream. When a RST_STREAM is sent from the stream recipient, the |
---|
715 | sender, upon receipt, should stop sending any data on the stream. |
---|
716 | The stream recipient should be aware that there is a race between |
---|
717 | data already in transit from the sender and the time the |
---|
718 | RST_STREAM is received. See Stream Error Handling (Section 3.4.2) |
---|
719 | |
---|
720 | TCP connection teardown: If the TCP connection is torn down while |
---|
721 | un-closed streams exist, then the endpoint must assume that the |
---|
722 | stream was abnormally interrupted and may be incomplete. |
---|
723 | |
---|
724 | |
---|
725 | |
---|
726 | |
---|
727 | Belshe, et al. Expires July 26, 2013 [Page 13] |
---|
728 | |
---|
729 | Internet-Draft HTTP/2.0 January 2013 |
---|
730 | |
---|
731 | |
---|
732 | If an endpoint receives a data frame after the stream is closed, it |
---|
733 | must send a RST_STREAM to the sender with the status PROTOCOL_ERROR. |
---|
734 | |
---|
735 | 3.4. Error Handling |
---|
736 | |
---|
737 | The HTTP/2.0 framing layer has only two types of errors, and they are |
---|
738 | always handled consistently. Any reference in this specification to |
---|
739 | "issue a session error" refers to Section 3.4.1. Any reference to |
---|
740 | "issue a stream error" refers to Section 3.4.2. |
---|
741 | |
---|
742 | 3.4.1. Session Error Handling |
---|
743 | |
---|
744 | A session error is any error which prevents further processing of the |
---|
745 | framing layer or which corrupts the session compression state. When |
---|
746 | a session error occurs, the endpoint encountering the error MUST |
---|
747 | first send a GOAWAY (Section 3.6.6) frame with the stream id of most |
---|
748 | recently received stream from the remote endpoint, and the error code |
---|
749 | for why the session is terminating. After sending the GOAWAY frame, |
---|
750 | the endpoint MUST close the TCP connection. |
---|
751 | |
---|
752 | Note that the session compression state is dependent upon both |
---|
753 | endpoints always processing all compressed data. If an endpoint |
---|
754 | partially processes a frame containing compressed data without |
---|
755 | updating compression state properly, future control frames which use |
---|
756 | compression will be always be errored. Implementations SHOULD always |
---|
757 | try to process compressed data so that errors which could be handled |
---|
758 | as stream errors do not become session errors. |
---|
759 | |
---|
760 | Note that because this GOAWAY is sent during a session error case, it |
---|
761 | is possible that the GOAWAY will not be reliably received by the |
---|
762 | receiving endpoint. It is a best-effort attempt to communicate with |
---|
763 | the remote about why the session is going down. |
---|
764 | |
---|
765 | 3.4.2. Stream Error Handling |
---|
766 | |
---|
767 | A stream error is an error related to a specific stream-id which does |
---|
768 | not affect processing of other streams at the framing layer. Upon a |
---|
769 | stream error, the endpoint MUST send a RST_STREAM (Section 3.6.3) |
---|
770 | frame which contains the stream id of the stream where the error |
---|
771 | occurred and the error status which caused the error. After sending |
---|
772 | the RST_STREAM, the stream is closed to the sending endpoint. After |
---|
773 | sending the RST_STREAM, if the sender receives any frames other than |
---|
774 | a RST_STREAM for that stream id, it will result in sending additional |
---|
775 | RST_STREAM frames. An endpoint MUST NOT send a RST_STREAM in |
---|
776 | response to an RST_STREAM, as doing so would lead to RST_STREAM |
---|
777 | loops. Sending a RST_STREAM does not cause the HTTP/2.0 session to |
---|
778 | be closed. |
---|
779 | |
---|
780 | |
---|
781 | |
---|
782 | |
---|
783 | Belshe, et al. Expires July 26, 2013 [Page 14] |
---|
784 | |
---|
785 | Internet-Draft HTTP/2.0 January 2013 |
---|
786 | |
---|
787 | |
---|
788 | If an endpoint has multiple RST_STREAM frames to send in succession |
---|
789 | for the same stream-id and the same error code, it MAY coalesce them |
---|
790 | into a single RST_STREAM frame. (This can happen if a stream is |
---|
791 | closed, but the remote sends multiple data frames. There is no |
---|
792 | reason to send a RST_STREAM for each frame in succession). |
---|
793 | |
---|
794 | 3.5. Stream Flow Control |
---|
795 | |
---|
796 | Multiplexing streams introduces contention for access to the shared |
---|
797 | TCP connection. Stream contention can result in streams being |
---|
798 | blocked by other streams. A flow control scheme ensures that streams |
---|
799 | do not destructively interfere with other streams on the same TCP |
---|
800 | connection. |
---|
801 | |
---|
802 | 3.5.1. Flow Control Principles |
---|
803 | |
---|
804 | Experience with TCP congestion control has shown that algorithms can |
---|
805 | evolve over time to become more sophisticated without requiring |
---|
806 | protocol changes. TCP congestion control and its evolution is |
---|
807 | clearly different from HTTP/2.0 flow control, though the evolution of |
---|
808 | TCP congestion control algorithms shows that a similar approach could |
---|
809 | be feasible for HTTP/2.0 flow control. |
---|
810 | |
---|
811 | HTTP/2.0 stream flow control aims to allow for future improvements to |
---|
812 | flow control algorithms without requiring protocol changes. The |
---|
813 | following principles guide the HTTP/2.0 design: |
---|
814 | |
---|
815 | 1. Flow control is hop-by-hop, not end-to-end. |
---|
816 | |
---|
817 | 2. Flow control is based on window update messages. Receivers |
---|
818 | advertise how many octets they are prepared to receive on a |
---|
819 | stream. This is a credit-based scheme. |
---|
820 | |
---|
821 | 3. Flow control is directional with overall control provided by the |
---|
822 | receiver. A receiver MAY choose to set any window size that it |
---|
823 | desires for each stream [[TBD: ... and for the overall |
---|
824 | connection]]. A sender MUST respect flow control limits imposed |
---|
825 | by a receiver. Clients, servers and intermediaries all |
---|
826 | independently advertise their flow control preferences as a |
---|
827 | receiver and abide by the flow control limits set by their peer |
---|
828 | when sending. |
---|
829 | |
---|
830 | 4. Flow control can be disabled by a receiver. A receiver can |
---|
831 | choose to either disable flow control, or to declare an infinite |
---|
832 | flow control limit. [[TBD: determine whether just one mechanism |
---|
833 | is sufficient, and then which alternative]] |
---|
834 | |
---|
835 | |
---|
836 | |
---|
837 | |
---|
838 | |
---|
839 | Belshe, et al. Expires July 26, 2013 [Page 15] |
---|
840 | |
---|
841 | Internet-Draft HTTP/2.0 January 2013 |
---|
842 | |
---|
843 | |
---|
844 | 5. HTTP/2.0 standardizes only the format of the window update |
---|
845 | message (Section 3.6.8). This does not stipulate how a receiver |
---|
846 | decides when to send this message or the value that it sends. |
---|
847 | Nor does it specify how a sender chooses to send packets. |
---|
848 | Implementations are able to select any algorithm that suits their |
---|
849 | needs. An example flow control algorithm is described in |
---|
850 | Section 3.5.2. |
---|
851 | |
---|
852 | Implementations are also responsible for managing how requests and |
---|
853 | responses are sent based on priority; choosing how to avoid head of |
---|
854 | line blocking for requests; and managing the creation of new streams. |
---|
855 | Algorithm choices for these could interact with any flow control |
---|
856 | algorithm. |
---|
857 | |
---|
858 | 3.5.2. Basic Flow Control Algorithm |
---|
859 | |
---|
860 | This section describes a basic flow control algorithm. This |
---|
861 | algorithm is provided as an example, implementations can use any |
---|
862 | algorithm that complies with flow control requirements. |
---|
863 | |
---|
864 | [[Algorithm TBD]] |
---|
865 | |
---|
866 | 3.6. Control frame types |
---|
867 | |
---|
868 | 3.6.1. SYN_STREAM |
---|
869 | |
---|
870 | The SYN_STREAM control frame allows the sender to asynchronously |
---|
871 | create a stream between the endpoints. See Stream Creation |
---|
872 | (Section 3.3.2) |
---|
873 | |
---|
874 | |
---|
875 | |
---|
876 | |
---|
877 | |
---|
878 | |
---|
879 | |
---|
880 | |
---|
881 | |
---|
882 | |
---|
883 | |
---|
884 | |
---|
885 | |
---|
886 | |
---|
887 | |
---|
888 | |
---|
889 | |
---|
890 | |
---|
891 | |
---|
892 | |
---|
893 | |
---|
894 | |
---|
895 | Belshe, et al. Expires July 26, 2013 [Page 16] |
---|
896 | |
---|
897 | Internet-Draft HTTP/2.0 January 2013 |
---|
898 | |
---|
899 | |
---|
900 | +------------------------------------+ |
---|
901 | |1| version | 1 | |
---|
902 | +------------------------------------+ |
---|
903 | | Flags (8) | Length (24 bits) | |
---|
904 | +------------------------------------+ |
---|
905 | |X| Stream-ID (31bits) | |
---|
906 | +------------------------------------+ |
---|
907 | |X| Associated-To-Stream-ID (31bits) | |
---|
908 | +------------------------------------+ |
---|
909 | | Pri|Unused | Slot | | |
---|
910 | +-------------------+ | |
---|
911 | | Number of Name/Value pairs (int32) | <+ |
---|
912 | +------------------------------------+ | |
---|
913 | | Length of name (int32) | | This section is the |
---|
914 | +------------------------------------+ | "Name/Value Header |
---|
915 | | Name (string) | | Block", and is |
---|
916 | +------------------------------------+ | compressed. |
---|
917 | | Length of value (int32) | | |
---|
918 | +------------------------------------+ | |
---|
919 | | Value (string) | | |
---|
920 | +------------------------------------+ | |
---|
921 | | (repeats) | <+ |
---|
922 | |
---|
923 | Flags: Flags related to this frame. Valid flags are: |
---|
924 | |
---|
925 | 0x01 = FLAG_FIN - marks this frame as the last frame to be |
---|
926 | transmitted on this stream and puts the sender in the half-closed |
---|
927 | (Section 3.3.6) state. |
---|
928 | |
---|
929 | 0x02 = FLAG_UNIDIRECTIONAL - a stream created with this flag puts |
---|
930 | the recipient in the half-closed (Section 3.3.6) state. |
---|
931 | |
---|
932 | Length: The length is the number of bytes which follow the length |
---|
933 | field in the frame. For SYN_STREAM frames, this is 10 bytes plus the |
---|
934 | length of the compressed Name/Value block. |
---|
935 | |
---|
936 | Stream-ID: The 31-bit identifier for this stream. This stream-id |
---|
937 | will be used in frames which are part of this stream. |
---|
938 | |
---|
939 | Associated-To-Stream-ID: The 31-bit identifier for a stream which |
---|
940 | this stream is associated to. If this stream is independent of all |
---|
941 | other streams, it should be 0. |
---|
942 | |
---|
943 | Priority: A 3-bit priority (Section 3.3.3) field. |
---|
944 | |
---|
945 | Unused: 5 bits of unused space, reserved for future use. |
---|
946 | |
---|
947 | Slot: An 8 bit unsigned integer specifying the index in the server's |
---|
948 | |
---|
949 | |
---|
950 | |
---|
951 | Belshe, et al. Expires July 26, 2013 [Page 17] |
---|
952 | |
---|
953 | Internet-Draft HTTP/2.0 January 2013 |
---|
954 | |
---|
955 | |
---|
956 | CREDENTIAL vector of the client certificate to be used for this |
---|
957 | request. see CREDENTIAL frame (Section 3.6.9). The value 0 means no |
---|
958 | client certificate should be associated with this stream. |
---|
959 | |
---|
960 | Name/Value Header Block: A set of name/value pairs carried as part of |
---|
961 | the SYN_STREAM. see Name/Value Header Block (Section 3.6.10). |
---|
962 | |
---|
963 | If an endpoint receives a SYN_STREAM which is larger than the |
---|
964 | implementation supports, it MAY send a RST_STREAM with error code |
---|
965 | FRAME_TOO_LARGE. All implementations MUST support the minimum size |
---|
966 | limits defined in the Control Frames section (Section 3.2.1). |
---|
967 | |
---|
968 | 3.6.2. SYN_REPLY |
---|
969 | |
---|
970 | SYN_REPLY indicates the acceptance of a stream creation by the |
---|
971 | recipient of a SYN_STREAM frame. |
---|
972 | |
---|
973 | +------------------------------------+ |
---|
974 | |1| version | 2 | |
---|
975 | +------------------------------------+ |
---|
976 | | Flags (8) | Length (24 bits) | |
---|
977 | +------------------------------------+ |
---|
978 | |X| Stream-ID (31bits) | |
---|
979 | +------------------------------------+ |
---|
980 | | Number of Name/Value pairs (int32) | <+ |
---|
981 | +------------------------------------+ | |
---|
982 | | Length of name (int32) | | This section is the |
---|
983 | +------------------------------------+ | "Name/Value Header |
---|
984 | | Name (string) | | Block", and is |
---|
985 | +------------------------------------+ | compressed. |
---|
986 | | Length of value (int32) | | |
---|
987 | +------------------------------------+ | |
---|
988 | | Value (string) | | |
---|
989 | +------------------------------------+ | |
---|
990 | | (repeats) | <+ |
---|
991 | |
---|
992 | Flags: Flags related to this frame. Valid flags are: |
---|
993 | |
---|
994 | 0x01 = FLAG_FIN - marks this frame as the last frame to be |
---|
995 | transmitted on this stream and puts the sender in the half-closed |
---|
996 | (Section 3.3.6) state. |
---|
997 | |
---|
998 | Length: The length is the number of bytes which follow the length |
---|
999 | field in the frame. For SYN_REPLY frames, this is 4 bytes plus the |
---|
1000 | length of the compressed Name/Value block. |
---|
1001 | |
---|
1002 | Stream-ID: The 31-bit identifier for this stream. |
---|
1003 | |
---|
1004 | |
---|
1005 | |
---|
1006 | |
---|
1007 | Belshe, et al. Expires July 26, 2013 [Page 18] |
---|
1008 | |
---|
1009 | Internet-Draft HTTP/2.0 January 2013 |
---|
1010 | |
---|
1011 | |
---|
1012 | If an endpoint receives multiple SYN_REPLY frames for the same active |
---|
1013 | stream ID, it MUST issue a stream error (Section 3.4.2) with the |
---|
1014 | error code STREAM_IN_USE. |
---|
1015 | |
---|
1016 | Name/Value Header Block: A set of name/value pairs carried as part of |
---|
1017 | the SYN_STREAM. see Name/Value Header Block (Section 3.6.10). |
---|
1018 | |
---|
1019 | If an endpoint receives a SYN_REPLY which is larger than the |
---|
1020 | implementation supports, it MAY send a RST_STREAM with error code |
---|
1021 | FRAME_TOO_LARGE. All implementations MUST support the minimum size |
---|
1022 | limits defined in the Control Frames section (Section 3.2.1). |
---|
1023 | |
---|
1024 | 3.6.3. RST_STREAM |
---|
1025 | |
---|
1026 | The RST_STREAM frame allows for abnormal termination of a stream. |
---|
1027 | When sent by the creator of a stream, it indicates the creator wishes |
---|
1028 | to cancel the stream. When sent by the recipient of a stream, it |
---|
1029 | indicates an error or that the recipient did not want to accept the |
---|
1030 | stream, so the stream should be closed. |
---|
1031 | |
---|
1032 | +----------------------------------+ |
---|
1033 | |1| version | 3 | |
---|
1034 | +----------------------------------+ |
---|
1035 | | Flags (8) | 8 | |
---|
1036 | +----------------------------------+ |
---|
1037 | |X| Stream-ID (31bits) | |
---|
1038 | +----------------------------------+ |
---|
1039 | | Status code | |
---|
1040 | +----------------------------------+ |
---|
1041 | |
---|
1042 | Flags: Flags related to this frame. RST_STREAM does not define any |
---|
1043 | flags. This value must be 0. |
---|
1044 | |
---|
1045 | Length: An unsigned 24-bit value representing the number of bytes |
---|
1046 | after the length field. For RST_STREAM control frames, this value is |
---|
1047 | always 8. |
---|
1048 | |
---|
1049 | Stream-ID: The 31-bit identifier for this stream. |
---|
1050 | |
---|
1051 | Status code: (32 bits) An indicator for why the stream is being |
---|
1052 | terminated.The following status codes are defined: |
---|
1053 | |
---|
1054 | 1 - PROTOCOL_ERROR. This is a generic error, and should only be |
---|
1055 | used if a more specific error is not available. |
---|
1056 | |
---|
1057 | 2 - INVALID_STREAM. This is returned when a frame is received for |
---|
1058 | a stream which is not active. |
---|
1059 | |
---|
1060 | |
---|
1061 | |
---|
1062 | |
---|
1063 | Belshe, et al. Expires July 26, 2013 [Page 19] |
---|
1064 | |
---|
1065 | Internet-Draft HTTP/2.0 January 2013 |
---|
1066 | |
---|
1067 | |
---|
1068 | 3 - REFUSED_STREAM. Indicates that the stream was refused before |
---|
1069 | any processing has been done on the stream. |
---|
1070 | |
---|
1071 | 4 - UNSUPPORTED_VERSION. Indicates that the recipient of a stream |
---|
1072 | does not support the HTTP/2.0 version requested. |
---|
1073 | |
---|
1074 | 5 - CANCEL. Used by the creator of a stream to indicate that the |
---|
1075 | stream is no longer needed. |
---|
1076 | |
---|
1077 | 6 - INTERNAL_ERROR. This is a generic error which can be used |
---|
1078 | when the implementation has internally failed, not due to anything |
---|
1079 | in the protocol. |
---|
1080 | |
---|
1081 | 7 - FLOW_CONTROL_ERROR. The endpoint detected that its peer |
---|
1082 | violated the flow control protocol. |
---|
1083 | |
---|
1084 | 8 - STREAM_IN_USE. The endpoint received a SYN_REPLY for a stream |
---|
1085 | already open. |
---|
1086 | |
---|
1087 | 9 - STREAM_ALREADY_CLOSED. The endpoint received a data or |
---|
1088 | SYN_REPLY frame for a stream which is half closed. |
---|
1089 | |
---|
1090 | 10 - INVALID_CREDENTIALS. The server received a request for a |
---|
1091 | resource whose origin does not have valid credentials in the |
---|
1092 | client certificate vector. |
---|
1093 | |
---|
1094 | 11 - FRAME_TOO_LARGE. The endpoint received a frame which this |
---|
1095 | implementation could not support. If FRAME_TOO_LARGE is sent for |
---|
1096 | a SYN_STREAM, HEADERS, or SYN_REPLY frame without fully processing |
---|
1097 | the compressed portion of those frames, then the compression state |
---|
1098 | will be out-of-sync with the other endpoint. In this case, |
---|
1099 | senders of FRAME_TOO_LARGE MUST close the session. |
---|
1100 | |
---|
1101 | Note: 0 is not a valid status code for a RST_STREAM. |
---|
1102 | |
---|
1103 | After receiving a RST_STREAM on a stream, the recipient must not send |
---|
1104 | additional frames for that stream, and the stream moves into the |
---|
1105 | closed state. |
---|
1106 | |
---|
1107 | 3.6.4. SETTINGS |
---|
1108 | |
---|
1109 | A SETTINGS frame contains a set of id/value pairs for communicating |
---|
1110 | configuration data about how the two endpoints may communicate. |
---|
1111 | SETTINGS frames can be sent at any time by either endpoint, are |
---|
1112 | optionally sent, and are fully asynchronous. When the server is the |
---|
1113 | sender, the sender can request that configuration data be persisted |
---|
1114 | by the client across HTTP/2.0 sessions and returned to the server in |
---|
1115 | future communications. |
---|
1116 | |
---|
1117 | |
---|
1118 | |
---|
1119 | Belshe, et al. Expires July 26, 2013 [Page 20] |
---|
1120 | |
---|
1121 | Internet-Draft HTTP/2.0 January 2013 |
---|
1122 | |
---|
1123 | |
---|
1124 | Persistence of SETTINGS ID/Value pairs is done on a per origin/IP |
---|
1125 | pair (the "origin" is the set of scheme, host, and port from the URI. |
---|
1126 | See [RFC6454]). That is, when a client connects to a server, and the |
---|
1127 | server persists settings within the client, the client SHOULD return |
---|
1128 | the persisted settings on future connections to the same origin AND |
---|
1129 | IP address and TCP port. Clients MUST NOT request servers to use the |
---|
1130 | persistence features of the SETTINGS frames, and servers MUST ignore |
---|
1131 | persistence related flags sent by a client. |
---|
1132 | |
---|
1133 | +----------------------------------+ |
---|
1134 | |1| version | 4 | |
---|
1135 | +----------------------------------+ |
---|
1136 | | Flags (8) | Length (24 bits) | |
---|
1137 | +----------------------------------+ |
---|
1138 | | Number of entries | |
---|
1139 | +----------------------------------+ |
---|
1140 | | ID/Value Pairs | |
---|
1141 | | ... | |
---|
1142 | |
---|
1143 | Control bit: The control bit is always 1 for this message. |
---|
1144 | |
---|
1145 | Version: The HTTP/2.0 version number. |
---|
1146 | |
---|
1147 | Type: The message type for a SETTINGS message is 4. |
---|
1148 | |
---|
1149 | Flags: FLAG_SETTINGS_CLEAR_SETTINGS (0x1): When set, the client |
---|
1150 | should clear any previously persisted SETTINGS ID/Value pairs. If |
---|
1151 | this frame contains ID/Value pairs with the |
---|
1152 | FLAG_SETTINGS_PERSIST_VALUE set, then the client will first clear its |
---|
1153 | existing, persisted settings, and then persist the values with the |
---|
1154 | flag set which are contained within this frame. Because persistence |
---|
1155 | is only implemented on the client, this flag can only be used when |
---|
1156 | the sender is the server. |
---|
1157 | |
---|
1158 | Length: An unsigned 24-bit value representing the number of bytes |
---|
1159 | after the length field. The total size of a SETTINGS frame is 8 |
---|
1160 | bytes + length. |
---|
1161 | |
---|
1162 | Number of entries: A 32-bit value representing the number of ID/value |
---|
1163 | pairs in this message. |
---|
1164 | |
---|
1165 | ID: A 32-bit ID number, comprised of 8 bits of flags and 24 bits of |
---|
1166 | unique ID. |
---|
1167 | |
---|
1168 | ID.flags: |
---|
1169 | |
---|
1170 | FLAG_SETTINGS_PERSIST_VALUE (0x1): When set, the sender of this |
---|
1171 | SETTINGS frame is requesting that the recipient persist the ID/ |
---|
1172 | |
---|
1173 | |
---|
1174 | |
---|
1175 | Belshe, et al. Expires July 26, 2013 [Page 21] |
---|
1176 | |
---|
1177 | Internet-Draft HTTP/2.0 January 2013 |
---|
1178 | |
---|
1179 | |
---|
1180 | Value and return it in future SETTINGS frames sent from the |
---|
1181 | sender to this recipient. Because persistence is only |
---|
1182 | implemented on the client, this flag is only sent by the |
---|
1183 | server. |
---|
1184 | |
---|
1185 | FLAG_SETTINGS_PERSISTED (0x2): When set, the sender is |
---|
1186 | notifying the recipient that this ID/Value pair was previously |
---|
1187 | sent to the sender by the recipient with the |
---|
1188 | FLAG_SETTINGS_PERSIST_VALUE, and the sender is returning it. |
---|
1189 | Because persistence is only implemented on the client, this |
---|
1190 | flag is only sent by the client. |
---|
1191 | |
---|
1192 | Defined IDs: |
---|
1193 | |
---|
1194 | 1 - SETTINGS_UPLOAD_BANDWIDTH allows the sender to send its |
---|
1195 | expected upload bandwidth on this channel. This number is an |
---|
1196 | estimate. The value should be the integral number of kilobytes |
---|
1197 | per second that the sender predicts as an expected maximum |
---|
1198 | upload channel capacity. |
---|
1199 | |
---|
1200 | 2 - SETTINGS_DOWNLOAD_BANDWIDTH allows the sender to send its |
---|
1201 | expected download bandwidth on this channel. This number is an |
---|
1202 | estimate. The value should be the integral number of kilobytes |
---|
1203 | per second that the sender predicts as an expected maximum |
---|
1204 | download channel capacity. |
---|
1205 | |
---|
1206 | 3 - SETTINGS_ROUND_TRIP_TIME allows the sender to send its |
---|
1207 | expected round-trip-time on this channel. The round trip time |
---|
1208 | is defined as the minimum amount of time to send a control |
---|
1209 | frame from this client to the remote and receive a response. |
---|
1210 | The value is represented in milliseconds. |
---|
1211 | |
---|
1212 | 4 - SETTINGS_MAX_CONCURRENT_STREAMS allows the sender to inform |
---|
1213 | the remote endpoint the maximum number of concurrent streams |
---|
1214 | which it will allow. By default there is no limit. For |
---|
1215 | implementors it is recommended that this value be no smaller |
---|
1216 | than 100. |
---|
1217 | |
---|
1218 | 5 - SETTINGS_CURRENT_CWND allows the sender to inform the |
---|
1219 | remote endpoint of the current TCP CWND value. |
---|
1220 | |
---|
1221 | 6 - SETTINGS_DOWNLOAD_RETRANS_RATE allows the sender to inform |
---|
1222 | the remote endpoint the retransmission rate (bytes |
---|
1223 | retransmitted / total bytes transmitted). |
---|
1224 | |
---|
1225 | 7 - SETTINGS_INITIAL_WINDOW_SIZE allows the sender to inform |
---|
1226 | the remote endpoint the initial window size (in bytes) for new |
---|
1227 | streams. |
---|
1228 | |
---|
1229 | |
---|
1230 | |
---|
1231 | Belshe, et al. Expires July 26, 2013 [Page 22] |
---|
1232 | |
---|
1233 | Internet-Draft HTTP/2.0 January 2013 |
---|
1234 | |
---|
1235 | |
---|
1236 | 8 - SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE allows the server |
---|
1237 | to inform the client of the new size of the client certificate |
---|
1238 | vector. |
---|
1239 | |
---|
1240 | Value: A 32-bit value. |
---|
1241 | |
---|
1242 | The message is intentionally extensible for future information which |
---|
1243 | may improve client-server communications. The sender does not need |
---|
1244 | to send every type of ID/value. It must only send those for which it |
---|
1245 | has accurate values to convey. When multiple ID/value pairs are |
---|
1246 | sent, they should be sent in order of lowest id to highest id. A |
---|
1247 | single SETTINGS frame MUST not contain multiple values for the same |
---|
1248 | ID. If the recipient of a SETTINGS frame discovers multiple values |
---|
1249 | for the same ID, it MUST ignore all values except the first one. |
---|
1250 | |
---|
1251 | A server may send multiple SETTINGS frames containing different ID/ |
---|
1252 | Value pairs. When the same ID/Value is sent twice, the most recent |
---|
1253 | value overrides any previously sent values. If the server sends IDs |
---|
1254 | 1, 2, and 3 with the FLAG_SETTINGS_PERSIST_VALUE in a first SETTINGS |
---|
1255 | frame, and then sends IDs 4 and 5 with the |
---|
1256 | FLAG_SETTINGS_PERSIST_VALUE, when the client returns the persisted |
---|
1257 | state on its next SETTINGS frame, it SHOULD send all 5 settings (1, |
---|
1258 | 2, 3, 4, and 5 in this example) to the server. |
---|
1259 | |
---|
1260 | 3.6.5. PING |
---|
1261 | |
---|
1262 | The PING control frame is a mechanism for measuring a minimal round- |
---|
1263 | trip time from the sender. It can be sent from the client or the |
---|
1264 | server. Recipients of a PING frame should send an identical frame to |
---|
1265 | the sender as soon as possible (if there is other pending data |
---|
1266 | waiting to be sent, PING should take highest priority). Each ping |
---|
1267 | sent by a sender should use a unique ID. |
---|
1268 | |
---|
1269 | +----------------------------------+ |
---|
1270 | |1| version | 6 | |
---|
1271 | +----------------------------------+ |
---|
1272 | | 0 (flags) | 4 (length) | |
---|
1273 | +----------------------------------| |
---|
1274 | | 32-bit ID | |
---|
1275 | +----------------------------------+ |
---|
1276 | |
---|
1277 | Control bit: The control bit is always 1 for this message. |
---|
1278 | |
---|
1279 | Version: The HTTP/2.0 version number. |
---|
1280 | |
---|
1281 | Type: The message type for a PING message is 6. |
---|
1282 | |
---|
1283 | Length: This frame is always 4 bytes long. |
---|
1284 | |
---|
1285 | |
---|
1286 | |
---|
1287 | Belshe, et al. Expires July 26, 2013 [Page 23] |
---|
1288 | |
---|
1289 | Internet-Draft HTTP/2.0 January 2013 |
---|
1290 | |
---|
1291 | |
---|
1292 | ID: A unique ID for this ping, represented as an unsigned 32 bit |
---|
1293 | value. When the client initiates a ping, it must use an odd numbered |
---|
1294 | ID. When the server initiates a ping, it must use an even numbered |
---|
1295 | ping. Use of odd/even IDs is required in order to avoid accidental |
---|
1296 | looping on PINGs (where each side initiates an identical PING at the |
---|
1297 | same time). |
---|
1298 | |
---|
1299 | Note: If a sender uses all possible PING ids (e.g. has sent all 2^31 |
---|
1300 | possible IDs), it can wrap and start re-using IDs. |
---|
1301 | |
---|
1302 | If a server receives an even numbered PING which it did not initiate, |
---|
1303 | it must ignore the PING. If a client receives an odd numbered PING |
---|
1304 | which it did not initiate, it must ignore the PING. |
---|
1305 | |
---|
1306 | 3.6.6. GOAWAY |
---|
1307 | |
---|
1308 | The GOAWAY control frame is a mechanism to tell the remote side of |
---|
1309 | the connection to stop creating streams on this session. It can be |
---|
1310 | sent from the client or the server. Once sent, the sender will not |
---|
1311 | respond to any new SYN_STREAMs on this session. Recipients of a |
---|
1312 | GOAWAY frame must not send additional streams on this session, |
---|
1313 | although a new session can be established for new streams. The |
---|
1314 | purpose of this message is to allow an endpoint to gracefully stop |
---|
1315 | accepting new streams (perhaps for a reboot or maintenance), while |
---|
1316 | still finishing processing of previously established streams. |
---|
1317 | |
---|
1318 | There is an inherent race condition between an endpoint sending |
---|
1319 | SYN_STREAMs and the remote sending a GOAWAY message. To deal with |
---|
1320 | this case, the GOAWAY contains a last-stream-id indicating the |
---|
1321 | stream-id of the last stream which was created on the sending |
---|
1322 | endpoint in this session. If the receiver of the GOAWAY sent new |
---|
1323 | SYN_STREAMs for sessions after this last-stream-id, they were not |
---|
1324 | processed by the server and the receiver may treat the stream as |
---|
1325 | though it had never been created at all (hence the receiver may want |
---|
1326 | to re-create the stream later on a new session). |
---|
1327 | |
---|
1328 | Endpoints should always send a GOAWAY message before closing a |
---|
1329 | connection so that the remote can know whether a stream has been |
---|
1330 | partially processed or not. (For example, if an HTTP client sends a |
---|
1331 | POST at the same time that a server closes a connection, the client |
---|
1332 | cannot know if the server started to process that POST request if the |
---|
1333 | server does not send a GOAWAY frame to indicate where it stopped |
---|
1334 | working). |
---|
1335 | |
---|
1336 | After sending a GOAWAY message, the sender must ignore all SYN_STREAM |
---|
1337 | frames for new streams. |
---|
1338 | |
---|
1339 | |
---|
1340 | |
---|
1341 | |
---|
1342 | |
---|
1343 | Belshe, et al. Expires July 26, 2013 [Page 24] |
---|
1344 | |
---|
1345 | Internet-Draft HTTP/2.0 January 2013 |
---|
1346 | |
---|
1347 | |
---|
1348 | +----------------------------------+ |
---|
1349 | |1| version | 7 | |
---|
1350 | +----------------------------------+ |
---|
1351 | | 0 (flags) | 8 (length) | |
---|
1352 | +----------------------------------| |
---|
1353 | |X| Last-good-stream-ID (31 bits) | |
---|
1354 | +----------------------------------+ |
---|
1355 | | Status code | |
---|
1356 | +----------------------------------+ |
---|
1357 | |
---|
1358 | Control bit: The control bit is always 1 for this message. |
---|
1359 | |
---|
1360 | Version: The HTTP/2.0 version number. |
---|
1361 | |
---|
1362 | Type: The message type for a GOAWAY message is 7. |
---|
1363 | |
---|
1364 | Length: This frame is always 8 bytes long. |
---|
1365 | |
---|
1366 | Last-good-stream-Id: The last stream id which was replied to (with |
---|
1367 | either a SYN_REPLY or RST_STREAM) by the sender of the GOAWAY |
---|
1368 | message. If no streams were replied to, this value MUST be 0. |
---|
1369 | |
---|
1370 | Status: The reason for closing the session. |
---|
1371 | |
---|
1372 | 0 - OK. This is a normal session teardown. |
---|
1373 | |
---|
1374 | 1 - PROTOCOL_ERROR. This is a generic error, and should only be |
---|
1375 | used if a more specific error is not available. |
---|
1376 | |
---|
1377 | 2 - INTERNAL_ERROR. This is a generic error which can be used |
---|
1378 | when the implementation has internally failed, not due to anything |
---|
1379 | in the protocol. |
---|
1380 | |
---|
1381 | 3.6.7. HEADERS |
---|
1382 | |
---|
1383 | The HEADERS frame augments a stream with additional headers. It may |
---|
1384 | be optionally sent on an existing stream at any time. Specific |
---|
1385 | application of the headers in this frame is application-dependent. |
---|
1386 | The name/value header block within this frame is compressed. |
---|
1387 | |
---|
1388 | |
---|
1389 | |
---|
1390 | |
---|
1391 | |
---|
1392 | |
---|
1393 | |
---|
1394 | |
---|
1395 | |
---|
1396 | |
---|
1397 | |
---|
1398 | |
---|
1399 | Belshe, et al. Expires July 26, 2013 [Page 25] |
---|
1400 | |
---|
1401 | Internet-Draft HTTP/2.0 January 2013 |
---|
1402 | |
---|
1403 | |
---|
1404 | +------------------------------------+ |
---|
1405 | |1| version | 8 | |
---|
1406 | +------------------------------------+ |
---|
1407 | | Flags (8) | Length (24 bits) | |
---|
1408 | +------------------------------------+ |
---|
1409 | |X| Stream-ID (31bits) | |
---|
1410 | +------------------------------------+ |
---|
1411 | | Number of Name/Value pairs (int32) | <+ |
---|
1412 | +------------------------------------+ | |
---|
1413 | | Length of name (int32) | | This section is the |
---|
1414 | +------------------------------------+ | "Name/Value Header |
---|
1415 | | Name (string) | | Block", and is |
---|
1416 | +------------------------------------+ | compressed. |
---|
1417 | | Length of value (int32) | | |
---|
1418 | +------------------------------------+ | |
---|
1419 | | Value (string) | | |
---|
1420 | +------------------------------------+ | |
---|
1421 | | (repeats) | <+ |
---|
1422 | |
---|
1423 | Flags: Flags related to this frame. Valid flags are: |
---|
1424 | |
---|
1425 | 0x01 = FLAG_FIN - marks this frame as the last frame to be |
---|
1426 | transmitted on this stream and puts the sender in the half-closed |
---|
1427 | (Section 3.3.6) state. |
---|
1428 | |
---|
1429 | Length: An unsigned 24 bit value representing the number of bytes |
---|
1430 | after the length field. The minimum length of the length field is 4 |
---|
1431 | (when the number of name value pairs is 0). |
---|
1432 | |
---|
1433 | Stream-ID: The stream this HEADERS block is associated with. |
---|
1434 | |
---|
1435 | Name/Value Header Block: A set of name/value pairs carried as part of |
---|
1436 | the SYN_STREAM. see Name/Value Header Block (Section 3.6.10). |
---|
1437 | |
---|
1438 | 3.6.8. WINDOW_UPDATE |
---|
1439 | |
---|
1440 | The WINDOW_UPDATE control frame is used to implement per stream flow |
---|
1441 | control in HTTP/2.0. Flow control in HTTP/2.0 is per hop, that is, |
---|
1442 | only between the two endpoints of a HTTP/2.0 connection. If there |
---|
1443 | are one or more intermediaries between the client and the origin |
---|
1444 | server, flow control signals are not explicitly forwarded by the |
---|
1445 | intermediaries. (However, throttling of data transfer by any |
---|
1446 | recipient may have the effect of indirectly propagating flow control |
---|
1447 | information upstream back to the original sender.) Flow control only |
---|
1448 | applies to the data portion of data frames. Recipients must buffer |
---|
1449 | all control frames. If a recipient fails to buffer an entire control |
---|
1450 | frame, it MUST issue a stream error (Section 3.4.2) with the status |
---|
1451 | code FLOW_CONTROL_ERROR for the stream. |
---|
1452 | |
---|
1453 | |
---|
1454 | |
---|
1455 | Belshe, et al. Expires July 26, 2013 [Page 26] |
---|
1456 | |
---|
1457 | Internet-Draft HTTP/2.0 January 2013 |
---|
1458 | |
---|
1459 | |
---|
1460 | Flow control in HTTP/2.0 is implemented by a data transfer window |
---|
1461 | kept by the sender of each stream. The data transfer window is a |
---|
1462 | simple uint32 that indicates how many bytes of data the sender can |
---|
1463 | transmit. After a stream is created, but before any data frames have |
---|
1464 | been transmitted, the sender begins with the initial window size. |
---|
1465 | This window size is a measure of the buffering capability of the |
---|
1466 | recipient. The sender must not send a data frame with data length |
---|
1467 | greater than the transfer window size. After sending each data |
---|
1468 | frame, the sender decrements its transfer window size by the amount |
---|
1469 | of data transmitted. When the window size becomes less than or equal |
---|
1470 | to 0, the sender must pause transmitting data frames. At the other |
---|
1471 | end of the stream, the recipient sends a WINDOW_UPDATE control back |
---|
1472 | to notify the sender that it has consumed some data and freed up |
---|
1473 | buffer space to receive more data. |
---|
1474 | |
---|
1475 | +----------------------------------+ |
---|
1476 | |1| version | 9 | |
---|
1477 | +----------------------------------+ |
---|
1478 | | 0 (flags) | 8 (length) | |
---|
1479 | +----------------------------------+ |
---|
1480 | |X| Stream-ID (31-bits) | |
---|
1481 | +----------------------------------+ |
---|
1482 | |X| Delta-Window-Size (31-bits) | |
---|
1483 | +----------------------------------+ |
---|
1484 | |
---|
1485 | Control bit: The control bit is always 1 for this message. |
---|
1486 | |
---|
1487 | Version: The HTTP/2.0 version number. |
---|
1488 | |
---|
1489 | Type: The message type for a WINDOW_UPDATE message is 9. |
---|
1490 | |
---|
1491 | Length: The length field is always 8 for this frame (there are 8 |
---|
1492 | bytes after the length field). |
---|
1493 | |
---|
1494 | Stream-ID: The stream ID that this WINDOW_UPDATE control frame is |
---|
1495 | for. |
---|
1496 | |
---|
1497 | Delta-Window-Size: The additional number of bytes that the sender can |
---|
1498 | transmit in addition to existing remaining window size. The legal |
---|
1499 | range for this field is 1 to 2^31 - 1 (0x7fffffff) bytes. |
---|
1500 | |
---|
1501 | The window size as kept by the sender must never exceed 2^31 |
---|
1502 | (although it can become negative in one special case). If a sender |
---|
1503 | receives a WINDOW_UPDATE that causes the its window size to exceed |
---|
1504 | this limit, it must send RST_STREAM with status code |
---|
1505 | FLOW_CONTROL_ERROR to terminate the stream. |
---|
1506 | |
---|
1507 | When a HTTP/2.0 connection is first established, the default initial |
---|
1508 | |
---|
1509 | |
---|
1510 | |
---|
1511 | Belshe, et al. Expires July 26, 2013 [Page 27] |
---|
1512 | |
---|
1513 | Internet-Draft HTTP/2.0 January 2013 |
---|
1514 | |
---|
1515 | |
---|
1516 | window size for all streams is 64KB. An endpoint can use the |
---|
1517 | SETTINGS control frame to adjust the initial window size for the |
---|
1518 | connection. That is, its peer can start out using the 64KB default |
---|
1519 | initial window size when sending data frames before receiving the |
---|
1520 | SETTINGS. Because SETTINGS is asynchronous, there may be a race |
---|
1521 | condition if the recipient wants to decrease the initial window size, |
---|
1522 | but its peer immediately sends 64KB on the creation of a new |
---|
1523 | connection, before waiting for the SETTINGS to arrive. This is one |
---|
1524 | case where the window size kept by the sender will become negative. |
---|
1525 | Once the sender detects this condition, it must stop sending data |
---|
1526 | frames and wait for the recipient to catch up. The recipient has two |
---|
1527 | choices: |
---|
1528 | |
---|
1529 | immediately send RST_STREAM with FLOW_CONTROL_ERROR status code. |
---|
1530 | |
---|
1531 | allow the head of line blocking (as there is only one stream for |
---|
1532 | the session and the amount of data in flight is bounded by the |
---|
1533 | default initial window size), and send WINDOW_UPDATE as it |
---|
1534 | consumes data. |
---|
1535 | |
---|
1536 | In the case of option 2, both sides must compute the window size |
---|
1537 | based on the initial window size in the SETTINGS. For example, if |
---|
1538 | the recipient sets the initial window size to be 16KB, and the sender |
---|
1539 | sends 64KB immediately on connection establishment, the sender will |
---|
1540 | discover its window size is -48KB on receipt of the SETTINGS. As the |
---|
1541 | recipient consumes the first 16KB, it must send a WINDOW_UPDATE of |
---|
1542 | 16KB back to the sender. This interaction continues until the |
---|
1543 | sender's window size becomes positive again, and it can resume |
---|
1544 | transmitting data frames. |
---|
1545 | |
---|
1546 | After the recipient reads in a data frame with FLAG_FIN that marks |
---|
1547 | the end of the data stream, it should not send WINDOW_UPDATE frames |
---|
1548 | as it consumes the last data frame. A sender should ignore all the |
---|
1549 | WINDOW_UPDATE frames associated with the stream after it send the |
---|
1550 | last frame for the stream. |
---|
1551 | |
---|
1552 | The data frames from the sender and the WINDOW_UPDATE frames from the |
---|
1553 | recipient are completely asynchronous with respect to each other. |
---|
1554 | This property allows a recipient to aggressively update the window |
---|
1555 | size kept by the sender to prevent the stream from stalling. |
---|
1556 | |
---|
1557 | 3.6.9. CREDENTIAL |
---|
1558 | |
---|
1559 | The CREDENTIAL control frame is used by the client to send additional |
---|
1560 | client certificates to the server. A HTTP/2.0 client may decide to |
---|
1561 | send requests for resources from different origins on the same |
---|
1562 | HTTP/2.0 session if it decides that that server handles both origins. |
---|
1563 | For example if the IP address associated with both hostnames matches |
---|
1564 | |
---|
1565 | |
---|
1566 | |
---|
1567 | Belshe, et al. Expires July 26, 2013 [Page 28] |
---|
1568 | |
---|
1569 | Internet-Draft HTTP/2.0 January 2013 |
---|
1570 | |
---|
1571 | |
---|
1572 | and the SSL server certificate presented in the initial handshake is |
---|
1573 | valid for both hostnames. However, because the SSL connection can |
---|
1574 | contain at most one client certificate, the client needs a mechanism |
---|
1575 | to send additional client certificates to the server. |
---|
1576 | |
---|
1577 | The server is required to maintain a vector of client certificates |
---|
1578 | associated with a HTTP/2.0 session. When the client needs to send a |
---|
1579 | client certificate to the server, it will send a CREDENTIAL frame |
---|
1580 | that specifies the index of the slot in which to store the |
---|
1581 | certificate as well as proof that the client posesses the |
---|
1582 | corresponding private key. The initial size of this vector must be |
---|
1583 | 8. If the client provides a client certificate during the first TLS |
---|
1584 | handshake, the contents of this certificate must be copied into the |
---|
1585 | first slot (index 1) in the CREDENTIAL vector, though it may be |
---|
1586 | overwritten by subsequent CREDENTIAL frames. The server must |
---|
1587 | exclusively use the CREDENTIAL vector when evaluating the client |
---|
1588 | certificates associated with an origin. The server may change the |
---|
1589 | size of this vector by sending a SETTINGS frame with the setting |
---|
1590 | SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE value specified. In the |
---|
1591 | event that the new size is smaller than the current size, truncation |
---|
1592 | occurs preserving lower-index slots as possible. |
---|
1593 | |
---|
1594 | TLS renegotiation with client authentication is incompatible with |
---|
1595 | HTTP/2.0 given the multiplexed nature of HTTP/2.0. Specifically, |
---|
1596 | imagine that the client has 2 requests outstanding to the server for |
---|
1597 | two different pages (in different tabs). When the renegotiation + |
---|
1598 | client certificate request comes in, the browser is unable to |
---|
1599 | determine which resource triggered the client certificate request, in |
---|
1600 | order to prompt the user accordingly. |
---|
1601 | |
---|
1602 | +----------------------------------+ |
---|
1603 | |1|000000000000001|0000000000001011| |
---|
1604 | +----------------------------------+ |
---|
1605 | | flags (8) | Length (24 bits) | |
---|
1606 | +----------------------------------+ |
---|
1607 | | Slot (16 bits) | | |
---|
1608 | +-----------------+ | |
---|
1609 | | Proof Length (32 bits) | |
---|
1610 | +----------------------------------+ |
---|
1611 | | Proof | |
---|
1612 | +----------------------------------+ <+ |
---|
1613 | | Certificate Length (32 bits) | | |
---|
1614 | +----------------------------------+ | Repeated until end of frame |
---|
1615 | | Certificate | | |
---|
1616 | +----------------------------------+ <+ |
---|
1617 | |
---|
1618 | Slot: The index in the server's client certificate vector where this |
---|
1619 | certificate should be stored. If there is already a certificate |
---|
1620 | |
---|
1621 | |
---|
1622 | |
---|
1623 | Belshe, et al. Expires July 26, 2013 [Page 29] |
---|
1624 | |
---|
1625 | Internet-Draft HTTP/2.0 January 2013 |
---|
1626 | |
---|
1627 | |
---|
1628 | stored at this index, it will be overwritten. The index is one |
---|
1629 | based, not zero based; zero is an invalid slot index. |
---|
1630 | |
---|
1631 | Proof: Cryptographic proof that the client has possession of the |
---|
1632 | private key associated with the certificate. The format is a TLS |
---|
1633 | digitally-signed element ([RFC5246], Section 4.7). The signature |
---|
1634 | algorithm must be the same as that used in the CertificateVerify |
---|
1635 | message. However, since the MD5+SHA1 signature type used in TLS 1.0 |
---|
1636 | connections can not be correctly encoded in a digitally-signed |
---|
1637 | element, SHA1 must be used when MD5+SHA1 was used in the SSL |
---|
1638 | connection. The signature is calculated over a 32 byte TLS extractor |
---|
1639 | value (http://tools.ietf.org/html/rfc5705) with a label of "EXPORTER |
---|
1640 | HTTP/2.0 certificate proof" using the empty string as context. |
---|
1641 | ForRSA certificates the signature would be a PKCS#1 v1.5 signature. |
---|
1642 | For ECDSA, it would be an ECDSA-Sig-Value |
---|
1643 | (http://tools.ietf.org/html/rfc5480#appendix-A). For a 1024-bit RSA |
---|
1644 | key, the CREDENTIAL message would be ~500 bytes. |
---|
1645 | |
---|
1646 | Certificate: The certificate chain, starting with the leaf |
---|
1647 | certificate. Each certificate must be encoded as a 32 bit length, |
---|
1648 | followed by a DER encoded certificate. The certificate must be of |
---|
1649 | the same type (RSA, ECDSA, etc) as the client certificate associated |
---|
1650 | with the SSL connection. |
---|
1651 | |
---|
1652 | If the server receives a request for a resource with unacceptable |
---|
1653 | credential (either missing or invalid), it must reply with a |
---|
1654 | RST_STREAM frame with the status code INVALID_CREDENTIALS. Upon |
---|
1655 | receipt of a RST_STREAM frame with INVALID_CREDENTIALS, the client |
---|
1656 | should initiate a new stream directly to the requested origin and |
---|
1657 | resend the request. Note, HTTP/2.0 does not allow the server to |
---|
1658 | request different client authentication for different resources in |
---|
1659 | the same origin. |
---|
1660 | |
---|
1661 | If the server receives an invalid CREDENTIAL frame, it MUST respond |
---|
1662 | with a GOAWAY frame and shutdown the session. |
---|
1663 | |
---|
1664 | 3.6.10. Name/Value Header Block |
---|
1665 | |
---|
1666 | The Name/Value Header Block is found in the SYN_STREAM, SYN_REPLY and |
---|
1667 | HEADERS control frames, and shares a common format: |
---|
1668 | |
---|
1669 | |
---|
1670 | |
---|
1671 | |
---|
1672 | |
---|
1673 | |
---|
1674 | |
---|
1675 | |
---|
1676 | |
---|
1677 | |
---|
1678 | |
---|
1679 | Belshe, et al. Expires July 26, 2013 [Page 30] |
---|
1680 | |
---|
1681 | Internet-Draft HTTP/2.0 January 2013 |
---|
1682 | |
---|
1683 | |
---|
1684 | +------------------------------------+ |
---|
1685 | | Number of Name/Value pairs (int32) | |
---|
1686 | +------------------------------------+ |
---|
1687 | | Length of name (int32) | |
---|
1688 | +------------------------------------+ |
---|
1689 | | Name (string) | |
---|
1690 | +------------------------------------+ |
---|
1691 | | Length of value (int32) | |
---|
1692 | +------------------------------------+ |
---|
1693 | | Value (string) | |
---|
1694 | +------------------------------------+ |
---|
1695 | | (repeats) | |
---|
1696 | |
---|
1697 | Number of Name/Value pairs: The number of repeating name/value pairs |
---|
1698 | following this field. |
---|
1699 | |
---|
1700 | List of Name/Value pairs: |
---|
1701 | |
---|
1702 | Length of Name: a 32-bit value containing the number of octets in |
---|
1703 | the name field. Note that in practice, this length must not |
---|
1704 | exceed 2^24, as that is the maximum size of a HTTP/2.0 frame. |
---|
1705 | |
---|
1706 | Name: 0 or more octets, 8-bit sequences of data, excluding 0. |
---|
1707 | |
---|
1708 | Length of Value: a 32-bit value containing the number of octets in |
---|
1709 | the value field. Note that in practice, this length must not |
---|
1710 | exceed 2^24, as that is the maximum size of a HTTP/2.0 frame. |
---|
1711 | |
---|
1712 | Value: 0 or more octets, 8-bit sequences of data, excluding 0. |
---|
1713 | |
---|
1714 | Each header name must have at least one value. Header names are |
---|
1715 | encoded using the US-ASCII character set [ASCII] and must be all |
---|
1716 | lower case. The length of each name must be greater than zero. A |
---|
1717 | recipient of a zero-length name MUST issue a stream error |
---|
1718 | (Section 3.4.2) with the status code PROTOCOL_ERROR for the |
---|
1719 | stream-id. |
---|
1720 | |
---|
1721 | Duplicate header names are not allowed. To send two identically |
---|
1722 | named headers, send a header with two values, where the values are |
---|
1723 | separated by a single NUL (0) byte. A header value can either be |
---|
1724 | empty (e.g. the length is zero) or it can contain multiple, NUL- |
---|
1725 | separated values, each with length greater than zero. The value |
---|
1726 | never starts nor ends with a NUL character. Recipients of illegal |
---|
1727 | value fields MUST issue a stream error (Section 3.4.2) with the |
---|
1728 | status code PROTOCOL_ERROR for the stream-id. |
---|
1729 | |
---|
1730 | |
---|
1731 | |
---|
1732 | |
---|
1733 | |
---|
1734 | |
---|
1735 | Belshe, et al. Expires July 26, 2013 [Page 31] |
---|
1736 | |
---|
1737 | Internet-Draft HTTP/2.0 January 2013 |
---|
1738 | |
---|
1739 | |
---|
1740 | 3.6.10.1. Compression |
---|
1741 | |
---|
1742 | The Name/Value Header Block is a section of the SYN_STREAM, |
---|
1743 | SYN_REPLY, and HEADERS frames used to carry header meta-data. This |
---|
1744 | block is always compressed using zlib compression. Within this |
---|
1745 | specification, any reference to 'zlib' is referring to the ZLIB |
---|
1746 | Compressed Data Format Specification Version 3.3 as part of RFC1950. |
---|
1747 | [RFC1950] |
---|
1748 | |
---|
1749 | For each HEADERS compression instance, the initial state is |
---|
1750 | initialized using the following dictionary [UDELCOMPRESSION]: |
---|
1751 | |
---|
1752 | <CODE BEGINS> |
---|
1753 | |
---|
1754 | const unsigned char http2_dictionary_txt[] = { |
---|
1755 | 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, \\ - - - - o p t i |
---|
1756 | 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, \\ o n s - - - - h |
---|
1757 | 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, \\ e a d - - - - p |
---|
1758 | 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, \\ o s t - - - - p |
---|
1759 | 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, \\ u t - - - - d e |
---|
1760 | 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, \\ l e t e - - - - |
---|
1761 | 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, \\ t r a c e - - - |
---|
1762 | 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, \\ - a c c e p t - |
---|
1763 | 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, \\ - - - a c c e p |
---|
1764 | 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, \\ t - c h a r s e |
---|
1765 | 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, \\ t - - - - a c c |
---|
1766 | 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, \\ e p t - e n c o |
---|
1767 | 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, \\ d i n g - - - - |
---|
1768 | 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, \\ a c c e p t - l |
---|
1769 | 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, \\ a n g u a g e - |
---|
1770 | 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, \\ - - - a c c e p |
---|
1771 | 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, \\ t - r a n g e s |
---|
1772 | 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, \\ - - - - a g e - |
---|
1773 | 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, \\ - - - a l l o w |
---|
1774 | 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, \\ - - - - a u t h |
---|
1775 | 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, \\ o r i z a t i o |
---|
1776 | 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, \\ n - - - - c a c |
---|
1777 | 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, \\ h e - c o n t r |
---|
1778 | 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, \\ o l - - - - c o |
---|
1779 | 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, \\ n n e c t i o n |
---|
1780 | 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, \\ - - - - c o n t |
---|
1781 | 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, \\ e n t - b a s e |
---|
1782 | 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, \\ - - - - c o n t |
---|
1783 | 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, \\ e n t - e n c o |
---|
1784 | 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, \\ d i n g - - - - |
---|
1785 | 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, \\ c o n t e n t - |
---|
1786 | 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, \\ l a n g u a g e |
---|
1787 | 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, \\ - - - - c o n t |
---|
1788 | |
---|
1789 | |
---|
1790 | |
---|
1791 | Belshe, et al. Expires July 26, 2013 [Page 32] |
---|
1792 | |
---|
1793 | Internet-Draft HTTP/2.0 January 2013 |
---|
1794 | |
---|
1795 | |
---|
1796 | 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, \\ e n t - l e n g |
---|
1797 | 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, \\ t h - - - - c o |
---|
1798 | 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, \\ n t e n t - l o |
---|
1799 | 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, \\ c a t i o n - - |
---|
1800 | 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, \\ - - c o n t e n |
---|
1801 | 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, \\ t - m d 5 - - - |
---|
1802 | 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, \\ - c o n t e n t |
---|
1803 | 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, \\ - r a n g e - - |
---|
1804 | 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, \\ - - c o n t e n |
---|
1805 | 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, \\ t - t y p e - - |
---|
1806 | 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, \\ - - d a t e - - |
---|
1807 | 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, \\ - - e t a g - - |
---|
1808 | 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, \\ - - e x p e c t |
---|
1809 | 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, \\ - - - - e x p i |
---|
1810 | 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, \\ r e s - - - - f |
---|
1811 | 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, \\ r o m - - - - h |
---|
1812 | 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, \\ o s t - - - - i |
---|
1813 | 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, \\ f - m a t c h - |
---|
1814 | 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, \\ - - - i f - m o |
---|
1815 | 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, \\ d i f i e d - s |
---|
1816 | 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, \\ i n c e - - - - |
---|
1817 | 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, \\ i f - n o n e - |
---|
1818 | 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, \\ m a t c h - - - |
---|
1819 | 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, \\ - i f - r a n g |
---|
1820 | 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, \\ e - - - - i f - |
---|
1821 | 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, \\ u n m o d i f i |
---|
1822 | 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, \\ e d - s i n c e |
---|
1823 | 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, \\ - - - - l a s t |
---|
1824 | 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, \\ - m o d i f i e |
---|
1825 | 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, \\ d - - - - l o c |
---|
1826 | 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, \\ a t i o n - - - |
---|
1827 | 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, \\ - m a x - f o r |
---|
1828 | 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, \\ w a r d s - - - |
---|
1829 | 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, \\ - p r a g m a - |
---|
1830 | 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, \\ - - - p r o x y |
---|
1831 | 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, \\ - a u t h e n t |
---|
1832 | 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, \\ i c a t e - - - |
---|
1833 | 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, \\ - p r o x y - a |
---|
1834 | 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, \\ u t h o r i z a |
---|
1835 | 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, \\ t i o n - - - - |
---|
1836 | 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, \\ r a n g e - - - |
---|
1837 | 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, \\ - r e f e r e r |
---|
1838 | 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, \\ - - - - r e t r |
---|
1839 | 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, \\ y - a f t e r - |
---|
1840 | 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, \\ - - - s e r v e |
---|
1841 | 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, \\ r - - - - t e - |
---|
1842 | 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, \\ - - - t r a i l |
---|
1843 | 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, \\ e r - - - - t r |
---|
1844 | |
---|
1845 | |
---|
1846 | |
---|
1847 | Belshe, et al. Expires July 26, 2013 [Page 33] |
---|
1848 | |
---|
1849 | Internet-Draft HTTP/2.0 January 2013 |
---|
1850 | |
---|
1851 | |
---|
1852 | 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, \\ a n s f e r - e |
---|
1853 | 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, \\ n c o d i n g - |
---|
1854 | 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, \\ - - - u p g r a |
---|
1855 | 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, \\ d e - - - - u s |
---|
1856 | 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, \\ e r - a g e n t |
---|
1857 | 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, \\ - - - - v a r y |
---|
1858 | 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, \\ - - - - v i a - |
---|
1859 | 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, \\ - - - w a r n i |
---|
1860 | 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, \\ n g - - - - w w |
---|
1861 | 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, \\ w - a u t h e n |
---|
1862 | 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, \\ t i c a t e - - |
---|
1863 | 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, \\ - - m e t h o d |
---|
1864 | 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, \\ - - - - g e t - |
---|
1865 | 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, \\ - - - s t a t u |
---|
1866 | 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, \\ s - - - - 2 0 0 |
---|
1867 | 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, \\ - O K - - - - v |
---|
1868 | 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, \\ e r s i o n - - |
---|
1869 | 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, \\ - - H T T P - 1 |
---|
1870 | 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, \\ - 1 - - - - u r |
---|
1871 | 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, \\ l - - - - p u b |
---|
1872 | 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, \\ l i c - - - - s |
---|
1873 | 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, \\ e t - c o o k i |
---|
1874 | 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, \\ e - - - - k e e |
---|
1875 | 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, \\ p - a l i v e - |
---|
1876 | 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, \\ - - - o r i g i |
---|
1877 | 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, \\ n 1 0 0 1 0 1 2 |
---|
1878 | 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, \\ 0 1 2 0 2 2 0 5 |
---|
1879 | 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, \\ 2 0 6 3 0 0 3 0 |
---|
1880 | 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, \\ 2 3 0 3 3 0 4 3 |
---|
1881 | 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, \\ 0 5 3 0 6 3 0 7 |
---|
1882 | 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, \\ 4 0 2 4 0 5 4 0 |
---|
1883 | 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, \\ 6 4 0 7 4 0 8 4 |
---|
1884 | 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, \\ 0 9 4 1 0 4 1 1 |
---|
1885 | 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, \\ 4 1 2 4 1 3 4 1 |
---|
1886 | 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, \\ 4 4 1 5 4 1 6 4 |
---|
1887 | 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, \\ 1 7 5 0 2 5 0 4 |
---|
1888 | 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, \\ 5 0 5 2 0 3 - N |
---|
1889 | 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, \\ o n - A u t h o |
---|
1890 | 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, \\ r i t a t i v e |
---|
1891 | 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, \\ - I n f o r m a |
---|
1892 | 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, \\ t i o n 2 0 4 - |
---|
1893 | 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, \\ N o - C o n t e |
---|
1894 | 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, \\ n t 3 0 1 - M o |
---|
1895 | 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, \\ v e d - P e r m |
---|
1896 | 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, \\ a n e n t l y 4 |
---|
1897 | 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, \\ 0 0 - B a d - R |
---|
1898 | 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, \\ e q u e s t 4 0 |
---|
1899 | 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, \\ 1 - U n a u t h |
---|
1900 | |
---|
1901 | |
---|
1902 | |
---|
1903 | Belshe, et al. Expires July 26, 2013 [Page 34] |
---|
1904 | |
---|
1905 | Internet-Draft HTTP/2.0 January 2013 |
---|
1906 | |
---|
1907 | |
---|
1908 | 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, \\ o r i z e d 4 0 |
---|
1909 | 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, \\ 3 - F o r b i d |
---|
1910 | 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, \\ d e n 4 0 4 - N |
---|
1911 | 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, \\ o t - F o u n d |
---|
1912 | 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, \\ 5 0 0 - I n t e |
---|
1913 | 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, \\ r n a l - S e r |
---|
1914 | 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, \\ v e r - E r r o |
---|
1915 | 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, \\ r 5 0 1 - N o t |
---|
1916 | 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, \\ - I m p l e m e |
---|
1917 | 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, \\ n t e d 5 0 3 - |
---|
1918 | 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, \\ S e r v i c e - |
---|
1919 | 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, \\ U n a v a i l a |
---|
1920 | 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, \\ b l e J a n - F |
---|
1921 | 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, \\ e b - M a r - A |
---|
1922 | 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, \\ p r - M a y - J |
---|
1923 | 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, \\ u n - J u l - A |
---|
1924 | 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, \\ u g - S e p t - |
---|
1925 | 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, \\ O c t - N o v - |
---|
1926 | 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, \\ D e c - 0 0 - 0 |
---|
1927 | 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, \\ 0 - 0 0 - M o n |
---|
1928 | 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, \\ - - T u e - - W |
---|
1929 | 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, \\ e d - - T h u - |
---|
1930 | 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, \\ - F r i - - S a |
---|
1931 | 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, \\ t - - S u n - - |
---|
1932 | 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, \\ G M T c h u n k |
---|
1933 | 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, \\ e d - t e x t - |
---|
1934 | 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, \\ h t m l - i m a |
---|
1935 | 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, \\ g e - p n g - i |
---|
1936 | 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, \\ m a g e - j p g |
---|
1937 | 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, \\ - i m a g e - g |
---|
1938 | 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, \\ i f - a p p l i |
---|
1939 | 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, \\ c a t i o n - x |
---|
1940 | 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, \\ m l - a p p l i |
---|
1941 | 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, \\ c a t i o n - x |
---|
1942 | 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, \\ h t m l - x m l |
---|
1943 | 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, \\ - t e x t - p l |
---|
1944 | 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, \\ a i n - t e x t |
---|
1945 | 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, \\ - j a v a s c r |
---|
1946 | 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, \\ i p t - p u b l |
---|
1947 | 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, \\ i c p r i v a t |
---|
1948 | 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, \\ e m a x - a g e |
---|
1949 | 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, \\ - g z i p - d e |
---|
1950 | 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, \\ f l a t e - s d |
---|
1951 | 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, \\ c h c h a r s e |
---|
1952 | 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, \\ t - u t f - 8 c |
---|
1953 | 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, \\ h a r s e t - i |
---|
1954 | 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, \\ s o - 8 8 5 9 - |
---|
1955 | 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, \\ 1 - u t f - - - |
---|
1956 | |
---|
1957 | |
---|
1958 | |
---|
1959 | Belshe, et al. Expires July 26, 2013 [Page 35] |
---|
1960 | |
---|
1961 | Internet-Draft HTTP/2.0 January 2013 |
---|
1962 | |
---|
1963 | |
---|
1964 | 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e \\ - e n q - 0 - |
---|
1965 | }; |
---|
1966 | |
---|
1967 | <CODE ENDS> |
---|
1968 | |
---|
1969 | The entire contents of the name/value header block is compressed |
---|
1970 | using zlib. There is a single zlib stream for all name value pairs |
---|
1971 | in one direction on a connection. HTTP/2.0 uses a SYNC_FLUSH between |
---|
1972 | each compressed frame. |
---|
1973 | |
---|
1974 | Implementation notes: the compression engine can be tuned to favor |
---|
1975 | speed or size. Optimizing for size increases memory use and CPU |
---|
1976 | consumption. Because header blocks are generally small, implementors |
---|
1977 | may want to reduce the window-size of the compression engine from the |
---|
1978 | default 15bits (a 32KB window) to more like 11bits (a 2KB window). |
---|
1979 | The exact setting is chosen by the compressor, the decompressor will |
---|
1980 | work with any setting. |
---|
1981 | |
---|
1982 | 4. HTTP Layering over HTTP/2.0 |
---|
1983 | |
---|
1984 | HTTP/2.0 is intended to be as compatible as possible with current |
---|
1985 | web-based applications. This means that, from the perspective of the |
---|
1986 | server business logic or application API, the features of HTTP are |
---|
1987 | unchanged. To achieve this, all of the application request and |
---|
1988 | response header semantics are preserved, although the syntax of |
---|
1989 | conveying those semantics has changed. Thus, the rules from the |
---|
1990 | HTTP/1.1 specification in RFC2616 [RFC2616] apply with the changes in |
---|
1991 | the sections below. |
---|
1992 | |
---|
1993 | 4.1. Connection Management |
---|
1994 | |
---|
1995 | Clients SHOULD NOT open more than one HTTP/2.0 session to a given |
---|
1996 | origin [RFC6454] concurrently. |
---|
1997 | |
---|
1998 | Note that it is possible for one HTTP/2.0 session to be finishing |
---|
1999 | (e.g. a GOAWAY message has been sent, but not all streams have |
---|
2000 | finished), while another HTTP/2.0 session is starting. |
---|
2001 | |
---|
2002 | 4.1.1. Use of GOAWAY |
---|
2003 | |
---|
2004 | HTTP/2.0 provides a GOAWAY message which can be used when closing a |
---|
2005 | connection from either the client or server. Without a server GOAWAY |
---|
2006 | message, HTTP has a race condition where the client sends a request |
---|
2007 | (a new SYN_STREAM) just as the server is closing the connection, and |
---|
2008 | the client cannot know if the server received the stream or not. By |
---|
2009 | using the last-stream-id in the GOAWAY, servers can indicate to the |
---|
2010 | client if a request was processed or not. |
---|
2011 | |
---|
2012 | |
---|
2013 | |
---|
2014 | |
---|
2015 | Belshe, et al. Expires July 26, 2013 [Page 36] |
---|
2016 | |
---|
2017 | Internet-Draft HTTP/2.0 January 2013 |
---|
2018 | |
---|
2019 | |
---|
2020 | Note that some servers will choose to send the GOAWAY and immediately |
---|
2021 | terminate the connection without waiting for active streams to |
---|
2022 | finish. The client will be able to determine this because HTTP/2.0 |
---|
2023 | streams are determinstically closed. This abrupt termination will |
---|
2024 | force the client to heuristically decide whether to retry the pending |
---|
2025 | requests. Clients always need to be capable of dealing with this |
---|
2026 | case because they must deal with accidental connection termination |
---|
2027 | cases, which are the same as the server never having sent a GOAWAY. |
---|
2028 | |
---|
2029 | More sophisticated servers will use GOAWAY to implement a graceful |
---|
2030 | teardown. They will send the GOAWAY and provide some time for the |
---|
2031 | active streams to finish before terminating the connection. |
---|
2032 | |
---|
2033 | If a HTTP/2.0 client closes the connection, it should also send a |
---|
2034 | GOAWAY message. This allows the server to know if any server-push |
---|
2035 | streams were received by the client. |
---|
2036 | |
---|
2037 | If the endpoint closing the connection has not received any |
---|
2038 | SYN_STREAMs from the remote, the GOAWAY will contain a last-stream-id |
---|
2039 | of 0. |
---|
2040 | |
---|
2041 | 4.2. HTTP Request/Response |
---|
2042 | |
---|
2043 | 4.2.1. Request |
---|
2044 | |
---|
2045 | The client initiates a request by sending a SYN_STREAM frame. For |
---|
2046 | requests which do not contain a body, the SYN_STREAM frame MUST set |
---|
2047 | the FLAG_FIN, indicating that the client intends to send no further |
---|
2048 | data on this stream. For requests which do contain a body, the |
---|
2049 | SYN_STREAM will not contain the FLAG_FIN, and the body will follow |
---|
2050 | the SYN_STREAM in a series of DATA frames. The last DATA frame will |
---|
2051 | set the FLAG_FIN to indicate the end of the body. |
---|
2052 | |
---|
2053 | The SYN_STREAM Name/Value section will contain all of the HTTP |
---|
2054 | headers which are associated with an HTTP request. The header block |
---|
2055 | in HTTP/2.0 is mostly unchanged from today's HTTP header block, with |
---|
2056 | the following differences: |
---|
2057 | |
---|
2058 | The first line of the request is unfolded into name/value pairs |
---|
2059 | like other HTTP headers and MUST be present: |
---|
2060 | |
---|
2061 | ":method" - the HTTP method for this request (e.g. "GET", |
---|
2062 | "POST", "HEAD", etc) |
---|
2063 | |
---|
2064 | ":path" - the url-path for this url with "/" prefixed. (See |
---|
2065 | RFC1738 [RFC1738]). For example, for |
---|
2066 | "http://www.google.com/search?q=dogs" the path would be |
---|
2067 | "/search?q=dogs". |
---|
2068 | |
---|
2069 | |
---|
2070 | |
---|
2071 | Belshe, et al. Expires July 26, 2013 [Page 37] |
---|
2072 | |
---|
2073 | Internet-Draft HTTP/2.0 January 2013 |
---|
2074 | |
---|
2075 | |
---|
2076 | ":version" - the HTTP version of this request (e.g. |
---|
2077 | "HTTP/1.1") |
---|
2078 | |
---|
2079 | In addition, the following two name/value pairs must also be |
---|
2080 | present in every request: |
---|
2081 | |
---|
2082 | ":host" - the hostport (See RFC1738 [RFC1738]) portion of the |
---|
2083 | URL for this request (e.g. "www.google.com:1234"). This header |
---|
2084 | is the same as the HTTP 'Host' header. |
---|
2085 | |
---|
2086 | ":scheme" - the scheme portion of the URL for this request |
---|
2087 | (e.g. "https")) |
---|
2088 | |
---|
2089 | Header names are all lowercase. |
---|
2090 | |
---|
2091 | The Connection, Host, Keep-Alive, Proxy-Connection, and Transfer- |
---|
2092 | Encoding headers are not valid and MUST not be sent. |
---|
2093 | |
---|
2094 | User-agents MUST support gzip compression. Regardless of the |
---|
2095 | Accept-Encoding sent by the user-agent, the server may always send |
---|
2096 | content encoded with gzip or deflate encoding. |
---|
2097 | |
---|
2098 | If a server receives a request where the sum of the data frame |
---|
2099 | payload lengths does not equal the size of the Content-Length |
---|
2100 | header, the server MUST return a 400 (Bad Request) error. |
---|
2101 | |
---|
2102 | POST-specific changes: |
---|
2103 | |
---|
2104 | Although POSTs are inherently chunked, POST requests SHOULD |
---|
2105 | also be accompanied by a Content-Length header. There are two |
---|
2106 | reasons for this: First, it assists with upload progress meters |
---|
2107 | for an improved user experience. But second, we know from |
---|
2108 | early versions of HTTP/2.0 that failure to send a content |
---|
2109 | length header is incompatible with many existing HTTP server |
---|
2110 | implementations. Existing user-agents do not omit the Content- |
---|
2111 | Length header, and server implementations have come to depend |
---|
2112 | upon this. |
---|
2113 | |
---|
2114 | The user-agent is free to prioritize requests as it sees fit. If the |
---|
2115 | user-agent cannot make progress without receiving a resource, it |
---|
2116 | should attempt to raise the priority of that resource. Resources |
---|
2117 | such as images, SHOULD generally use the lowest priority. |
---|
2118 | |
---|
2119 | If a client sends a SYN_STREAM without all of the method, host, path, |
---|
2120 | scheme, and version headers, the server MUST reply with a HTTP 400 |
---|
2121 | Bad Request reply. |
---|
2122 | |
---|
2123 | |
---|
2124 | |
---|
2125 | |
---|
2126 | |
---|
2127 | Belshe, et al. Expires July 26, 2013 [Page 38] |
---|
2128 | |
---|
2129 | Internet-Draft HTTP/2.0 January 2013 |
---|
2130 | |
---|
2131 | |
---|
2132 | 4.2.2. Response |
---|
2133 | |
---|
2134 | The server responds to a client request with a SYN_REPLY frame. |
---|
2135 | Symmetric to the client's upload stream, server will send data after |
---|
2136 | the SYN_REPLY frame via a series of DATA frames, and the last data |
---|
2137 | frame will contain the FLAG_FIN to indicate successful end-of-stream. |
---|
2138 | If a response (like a 202 or 204 response) contains no body, the |
---|
2139 | SYN_REPLY frame may contain the FLAG_FIN flag to indicate no further |
---|
2140 | data will be sent on the stream. |
---|
2141 | |
---|
2142 | The response status line is unfolded into name/value pairs like |
---|
2143 | other HTTP headers and must be present: |
---|
2144 | |
---|
2145 | ":status" - The HTTP response status code (e.g. "200" or "200 |
---|
2146 | OK") |
---|
2147 | |
---|
2148 | ":version" - The HTTP response version (e.g. "HTTP/1.1") |
---|
2149 | |
---|
2150 | All header names must be lowercase. |
---|
2151 | |
---|
2152 | The Connection, Keep-Alive, Proxy-Connection, and Transfer- |
---|
2153 | Encoding headers are not valid and MUST not be sent. |
---|
2154 | |
---|
2155 | Responses MAY be accompanied by a Content-Length header for |
---|
2156 | advisory purposes. (e.g. for UI progress meters) |
---|
2157 | |
---|
2158 | If a client receives a response where the sum of the data frame |
---|
2159 | payload lengths does not equal the size of the Content-Length |
---|
2160 | header, the client MUST ignore the content length header. |
---|
2161 | |
---|
2162 | If a client receives a SYN_REPLY without a status or without a |
---|
2163 | version header, the client must reply with a RST_STREAM frame |
---|
2164 | indicating a PROTOCOL ERROR. |
---|
2165 | |
---|
2166 | 4.2.3. Authentication |
---|
2167 | |
---|
2168 | When a client sends a request to an origin server that requires |
---|
2169 | authentication, the server can reply with a "401 Unauthorized" |
---|
2170 | response, and include a WWW-Authenticate challenge header that |
---|
2171 | defines the authentication scheme to be used. The client then |
---|
2172 | retries the request with an Authorization header appropriate to the |
---|
2173 | specified authentication scheme. |
---|
2174 | |
---|
2175 | There are four options for proxy authentication, Basic, Digest, NTLM |
---|
2176 | and Negotiate (SPNEGO). The first two options were defined in |
---|
2177 | RFC2617 [RFC2617], and are stateless. The second two options were |
---|
2178 | developed by Microsoft and specified in RFC4559 [RFC4559], and are |
---|
2179 | stateful; otherwise known as multi-round authentication, or |
---|
2180 | |
---|
2181 | |
---|
2182 | |
---|
2183 | Belshe, et al. Expires July 26, 2013 [Page 39] |
---|
2184 | |
---|
2185 | Internet-Draft HTTP/2.0 January 2013 |
---|
2186 | |
---|
2187 | |
---|
2188 | connection authentication. |
---|
2189 | |
---|
2190 | 4.2.3.1. Stateless Authentication |
---|
2191 | |
---|
2192 | Stateless Authentication over HTTP/2.0 is identical to how it is |
---|
2193 | performed over HTTP. If multiple HTTP/2.0 streams are concurrently |
---|
2194 | sent to a single server, each will authenticate independently, |
---|
2195 | similar to how two HTTP connections would independently authenticate |
---|
2196 | to a proxy server. |
---|
2197 | |
---|
2198 | 4.2.3.2. Stateful Authentication |
---|
2199 | |
---|
2200 | Unfortunately, the stateful authentication mechanisms were |
---|
2201 | implemented and defined in a such a way that directly violates |
---|
2202 | RFC2617 - they do not include a "realm" as part of the request. This |
---|
2203 | is problematic in HTTP/2.0 because it makes it impossible for a |
---|
2204 | client to disambiguate two concurrent server authentication |
---|
2205 | challenges. |
---|
2206 | |
---|
2207 | To deal with this case, HTTP/2.0 servers using Stateful |
---|
2208 | Authentication MUST implement one of two changes: |
---|
2209 | |
---|
2210 | Servers can add a "realm=<desired realm>" header so that the two |
---|
2211 | authentication requests can be disambiguated and run concurrently. |
---|
2212 | Unfortunately, given how these mechanisms work, this is probably |
---|
2213 | not practical. |
---|
2214 | |
---|
2215 | Upon sending the first stateful challenge response, the server |
---|
2216 | MUST buffer and defer all further frames which are not part of |
---|
2217 | completing the challenge until the challenge has completed. |
---|
2218 | Completing the authentication challenge may take multiple round |
---|
2219 | trips. Once the client receives a "401 Authenticate" response for |
---|
2220 | a stateful authentication type, it MUST stop sending new requests |
---|
2221 | to the server until the authentication has completed by receiving |
---|
2222 | a non-401 response on at least one stream. |
---|
2223 | |
---|
2224 | 4.3. Server Push Transactions |
---|
2225 | |
---|
2226 | HTTP/2.0 enables a server to send multiple replies to a client for a |
---|
2227 | single request. The rationale for this feature is that sometimes a |
---|
2228 | server knows that it will need to send multiple resources in response |
---|
2229 | to a single request. Without server push features, the client must |
---|
2230 | first download the primary resource, then discover the secondary |
---|
2231 | resource(s), and request them. Pushing of resources avoids the |
---|
2232 | round-trip delay, but also creates a potential race where a server |
---|
2233 | can be pushing content which a user-agent is in the process of |
---|
2234 | requesting. The following mechanics attempt to prevent the race |
---|
2235 | condition while enabling the performance benefit. |
---|
2236 | |
---|
2237 | |
---|
2238 | |
---|
2239 | Belshe, et al. Expires July 26, 2013 [Page 40] |
---|
2240 | |
---|
2241 | Internet-Draft HTTP/2.0 January 2013 |
---|
2242 | |
---|
2243 | |
---|
2244 | Browsers receiving a pushed response MUST validate that the server is |
---|
2245 | authorized to push the URL using the browser same-origin [RFC6454] |
---|
2246 | policy. For example, a HTTP/2.0 connection to www.foo.com is |
---|
2247 | generally not permitted to push a response for www.evil.com. |
---|
2248 | |
---|
2249 | If the browser accepts a pushed response (e.g. it does not send a |
---|
2250 | RST_STREAM), the browser MUST attempt to cache the pushed response in |
---|
2251 | same way that it would cache any other response. This means |
---|
2252 | validating the response headers and inserting into the disk cache. |
---|
2253 | |
---|
2254 | Because pushed responses have no request, they have no request |
---|
2255 | headers associated with them. At the framing layer, HTTP/2.0 pushed |
---|
2256 | streams contain an "associated-stream-id" which indicates the |
---|
2257 | requested stream for which the pushed stream is related. The pushed |
---|
2258 | stream inherits all of the headers from the associated-stream-id with |
---|
2259 | the exception of ":host", ":scheme", and ":path", which are provided |
---|
2260 | as part of the pushed response stream headers. The browser MUST |
---|
2261 | store these inherited and implied request headers with the cached |
---|
2262 | resource. |
---|
2263 | |
---|
2264 | Implementation note: With server push, it is theoretically possible |
---|
2265 | for servers to push unreasonable amounts of content or resources to |
---|
2266 | the user-agent. Browsers MUST implement throttles to protect against |
---|
2267 | unreasonable push attacks. |
---|
2268 | |
---|
2269 | 4.3.1. Server implementation |
---|
2270 | |
---|
2271 | When the server intends to push a resource to the user-agent, it |
---|
2272 | opens a new stream by sending a unidirectional SYN_STREAM. The |
---|
2273 | SYN_STREAM MUST include an Associated-To-Stream-ID, and MUST set the |
---|
2274 | FLAG_UNIDIRECTIONAL flag. The SYN_STREAM MUST include headers for |
---|
2275 | ":scheme", ":host", ":path", which represent the URL for the resource |
---|
2276 | being pushed. Subsequent headers may follow in HEADERS frames. The |
---|
2277 | purpose of the association is so that the user-agent can |
---|
2278 | differentiate which request induced the pushed stream; without it, if |
---|
2279 | the user-agent had two tabs open to the same page, each pushing |
---|
2280 | unique content under a fixed URL, the user-agent would not be able to |
---|
2281 | differentiate the requests. |
---|
2282 | |
---|
2283 | The Associated-To-Stream-ID must be the ID of an existing, open |
---|
2284 | stream. The reason for this restriction is to have a clear endpoint |
---|
2285 | for pushed content. If the user-agent requested a resource on stream |
---|
2286 | 11, the server replies on stream 11. It can push any number of |
---|
2287 | additional streams to the client before sending a FLAG_FIN on stream |
---|
2288 | 11. However, once the originating stream is closed no further push |
---|
2289 | streams may be associated with it. The pushed streams do not need to |
---|
2290 | be closed (FIN set) before the originating stream is closed, they |
---|
2291 | only need to be created before the originating stream closes. |
---|
2292 | |
---|
2293 | |
---|
2294 | |
---|
2295 | Belshe, et al. Expires July 26, 2013 [Page 41] |
---|
2296 | |
---|
2297 | Internet-Draft HTTP/2.0 January 2013 |
---|
2298 | |
---|
2299 | |
---|
2300 | It is illegal for a server to push a resource with the Associated-To- |
---|
2301 | Stream-ID of 0. |
---|
2302 | |
---|
2303 | To minimize race conditions with the client, the SYN_STREAM for the |
---|
2304 | pushed resources MUST be sent prior to sending any content which |
---|
2305 | could allow the client to discover the pushed resource and request |
---|
2306 | it. |
---|
2307 | |
---|
2308 | The server MUST only push resources which would have been returned |
---|
2309 | from a GET request. |
---|
2310 | |
---|
2311 | Note: If the server does not have all of the Name/Value Response |
---|
2312 | headers available at the time it issues the HEADERS frame for the |
---|
2313 | pushed resource, it may later use an additional HEADERS frame to |
---|
2314 | augment the name/value pairs to be associated with the pushed stream. |
---|
2315 | The subsequent HEADERS frame(s) must not contain a header for |
---|
2316 | ':host', ':scheme', or ':path' (e.g. the server can't change the |
---|
2317 | identity of the resource to be pushed). The HEADERS frame must not |
---|
2318 | contain duplicate headers with a previously sent HEADERS frame. The |
---|
2319 | server must send a HEADERS frame including the scheme/host/port |
---|
2320 | headers before sending any data frames on the stream. |
---|
2321 | |
---|
2322 | 4.3.2. Client implementation |
---|
2323 | |
---|
2324 | When fetching a resource the client has 3 possibilities: |
---|
2325 | |
---|
2326 | the resource is not being pushed |
---|
2327 | |
---|
2328 | the resource is being pushed, but the data has not yet arrived |
---|
2329 | |
---|
2330 | the resource is being pushed, and the data has started to arrive |
---|
2331 | |
---|
2332 | When a SYN_STREAM and HEADERS frame which contains an Associated-To- |
---|
2333 | Stream-ID is received, the client must not issue GET requests for the |
---|
2334 | resource in the pushed stream, and instead wait for the pushed stream |
---|
2335 | to arrive. |
---|
2336 | |
---|
2337 | If a client receives a server push stream with stream-id 0, it MUST |
---|
2338 | issue a session error (Section 3.4.1) with the status code |
---|
2339 | PROTOCOL_ERROR. |
---|
2340 | |
---|
2341 | When a client receives a SYN_STREAM from the server without a the |
---|
2342 | ':host', ':scheme', and ':path' headers in the Name/Value section, it |
---|
2343 | MUST reply with a RST_STREAM with error code HTTP_PROTOCOL_ERROR. |
---|
2344 | |
---|
2345 | To cancel individual server push streams, the client can issue a |
---|
2346 | stream error (Section 3.4.2) with error code CANCEL. Upon receipt, |
---|
2347 | the server MUST stop sending on this stream immediately (this is an |
---|
2348 | |
---|
2349 | |
---|
2350 | |
---|
2351 | Belshe, et al. Expires July 26, 2013 [Page 42] |
---|
2352 | |
---|
2353 | Internet-Draft HTTP/2.0 January 2013 |
---|
2354 | |
---|
2355 | |
---|
2356 | Abrupt termination). |
---|
2357 | |
---|
2358 | To cancel all server push streams related to a request, the client |
---|
2359 | may issue a stream error (Section 3.4.2) with error code CANCEL on |
---|
2360 | the associated-stream-id. By cancelling that stream, the server MUST |
---|
2361 | immediately stop sending frames for any streams with |
---|
2362 | in-association-to for the original stream. |
---|
2363 | |
---|
2364 | If the server sends a HEADER frame containing duplicate headers with |
---|
2365 | a previous HEADERS frame for the same stream, the client must issue a |
---|
2366 | stream error (Section 3.4.2) with error code PROTOCOL ERROR. |
---|
2367 | |
---|
2368 | If the server sends a HEADERS frame after sending a data frame for |
---|
2369 | the same stream, the client MAY ignore the HEADERS frame. Ignoring |
---|
2370 | the HEADERS frame after a data frame prevents handling of HTTP's |
---|
2371 | trailing headers |
---|
2372 | (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.40). |
---|
2373 | |
---|
2374 | 5. Design Rationale and Notes |
---|
2375 | |
---|
2376 | Authors' notes: The notes in this section have no bearing on the |
---|
2377 | HTTP/2.0 protocol as specified within this document, and none of |
---|
2378 | these notes should be considered authoritative about how the protocol |
---|
2379 | works. However, these notes may prove useful in future debates about |
---|
2380 | how to resolve protocol ambiguities or how to evolve the protocol |
---|
2381 | going forward. They may be removed before the final draft. |
---|
2382 | |
---|
2383 | 5.1. Separation of Framing Layer and Application Layer |
---|
2384 | |
---|
2385 | Readers may note that this specification sometimes blends the framing |
---|
2386 | layer (Section 3) with requirements of a specific application - HTTP |
---|
2387 | (Section 4). This is reflected in the request/response nature of the |
---|
2388 | streams, the definition of the HEADERS and compression contexts which |
---|
2389 | are very similar to HTTP, and other areas as well. |
---|
2390 | |
---|
2391 | This blending is intentional - the primary goal of this protocol is |
---|
2392 | to create a low-latency protocol for use with HTTP. Isolating the |
---|
2393 | two layers is convenient for description of the protocol and how it |
---|
2394 | relates to existing HTTP implementations. However, the ability to |
---|
2395 | reuse the HTTP/2.0 framing layer is a non goal. |
---|
2396 | |
---|
2397 | 5.2. Error handling - Framing Layer |
---|
2398 | |
---|
2399 | Error handling at the HTTP/2.0 layer splits errors into two groups: |
---|
2400 | Those that affect an individual HTTP/2.0 stream, and those that do |
---|
2401 | not. |
---|
2402 | |
---|
2403 | When an error is confined to a single stream, but general framing is |
---|
2404 | |
---|
2405 | |
---|
2406 | |
---|
2407 | Belshe, et al. Expires July 26, 2013 [Page 43] |
---|
2408 | |
---|
2409 | Internet-Draft HTTP/2.0 January 2013 |
---|
2410 | |
---|
2411 | |
---|
2412 | in tact, HTTP/2.0 attempts to use the RST_STREAM as a mechanism to |
---|
2413 | invalidate the stream but move forward without aborting the |
---|
2414 | connection altogether. |
---|
2415 | |
---|
2416 | For errors occuring outside of a single stream context, HTTP/2.0 |
---|
2417 | assumes the entire session is hosed. In this case, the endpoint |
---|
2418 | detecting the error should initiate a connection close. |
---|
2419 | |
---|
2420 | 5.3. One Connection Per Domain |
---|
2421 | |
---|
2422 | HTTP/2.0 attempts to use fewer connections than other protocols have |
---|
2423 | traditionally used. The rationale for this behavior is because it is |
---|
2424 | very difficult to provide a consistent level of service (e.g. TCP |
---|
2425 | slow-start), prioritization, or optimal compression when the client |
---|
2426 | is connecting to the server through multiple channels. |
---|
2427 | |
---|
2428 | Through lab measurements, we have seen consistent latency benefits by |
---|
2429 | using fewer connections from the client. The overall number of |
---|
2430 | packets sent by HTTP/2.0 can be as much as 40% less than HTTP. |
---|
2431 | Handling large numbers of concurrent connections on the server also |
---|
2432 | does become a scalability problem, and HTTP/2.0 reduces this load. |
---|
2433 | |
---|
2434 | The use of multiple connections is not without benefit, however. |
---|
2435 | Because HTTP/2.0 multiplexes multiple, independent streams onto a |
---|
2436 | single stream, it creates a potential for head-of-line blocking |
---|
2437 | problems at the transport level. In tests so far, the negative |
---|
2438 | effects of head-of-line blocking (especially in the presence of |
---|
2439 | packet loss) is outweighed by the benefits of compression and |
---|
2440 | prioritization. |
---|
2441 | |
---|
2442 | 5.4. Fixed vs Variable Length Fields |
---|
2443 | |
---|
2444 | HTTP/2.0 favors use of fixed length 32bit fields in cases where |
---|
2445 | smaller, variable length encodings could have been used. To some, |
---|
2446 | this seems like a tragic waste of bandwidth. HTTP/2.0 choses the |
---|
2447 | simple encoding for speed and simplicity. |
---|
2448 | |
---|
2449 | The goal of HTTP/2.0 is to reduce latency on the network. The |
---|
2450 | overhead of HTTP/2.0 frames is generally quite low. Each data frame |
---|
2451 | is only an 8 byte overhead for a 1452 byte payload (~0.6%). At the |
---|
2452 | time of this writing, bandwidth is already plentiful, and there is a |
---|
2453 | strong trend indicating that bandwidth will continue to increase. |
---|
2454 | With an average worldwide bandwidth of 1Mbps, and assuming that a |
---|
2455 | variable length encoding could reduce the overhead by 50%, the |
---|
2456 | latency saved by using a variable length encoding would be less than |
---|
2457 | 100 nanoseconds. More interesting are the effects when the larger |
---|
2458 | encodings force a packet boundary, in which case a round-trip could |
---|
2459 | be induced. However, by addressing other aspects of HTTP/2.0 and TCP |
---|
2460 | |
---|
2461 | |
---|
2462 | |
---|
2463 | Belshe, et al. Expires July 26, 2013 [Page 44] |
---|
2464 | |
---|
2465 | Internet-Draft HTTP/2.0 January 2013 |
---|
2466 | |
---|
2467 | |
---|
2468 | interactions, we believe this is completely mitigated. |
---|
2469 | |
---|
2470 | 5.5. Compression Context(s) |
---|
2471 | |
---|
2472 | When isolating the compression contexts used for communicating with |
---|
2473 | multiple origins, we had a few choices to make. We could have |
---|
2474 | maintained a map (or list) of compression contexts usable for each |
---|
2475 | origin. The basic case is easy - each HEADERS frame would need to |
---|
2476 | identify the context to use for that frame. However, compression |
---|
2477 | contexts are not cheap, so the lifecycle of each context would need |
---|
2478 | to be bounded. For proxy servers, where we could churn through many |
---|
2479 | contexts, this would be a concern. We considered using a static set |
---|
2480 | of contexts, say 16 of them, which would bound the memory use. We |
---|
2481 | also considered dynamic contexts, which could be created on the fly, |
---|
2482 | and would need to be subsequently destroyed. All of these are |
---|
2483 | complicated, and ultimately we decided that such a mechanism creates |
---|
2484 | too many problems to solve. |
---|
2485 | |
---|
2486 | Alternatively, we've chosen the simple approach, which is to simply |
---|
2487 | provide a flag for resetting the compression context. For the common |
---|
2488 | case (no proxy), this fine because most requests are to the same |
---|
2489 | origin and we never need to reset the context. For cases where we |
---|
2490 | are using two different origins over a single HTTP/2.0 session, we |
---|
2491 | simply reset the compression state between each transition. |
---|
2492 | |
---|
2493 | 5.6. Unidirectional streams |
---|
2494 | |
---|
2495 | Many readers notice that unidirectional streams are both a bit |
---|
2496 | confusing in concept and also somewhat redundant. If the recipient |
---|
2497 | of a stream doesn't wish to send data on a stream, it could simply |
---|
2498 | send a SYN_REPLY with the FLAG_FIN bit set. The FLAG_UNIDIRECTIONAL |
---|
2499 | is, therefore, not necessary. |
---|
2500 | |
---|
2501 | It is true that we don't need the UNIDIRECTIONAL markings. It is |
---|
2502 | added because it avoids the recipient of pushed streams from needing |
---|
2503 | to send a set of empty frames (e.g. the SYN_STREAM w/ FLAG_FIN) which |
---|
2504 | otherwise serve no purpose. |
---|
2505 | |
---|
2506 | 5.7. Data Compression |
---|
2507 | |
---|
2508 | Generic compression of data portion of the streams (as opposed to |
---|
2509 | compression of the headers) without knowing the content of the stream |
---|
2510 | is redundant. There is no value in compressing a stream which is |
---|
2511 | already compressed. Because of this, HTTP/2.0 does allow data |
---|
2512 | compression to be optional. We included it because study of existing |
---|
2513 | websites shows that many sites are not using compression as they |
---|
2514 | should, and users suffer because of it. We wanted a mechanism where, |
---|
2515 | at the HTTP/2.0 layer, site administrators could simply force |
---|
2516 | |
---|
2517 | |
---|
2518 | |
---|
2519 | Belshe, et al. Expires July 26, 2013 [Page 45] |
---|
2520 | |
---|
2521 | Internet-Draft HTTP/2.0 January 2013 |
---|
2522 | |
---|
2523 | |
---|
2524 | compression - it is better to compress twice than to not compress. |
---|
2525 | |
---|
2526 | Overall, however, with this feature being optional and sometimes |
---|
2527 | redundant, it is unclear if it is useful at all. We will likely |
---|
2528 | remove it from the specification. |
---|
2529 | |
---|
2530 | 5.8. Server Push |
---|
2531 | |
---|
2532 | A subtle but important point is that server push streams must be |
---|
2533 | declared before the associated stream is closed. The reason for this |
---|
2534 | is so that proxies have a lifetime for which they can discard |
---|
2535 | information about previous streams. If a pushed stream could |
---|
2536 | associate itself with an already-closed stream, then endpoints would |
---|
2537 | not have a specific lifecycle for when they could disavow knowledge |
---|
2538 | of the streams which went before. |
---|
2539 | |
---|
2540 | 6. Security Considerations |
---|
2541 | |
---|
2542 | 6.1. Use of Same-origin constraints |
---|
2543 | |
---|
2544 | This specification uses the same-origin policy [RFC6454] in all cases |
---|
2545 | where verification of content is required. |
---|
2546 | |
---|
2547 | 6.2. HTTP Headers and HTTP/2.0 Headers |
---|
2548 | |
---|
2549 | At the application level, HTTP uses name/value pairs in its headers. |
---|
2550 | Because HTTP/2.0 merges the existing HTTP headers with HTTP/2.0 |
---|
2551 | headers, there is a possibility that some HTTP applications already |
---|
2552 | use a particular header name. To avoid any conflicts, all headers |
---|
2553 | introduced for layering HTTP over HTTP/2.0 are prefixed with ":". ":" |
---|
2554 | is not a valid sequence in HTTP header naming, preventing any |
---|
2555 | possible conflict. |
---|
2556 | |
---|
2557 | 6.3. Cross-Protocol Attacks |
---|
2558 | |
---|
2559 | By utilizing TLS, we believe that HTTP/2.0 introduces no new cross- |
---|
2560 | protocol attacks. TLS encrypts the contents of all transmission |
---|
2561 | (except the handshake itself), making it difficult for attackers to |
---|
2562 | control the data which could be used in a cross-protocol attack. |
---|
2563 | |
---|
2564 | 6.4. Server Push Implicit Headers |
---|
2565 | |
---|
2566 | Pushed resources do not have an associated request. In order for |
---|
2567 | existing HTTP cache control validations (such as the Vary header) to |
---|
2568 | work, however, all cached resources must have a set of request |
---|
2569 | headers. For this reason, browsers MUST be careful to inherit |
---|
2570 | request headers from the associated stream for the push. This |
---|
2571 | includes the 'Cookie' header. |
---|
2572 | |
---|
2573 | |
---|
2574 | |
---|
2575 | Belshe, et al. Expires July 26, 2013 [Page 46] |
---|
2576 | |
---|
2577 | Internet-Draft HTTP/2.0 January 2013 |
---|
2578 | |
---|
2579 | |
---|
2580 | 7. Privacy Considerations |
---|
2581 | |
---|
2582 | 7.1. Long Lived Connections |
---|
2583 | |
---|
2584 | HTTP/2.0 aims to keep connections open longer between clients and |
---|
2585 | servers in order to reduce the latency when a user makes a request. |
---|
2586 | The maintenance of these connections over time could be used to |
---|
2587 | expose private information. For example, a user using a browser |
---|
2588 | hours after the previous user stopped using that browser may be able |
---|
2589 | to learn about what the previous user was doing. This is a problem |
---|
2590 | with HTTP in its current form as well, however the short lived |
---|
2591 | connections make it less of a risk. |
---|
2592 | |
---|
2593 | 7.2. SETTINGS frame |
---|
2594 | |
---|
2595 | The HTTP/2.0 SETTINGS frame allows servers to store out-of-band |
---|
2596 | transmitted information about the communication between client and |
---|
2597 | server on the client. Although this is intended only to be used to |
---|
2598 | reduce latency, renegade servers could use it as a mechanism to store |
---|
2599 | identifying information about the client in future requests. |
---|
2600 | |
---|
2601 | Clients implementing privacy modes, such as Google Chrome's |
---|
2602 | "incognito mode", may wish to disable client-persisted SETTINGS |
---|
2603 | storage. |
---|
2604 | |
---|
2605 | Clients MUST clear persisted SETTINGS information when clearing the |
---|
2606 | cookies. |
---|
2607 | |
---|
2608 | TODO: Put range maximums on each type of setting to limit |
---|
2609 | inappropriate uses. |
---|
2610 | |
---|
2611 | 8. Requirements Notation |
---|
2612 | |
---|
2613 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
---|
2614 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
---|
2615 | document are to be interpreted as described in RFC 2119 [RFC2119]. |
---|
2616 | |
---|
2617 | 9. Acknowledgements |
---|
2618 | |
---|
2619 | This document includes substantial input from the following |
---|
2620 | individuals: |
---|
2621 | |
---|
2622 | o Adam Langley, Wan-Teh Chang, Jim Morrison, Mark Nottingham, Alyssa |
---|
2623 | Wilk, Costin Manolache, William Chan, Vitaliy Lvin, Joe Chan, Adam |
---|
2624 | Barth, Ryan Hamilton, Gavin Peters, Kent Alstad, Kevin Lindsay, |
---|
2625 | Paul Amer, Fan Yang, Jonathan Leighton (SPDY contributors). |
---|
2626 | |
---|
2627 | |
---|
2628 | |
---|
2629 | |
---|
2630 | |
---|
2631 | Belshe, et al. Expires July 26, 2013 [Page 47] |
---|
2632 | |
---|
2633 | Internet-Draft HTTP/2.0 January 2013 |
---|
2634 | |
---|
2635 | |
---|
2636 | o Gabriel Montenegro and Willy Tarreau (Upgrade mechanism) |
---|
2637 | |
---|
2638 | o William Chan, Salvatore Loreto, Osama Mazahir, Gabriel Montenegro, |
---|
2639 | Jitu Padhye, Roberto Peon, Rob Trace (Flow control principles) |
---|
2640 | |
---|
2641 | o Mark Nottingham and Julian Reschke |
---|
2642 | |
---|
2643 | 10. Normative References |
---|
2644 | |
---|
2645 | [ASCII] "US-ASCII. Coded Character Set - 7-Bit American |
---|
2646 | Standard Code for Information Interchange. |
---|
2647 | Standard ANSI X3.4-1986, ANSI, 1986.". |
---|
2648 | |
---|
2649 | [HTTP-p1] Fielding, R. and J. Reschke, "Hypertext Transfer |
---|
2650 | Protocol (HTTP/1.1): Message Syntax and Routing", |
---|
2651 | draft-ietf-httpbis-p1-messaging-21 (work in |
---|
2652 | progress), October 2012. |
---|
2653 | |
---|
2654 | [HTTP-p2] Fielding, R. and J. Reschke, "Hypertext Transfer |
---|
2655 | Protocol (HTTP/1.1): Semantics and Content", |
---|
2656 | draft-ietf-httpbis-p2-semantics-21 (work in |
---|
2657 | progress), October 2012. |
---|
2658 | |
---|
2659 | [RFC0793] Postel, J., "Transmission Control Protocol", |
---|
2660 | STD 7, RFC 793, September 1981. |
---|
2661 | |
---|
2662 | [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, |
---|
2663 | "Uniform Resource Locators (URL)", RFC 1738, |
---|
2664 | December 1994. |
---|
2665 | |
---|
2666 | [RFC1950] Deutsch, L. and J. Gailly, "ZLIB Compressed Data |
---|
2667 | Format Specification version 3.3", RFC 1950, |
---|
2668 | May 1996. |
---|
2669 | |
---|
2670 | [RFC2119] Bradner, S., "Key words for use in RFCs to |
---|
2671 | Indicate Requirement Levels", BCP 14, RFC 2119, |
---|
2672 | March 1997. |
---|
2673 | |
---|
2674 | [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., |
---|
2675 | Masinter, L., Leach, P., and T. Berners-Lee, |
---|
2676 | "Hypertext Transfer Protocol -- HTTP/1.1", |
---|
2677 | RFC 2616, June 1999. |
---|
2678 | |
---|
2679 | [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., |
---|
2680 | Lawrence, S., Leach, P., Luotonen, A., and L. |
---|
2681 | Stewart, "HTTP Authentication: Basic and Digest |
---|
2682 | Access Authentication", RFC 2617, June 1999. |
---|
2683 | |
---|
2684 | |
---|
2685 | |
---|
2686 | |
---|
2687 | Belshe, et al. Expires July 26, 2013 [Page 48] |
---|
2688 | |
---|
2689 | Internet-Draft HTTP/2.0 January 2013 |
---|
2690 | |
---|
2691 | |
---|
2692 | [RFC4559] Jaganathan, K., Zhu, L., and J. Brezak, "SPNEGO- |
---|
2693 | based Kerberos and NTLM HTTP Authentication in |
---|
2694 | Microsoft Windows", RFC 4559, June 2006. |
---|
2695 | |
---|
2696 | [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer |
---|
2697 | Security (TLS) Protocol Version 1.2", RFC 5246, |
---|
2698 | August 2008. |
---|
2699 | |
---|
2700 | [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, |
---|
2701 | December 2011. |
---|
2702 | |
---|
2703 | [TLSNPN] Langley, A., "TLS Next Protocol Negotiation", |
---|
2704 | draft-agl-tls-nextprotoneg-01 (work in progress), |
---|
2705 | August 2010. |
---|
2706 | |
---|
2707 | [UDELCOMPRESSION] Yang, F., Amer, P., and J. Leighton, "A |
---|
2708 | Methodology to Derive SPDY's Initial Dictionary |
---|
2709 | for Zlib Compression", <http://www.eecis.udel.edu/ |
---|
2710 | ~amer/PEL/poc/pdf/SPDY-Fan.pdf>. |
---|
2711 | |
---|
2712 | Appendix A. Change Log (to be removed by RFC Editor before publication) |
---|
2713 | |
---|
2714 | A.1. Since draft-ietf-httpbis-http2-00 |
---|
2715 | |
---|
2716 | Changed title throughout. |
---|
2717 | |
---|
2718 | Removed section on Incompatibilities with SPDY draft#2. |
---|
2719 | |
---|
2720 | Changed INTERNAL_ERROR on GOAWAY to have a value of 2 <https:// |
---|
2721 | groups.google.com/forum/?fromgroups#!topic/spdy-dev/cfUef2gL3iU>. |
---|
2722 | |
---|
2723 | Replaced abstract and introduction. |
---|
2724 | |
---|
2725 | Added section on starting HTTP/2.0, including upgrade mechanism. |
---|
2726 | |
---|
2727 | Removed unused references. |
---|
2728 | |
---|
2729 | Added flow control principles (Section 3.5.1) based on <http:// |
---|
2730 | tools.ietf.org/html/draft-montenegro-httpbis-http2-fc-principles-01>. |
---|
2731 | |
---|
2732 | A.2. Since draft-mbelshe-httpbis-spdy-00 |
---|
2733 | |
---|
2734 | Adopted as base for draft-ietf-httpbis-http2. |
---|
2735 | |
---|
2736 | Updated authors/editors list. |
---|
2737 | |
---|
2738 | Added status note. |
---|
2739 | |
---|
2740 | |
---|
2741 | |
---|
2742 | |
---|
2743 | Belshe, et al. Expires July 26, 2013 [Page 49] |
---|
2744 | |
---|
2745 | Internet-Draft HTTP/2.0 January 2013 |
---|
2746 | |
---|
2747 | |
---|
2748 | Authors' Addresses |
---|
2749 | |
---|
2750 | Mike Belshe |
---|
2751 | Twist |
---|
2752 | |
---|
2753 | EMail: mbelshe@chromium.org |
---|
2754 | |
---|
2755 | |
---|
2756 | Roberto Peon |
---|
2757 | Google, Inc |
---|
2758 | |
---|
2759 | EMail: fenix@google.com |
---|
2760 | |
---|
2761 | |
---|
2762 | Martin Thomson (editor) |
---|
2763 | Microsoft |
---|
2764 | 3210 Porter Drive |
---|
2765 | Palo Alto 94043 |
---|
2766 | US |
---|
2767 | |
---|
2768 | EMail: martin.thomson@skype.net |
---|
2769 | |
---|
2770 | |
---|
2771 | Alexey Melnikov (editor) |
---|
2772 | Isode Ltd |
---|
2773 | 5 Castle Business Village |
---|
2774 | 36 Station Road |
---|
2775 | Hampton, Middlesex TW12 2BX |
---|
2776 | UK |
---|
2777 | |
---|
2778 | EMail: Alexey.Melnikov@isode.com |
---|
2779 | |
---|
2780 | |
---|
2781 | |
---|
2782 | |
---|
2783 | |
---|
2784 | |
---|
2785 | |
---|
2786 | |
---|
2787 | |
---|
2788 | |
---|
2789 | |
---|
2790 | |
---|
2791 | |
---|
2792 | |
---|
2793 | |
---|
2794 | |
---|
2795 | |
---|
2796 | |
---|
2797 | |
---|
2798 | |
---|
2799 | Belshe, et al. Expires July 26, 2013 [Page 50] |
---|
2800 | |
---|