You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5021 lines
252 KiB

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="lib/rfc2629.xslt"?>
  3. <?rfc toc="yes" ?>
  4. <?rfc symrefs="yes" ?>
  5. <?rfc sortrefs="yes" ?>
  6. <?rfc compact="yes"?>
  7. <?rfc subcompact="no" ?>
  8. <?rfc linkmailto="no" ?>
  9. <?rfc editing="no" ?>
  10. <?rfc comments="yes" ?>
  11. <?rfc inline="yes"?>
  12. <?rfc rfcedstyle="yes"?>
  13. <?rfc-ext allow-markup-in-artwork="yes" ?>
  14. <?rfc-ext include-index="no" ?>
  15. <rfc ipr="trust200902"
  16. category="std"
  17. docName="draft-ietf-httpbis-http2-latest"
  18. x:maturity-level="proposed"
  19. xmlns:x="http://purl.org/net/xml2rfc/ext">
  20. <x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=&lt;{ref}&gt;:"/>
  21. <front>
  22. <title abbrev="HTTP/2">Hypertext Transfer Protocol version 2</title>
  23. <author initials="M." surname="Belshe" fullname="Mike Belshe">
  24. <organization>Twist</organization>
  25. <address>
  26. <email>mbelshe@chromium.org</email>
  27. </address>
  28. </author>
  29. <author initials="R." surname="Peon" fullname="Roberto Peon">
  30. <organization>Google, Inc</organization>
  31. <address>
  32. <email>fenix@google.com</email>
  33. </address>
  34. </author>
  35. <author initials="M." surname="Thomson" fullname="Martin Thomson" role="editor">
  36. <organization>Mozilla</organization>
  37. <address>
  38. <postal>
  39. <street>331 E Evelyn Street</street>
  40. <city>Mountain View</city>
  41. <region>CA</region>
  42. <code>94041</code>
  43. <country>US</country>
  44. </postal>
  45. <email>martin.thomson@gmail.com</email>
  46. </address>
  47. </author>
  48. <date year="2014" />
  49. <area>Applications</area>
  50. <workgroup>HTTPbis</workgroup>
  51. <keyword>HTTP</keyword>
  52. <keyword>SPDY</keyword>
  53. <keyword>Web</keyword>
  54. <abstract>
  55. <t>
  56. This specification describes an optimized expression of the semantics of the Hypertext
  57. Transfer Protocol (HTTP). HTTP/2 enables a more efficient use of network resources and a
  58. reduced perception of latency by introducing header field compression and allowing multiple
  59. concurrent messages on the same connection. It also introduces unsolicited push of
  60. representations from servers to clients.
  61. </t>
  62. <t>
  63. This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax.
  64. HTTP's existing semantics remain unchanged.
  65. </t>
  66. </abstract>
  67. <note title="Editorial Note (To be removed by RFC Editor)">
  68. <t>
  69. Discussion of this draft takes place on the HTTPBIS working group mailing list
  70. (ietf-http-wg@w3.org), which is archived at <eref
  71. target="https://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
  72. </t>
  73. <t>
  74. Working Group information can be found at <eref
  75. target="https://tools.ietf.org/wg/httpbis/"/>; that specific to HTTP/2 are at <eref
  76. target="https://http2.github.io/"/>.
  77. </t>
  78. <t>
  79. The changes in this draft are summarized in <xref
  80. target="change.log"/>.
  81. </t>
  82. </note>
  83. </front>
  84. <middle>
  85. <section anchor="intro" title="Introduction">
  86. <t>
  87. The Hypertext Transfer Protocol (HTTP) is a wildly successful protocol. However, the
  88. HTTP/1.1 message format (<xref target="RFC7230" x:fmt="," x:rel="#http.message"/>) has
  89. several characteristics that have a negative overall effect on application performance
  90. today.
  91. </t>
  92. <t>
  93. In particular, HTTP/1.0 allowed only one request to be outstanding at a time on a given
  94. TCP connection. HTTP/1.1 added request pipelining, but this only partially addressed
  95. request concurrency and still suffers from head-of-line blocking. Therefore, HTTP/1.1
  96. clients that need to make many requests typically use multiple connections to a server in
  97. order to achieve concurrency and thereby reduce latency.
  98. </t>
  99. <t>
  100. Furthermore, HTTP header fields are often repetitive and verbose, causing unnecessary
  101. network traffic, as well as causing the initial <xref target="TCP">TCP</xref> congestion
  102. window to quickly fill. This can result in excessive latency when multiple requests are
  103. made on a new TCP connection.
  104. </t>
  105. <t>
  106. HTTP/2 addresses these issues by defining an optimized mapping of HTTP's semantics to an
  107. underlying connection. Specifically, it allows interleaving of request and response
  108. messages on the same connection and uses an efficient coding for HTTP header fields. It
  109. also allows prioritization of requests, letting more important requests complete more
  110. quickly, further improving performance.
  111. </t>
  112. <t>
  113. The resulting protocol is more friendly to the network, because fewer TCP connections can
  114. be used in comparison to HTTP/1.x. This means less competition with other flows, and
  115. longer-lived connections, which in turn leads to better utilization of available network
  116. capacity.
  117. </t>
  118. <t>
  119. Finally, HTTP/2 also enables more efficient processing of messages through use of binary
  120. message framing.
  121. </t>
  122. </section>
  123. <section anchor="Overview" title="HTTP/2 Protocol Overview">
  124. <t>
  125. HTTP/2 provides an optimized transport for HTTP semantics. HTTP/2 supports all of the core
  126. features of HTTP/1.1, but aims to be more efficient in several ways.
  127. </t>
  128. <t>
  129. The basic protocol unit in HTTP/2 is a <xref target="FrameHeader">frame</xref>. Each frame
  130. type serves a different purpose. For example, <x:ref>HEADERS</x:ref> and
  131. <x:ref>DATA</x:ref> frames form the basis of <xref target="HttpSequence">HTTP requests and
  132. responses</xref>; other frame types like <x:ref>SETTINGS</x:ref>,
  133. <x:ref>WINDOW_UPDATE</x:ref>, and <x:ref>PUSH_PROMISE</x:ref> are used in support of other
  134. HTTP/2 features.
  135. </t>
  136. <t>
  137. Multiplexing of requests is achieved by having each HTTP request-response exchange
  138. associated with its own <xref target="StreamsLayer">stream</xref>. Streams are largely
  139. independent of each other, so a blocked or stalled request or response does not prevent
  140. progress on other streams.
  141. </t>
  142. <t>
  143. Flow control and prioritization ensure that it is possible to efficiently use multiplexed
  144. streams. <xref target="FlowControl">Flow control</xref> helps to ensure that only data that
  145. can be used by a receiver is transmitted. <xref
  146. target="StreamPriority">Prioritization</xref> ensures that limited resources can be directed
  147. to the most important streams first.
  148. </t>
  149. <t>
  150. HTTP/2 adds a new interaction mode, whereby a server can <xref target="PushResources">push
  151. responses to a client</xref>. Server push allows a server to speculatively send a client
  152. data that the server anticipates the client will need, trading off some network usage
  153. against a potential latency gain. The server does this by synthesizing a request, which it
  154. sends as a <x:ref>PUSH_PROMISE</x:ref> frame. The server is then able to send a response to
  155. the synthetic request on a separate stream.
  156. </t>
  157. <t>
  158. Frames that contain HTTP header fields are <xref target="HeaderBlock">compressed</xref>.
  159. HTTP requests can be highly redundant, so compression can reduce the size of requests and
  160. responses significantly.
  161. </t>
  162. <section title="Document Organization">
  163. <t>
  164. The HTTP/2 specification is split into four parts:
  165. <list style="symbols">
  166. <t>
  167. <xref target="starting">Starting HTTP/2</xref> covers how an HTTP/2 connection is
  168. initiated.
  169. </t>
  170. <t>
  171. The <xref target="FramingLayer">framing</xref> and <xref
  172. target="StreamsLayer">streams</xref> layers describe the way HTTP/2 frames are
  173. structured and formed into multiplexed streams.
  174. </t>
  175. <t>
  176. <xref target="FrameTypes">Frame</xref> and <xref target="ErrorCodes">error</xref>
  177. definitions include details of the frame and error types used in HTTP/2.
  178. </t>
  179. <t>
  180. <xref target="HTTPLayer">HTTP mappings</xref> and <xref target="HttpExtra">additional
  181. requirements</xref> describe how HTTP semantics are expressed using frames and
  182. streams.
  183. </t>
  184. </list>
  185. </t>
  186. <t>
  187. While some of the frame and stream layer concepts are isolated from HTTP, this
  188. specification does not define a completely generic framing layer. The framing and streams
  189. layers are tailored to the needs of the HTTP protocol and server push.
  190. </t>
  191. </section>
  192. <section title="Conventions and Terminology">
  193. <t>
  194. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD
  195. NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as
  196. described in <xref target="RFC2119">RFC 2119</xref>.
  197. </t>
  198. <t>
  199. All numeric values are in network byte order. Values are unsigned unless otherwise
  200. indicated. Literal values are provided in decimal or hexadecimal as appropriate.
  201. Hexadecimal literals are prefixed with <spanx style="verb">0x</spanx> to distinguish them
  202. from decimal literals.
  203. </t>
  204. <t>
  205. The following terms are used:
  206. <list style="hanging">
  207. <t hangText="client:">
  208. The endpoint initiating the HTTP/2 connection.
  209. </t>
  210. <t hangText="connection:">
  211. A transport-layer connection between two endpoints.
  212. </t>
  213. <t hangText="connection error:">
  214. An error that affects the entire HTTP/2 connection.
  215. </t>
  216. <t hangText="endpoint:">
  217. Either the client or server of the connection.
  218. </t>
  219. <t hangText="frame:">
  220. The smallest unit of communication within an HTTP/2 connection, consisting of a header
  221. and a variable-length sequence of octets structured according to the frame type.
  222. </t>
  223. <t hangText="peer:">
  224. An endpoint. When discussing a particular endpoint, "peer" refers to the endpoint
  225. that is remote to the primary subject of discussion.
  226. </t>
  227. <t hangText="receiver:">
  228. An endpoint that is receiving frames.
  229. </t>
  230. <t hangText="sender:">
  231. An endpoint that is transmitting frames.
  232. </t>
  233. <t hangText="server:">
  234. The endpoint which did not initiate the HTTP/2 connection.
  235. </t>
  236. <t hangText="stream:">
  237. A bi-directional flow of frames across a virtual channel within the HTTP/2 connection.
  238. </t>
  239. <t hangText="stream error:">
  240. An error on the individual HTTP/2 stream.
  241. </t>
  242. </list>
  243. </t>
  244. <t>
  245. Finally, the terms "gateway", "intermediary", "proxy", and "tunnel" are defined
  246. in <xref target="RFC7230" x:fmt="of" x:rel="#intermediaries"/>.
  247. </t>
  248. </section>
  249. </section>
  250. <section anchor="starting" title="Starting HTTP/2">
  251. <t>
  252. An HTTP/2 connection is an application layer protocol running on top of a TCP connection
  253. (<xref target="TCP"/>). The client is the TCP connection initiator.
  254. </t>
  255. <t>
  256. HTTP/2 uses the same "http" and "https" URI schemes used by HTTP/1.1. HTTP/2 shares the same
  257. default port numbers: 80 for "http" URIs and 443 for "https" URIs. As a result,
  258. implementations processing requests for target resource URIs like <spanx
  259. style="verb">http://example.org/foo</spanx> or <spanx
  260. style="verb">https://example.com/bar</spanx> are required to first discover whether the
  261. upstream server (the immediate peer to which the client wishes to establish a connection)
  262. supports HTTP/2.
  263. </t>
  264. <t>
  265. The means by which support for HTTP/2 is determined is different for "http" and "https"
  266. URIs. Discovery for "http" URIs is described in <xref target="discover-http"/>. Discovery
  267. for "https" URIs is described in <xref target="discover-https"/>.
  268. </t>
  269. <section anchor="versioning" title="HTTP/2 Version Identification">
  270. <t>
  271. The protocol defined in this document has two identifiers.
  272. <list style="symbols">
  273. <x:lt>
  274. <t>
  275. The string "h2" identifies the protocol where HTTP/2 uses <xref
  276. target="TLS12">TLS</xref>. This identifier is used in the <xref
  277. target="TLS-ALPN">TLS application layer protocol negotiation extension (ALPN)</xref>
  278. field and any place that HTTP/2 over TLS is identified.
  279. </t>
  280. <t>
  281. The "h2" string is serialized into an ALPN protocol identifier as the two octet
  282. sequence: 0x68, 0x32.
  283. </t>
  284. </x:lt>
  285. <x:lt>
  286. <t>
  287. The string "h2c" identifies the protocol where HTTP/2 is run over cleartext TCP.
  288. This identifier is used in the HTTP/1.1 Upgrade header field and any place that
  289. HTTP/2 over TCP is identified.
  290. </t>
  291. </x:lt>
  292. </list>
  293. </t>
  294. <t>
  295. Negotiating "h2" or "h2c" implies the use of the transport, security, framing and message
  296. semantics described in this document.
  297. </t>
  298. <t>
  299. <cref>RFC Editor's Note: please remove the remainder of this section prior to the
  300. publication of a final version of this document.</cref>
  301. </t>
  302. <t>
  303. Only implementations of the final, published RFC can identify themselves as "h2" or "h2c".
  304. Until such an RFC exists, implementations MUST NOT identify themselves using these
  305. strings.
  306. </t>
  307. <t>
  308. Examples and text throughout the rest of this document use "h2" as a matter of
  309. editorial convenience only. Implementations of draft versions MUST NOT identify using
  310. this string.
  311. </t>
  312. <t>
  313. Implementations of draft versions of the protocol MUST add the string "-" and the
  314. corresponding draft number to the identifier. For example, draft-ietf-httpbis-http2-11
  315. over TLS is identified using the string "h2-11".
  316. </t>
  317. <t>
  318. Non-compatible experiments that are based on these draft versions MUST append the string
  319. "-" and an experiment name to the identifier. For example, an experimental implementation
  320. of packet mood-based encoding based on draft-ietf-httpbis-http2-09 might identify itself
  321. as "h2-09-emo". Note that any label MUST conform to the "token" syntax defined in
  322. <xref target="RFC7230" x:fmt="of" x:rel="#field.components"/>. Experimenters are
  323. encouraged to coordinate their experiments on the ietf-http-wg@w3.org mailing list.
  324. </t>
  325. </section>
  326. <section anchor="discover-http" title="Starting HTTP/2 for &quot;http&quot; URIs">
  327. <t>
  328. A client that makes a request for an "http" URI without prior knowledge about support for
  329. HTTP/2 uses the HTTP Upgrade mechanism (<xref target="RFC7230" x:fmt="of"
  330. x:rel="#header.upgrade"/>). The client makes an HTTP/1.1 request that includes an Upgrade
  331. header field identifying HTTP/2 with the "h2c" token. The HTTP/1.1 request MUST include
  332. exactly one <xref target="Http2SettingsHeader">HTTP2-Settings</xref> header field.
  333. </t>
  334. <figure>
  335. <preamble>For example:</preamble>
  336. <artwork type="message/http; msgtype=&#34;request&#34;" x:indent-with=" "><![CDATA[
  337. GET / HTTP/1.1
  338. Host: server.example.com
  339. Connection: Upgrade, HTTP2-Settings
  340. Upgrade: h2c
  341. HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>
  342. ]]></artwork>
  343. </figure>
  344. <t>
  345. Requests that contain an entity body MUST be sent in their entirety before the client can
  346. send HTTP/2 frames. This means that a large request entity can block the use of the
  347. connection until it is completely sent.
  348. </t>
  349. <t>
  350. If concurrency of an initial request with subsequent requests is important, an OPTIONS
  351. request can be used to perform the upgrade to HTTP/2, at the cost of an additional
  352. round-trip.
  353. </t>
  354. <t>
  355. A server that does not support HTTP/2 can respond to the request as though the Upgrade
  356. header field were absent:
  357. </t>
  358. <figure>
  359. <artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with=" ">
  360. HTTP/1.1 200 OK
  361. Content-Length: 243
  362. Content-Type: text/html
  363. ...
  364. </artwork>
  365. </figure>
  366. <t>
  367. A server MUST ignore a "h2" token in an Upgrade header field. Presence of a token with
  368. "h2" implies HTTP/2 over TLS, which is instead negotiated as described in <xref
  369. target="discover-https"/>.
  370. </t>
  371. <t>
  372. A server that supports HTTP/2 can accept the upgrade with a 101 (Switching Protocols)
  373. response. After the empty line that terminates the 101 response, the server can begin
  374. sending HTTP/2 frames. These frames MUST include a response to the request that initiated
  375. the Upgrade.
  376. </t>
  377. <figure>
  378. <preamble>
  379. For example:
  380. </preamble>
  381. <artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with=" ">
  382. HTTP/1.1 101 Switching Protocols
  383. Connection: Upgrade
  384. Upgrade: h2c
  385. [ HTTP/2 connection ...
  386. </artwork>
  387. </figure>
  388. <t>
  389. The first HTTP/2 frame sent by the server is a <x:ref>SETTINGS</x:ref> frame (<xref
  390. target="SETTINGS"/>) as the server connection preface (<xref
  391. target="ConnectionHeader"/>). Upon receiving the 101 response, the client sends a <xref
  392. target="ConnectionHeader">connection preface</xref>, which includes a
  393. <x:ref>SETTINGS</x:ref> frame.
  394. </t>
  395. <t>
  396. The HTTP/1.1 request that is sent prior to upgrade is assigned stream identifier 1 and is
  397. assigned <xref target="pri-default">default priority values</xref>. Stream 1 is
  398. implicitly half closed from the client toward the server, since the request is completed
  399. as an HTTP/1.1 request. After commencing the HTTP/2 connection, stream 1 is used for the
  400. response.
  401. </t>
  402. <section anchor="Http2SettingsHeader" title="HTTP2-Settings Header Field">
  403. <t>
  404. A request that upgrades from HTTP/1.1 to HTTP/2 MUST include exactly one <spanx
  405. style="verb">HTTP2-Settings</spanx> header field. The <spanx
  406. style="verb">HTTP2-Settings</spanx> header field is a connection-specific header field
  407. that includes parameters that govern the HTTP/2 connection, provided in anticipation of
  408. the server accepting the request to upgrade.
  409. </t>
  410. <figure>
  411. <artwork type="abnf" x:indent-with=" "><![CDATA[
  412. HTTP2-Settings = token68
  413. ]]></artwork>
  414. </figure>
  415. <t>
  416. A server MUST NOT upgrade the connection to HTTP/2 if this header field is not present,
  417. or if more than one is present. A server MUST NOT send this header field.
  418. </t>
  419. <t>
  420. The content of the <spanx style="verb">HTTP2-Settings</spanx> header field is the
  421. payload of a <x:ref>SETTINGS</x:ref> frame (<xref target="SETTINGS"/>), encoded as a
  422. base64url string (that is, the URL- and filename-safe Base64 encoding described in <xref
  423. target="RFC4648" x:fmt="of" x:sec="5"/>, with any trailing '=' characters omitted). The
  424. <xref target="RFC5234">ABNF</xref> production for <spanx style="verb">token68</spanx> is
  425. defined in <xref target="RFC7235" x:fmt="of" x:rel="#challenge.and.response"/>.
  426. </t>
  427. <t>
  428. Since the upgrade is only intended to apply to the immediate connection, a client
  429. sending <spanx style="verb">HTTP2-Settings</spanx> MUST also send <spanx
  430. style="verb">HTTP2-Settings</spanx> as a connection option in the <spanx
  431. style="verb">Connection</spanx> header field to prevent it from being forwarded
  432. downstream.
  433. </t>
  434. <t>
  435. A server decodes and interprets these values as it would any other
  436. <x:ref>SETTINGS</x:ref> frame. <xref target="SettingsSync">Acknowledgement of the
  437. SETTINGS parameters</xref> is not necessary, since a 101 response serves as implicit
  438. acknowledgment. Providing these values in the Upgrade request gives a client an
  439. opportunity to provide parameters prior to receiving any frames from the server.
  440. </t>
  441. </section>
  442. </section>
  443. <section anchor="discover-https" title="Starting HTTP/2 for &quot;https&quot; URIs">
  444. <t>
  445. A client that makes a request to an "https" URI uses <xref target="TLS12">TLS</xref>
  446. with the <xref target="TLS-ALPN">application layer protocol negotiation extension</xref>.
  447. </t>
  448. <t>
  449. HTTP/2 over TLS uses the "h2" application token. The "h2c" token MUST NOT be sent by a
  450. client or selected by a server.
  451. </t>
  452. <t>
  453. Once TLS negotiation is complete, both the client and the server send a <xref
  454. target="ConnectionHeader">connection preface</xref>.
  455. </t>
  456. </section>
  457. <section anchor="known-http" title="Starting HTTP/2 with Prior Knowledge">
  458. <t>
  459. A client can learn that a particular server supports HTTP/2 by other means. For example,
  460. <xref target="ALT-SVC"/> describes a mechanism for advertising this capability.
  461. </t>
  462. <t>
  463. A client MAY immediately send HTTP/2 frames to a server that is known to support HTTP/2,
  464. after the <xref target="ConnectionHeader">connection preface</xref>; a server can
  465. identify such a connection by the presence of the connection preface. This only affects
  466. the establishment of HTTP/2 connections over cleartext TCP; implementations that support
  467. HTTP/2 over TLS MUST use <xref target="TLS-ALPN">protocol negotiation in TLS</xref>.
  468. </t>
  469. <t>
  470. Without additional information, prior support for HTTP/2 is not a strong signal that a
  471. given server will support HTTP/2 for future connections. For example, it is possible for
  472. server configurations to change, for configurations to differ between instances in
  473. clustered servers, or for network conditions to change.
  474. </t>
  475. </section>
  476. <section anchor="ConnectionHeader" title="HTTP/2 Connection Preface">
  477. <t>
  478. Upon establishment of a TCP connection and determination that HTTP/2 will be used by both
  479. peers, each endpoint MUST send a connection preface as a final confirmation and to
  480. establish the initial SETTINGS parameters for the HTTP/2 connection. The client and
  481. server each send a different connection preface.
  482. </t>
  483. <t>
  484. The client connection preface starts with a sequence of 24 octets, which in hex notation
  485. are:
  486. </t>
  487. <figure>
  488. <artwork type="inline" x:indent-with=" "><![CDATA[
  489. 0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
  490. ]]></artwork>
  491. </figure>
  492. <t>
  493. (the string <spanx style="verb">PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n</spanx>). This sequence
  494. is followed by a <x:ref>SETTINGS</x:ref> frame (<xref target="SETTINGS"/>). The
  495. <x:ref>SETTINGS</x:ref> frame MAY be empty. The client sends the client connection
  496. preface immediately upon receipt of a 101 Switching Protocols response (indicating a
  497. successful upgrade), or as the first application data octets of a TLS connection. If
  498. starting an HTTP/2 connection with prior knowledge of server support for the protocol, the
  499. client connection preface is sent upon connection establishment.
  500. </t>
  501. <t>
  502. <list>
  503. <t>
  504. The client connection preface is selected so that a large proportion of HTTP/1.1 or
  505. HTTP/1.0 servers and intermediaries do not attempt to process further frames. Note
  506. that this does not address the concerns raised in <xref target="TALKING"/>.
  507. </t>
  508. </list>
  509. </t>
  510. <t>
  511. The server connection preface consists of a potentially empty <x:ref>SETTINGS</x:ref>
  512. frame (<xref target="SETTINGS"/>) that MUST be the first frame the server sends in the
  513. HTTP/2 connection.
  514. </t>
  515. <t>
  516. The <x:ref>SETTINGS</x:ref> frames received from a peer as part of the connection preface
  517. MUST be acknowledged (see <xref target="SettingsSync"/>) after sending the connection
  518. preface.
  519. </t>
  520. <t>
  521. To avoid unnecessary latency, clients are permitted to send additional frames to the
  522. server immediately after sending the client connection preface, without waiting to receive
  523. the server connection preface. It is important to note, however, that the server
  524. connection preface <x:ref>SETTINGS</x:ref> frame might include parameters that necessarily
  525. alter how a client is expected to communicate with the server. Upon receiving the
  526. <x:ref>SETTINGS</x:ref> frame, the client is expected to honor any parameters established.
  527. In some configurations, it is possible for the server to transmit <x:ref>SETTINGS</x:ref>
  528. before the client sends additional frames, providing an opportunity to avoid this issue.
  529. </t>
  530. <t>
  531. Clients and servers MUST treat an invalid connection preface as a <xref
  532. target="ConnectionErrorHandler">connection error</xref> of type
  533. <x:ref>PROTOCOL_ERROR</x:ref>. A <x:ref>GOAWAY</x:ref> frame (<xref target="GOAWAY"/>)
  534. MAY be omitted in this case, since an invalid preface indicates that the peer is not using
  535. HTTP/2.
  536. </t>
  537. </section>
  538. </section>
  539. <section anchor="FramingLayer" title="HTTP Frames">
  540. <t>
  541. Once the HTTP/2 connection is established, endpoints can begin exchanging frames.
  542. </t>
  543. <section anchor="FrameHeader" title="Frame Format">
  544. <t>
  545. All frames begin with a fixed 9-octet header followed by a variable-length payload.
  546. </t>
  547. <figure title="Frame Layout">
  548. <artwork type="inline"><![CDATA[
  549. 0 1 2 3
  550. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  551. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  552. | Length (24) |
  553. +---------------+---------------+---------------+
  554. | Type (8) | Flags (8) |
  555. +-+-+-----------+---------------+-------------------------------+
  556. |R| Stream Identifier (31) |
  557. +=+=============================================================+
  558. | Frame Payload (0...) ...
  559. +---------------------------------------------------------------+
  560. ]]></artwork>
  561. </figure>
  562. <t>
  563. The fields of the frame header are defined as:
  564. <list style="hanging">
  565. <x:lt hangText="Length:">
  566. <t>
  567. The length of the frame payload expressed as an unsigned 24-bit integer. Values
  568. greater than 2<x:sup>14</x:sup> (16,384) MUST NOT be sent unless the receiver has
  569. set a larger value for <x:ref>SETTINGS_MAX_FRAME_SIZE</x:ref>.
  570. </t>
  571. <t>
  572. The 9 octets of the frame header are not included in this value.
  573. </t>
  574. </x:lt>
  575. <x:lt hangText="Type:">
  576. <t>
  577. The 8-bit type of the frame. The frame type determines the format and semantics of
  578. the frame. Implementations MUST ignore and discard any frame that has a type that
  579. is unknown.
  580. </t>
  581. </x:lt>
  582. <x:lt hangText="Flags:">
  583. <t>
  584. An 8-bit field reserved for frame-type specific boolean flags.
  585. </t>
  586. <t>
  587. Flags are assigned semantics specific to the indicated frame type. Flags that have
  588. no defined semantics for a particular frame type MUST be ignored, and MUST be left
  589. unset (0) when sending.
  590. </t>
  591. </x:lt>
  592. <x:lt hangText="R:">
  593. <t>
  594. A reserved 1-bit field. The semantics of this bit are undefined and the bit MUST
  595. remain unset (0) when sending and MUST be ignored when receiving.
  596. </t>
  597. </x:lt>
  598. <x:lt hangText="Stream Identifier:">
  599. <t>
  600. A 31-bit stream identifier (see <xref target="StreamIdentifiers"/>). The value 0 is
  601. reserved for frames that are associated with the connection as a whole as opposed to
  602. an individual stream.
  603. </t>
  604. </x:lt>
  605. </list>
  606. </t>
  607. <t>
  608. The structure and content of the frame payload is dependent entirely on the frame type.
  609. </t>
  610. </section>
  611. <section anchor="FrameSize" title="Frame Size">
  612. <t>
  613. The size of a frame payload is limited by the maximum size that a receiver advertises in
  614. the <x:ref>SETTINGS_MAX_FRAME_SIZE</x:ref> setting. This setting can have any value
  615. between 2<x:sup>14</x:sup> (16,384) and 2<x:sup>24</x:sup>-1 (16,777,215) octets,
  616. inclusive.
  617. </t>
  618. <t>
  619. All implementations MUST be capable of receiving and minimally processing frames up to
  620. 2<x:sup>14</x:sup> octets in length, plus the 9 octet <xref target="FrameHeader">frame
  621. header</xref>. The size of the frame header is not included when describing frame sizes.
  622. <list style="hanging">
  623. <t hangText="Note:">
  624. Certain frame types, such as <xref target="PING">PING</xref>, impose additional limits
  625. on the amount of payload data allowed.
  626. </t>
  627. </list>
  628. </t>
  629. <t>
  630. If a frame size exceeds any defined limit, or is too small to contain mandatory frame
  631. data, the endpoint MUST send a <x:ref>FRAME_SIZE_ERROR</x:ref> error. A frame size error
  632. in a frame that could alter the state of the entire connection MUST be treated as a <xref
  633. target="ConnectionErrorHandler">connection error</xref>; this includes any frame carrying
  634. a <xref target="HeaderBlock">header block</xref> (that is, <x:ref>HEADERS</x:ref>,
  635. <x:ref>PUSH_PROMISE</x:ref>, and <x:ref>CONTINUATION</x:ref>), <x:ref>SETTINGS</x:ref>,
  636. and any <x:ref>WINDOW_UPDATE</x:ref> frame with a stream identifier of 0.
  637. </t>
  638. <t>
  639. Endpoints are not obligated to use all available space in a frame. Responsiveness can be
  640. improved by using frames that are smaller than the permitted maximum size. Sending large
  641. frames can result in delays in sending time-sensitive frames (such
  642. <x:ref>RST_STREAM</x:ref>, <x:ref>WINDOW_UPDATE</x:ref>, or <x:ref>PRIORITY</x:ref>)
  643. which if blocked by the transmission of a large frame, could affect performance.
  644. </t>
  645. </section>
  646. <section anchor="HeaderBlock" title="Header Compression and Decompression">
  647. <t>
  648. Just as in HTTP/1, a header field in HTTP/2 is a name with one or more associated values.
  649. They are used within HTTP request and response messages as well as server push operations
  650. (see <xref target="PushResources" />).
  651. </t>
  652. <t>
  653. Header lists are collections of zero or more header fields. When transmitted over a
  654. connection, a header list is serialized into a header block using <xref
  655. target="COMPRESSION">HTTP Header Compression</xref>. The serialized header block is then
  656. divided into one or more octet sequences, called header block fragments, and transmitted
  657. within the payload of <xref target="HEADERS">HEADERS</xref>, <xref
  658. target="PUSH_PROMISE">PUSH_PROMISE</xref> or <xref
  659. target="CONTINUATION">CONTINUATION</xref> frames.
  660. </t>
  661. <t>
  662. The <xref target="COOKIE">Cookie header field</xref> is treated specially by the HTTP
  663. mapping (see <xref target="CompressCookie"/>).
  664. </t>
  665. <t>
  666. A receiving endpoint reassembles the header block by concatenating its fragments, then
  667. decompresses the block to reconstruct the header list.
  668. </t>
  669. <t>
  670. A complete header block consists of either:
  671. <list style="symbols">
  672. <t>
  673. a single <x:ref>HEADERS</x:ref> or <x:ref>PUSH_PROMISE</x:ref> frame,
  674. with the END_HEADERS flag set, or
  675. </t>
  676. <t>
  677. a <x:ref>HEADERS</x:ref> or <x:ref>PUSH_PROMISE</x:ref> frame with the END_HEADERS
  678. flag cleared and one or more <x:ref>CONTINUATION</x:ref> frames,
  679. where the last <x:ref>CONTINUATION</x:ref> frame has the END_HEADERS flag set.
  680. </t>
  681. </list>
  682. </t>
  683. <t>
  684. Header compression is stateful. One compression context and one decompression context is
  685. used for the entire connection. Each header block is processed as a discrete unit.
  686. Header blocks MUST be transmitted as a contiguous sequence of frames, with no interleaved
  687. frames of any other type or from any other stream. The last frame in a sequence of
  688. <x:ref>HEADERS</x:ref> or <x:ref>CONTINUATION</x:ref> frames MUST have the END_HEADERS
  689. flag set. The last frame in a sequence of <x:ref>PUSH_PROMISE</x:ref> or
  690. <x:ref>CONTINUATION</x:ref> frames MUST have the END_HEADERS flag set. This allows a
  691. header block to be logically equivalent to a single frame.
  692. </t>
  693. <t>
  694. Header block fragments can only be sent as the payload of <x:ref>HEADERS</x:ref>,
  695. <x:ref>PUSH_PROMISE</x:ref> or <x:ref>CONTINUATION</x:ref> frames, because these frames
  696. carry data that can modify the compression context maintained by a receiver. An endpoint
  697. receiving <x:ref>HEADERS</x:ref>, <x:ref>PUSH_PROMISE</x:ref> or
  698. <x:ref>CONTINUATION</x:ref> frames MUST reassemble header blocks and perform decompression
  699. even if the frames are to be discarded. A receiver MUST terminate the connection with a
  700. <xref target="ConnectionErrorHandler">connection error</xref> of type
  701. <x:ref>COMPRESSION_ERROR</x:ref> if it does not decompress a header block.
  702. </t>
  703. </section>
  704. </section>
  705. <section anchor="StreamsLayer" title="Streams and Multiplexing">
  706. <t>
  707. A "stream" is an independent, bi-directional sequence of frames exchanged between the client
  708. and server within an HTTP/2 connection. Streams have several important characteristics:
  709. <list style="symbols">
  710. <t>
  711. A single HTTP/2 connection can contain multiple concurrently open streams, with either
  712. endpoint interleaving frames from multiple streams.
  713. </t>
  714. <t>
  715. Streams can be established and used unilaterally or shared by either the client or
  716. server.
  717. </t>
  718. <t>
  719. Streams can be closed by either endpoint.
  720. </t>
  721. <t>
  722. The order in which frames are sent on a stream is significant. Recipients process frames
  723. in the order they are received. In particular, the order of <x:ref>HEADERS</x:ref>,
  724. and <x:ref>DATA</x:ref> frames is semantically significant.
  725. </t>
  726. <t>
  727. Streams are identified by an integer. Stream identifiers are assigned to streams by the
  728. endpoint initiating the stream.
  729. </t>
  730. </list>
  731. </t>
  732. <section anchor="StreamStates" title="Stream States">
  733. <t>
  734. The lifecycle of a stream is shown in <xref target="StreamStatesFigure"/>.
  735. </t>
  736. <figure anchor="StreamStatesFigure" title="Stream States">
  737. <artwork type="drawing">
  738. <![CDATA[
  739. +--------+
  740. PP | | PP
  741. ,--------| idle |--------.
  742. / | | \
  743. v +--------+ v
  744. +----------+ | +----------+
  745. | | | H | |
  746. ,---| reserved | | | reserved |---.
  747. | | (local) | v | (remote) | |
  748. | +----------+ +--------+ +----------+ |
  749. | | ES | | ES | |
  750. | | H ,-------| open |-------. | H |
  751. | | / | | \ | |
  752. | v v +--------+ v v |
  753. | +----------+ | +----------+ |
  754. | | half | | | half | |
  755. | | closed | | R | closed | |
  756. | | (remote) | | | (local) | |
  757. | +----------+ | +----------+ |
  758. | | v | |
  759. | | ES / R +--------+ ES / R | |
  760. | `----------->| |<-----------' |
  761. | R | closed | R |
  762. `-------------------->| |<--------------------'
  763. +--------+
  764. H: HEADERS frame (with implied CONTINUATIONs)
  765. PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
  766. ES: END_STREAM flag
  767. R: RST_STREAM frame
  768. ]]>
  769. </artwork>
  770. </figure>
  771. <t>
  772. Note that this diagram shows stream state transitions and the frames and flags that affect
  773. those transitions only. In this regard, <x:ref>CONTINUATION</x:ref> frames do not result
  774. in state transitions; they are effectively part of the <x:ref>HEADERS</x:ref> or
  775. <x:ref>PUSH_PROMISE</x:ref> that they follow. For this purpose, the END_STREAM flag is
  776. processed as a separate event to the frame that bears it; a <x:ref>HEADERS</x:ref> frame
  777. with the END_STREAM flag set can cause two state transitions.
  778. </t>
  779. <t>
  780. Both endpoints have a subjective view of the state of a stream that could be different
  781. when frames are in transit. Endpoints do not coordinate the creation of streams; they are
  782. created unilaterally by either endpoint. The negative consequences of a mismatch in
  783. states are limited to the "closed" state after sending <x:ref>RST_STREAM</x:ref>, where
  784. frames might be received for some time after closing.
  785. </t>
  786. <t>
  787. Streams have the following states:
  788. <list style="hanging">
  789. <x:lt hangText="idle:">
  790. <t>
  791. <vspace blankLines="0"/>
  792. All streams start in the "idle" state. In this state, no frames have been
  793. exchanged.
  794. </t>
  795. <t>
  796. The following transitions are valid from this state:
  797. <list style="symbols">
  798. <t>
  799. Sending or receiving a <x:ref>HEADERS</x:ref> frame causes the stream to become
  800. "open". The stream identifier is selected as described in <xref
  801. target="StreamIdentifiers"/>. The same <x:ref>HEADERS</x:ref> frame can also
  802. cause a stream to immediately become "half closed".
  803. </t>
  804. <t>
  805. Sending a <x:ref>PUSH_PROMISE</x:ref> frame marks the associated stream for
  806. later use. The stream state for the reserved stream transitions to "reserved
  807. (local)".
  808. </t>
  809. <t>
  810. Receiving a <x:ref>PUSH_PROMISE</x:ref> frame marks the associated stream as
  811. reserved by the remote peer. The state of the stream becomes "reserved
  812. (remote)".
  813. </t>
  814. </list>
  815. </t>
  816. <t>
  817. Receiving any frames other than <x:ref>HEADERS</x:ref> or
  818. <x:ref>PUSH_PROMISE</x:ref> on a stream in this state MUST be treated as a <xref
  819. target="ConnectionErrorHandler">connection error</xref> of type
  820. <x:ref>PROTOCOL_ERROR</x:ref>.
  821. </t>
  822. </x:lt>
  823. <x:lt hangText="reserved (local):">
  824. <t>
  825. <vspace blankLines="0"/>
  826. A stream in the "reserved (local)" state is one that has been promised by sending a
  827. <x:ref>PUSH_PROMISE</x:ref> frame. A <x:ref>PUSH_PROMISE</x:ref> frame reserves an
  828. idle stream by associating the stream with an open stream that was initiated by the
  829. remote peer (see <xref target="PushResources"/>).
  830. </t>
  831. <t>
  832. In this state, only the following transitions are possible:
  833. <list style="symbols">
  834. <t>
  835. The endpoint can send a <x:ref>HEADERS</x:ref> frame. This causes the stream to
  836. open in a "half closed (remote)" state.
  837. </t>
  838. <t>
  839. Either endpoint can send a <x:ref>RST_STREAM</x:ref> frame to cause the stream
  840. to become "closed". This releases the stream reservation.
  841. </t>
  842. </list>
  843. </t>
  844. <t>
  845. An endpoint MUST NOT send any type of frame other than <x:ref>HEADERS</x:ref> or
  846. <x:ref>RST_STREAM</x:ref> in this state.
  847. </t>
  848. <t>
  849. A <x:ref>PRIORITY</x:ref> frame MAY be received in this state. Receiving any type
  850. of frame other than <x:ref>RST_STREAM</x:ref> or <x:ref>PRIORITY</x:ref> on a stream
  851. in this state MUST be treated as a <xref target="ConnectionErrorHandler">connection
  852. error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>.
  853. </t>
  854. </x:lt>
  855. <x:lt hangText="reserved (remote):">
  856. <t>
  857. <vspace blankLines="0"/>
  858. A stream in the "reserved (remote)" state has been reserved by a remote peer.
  859. </t>
  860. <t>
  861. In this state, only the following transitions are possible:
  862. <list style="symbols">
  863. <t>
  864. Receiving a <x:ref>HEADERS</x:ref> frame causes the stream to transition to
  865. "half closed (local)".
  866. </t>
  867. <t>
  868. Either endpoint can send a <x:ref>RST_STREAM</x:ref> frame to cause the stream
  869. to become "closed". This releases the stream reservation.
  870. </t>
  871. </list>
  872. </t>
  873. <t>
  874. An endpoint MAY send a <x:ref>PRIORITY</x:ref> frame in this state to reprioritize
  875. the reserved stream. An endpoint MUST NOT send any type of frame other than
  876. <x:ref>RST_STREAM</x:ref>, <x:ref>WINDOW_UPDATE</x:ref>, or <x:ref>PRIORITY</x:ref>
  877. in this state.
  878. </t>
  879. <t>
  880. Receiving any type of frame other than <x:ref>HEADERS</x:ref> or
  881. <x:ref>RST_STREAM</x:ref> on a stream in this state MUST be treated as a <xref
  882. target="ConnectionErrorHandler">connection error</xref> of type
  883. <x:ref>PROTOCOL_ERROR</x:ref>.
  884. </t>
  885. </x:lt>
  886. <x:lt hangText="open:">
  887. <t>
  888. <vspace blankLines="0"/>
  889. A stream in the "open" state may be used by both peers to send frames of any type.
  890. In this state, sending peers observe advertised <xref target="FlowControl">stream
  891. level flow control limits</xref>.
  892. </t>
  893. <t>
  894. From this state either endpoint can send a frame with an END_STREAM flag set, which
  895. causes the stream to transition into one of the "half closed" states: an endpoint
  896. sending an END_STREAM flag causes the stream state to become "half closed (local)";
  897. an endpoint receiving an END_STREAM flag causes the stream state to become "half
  898. closed (remote)".
  899. </t>
  900. <t>
  901. Either endpoint can send a <x:ref>RST_STREAM</x:ref> frame from this state, causing
  902. it to transition immediately to "closed".
  903. </t>
  904. </x:lt>
  905. <x:lt hangText="half closed (local):">
  906. <t>
  907. <vspace blankLines="0"/>
  908. A stream that is in the "half closed (local)" state cannot be used for sending
  909. frames. Only <x:ref>WINDOW_UPDATE</x:ref>, <x:ref>PRIORITY</x:ref> and
  910. <x:ref>RST_STREAM</x:ref> frames can be sent in this state.
  911. </t>
  912. <t>
  913. A stream transitions from this state to "closed" when a frame that contains an
  914. END_STREAM flag is received, or when either peer sends a <x:ref>RST_STREAM</x:ref>
  915. frame.
  916. </t>
  917. <t>
  918. A receiver can ignore <x:ref>WINDOW_UPDATE</x:ref> frames in this state, which might
  919. arrive for a short period after a frame bearing the END_STREAM flag is sent.
  920. </t>
  921. <t>
  922. <x:ref>PRIORITY</x:ref> frames received in this state are used to reprioritize
  923. streams that depend on the current stream.
  924. </t>
  925. </x:lt>
  926. <x:lt hangText="half closed (remote):">
  927. <t>
  928. <vspace blankLines="0"/>
  929. A stream that is "half closed (remote)" is no longer being used by the peer to send
  930. frames. In this state, an endpoint is no longer obligated to maintain a receiver
  931. flow control window if it performs flow control.
  932. </t>
  933. <t>
  934. If an endpoint receives additional frames for a stream that is in this state, other
  935. than <x:ref>WINDOW_UPDATE</x:ref>, <x:ref>PRIORITY</x:ref> or
  936. <x:ref>RST_STREAM</x:ref>, it MUST respond with a <xref
  937. target="StreamErrorHandler">stream error</xref> of type
  938. <x:ref>STREAM_CLOSED</x:ref>.
  939. </t>
  940. <t>
  941. A stream that is "half closed (remote)" can be used by the endpoint to send frames
  942. of any type. In this state, the endpoint continues to observe advertised <xref
  943. target="FlowControl">stream level flow control limits</xref>.
  944. </t>
  945. <t>
  946. A stream can transition from this state to "closed" by sending a frame that contains
  947. an END_STREAM flag, or when either peer sends a <x:ref>RST_STREAM</x:ref> frame.
  948. </t>
  949. </x:lt>
  950. <x:lt hangText="closed:">
  951. <t>
  952. <vspace blankLines="0"/>
  953. The "closed" state is the terminal state.
  954. </t>
  955. <t>
  956. An endpoint MUST NOT send frames other than <x:ref>PRIORITY</x:ref> on a closed
  957. stream. An endpoint that receives any frame other than <x:ref>PRIORITY</x:ref>
  958. after receiving a <x:ref>RST_STREAM</x:ref> MUST treat that as a <xref
  959. target="StreamErrorHandler">stream error</xref> of type
  960. <x:ref>STREAM_CLOSED</x:ref>. Similarly, an endpoint that receives any frames after
  961. receiving a frame with the END_STREAM flag set MUST treat that as a <xref
  962. target="ConnectionErrorHandler">connection error</xref> of type
  963. <x:ref>STREAM_CLOSED</x:ref>, unless the frame is permitted as described below.
  964. </t>
  965. <t>
  966. <x:ref>WINDOW_UPDATE</x:ref> or <x:ref>RST_STREAM</x:ref> frames can be received in
  967. this state for a short period after a <x:ref>DATA</x:ref> or <x:ref>HEADERS</x:ref>
  968. frame containing an END_STREAM flag is sent. Until the remote peer receives and
  969. processes <x:ref>RST_STREAM</x:ref> or the frame bearing the END_STREAM flag, it
  970. might send frames of these types. Endpoints MUST ignore
  971. <x:ref>WINDOW_UPDATE</x:ref> or <x:ref>RST_STREAM</x:ref> frames received in this
  972. state, though endpoints MAY choose to treat frames that arrive a significant time
  973. after sending END_STREAM as a <xref target="ConnectionErrorHandler">connection
  974. error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>.
  975. </t>
  976. <t>
  977. <x:ref>PRIORITY</x:ref> frames can be sent on closed streams to prioritize streams
  978. that are dependent on the closed stream. Endpoints SHOULD process
  979. <x:ref>PRIORITY</x:ref> frame, though they can be ignored if the stream has been
  980. removed from the dependency tree (see <xref target="priority-gc"/>).
  981. </t>
  982. <t>
  983. If this state is reached as a result of sending a <x:ref>RST_STREAM</x:ref> frame,
  984. the peer that receives the <x:ref>RST_STREAM</x:ref> might have already sent - or
  985. enqueued for sending - frames on the stream that cannot be withdrawn. An endpoint
  986. MUST ignore frames that it receives on closed streams after it has sent a
  987. <x:ref>RST_STREAM</x:ref> frame. An endpoint MAY choose to limit the period over
  988. which it ignores frames and treat frames that arrive after this time as being in
  989. error.
  990. </t>
  991. <t>
  992. Flow controlled frames (i.e., <x:ref>DATA</x:ref>) received after sending
  993. <x:ref>RST_STREAM</x:ref> are counted toward the connection flow control window.
  994. Even though these frames might be ignored, because they are sent before the sender
  995. receives the <x:ref>RST_STREAM</x:ref>, the sender will consider the frames to count
  996. against the flow control window.
  997. </t>
  998. <t>
  999. An endpoint might receive a <x:ref>PUSH_PROMISE</x:ref> frame after it sends
  1000. <x:ref>RST_STREAM</x:ref>. <x:ref>PUSH_PROMISE</x:ref> causes a stream to become
  1001. "reserved" even if the associated stream has been reset. Therefore, a
  1002. <x:ref>RST_STREAM</x:ref> is needed to close an unwanted promised stream.
  1003. </t>
  1004. </x:lt>
  1005. </list>
  1006. </t>
  1007. <t>
  1008. In the absence of more specific guidance elsewhere in this document, implementations
  1009. SHOULD treat the receipt of a frame that is not expressly permitted in the description of
  1010. a state as a <xref target="ConnectionErrorHandler">connection error</xref> of type
  1011. <x:ref>PROTOCOL_ERROR</x:ref>. Frame of unknown types are ignored.
  1012. </t>
  1013. <t>
  1014. An example of the state transitions for an HTTP request/response exchange can be found in
  1015. <xref target="HttpSequence"/>. An example of the state transitions for server push can be
  1016. found in <xref target="PushRequests"/> and <xref target="PushResponses"/>.
  1017. </t>
  1018. <section anchor="StreamIdentifiers" title="Stream Identifiers">
  1019. <t>
  1020. Streams are identified with an unsigned 31-bit integer. Streams initiated by a client
  1021. MUST use odd-numbered stream identifiers; those initiated by the server MUST use
  1022. even-numbered stream identifiers. A stream identifier of zero (0x0) is used for
  1023. connection control messages; the stream identifier zero cannot be used to establish a
  1024. new stream.
  1025. </t>
  1026. <t>
  1027. HTTP/1.1 requests that are upgraded to HTTP/2 (see <xref target="discover-http"/>) are
  1028. responded to with a stream identifier of one (0x1). After the upgrade
  1029. completes, stream 0x1 is "half closed (local)" to the client. Therefore, stream 0x1
  1030. cannot be selected as a new stream identifier by a client that upgrades from HTTP/1.1.
  1031. </t>
  1032. <t>
  1033. The identifier of a newly established stream MUST be numerically greater than all
  1034. streams that the initiating endpoint has opened or reserved. This governs streams that
  1035. are opened using a <x:ref>HEADERS</x:ref> frame and streams that are reserved using
  1036. <x:ref>PUSH_PROMISE</x:ref>. An endpoint that receives an unexpected stream identifier
  1037. MUST respond with a <xref target="ConnectionErrorHandler">connection error</xref> of
  1038. type <x:ref>PROTOCOL_ERROR</x:ref>.
  1039. </t>
  1040. <t>
  1041. The first use of a new stream identifier implicitly closes all streams in the "idle"
  1042. state that might have been initiated by that peer with a lower-valued stream identifier.
  1043. For example, if a client sends a <x:ref>HEADERS</x:ref> frame on stream 7 without ever
  1044. sending a frame on stream 5, then stream 5 transitions to the "closed" state when the
  1045. first frame for stream 7 is sent or received.
  1046. </t>
  1047. <t>
  1048. Stream identifiers cannot be reused. Long-lived connections can result in an endpoint
  1049. exhausting the available range of stream identifiers. A client that is unable to
  1050. establish a new stream identifier can establish a new connection for new streams. A
  1051. server that is unable to establish a new stream identifier can send a
  1052. <x:ref>GOAWAY</x:ref> frame so that the client is forced to open a new connection for
  1053. new streams.
  1054. </t>
  1055. </section>
  1056. <section title="Stream Concurrency">
  1057. <t>
  1058. A peer can limit the number of concurrently active streams using the
  1059. <x:ref>SETTINGS_MAX_CONCURRENT_STREAMS</x:ref> parameter (see <xref
  1060. target="SettingValues"/>) within a <x:ref>SETTINGS</x:ref> frame. The maximum concurrent
  1061. streams setting is specific to each endpoint and applies only to the peer that receives
  1062. the setting. That is, clients specify the maximum number of concurrent streams the
  1063. server can initiate, and servers specify the maximum number of concurrent streams the
  1064. client can initiate.
  1065. </t>
  1066. <t>
  1067. Streams that are in the "open" state, or either of the "half closed" states count toward
  1068. the maximum number of streams that an endpoint is permitted to open. Streams in any of
  1069. these three states count toward the limit advertised in the
  1070. <x:ref>SETTINGS_MAX_CONCURRENT_STREAMS</x:ref> setting. Streams in either of the
  1071. "reserved" states do not count toward the stream limit.
  1072. </t>
  1073. <t>
  1074. Endpoints MUST NOT exceed the limit set by their peer. An endpoint that receives a
  1075. <x:ref>HEADERS</x:ref> frame that causes their advertised concurrent stream limit to be
  1076. exceeded MUST treat this as a <xref target="StreamErrorHandler">stream error</xref>. An
  1077. endpoint that wishes to reduce the value of
  1078. <x:ref>SETTINGS_MAX_CONCURRENT_STREAMS</x:ref> to a value that is below the current
  1079. number of open streams can either close streams that exceed the new value or allow
  1080. streams to complete.
  1081. </t>
  1082. </section>
  1083. </section>
  1084. <section anchor="FlowControl" title="Flow Control">
  1085. <t>
  1086. Using streams for multiplexing introduces contention over use of the TCP connection,
  1087. resulting in blocked streams. A flow control scheme ensures that streams on the same
  1088. connection do not destructively interfere with each other. Flow control is used for both
  1089. individual streams and for the connection as a whole.
  1090. </t>
  1091. <t>
  1092. HTTP/2 provides for flow control through use of the <xref
  1093. target="WINDOW_UPDATE">WINDOW_UPDATE frame</xref>.
  1094. </t>
  1095. <section anchor="fc-principles" title="Flow Control Principles">
  1096. <t>
  1097. HTTP/2 stream flow control aims to allow a variety of flow control algorithms to be
  1098. used without requiring protocol changes. Flow control in HTTP/2 has the following
  1099. characteristics:
  1100. <list style="numbers">
  1101. <t>
  1102. Flow control is specific to a connection; i.e., it is "hop-by-hop", not
  1103. "end-to-end".
  1104. </t>
  1105. <t>
  1106. Flow control is based on window update frames. Receivers advertise how many octets
  1107. they are prepared to receive on a stream and for the entire connection. This is a
  1108. credit-based scheme.
  1109. </t>
  1110. <t>
  1111. Flow control is directional with overall control provided by the receiver. A
  1112. receiver MAY choose to set any window size that it desires for each stream and for
  1113. the entire connection. A sender MUST respect flow control limits imposed by a
  1114. receiver. Clients, servers and intermediaries all independently advertise their
  1115. flow control window as a receiver and abide by the flow control limits set by
  1116. their peer when sending.
  1117. </t>
  1118. <t>
  1119. The initial value for the flow control window is 65,535 octets for both new streams
  1120. and the overall connection.
  1121. </t>
  1122. <t>
  1123. The frame type determines whether flow control applies to a frame. Of the frames
  1124. specified in this document, only <x:ref>DATA</x:ref> frames are subject to flow
  1125. control; all other frame types do not consume space in the advertised flow control
  1126. window. This ensures that important control frames are not blocked by flow control.
  1127. </t>
  1128. <t>
  1129. Flow control cannot be disabled.
  1130. </t>
  1131. <t>
  1132. HTTP/2 defines only the format and semantics of the <x:ref>WINDOW_UPDATE</x:ref>
  1133. frame (<xref target="WINDOW_UPDATE"/>). This document does not stipulate how a
  1134. receiver decides when to send this frame or the value that it sends, nor does it
  1135. specify how a sender chooses to send packets. Implementations are able to select
  1136. any algorithm that suits their needs.
  1137. </t>
  1138. </list>
  1139. </t>
  1140. <t>
  1141. Implementations are also responsible for managing how requests and responses are sent
  1142. based on priority; choosing how to avoid head of line blocking for requests; and
  1143. managing the creation of new streams. Algorithm choices for these could interact with
  1144. any flow control algorithm.
  1145. </t>
  1146. </section>
  1147. <section anchor="DisableFlowControl" title="Appropriate Use of Flow Control">
  1148. <t>
  1149. Flow control is defined to protect endpoints that are operating under resource
  1150. constraints. For example, a proxy needs to share memory between many connections, and
  1151. also might have a slow upstream connection and a fast downstream one. Flow control
  1152. addresses cases where the receiver is unable process data on one stream, yet wants to
  1153. continue to process other streams in the same connection.
  1154. </t>
  1155. <t>
  1156. Deployments that do not require this capability can advertise a flow control window of
  1157. the maximum size, incrementing the available space when new data is received. This
  1158. effectively disables flow control for that receiver. Conversely, a sender is always
  1159. subject to the flow control window advertised by the receiver.
  1160. </t>
  1161. <t>
  1162. Deployments with constrained resources (for example, memory) can employ flow control to
  1163. limit the amount of memory a peer can consume. Note, however, that this can lead to
  1164. suboptimal use of available network resources if flow control is enabled without
  1165. knowledge of the bandwidth-delay product (see <xref target="RFC1323"/>).
  1166. </t>
  1167. <t>
  1168. Even with full awareness of the current bandwidth-delay product, implementation of flow
  1169. control can be difficult. When using flow control, the receiver MUST read from the TCP
  1170. receive buffer in a timely fashion. Failure to do so could lead to a deadlock when
  1171. critical frames, such as <x:ref>WINDOW_UPDATE</x:ref>, are not read and acted upon.
  1172. </t>
  1173. </section>
  1174. </section>
  1175. <section anchor="StreamPriority" title="Stream priority">
  1176. <t>
  1177. A client can assign a priority for a new stream by including prioritization information in
  1178. the <xref target="HEADERS">HEADERS frame</xref> that opens the stream. For an existing
  1179. stream, the <xref target="PRIORITY">PRIORITY frame</xref> can be used to change the
  1180. priority.
  1181. </t>
  1182. <t>
  1183. The purpose of prioritization is to allow an endpoint to express how it would prefer its
  1184. peer allocate resources when managing concurrent streams. Most importantly, priority can
  1185. be used to select streams for transmitting frames when there is limited capacity for
  1186. sending.
  1187. </t>
  1188. <t>
  1189. Streams can be prioritized by marking them as dependent on the completion of other streams
  1190. (<xref target="pri-depend"/>). Each dependency is assigned a relative weight, a number
  1191. that is used to determine the relative proportion of available resources that are assigned
  1192. to streams dependent on the same stream.
  1193. </t>
  1194. <!--
  1195. Note that stream dependencies have not yet been validated in practice. The theory
  1196. might be fairly sound, but there are no implementations currently sending these. If it
  1197. turns out that they are not useful, or actively harmful, implementations will be requested
  1198. to avoid creating stream dependencies.
  1199. -->
  1200. <t>
  1201. Explicitly setting the priority for a stream is input to a prioritization process. It
  1202. does not guarantee any particular processing or transmission order for the stream relative
  1203. to any other stream. An endpoint cannot force a peer to process concurrent streams in a
  1204. particular order using priority. Expressing priority is therefore only ever a suggestion.
  1205. </t>
  1206. <t>
  1207. Providing prioritization information is optional, so default values are used if no
  1208. explicit indicator is provided (<xref target="pri-default"/>).
  1209. </t>
  1210. <section title="Stream Dependencies" anchor="pri-depend">
  1211. <t>
  1212. Each stream can be given an explicit dependency on another stream. Including a
  1213. dependency expresses a preference to allocate resources to the identified stream rather
  1214. than to the dependent stream.
  1215. </t>
  1216. <t>
  1217. A stream that is not dependent on any other stream is given a stream dependency of 0x0.
  1218. In other words, the non-existent stream 0 forms the root of the tree.
  1219. </t>
  1220. <t>
  1221. A stream that depends on another stream is a dependent stream. The stream upon which a
  1222. stream is dependent is a parent stream. A dependency on a stream that is not currently
  1223. in the tree - such as a stream in the "idle" state - results in that stream being given
  1224. a <xref target="pri-default">default priority</xref>.
  1225. </t>
  1226. <t>
  1227. When assigning a dependency on another stream, the stream is added as a new dependency
  1228. of the parent stream. Dependent streams that share the same parent are not ordered with
  1229. respect to each other. For example, if streams B and C are dependent on stream A, and
  1230. if stream D is created with a dependency on stream A, this results in a dependency order
  1231. of A followed by B, C, and D in any order.
  1232. </t>
  1233. <figure title="Example of Default Dependency Creation">
  1234. <artwork type="inline"><![CDATA[
  1235. A A
  1236. / \ ==> /|\
  1237. B C B D C
  1238. ]]></artwork>
  1239. </figure>
  1240. <t>
  1241. An exclusive flag allows for the insertion of a new level of dependencies. The
  1242. exclusive flag causes the stream to become the sole dependency of its parent stream,
  1243. causing other dependencies to become dependent on the exclusive stream. In the
  1244. previous example, if stream D is created with an exclusive dependency on stream A, this
  1245. results in D becoming the dependency parent of B and C.
  1246. </t>
  1247. <figure title="Example of Exclusive Dependency Creation">
  1248. <artwork type="inline"><![CDATA[
  1249. A
  1250. A |
  1251. / \ ==> D
  1252. B C / \
  1253. B C
  1254. ]]></artwork>
  1255. </figure>
  1256. <t>
  1257. Inside the dependency tree, a dependent stream SHOULD only be allocated resources if all
  1258. of the streams that it depends on (the chain of parent streams up to 0x0) are either
  1259. closed, or it is not possible to make progress on them.
  1260. </t>
  1261. <t>
  1262. A stream cannot depend on itself. An endpoint MUST treat this as a <xref
  1263. target="StreamErrorHandler">stream error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>.
  1264. </t>
  1265. </section>
  1266. <section title="Dependency Weighting">
  1267. <t>
  1268. All dependent streams are allocated an integer weight between 1 and 256 (inclusive).
  1269. </t>
  1270. <t>
  1271. Streams with the same parent SHOULD be allocated resources proportionally based on their
  1272. weight. Thus, if stream B depends on stream A with weight 4, and C depends on stream A
  1273. with weight 12, and if no progress can be made on A, stream B ideally receives one third
  1274. of the resources allocated to stream C.
  1275. </t>
  1276. </section>
  1277. <section anchor="reprioritize" title="Reprioritization">
  1278. <t>
  1279. Stream priorities are changed using the <x:ref>PRIORITY</x:ref> frame. Setting a
  1280. dependency causes a stream to become dependent on the identified parent stream.
  1281. </t>
  1282. <t>
  1283. Dependent streams move with their parent stream if the parent is reprioritized. Setting
  1284. a dependency with the exclusive flag for a reprioritized stream moves all the
  1285. dependencies of the new parent stream to become dependent on the reprioritized stream.
  1286. </t>
  1287. <t>
  1288. If a stream is made dependent on one of its own dependencies, the formerly dependent
  1289. stream is first moved to be dependent on the reprioritized stream's previous parent.
  1290. The moved dependency retains its weight.
  1291. </t>
  1292. <figure title="Example of Dependency Reordering">
  1293. <preamble>
  1294. For example, consider an original dependency tree where B and C depend on A, D and E
  1295. depend on C, and F depends on D. If A is made dependent on D, then D takes the place
  1296. of A. All other dependency relationships stay the same, except for F, which becomes
  1297. dependent on A if the reprioritization is exclusive.
  1298. </preamble>
  1299. <artwork type="inline"><![CDATA[
  1300. ? ? ? ?
  1301. | / \ | |
  1302. A D A D D
  1303. / \ / / \ / \ |
  1304. B C ==> F B C ==> F A OR A
  1305. / \ | / \ /|\
  1306. D E E B C B C F
  1307. | | |
  1308. F E E
  1309. (intermediate) (non-exclusive) (exclusive)
  1310. ]]></artwork>
  1311. </figure>
  1312. </section>
  1313. <section anchor="priority-gc" title="Prioritization State Management">
  1314. <t>
  1315. When a stream is removed from the dependency tree, its dependencies can be moved to
  1316. become dependent on the parent of the closed stream. The weights of new dependencies
  1317. are recalculated by distributing the weight of the dependency of the closed stream
  1318. proportionally based on the weights of its dependencies.
  1319. </t>
  1320. <t>
  1321. Streams that are removed from the dependency tree cause some prioritization information
  1322. to be lost. Resources are shared between streams with the same parent stream, which
  1323. means that if a stream in that set closes or becomes blocked, any spare capacity
  1324. allocated to a stream is distributed to the immediate neighbors of the stream. However,
  1325. if the common dependency is removed from the tree, those streams share resources with
  1326. streams at the next highest level.
  1327. </t>
  1328. <t>
  1329. For example, assume streams A and B share a parent, and streams C and D both depend on
  1330. stream A. Prior to the removal of stream A, if streams A and D are unable to proceed,
  1331. then stream C receives all the resources dedicated to stream A. If stream A is removed
  1332. from the tree, the weight of stream A is divided between streams C and D. If stream D
  1333. is still unable to proceed, this results in stream C receiving a reduced proportion of
  1334. resources. For equal starting weights, C receives one third, rather than one half, of
  1335. available resources.
  1336. </t>
  1337. <t>
  1338. It is possible for a stream to become closed while prioritization information that
  1339. creates a dependency on that stream is in transit. If a stream identified in a
  1340. dependency has no associated priority information, then the dependent stream is instead
  1341. assigned a <xref target="pri-default">default priority</xref>. This potentially creates
  1342. suboptimal prioritization, since the stream could be given a priority that is different
  1343. to what is intended.
  1344. </t>
  1345. <t>
  1346. To avoid these problems, an endpoint SHOULD retain stream prioritization state for a
  1347. period after streams become closed. The longer state is retained, the lower the chance
  1348. that streams are assigned incorrect or default priority values.
  1349. </t>
  1350. <t>
  1351. This could create a large state burden for an endpoint, so this state MAY be limited.
  1352. An endpoint MAY apply a fixed upper limit on the number of closed streams for which
  1353. prioritization state is tracked to limit state exposure. The amount of additional state
  1354. an endpoint maintains could be dependent on load; under high load, prioritization state
  1355. can be discarded to limit resource commitments. In extreme cases, an endpoint could
  1356. even discard prioritization state for active or reserved streams. If a fixed limit is
  1357. applied, endpoints SHOULD maintain state for at least as many streams as allowed by
  1358. their setting for <x:ref>SETTINGS_MAX_CONCURRENT_STREAMS</x:ref>.
  1359. </t>
  1360. <t>
  1361. An endpoint receiving a <x:ref>PRIORITY</x:ref> frame that changes the priority of a
  1362. closed stream SHOULD alter the dependencies of the streams that depend on it, if it has
  1363. retained enough state to do so.
  1364. </t>
  1365. </section>
  1366. <section title="Default Priorities" anchor="pri-default">
  1367. <t>
  1368. Providing priority information is optional. Streams are assigned a non-exclusive
  1369. dependency on stream 0x0 by default. <xref target="PushResources">Pushed streams</xref>
  1370. initially depend on their associated stream. In both cases, streams are assigned a
  1371. default weight of 16.
  1372. </t>
  1373. </section>
  1374. </section>
  1375. <section title="Error Handling">
  1376. <t>
  1377. HTTP/2 framing permits two classes of error:
  1378. <list style="symbols">
  1379. <t>
  1380. An error condition that renders the entire connection unusable is a connection error.
  1381. </t>
  1382. <t>
  1383. An error in an individual stream is a stream error.
  1384. </t>
  1385. </list>
  1386. </t>
  1387. <t>
  1388. A list of error codes is included in <xref target="ErrorCodes"/>.
  1389. </t>
  1390. <section anchor="ConnectionErrorHandler" title="Connection Error Handling">
  1391. <t>
  1392. A connection error is any error which prevents further processing of the framing layer,
  1393. or which corrupts any connection state.
  1394. </t>
  1395. <t>
  1396. An endpoint that encounters a connection error SHOULD first send a <x:ref>GOAWAY</x:ref>
  1397. frame (<xref target="GOAWAY"/>) with the stream identifier of the last stream that it
  1398. successfully received from its peer. The <x:ref>GOAWAY</x:ref> frame includes an error
  1399. code that indicates why the connection is terminating. After sending the
  1400. <x:ref>GOAWAY</x:ref> frame, the endpoint MUST close the TCP connection.
  1401. </t>
  1402. <t>
  1403. It is possible that the <x:ref>GOAWAY</x:ref> will not be reliably received by the
  1404. receiving endpoint (see <xref target="RFC7230" x:fmt=","
  1405. x:rel="#persistent.tear-down"/>). In the event of a connection error,
  1406. <x:ref>GOAWAY</x:ref> only provides a best effort attempt to communicate with the peer
  1407. about why the connection is being terminated.
  1408. </t>
  1409. <t>
  1410. An endpoint can end a connection at any time. In particular, an endpoint MAY choose to
  1411. treat a stream error as a connection error. Endpoints SHOULD send a
  1412. <x:ref>GOAWAY</x:ref> frame when ending a connection, providing that circumstances
  1413. permit it.
  1414. </t>
  1415. </section>
  1416. <section anchor="StreamErrorHandler" title="Stream Error Handling">
  1417. <t>
  1418. A stream error is an error related to a specific stream that does not affect processing
  1419. of other streams.
  1420. </t>
  1421. <t>
  1422. An endpoint that detects a stream error sends a <x:ref>RST_STREAM</x:ref> frame (<xref
  1423. target="RST_STREAM"/>) that contains the stream identifier of the stream where the error
  1424. occurred. The <x:ref>RST_STREAM</x:ref> frame includes an error code that indicates the
  1425. type of error.
  1426. </t>
  1427. <t>
  1428. A <x:ref>RST_STREAM</x:ref> is the last frame that an endpoint can send on a stream.
  1429. The peer that sends the <x:ref>RST_STREAM</x:ref> frame MUST be prepared to receive any
  1430. frames that were sent or enqueued for sending by the remote peer. These frames can be
  1431. ignored, except where they modify connection state (such as the state maintained for
  1432. <xref target="HeaderBlock">header compression</xref>, or flow control).
  1433. </t>
  1434. <t>
  1435. Normally, an endpoint SHOULD NOT send more than one <x:ref>RST_STREAM</x:ref> frame for
  1436. any stream. However, an endpoint MAY send additional <x:ref>RST_STREAM</x:ref> frames if
  1437. it receives frames on a closed stream after more than a round-trip time. This behavior
  1438. is permitted to deal with misbehaving implementations.
  1439. </t>
  1440. <t>
  1441. An endpoint MUST NOT send a <x:ref>RST_STREAM</x:ref> in response to an
  1442. <x:ref>RST_STREAM</x:ref> frame, to avoid looping.
  1443. </t>
  1444. </section>
  1445. <section title="Connection Termination">
  1446. <t>
  1447. If the TCP connection is closed or reset while streams remain in open or half closed
  1448. states, then the endpoint MUST assume that those streams were abnormally interrupted and
  1449. could be incomplete.
  1450. </t>
  1451. </section>
  1452. </section>
  1453. <section anchor="extensibility" title="Extending HTTP/2">
  1454. <t>
  1455. HTTP/2 permits extension of the protocol. Protocol extensions can be used to provide
  1456. additional services or alter any aspect of the protocol, within the limitations described
  1457. in this section. Extensions are effective only within the scope of a single HTTP/2
  1458. connection.
  1459. </t>
  1460. <t>
  1461. Extensions are permitted to use new <xref target="FrameHeader">frame types</xref>, new
  1462. <xref target="SettingValues">settings</xref>, or new <xref target="ErrorCodes">error
  1463. codes</xref>. Registries are established for managing these extension points: <xref
  1464. target="iana-frames">frame types</xref>, <xref target="iana-settings">settings</xref> and
  1465. <xref target="iana-errors">error codes</xref>.
  1466. </t>
  1467. <t>
  1468. Implementations MUST ignore unknown or unsupported values in all extensible protocol
  1469. elements. Implementations MUST discard frames that have unknown or unsupported types.
  1470. This means that any of these extension points can be safely used by extensions without
  1471. prior arrangement or negotiation. However, extension frames that appear in the middle of
  1472. a <xref target="HeaderBlock">header block</xref> are not permitted; these MUST be treated
  1473. as a <xref target="ConnectionErrorHandler">connection error</xref> of type
  1474. <x:ref>PROTOCOL_ERROR</x:ref>.
  1475. </t>
  1476. <t>
  1477. However, extensions that could change the semantics of existing protocol components MUST
  1478. be negotiated before being used. For example, an extension that changes the layout of the
  1479. <x:ref>HEADERS</x:ref> frame cannot be used until the peer has given a positive signal
  1480. that this is acceptable. In this case, it could also be necessary to coordinate when the
  1481. revised layout comes into effect. Note that treating any frame other than
  1482. <x:ref>DATA</x:ref> frames as flow controlled is such a change in semantics, and can only
  1483. be done through negotiation.
  1484. </t>
  1485. <t>
  1486. This document doesn't mandate a specific method for negotiating the use of an extension,
  1487. but notes that a <xref target="SettingValues">setting</xref> could be used for that
  1488. purpose. If both peers set a value that indicates willingness to use the extension, then
  1489. the extension can be used. If a setting is used for extension negotiation, the initial
  1490. value MUST be defined so that the extension is initially disabled.
  1491. </t>
  1492. </section>
  1493. </section>
  1494. <section anchor="FrameTypes" title="Frame Definitions">
  1495. <t>
  1496. This specification defines a number of frame types, each identified by a unique 8-bit type
  1497. code. Each frame type serves a distinct purpose either in the establishment and management
  1498. of the connection as a whole, or of individual streams.
  1499. </t>
  1500. <t>
  1501. The transmission of specific frame types can alter the state of a connection. If endpoints
  1502. fail to maintain a synchronized view of the connection state, successful communication
  1503. within the connection will no longer be possible. Therefore, it is important that endpoints
  1504. have a shared comprehension of how the state is affected by the use any given frame.
  1505. </t>
  1506. <section anchor="DATA" title="DATA">
  1507. <t>
  1508. DATA frames (type=0x0) convey arbitrary, variable-length sequences of octets associated
  1509. with a stream. One or more DATA frames are used, for instance, to carry HTTP request or
  1510. response payloads.
  1511. </t>
  1512. <t>
  1513. DATA frames MAY also contain arbitrary padding. Padding can be added to DATA frames to
  1514. obscure the size of messages.
  1515. </t>
  1516. <figure title="DATA Frame Payload">
  1517. <artwork type="inline"><![CDATA[
  1518. 0 1 2 3
  1519. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1520. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1521. |Pad Length? (8)|
  1522. +---------------+-----------------------------------------------+
  1523. | Data (*) ...
  1524. +---------------------------------------------------------------+
  1525. | Padding (*) ...
  1526. +---------------------------------------------------------------+
  1527. ]]></artwork>
  1528. </figure>
  1529. <t>
  1530. The DATA frame contains the following fields:
  1531. <list style="hanging">
  1532. <t hangText="Pad Length:">
  1533. An 8-bit field containing the length of the frame padding in units of octets. This
  1534. field is optional and is only present if the PADDED flag is set.
  1535. </t>
  1536. <t hangText="Data:">
  1537. Application data. The amount of data is the remainder of the frame payload after
  1538. subtracting the length of the other fields that are present.
  1539. </t>
  1540. <t hangText="Padding:">
  1541. Padding octets that contain no application semantic value. Padding octets MUST be set
  1542. to zero when sending and ignored when receiving.
  1543. </t>
  1544. </list>
  1545. </t>
  1546. <t>
  1547. The DATA frame defines the following flags:
  1548. <list style="hanging">
  1549. <t hangText="END_STREAM (0x1):">
  1550. Bit 1 being set indicates that this frame is the last that the endpoint will send for
  1551. the identified stream. Setting this flag causes the stream to enter one of <xref
  1552. target="StreamStates">the "half closed" states or the "closed" state</xref>.
  1553. </t>
  1554. <t hangText="PADDED (0x8):">
  1555. Bit 4 being set indicates that the Pad Length field and any padding that it describes
  1556. is present.
  1557. </t>
  1558. </list>
  1559. </t>
  1560. <t>
  1561. DATA frames MUST be associated with a stream. If a DATA frame is received whose stream
  1562. identifier field is 0x0, the recipient MUST respond with a <xref
  1563. target="ConnectionErrorHandler">connection error</xref> of type
  1564. <x:ref>PROTOCOL_ERROR</x:ref>.
  1565. </t>
  1566. <t>
  1567. DATA frames are subject to flow control and can only be sent when a stream is in the
  1568. "open" or "half closed (remote)" states. The entire DATA frame payload is included in flow
  1569. control, including Pad Length and Padding fields if present. If a DATA frame is received
  1570. whose stream is not in "open" or "half closed (local)" state, the recipient MUST respond
  1571. with a <xref target="StreamErrorHandler">stream error</xref> of type
  1572. <x:ref>STREAM_CLOSED</x:ref>.
  1573. </t>
  1574. <t>
  1575. The total number of padding octets is determined by the value of the Pad Length field. If
  1576. the length of the padding is greater than the length of the frame payload, the recipient
  1577. MUST treat this as a <xref target="ConnectionErrorHandler">connection error</xref> of
  1578. type <x:ref>PROTOCOL_ERROR</x:ref>.
  1579. <list style="hanging">
  1580. <t hangText="Note:">
  1581. A frame can be increased in size by one octet by including a Pad Length field with a
  1582. value of zero.
  1583. </t>
  1584. </list>
  1585. </t>
  1586. <t>
  1587. Padding is a security feature; see <xref target="padding"/>.
  1588. </t>
  1589. </section>
  1590. <section anchor="HEADERS" title="HEADERS">
  1591. <t>
  1592. The HEADERS frame (type=0x1) is used to <xref target="StreamStates">open a stream</xref>,
  1593. and additionally carries a header block fragment. HEADERS frames can be sent on a stream
  1594. in the "open" or "half closed (remote)" states.
  1595. </t>
  1596. <figure title="HEADERS Frame Payload">
  1597. <artwork type="inline"><![CDATA[
  1598. 0 1 2 3
  1599. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1600. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1601. |Pad Length? (8)|
  1602. +-+-------------+-----------------------------------------------+
  1603. |E| Stream Dependency? (31) |
  1604. +-+-------------+-----------------------------------------------+
  1605. | Weight? (8) |
  1606. +-+-------------+-----------------------------------------------+
  1607. | Header Block Fragment (*) ...
  1608. +---------------------------------------------------------------+
  1609. | Padding (*) ...
  1610. +---------------------------------------------------------------+
  1611. ]]></artwork>
  1612. </figure>
  1613. <t>
  1614. The HEADERS frame payload has the following fields:
  1615. <list style="hanging">
  1616. <t hangText="Pad Length:">
  1617. An 8-bit field containing the length of the frame padding in units of octets. This
  1618. field is only present if the PADDED flag is set.
  1619. </t>
  1620. <t hangText="E:">
  1621. A single bit flag indicates that the stream dependency is exclusive, see <xref
  1622. target="StreamPriority"/>. This field is only present if the PRIORITY flag is set.
  1623. </t>
  1624. <t hangText="Stream Dependency:">
  1625. A 31-bit stream identifier for the stream that this stream depends on, see <xref
  1626. target="StreamPriority"/>. This field is only present if the PRIORITY flag is set.
  1627. </t>
  1628. <t hangText="Weight:">
  1629. An 8-bit weight for the stream, see <xref target="StreamPriority"/>. Add one to the
  1630. value to obtain a weight between 1 and 256. This field is only present if the
  1631. PRIORITY flag is set.
  1632. </t>
  1633. <t hangText="Header Block Fragment:">
  1634. A <xref target="HeaderBlock">header block fragment</xref>.
  1635. </t>
  1636. <t hangText="Padding:">
  1637. Padding octets that contain no application semantic value. Padding octets MUST be set
  1638. to zero when sending and ignored when receiving.
  1639. </t>
  1640. </list>
  1641. </t>
  1642. <t>
  1643. The HEADERS frame defines the following flags:
  1644. <list style="hanging">
  1645. <x:lt hangText="END_STREAM (0x1):">
  1646. <t>
  1647. Bit 1 being set indicates that the <xref target="HeaderBlock">header block</xref> is
  1648. the last that the endpoint will send for the identified stream. Setting this flag
  1649. causes the stream to enter one of <xref target="StreamStates">"half closed"
  1650. states</xref>.
  1651. </t>
  1652. <t>
  1653. A HEADERS frame carries the END_STREAM flag that signals the end of a stream.
  1654. However, a HEADERS frame with the END_STREAM flag set can be followed by
  1655. <x:ref>CONTINUATION</x:ref> frames on the same stream. Logically, the
  1656. <x:ref>CONTINUATION</x:ref> frames are part of the HEADERS frame.
  1657. </t>
  1658. </x:lt>
  1659. <x:lt hangText="END_HEADERS (0x4):">
  1660. <t>
  1661. Bit 3 being set indicates that this frame contains an entire <xref
  1662. target="HeaderBlock">header block</xref> and is not followed by any
  1663. <x:ref>CONTINUATION</x:ref> frames.
  1664. </t>
  1665. <t>
  1666. A HEADERS frame without the END_HEADERS flag set MUST be followed by a
  1667. <x:ref>CONTINUATION</x:ref> frame for the same stream. A receiver MUST treat the
  1668. receipt of any other type of frame or a frame on a different stream as a <xref
  1669. target="ConnectionErrorHandler">connection error</xref> of type
  1670. <x:ref>PROTOCOL_ERROR</x:ref>.
  1671. </t>
  1672. </x:lt>
  1673. <x:lt hangText="PADDED (0x8):">
  1674. <t>
  1675. Bit 4 being set indicates that the Pad Length field and any padding that it
  1676. describes is present.
  1677. </t>
  1678. </x:lt>
  1679. <x:lt hangText="PRIORITY (0x20):">
  1680. <t>
  1681. Bit 6 being set indicates that the Exclusive Flag (E), Stream Dependency, and Weight
  1682. fields are present; see <xref target="StreamPriority"/>.
  1683. </t>
  1684. </x:lt>
  1685. </list>
  1686. </t>
  1687. <t>
  1688. The payload of a HEADERS frame contains a <xref target="HeaderBlock">header block
  1689. fragment</xref>. A header block that does not fit within a HEADERS frame is continued in
  1690. a <xref target="CONTINUATION">CONTINUATION frame</xref>.
  1691. </t>
  1692. <t>
  1693. HEADERS frames MUST be associated with a stream. If a HEADERS frame is received whose
  1694. stream identifier field is 0x0, the recipient MUST respond with a <xref
  1695. target="ConnectionErrorHandler">connection error</xref> of type
  1696. <x:ref>PROTOCOL_ERROR</x:ref>.
  1697. </t>
  1698. <t>
  1699. The HEADERS frame changes the connection state as described in <xref
  1700. target="HeaderBlock"/>.
  1701. </t>
  1702. <t>
  1703. The HEADERS frame includes optional padding. Padding fields and flags are identical to
  1704. those defined for <xref target="DATA">DATA frames</xref>.
  1705. </t>
  1706. <t>
  1707. Prioritization information in a HEADERS frame is logically equivalent to a separate
  1708. <x:ref>PRIORITY</x:ref> frame, but inclusion in HEADERS avoids the potential for churn in
  1709. stream prioritization when new streams are created. Priorization fields in HEADERS frames
  1710. subsequent to the first on a stream <xref target="reprioritize">reprioritize the
  1711. stream</xref>.
  1712. </t>
  1713. </section>
  1714. <section anchor="PRIORITY" title="PRIORITY">
  1715. <t>
  1716. The PRIORITY frame (type=0x2) specifies the <xref target="StreamPriority">sender-advised
  1717. priority of a stream</xref>. It can be sent at any time for an existing stream, including
  1718. closed streams. This enables reprioritization of existing streams.
  1719. </t>
  1720. <figure title="PRIORITY Frame Payload">
  1721. <artwork type="inline"><![CDATA[
  1722. 0 1 2 3
  1723. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1724. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1725. |E| Stream Dependency (31) |
  1726. +-+-------------+-----------------------------------------------+
  1727. | Weight (8) |
  1728. +-+-------------+
  1729. ]]></artwork>
  1730. </figure>
  1731. <t>
  1732. The payload of a PRIORITY frame contains the following fields:
  1733. <list style="hanging">
  1734. <t hangText="E:">
  1735. A single bit flag indicates that the stream dependency is exclusive, see <xref
  1736. target="StreamPriority"/>.
  1737. </t>
  1738. <t hangText="Stream Dependency:">
  1739. A 31-bit stream identifier for the stream that this stream depends on, see <xref
  1740. target="StreamPriority"/>.
  1741. </t>
  1742. <t hangText="Weight:">
  1743. An 8-bit weight for the identified stream dependency, see <xref
  1744. target="StreamPriority"/>. Add one to the value to obtain a weight between 1 and 256.
  1745. </t>
  1746. </list>
  1747. </t>
  1748. <t>
  1749. The PRIORITY frame does not define any flags.
  1750. </t>
  1751. <t>
  1752. The PRIORITY frame is associated with an existing stream. If a PRIORITY frame is received
  1753. with a stream identifier of 0x0, the recipient MUST respond with a <xref
  1754. target="ConnectionErrorHandler">connection error</xref> of type
  1755. <x:ref>PROTOCOL_ERROR</x:ref>.
  1756. </t>
  1757. <t>
  1758. The PRIORITY frame can be sent on a stream in any of the "reserved (remote)", "open",
  1759. "half closed (local)", "half closed (remote)", or "closed" states, though it cannot be
  1760. sent between consecutive frames that comprise a single <xref target="HeaderBlock">header
  1761. block</xref>. Note that this frame could arrive after processing or frame sending has
  1762. completed, which would cause it to have no effect on the current stream. For a stream
  1763. that is in the "half closed (remote)" or "closed" - state, this frame can only affect
  1764. processing of the current stream and not frame transmission.
  1765. </t>
  1766. <t>
  1767. The PRIORITY frame is the only frame that can be sent for a stream in the "closed" state.
  1768. This allows for the reprioritization of a group of dependent streams by altering the
  1769. priority of a parent stream, which might be closed. However, a PRIORITY frame sent on a
  1770. closed stream risks being ignored due to the peer having discarded priority state
  1771. information for that stream.
  1772. </t>
  1773. </section>
  1774. <section anchor="RST_STREAM" title="RST_STREAM">
  1775. <t>
  1776. The RST_STREAM frame (type=0x3) allows for abnormal termination of a stream. When sent by
  1777. the initiator of a stream, it indicates that they wish to cancel the stream or that an
  1778. error condition has occurred. When sent by the receiver of a stream, it indicates that
  1779. either the receiver is rejecting the stream, requesting that the stream be cancelled, or
  1780. that an error condition has occurred.
  1781. </t>
  1782. <figure title="RST_STREAM Frame Payload">
  1783. <artwork type="inline"><![CDATA[
  1784. 0 1 2 3
  1785. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1786. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1787. | Error Code (32) |
  1788. +---------------------------------------------------------------+
  1789. ]]></artwork>
  1790. </figure>
  1791. <t>
  1792. The RST_STREAM frame contains a single unsigned, 32-bit integer identifying the <xref
  1793. target="ErrorCodes">error code</xref>. The error code indicates why the stream is being
  1794. terminated.
  1795. </t>
  1796. <t>
  1797. The RST_STREAM frame does not define any flags.
  1798. </t>
  1799. <t>
  1800. The RST_STREAM frame fully terminates the referenced stream and causes it to enter the
  1801. closed state. After receiving a RST_STREAM on a stream, the receiver MUST NOT send
  1802. additional frames for that stream, with the exception of <x:ref>PRIORITY</x:ref>. However,
  1803. after sending the RST_STREAM, the sending endpoint MUST be prepared to receive and process
  1804. additional frames sent on the stream that might have been sent by the peer prior to the
  1805. arrival of the RST_STREAM.
  1806. </t>
  1807. <t>
  1808. RST_STREAM frames MUST be associated with a stream. If a RST_STREAM frame is received
  1809. with a stream identifier of 0x0, the recipient MUST treat this as a <xref
  1810. target="ConnectionErrorHandler">connection error</xref> of type
  1811. <x:ref>PROTOCOL_ERROR</x:ref>.
  1812. </t>
  1813. <t>
  1814. RST_STREAM frames MUST NOT be sent for a stream in the "idle" state. If a RST_STREAM
  1815. frame identifying an idle stream is received, the recipient MUST treat this as a <xref
  1816. target="ConnectionErrorHandler">connection error</xref> of type
  1817. <x:ref>PROTOCOL_ERROR</x:ref>.
  1818. </t>
  1819. </section>
  1820. <section anchor="SETTINGS" title="SETTINGS">
  1821. <t>
  1822. The SETTINGS frame (type=0x4) conveys configuration parameters that affect how endpoints
  1823. communicate, such as preferences and constraints on peer behavior. The SETTINGS frame is
  1824. also used to acknowledge the receipt of those parameters. Individually, a SETTINGS
  1825. parameter can also be referred to as a "setting".
  1826. </t>
  1827. <t>
  1828. SETTINGS parameters are not negotiated; they describe characteristics of the sending peer,
  1829. which are used by the receiving peer. Different values for the same parameter can be
  1830. advertised by each peer. For example, a client might set a high initial flow control
  1831. window, whereas a server might set a lower value to conserve resources.
  1832. </t>
  1833. <t>
  1834. A SETTINGS frame MUST be sent by both endpoints at the start of a connection, and MAY be
  1835. sent at any other time by either endpoint over the lifetime of the connection.
  1836. Implementations MUST support all of the parameters defined by this specification.
  1837. </t>
  1838. <t>
  1839. Each parameter in a SETTINGS frame replaces any existing value for that parameter.
  1840. Parameters are processed in the order in which they appear, and a receiver of a SETTINGS
  1841. frame does not need to maintain any state other than the current value of its
  1842. parameters. Therefore, the value of a SETTINGS parameter is the last value that is seen by
  1843. a receiver.
  1844. </t>
  1845. <t>
  1846. SETTINGS parameters are acknowledged by the receiving peer. To enable this, the SETTINGS
  1847. frame defines the following flag:
  1848. <list style="hanging">
  1849. <t hangText="ACK (0x1):">
  1850. Bit 1 being set indicates that this frame acknowledges receipt and application of the
  1851. peer's SETTINGS frame. When this bit is set, the payload of the SETTINGS frame MUST
  1852. be empty. Receipt of a SETTINGS frame with the ACK flag set and a length field value
  1853. other than 0 MUST be treated as a <xref target="ConnectionErrorHandler">connection
  1854. error</xref> of type <x:ref>FRAME_SIZE_ERROR</x:ref>. For more info, see <xref
  1855. target="SettingsSync">Settings Synchronization</xref>.
  1856. </t>
  1857. </list>
  1858. </t>
  1859. <t>
  1860. SETTINGS frames always apply to a connection, never a single stream. The stream
  1861. identifier for a SETTINGS frame MUST be zero (0x0). If an endpoint receives a SETTINGS
  1862. frame whose stream identifier field is anything other than 0x0, the endpoint MUST respond
  1863. with a <xref target="ConnectionErrorHandler">connection error</xref> of type
  1864. <x:ref>PROTOCOL_ERROR</x:ref>.
  1865. </t>
  1866. <t>
  1867. The SETTINGS frame affects connection state. A badly formed or incomplete SETTINGS frame
  1868. MUST be treated as a <xref target="ConnectionErrorHandler">connection error</xref> of type
  1869. <x:ref>PROTOCOL_ERROR</x:ref>.
  1870. </t>
  1871. <section title="SETTINGS Format" anchor="SettingFormat">
  1872. <t>
  1873. The payload of a SETTINGS frame consists of zero or more parameters, each consisting of
  1874. an unsigned 16-bit setting identifier and an unsigned 32-bit value.
  1875. </t>
  1876. <figure title="Setting Format">
  1877. <artwork type="inline"><![CDATA[
  1878. 0 1 2 3
  1879. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1880. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1881. | Identifier (16) |
  1882. +-------------------------------+-------------------------------+
  1883. | Value (32) |
  1884. +---------------------------------------------------------------+
  1885. ]]></artwork>
  1886. </figure>
  1887. </section>
  1888. <section anchor="SettingValues" title="Defined SETTINGS Parameters">
  1889. <t>
  1890. The following parameters are defined:
  1891. <list style="hanging">
  1892. <x:lt hangText="SETTINGS_HEADER_TABLE_SIZE (0x1):"
  1893. anchor="SETTINGS_HEADER_TABLE_SIZE">
  1894. <t>
  1895. Allows the sender to inform the remote endpoint of the maximum size of the header
  1896. compression table used to decode header blocks, in octets. The encoder can select
  1897. any size equal to or less than this value by using signaling specific to the
  1898. header compression format inside a header block. The initial value is 4,096
  1899. octets.
  1900. </t>
  1901. </x:lt>
  1902. <x:lt hangText="SETTINGS_ENABLE_PUSH (0x2):"
  1903. anchor="SETTINGS_ENABLE_PUSH">
  1904. <t>
  1905. This setting can be use to disable <xref target="PushResources">server
  1906. push</xref>. An endpoint MUST NOT send a <x:ref>PUSH_PROMISE</x:ref> frame if it
  1907. receives this parameter set to a value of 0. An endpoint that has both set this
  1908. parameter to 0 and had it acknowledged MUST treat the receipt of a
  1909. <x:ref>PUSH_PROMISE</x:ref> frame as a <xref
  1910. target="ConnectionErrorHandler">connection error</xref> of type
  1911. <x:ref>PROTOCOL_ERROR</x:ref>.
  1912. </t>
  1913. <t>
  1914. The initial value is 1, which indicates that server push is permitted. Any value
  1915. other than 0 or 1 MUST be treated as a <xref
  1916. target="ConnectionErrorHandler">connection error</xref> of type
  1917. <x:ref>PROTOCOL_ERROR</x:ref>.
  1918. </t>
  1919. </x:lt>
  1920. <x:lt hangText="SETTINGS_MAX_CONCURRENT_STREAMS (0x3):"
  1921. anchor="SETTINGS_MAX_CONCURRENT_STREAMS">
  1922. <t>
  1923. Indicates the maximum number of concurrent streams that the sender will allow.
  1924. This limit is directional: it applies to the number of streams that the sender
  1925. permits the receiver to create. Initially there is no limit to this value. It is
  1926. recommended that this value be no smaller than 100, so as to not unnecessarily
  1927. limit parallelism.
  1928. </t>
  1929. <t>
  1930. A value of 0 for SETTINGS_MAX_CONCURRENT_STREAMS SHOULD NOT be treated as special
  1931. by endpoints. A zero value does prevent the creation of new streams, however this
  1932. can also happen for any limit that is exhausted with active streams. Servers
  1933. SHOULD only set a zero value for short durations; if a server does not wish to
  1934. accept requests, closing the connection could be preferable.
  1935. </t>
  1936. </x:lt>
  1937. <x:lt hangText="SETTINGS_INITIAL_WINDOW_SIZE (0x4):"
  1938. anchor="SETTINGS_INITIAL_WINDOW_SIZE">
  1939. <t>
  1940. Indicates the sender's initial window size (in octets) for stream level flow
  1941. control. The initial value is 2<x:sup>16</x:sup>-1 (65,535) octets.
  1942. </t>
  1943. <t>
  1944. This setting affects the window size of all streams, including existing streams,
  1945. see <xref target="InitialWindowSize"/>.
  1946. </t>
  1947. <t>
  1948. Values above the maximum flow control window size of 2<x:sup>31</x:sup>-1 MUST
  1949. be treated as a <xref target="ConnectionErrorHandler">connection error</xref> of
  1950. type <x:ref>FLOW_CONTROL_ERROR</x:ref>.
  1951. </t>
  1952. </x:lt>
  1953. <x:lt hangText="SETTINGS_MAX_FRAME_SIZE (0x5):"
  1954. anchor="SETTINGS_MAX_FRAME_SIZE">
  1955. <t>
  1956. Indicates the size of the largest frame payload that the sender is willing to
  1957. receive, in octets.
  1958. </t>
  1959. <t>
  1960. The initial value is 2<x:sup>14</x:sup> (16,384) octets. The value advertised by
  1961. an endpoint MUST be between this initial value and the maximum allowed frame size
  1962. (2<x:sup>24</x:sup>-1 or 16,777,215 octets), inclusive. Values outside this range
  1963. MUST be treated as a <xref target="ConnectionErrorHandler">connection error</xref>
  1964. of type <x:ref>PROTOCOL_ERROR</x:ref>.
  1965. </t>
  1966. </x:lt>
  1967. <x:lt hangText="SETTINGS_MAX_HEADER_LIST_SIZE (0x6):"
  1968. anchor="SETTINGS_MAX_HEADER_LIST_SIZE">
  1969. <t>
  1970. This advisory setting informs a peer of the maximum size of header list that the
  1971. sender is prepared to accept, in octets. The value is based on the uncompressed
  1972. size of header fields, including the length of the name and value in octets plus
  1973. an overhead of 32 octets for each header field.
  1974. </t>
  1975. <t>
  1976. For any given request, a lower limit than what is advertised MAY be enforced. The
  1977. initial value of this setting is unlimited.
  1978. </t>
  1979. </x:lt>
  1980. </list>
  1981. </t>
  1982. <t>
  1983. An endpoint that receives a SETTINGS frame with any unknown or unsupported identifier
  1984. MUST ignore that setting.
  1985. </t>
  1986. </section>
  1987. <section anchor="SettingsSync" title="Settings Synchronization">
  1988. <t>
  1989. Most values in SETTINGS benefit from or require an understanding of when the peer has
  1990. received and applied the changed parameter values. In order to provide
  1991. such synchronization timepoints, the recipient of a SETTINGS frame in which the ACK flag
  1992. is not set MUST apply the updated parameters as soon as possible upon receipt.
  1993. </t>
  1994. <t>
  1995. The values in the SETTINGS frame MUST be processed in the order they appear, with no
  1996. other frame processing between values. Unsupported parameters MUST be ignored. Once
  1997. all values have been processed, the recipient MUST immediately emit a SETTINGS frame
  1998. with the ACK flag set. Upon receiving a SETTINGS frame with the ACK flag set, the sender
  1999. of the altered parameters can rely on the setting having been applied.
  2000. </t>
  2001. <t>
  2002. If the sender of a SETTINGS frame does not receive an acknowledgement within a
  2003. reasonable amount of time, it MAY issue a <xref
  2004. target="ConnectionErrorHandler">connection error</xref> of type
  2005. <x:ref>SETTINGS_TIMEOUT</x:ref>.
  2006. </t>
  2007. </section>
  2008. </section>
  2009. <section anchor="PUSH_PROMISE" title="PUSH_PROMISE">
  2010. <t>
  2011. The PUSH_PROMISE frame (type=0x5) is used to notify the peer endpoint in advance of
  2012. streams the sender intends to initiate. The PUSH_PROMISE frame includes the unsigned
  2013. 31-bit identifier of the stream the endpoint plans to create along with a set of headers
  2014. that provide additional context for the stream. <xref target="PushResources"/> contains a
  2015. thorough description of the use of PUSH_PROMISE frames.
  2016. </t>
  2017. <figure title="PUSH_PROMISE Payload Format">
  2018. <artwork type="inline"><![CDATA[
  2019. 0 1 2 3
  2020. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2021. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2022. |Pad Length? (8)|
  2023. +-+-------------+-----------------------------------------------+
  2024. |R| Promised Stream ID (31) |
  2025. +-+-----------------------------+-------------------------------+
  2026. | Header Block Fragment (*) ...
  2027. +---------------------------------------------------------------+
  2028. | Padding (*) ...
  2029. +---------------------------------------------------------------+
  2030. ]]></artwork>
  2031. </figure>
  2032. <t>
  2033. The PUSH_PROMISE frame payload has the following fields:
  2034. <list style="hanging">
  2035. <t hangText="Pad Length:">
  2036. An 8-bit field containing the length of the frame padding in units of octets. This
  2037. field is only present if the PADDED flag is set.
  2038. </t>
  2039. <t hangText="R:">
  2040. A single reserved bit.
  2041. </t>
  2042. <t hangText="Promised Stream ID:">
  2043. An unsigned 31-bit integer that identifies the stream that is reserved by the
  2044. PUSH_PROMISE. The promised stream identifier MUST be a valid choice for the next
  2045. stream sent by the sender (see <xref target="StreamIdentifiers">new stream
  2046. identifier</xref>).
  2047. </t>
  2048. <t hangText="Header Block Fragment:">
  2049. A <xref target="HeaderBlock">header block fragment</xref> containing request header
  2050. fields.
  2051. </t>
  2052. <t hangText="Padding:">
  2053. Padding octets.
  2054. </t>
  2055. </list>
  2056. </t>
  2057. <t>
  2058. The PUSH_PROMISE frame defines the following flags:
  2059. <list style="hanging">
  2060. <x:lt hangText="END_HEADERS (0x4):">
  2061. <t>
  2062. Bit 3 being set indicates that this frame contains an entire <xref
  2063. target="HeaderBlock">header block</xref> and is not followed by any
  2064. <x:ref>CONTINUATION</x:ref> frames.
  2065. </t>
  2066. <t>
  2067. A PUSH_PROMISE frame without the END_HEADERS flag set MUST be followed by a
  2068. CONTINUATION frame for the same stream. A receiver MUST treat the receipt of any
  2069. other type of frame or a frame on a different stream as a <xref
  2070. target="ConnectionErrorHandler">connection error</xref> of type
  2071. <x:ref>PROTOCOL_ERROR</x:ref>.
  2072. </t>
  2073. </x:lt>
  2074. <x:lt hangText="PADDED (0x8):">
  2075. <t>
  2076. Bit 4 being set indicates that the Pad Length field and any padding that it
  2077. describes is present.
  2078. </t>
  2079. </x:lt>
  2080. </list>
  2081. </t>
  2082. <t>
  2083. PUSH_PROMISE frames MUST be associated with an existing, peer-initiated stream. The stream
  2084. identifier of a PUSH_PROMISE frame indicates the stream it is associated with. If the
  2085. stream identifier field specifies the value 0x0, a recipient MUST respond with a <xref
  2086. target="ConnectionErrorHandler">connection error</xref> of type
  2087. <x:ref>PROTOCOL_ERROR</x:ref>.
  2088. </t>
  2089. <t>
  2090. Promised streams are not required to be used in the order they are promised. The
  2091. PUSH_PROMISE only reserves stream identifiers for later use.
  2092. </t>
  2093. <t>
  2094. PUSH_PROMISE MUST NOT be sent if the <x:ref>SETTINGS_ENABLE_PUSH</x:ref> setting of the
  2095. peer endpoint is set to 0. An endpoint that has set this setting and has received
  2096. acknowledgement MUST treat the receipt of a PUSH_PROMISE frame as a <xref
  2097. target="ConnectionErrorHandler">connection error</xref> of type
  2098. <x:ref>PROTOCOL_ERROR</x:ref>.
  2099. </t>
  2100. <t>
  2101. Recipients of PUSH_PROMISE frames can choose to reject promised streams by returning a
  2102. <x:ref>RST_STREAM</x:ref> referencing the promised stream identifier back to the sender of
  2103. the PUSH_PROMISE.
  2104. </t>
  2105. <t>
  2106. A PUSH_PROMISE frame modifies the connection state in two ways. The inclusion of a <xref
  2107. target="HeaderBlock">header block</xref> potentially modifies the state maintained for
  2108. header compression. PUSH_PROMISE also reserves a stream for later use, causing the
  2109. promised stream to enter the "reserved" state. A sender MUST NOT send a PUSH_PROMISE on a
  2110. stream unless that stream is either "open" or "half closed (remote)"; the sender MUST
  2111. ensure that the promised stream is a valid choice for a <xref
  2112. target="StreamIdentifiers">new stream identifier</xref> (that is, the promised stream MUST
  2113. be in the "idle" state).
  2114. </t>
  2115. <t>
  2116. Since PUSH_PROMISE reserves a stream, ignoring a PUSH_PROMISE frame causes the stream
  2117. state to become indeterminate. A receiver MUST treat the receipt of a PUSH_PROMISE on a
  2118. stream that is neither "open" nor "half closed (local)" as a <xref
  2119. target="ConnectionErrorHandler">connection error</xref> of type
  2120. <x:ref>PROTOCOL_ERROR</x:ref>. However, an endpoint that has sent
  2121. <x:ref>RST_STREAM</x:ref> on the associated stream MUST handle PUSH_PROMISE frames that
  2122. might have been created before the <x:ref>RST_STREAM</x:ref> frame is received and
  2123. processed.
  2124. </t>
  2125. <t>
  2126. A receiver MUST treat the receipt of a PUSH_PROMISE that promises an <xref
  2127. target="StreamIdentifiers">illegal stream identifier</xref> (that is, an identifier for a
  2128. stream that is not currently in the "idle" state) as a <xref
  2129. target="ConnectionErrorHandler">connection error</xref> of type
  2130. <x:ref>PROTOCOL_ERROR</x:ref>.
  2131. </t>
  2132. <t>
  2133. The PUSH_PROMISE frame includes optional padding. Padding fields and flags are identical
  2134. to those defined for <xref target="DATA">DATA frames</xref>.
  2135. </t>
  2136. </section>
  2137. <section anchor="PING" title="PING">
  2138. <t>
  2139. The PING frame (type=0x6) is a mechanism for measuring a minimal round trip time from the
  2140. sender, as well as determining whether an idle connection is still functional. PING
  2141. frames can be sent from any endpoint.
  2142. </t>
  2143. <figure title="PING Payload Format">
  2144. <artwork type="inline"><![CDATA[
  2145. 0 1 2 3
  2146. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2147. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2148. | |
  2149. | Opaque Data (64) |
  2150. | |
  2151. +---------------------------------------------------------------+
  2152. ]]></artwork>
  2153. </figure>
  2154. <t>
  2155. In addition to the frame header, PING frames MUST contain 8 octets of data in the payload.
  2156. A sender can include any value it chooses and use those bytes in any fashion.
  2157. </t>
  2158. <t>
  2159. Receivers of a PING frame that does not include an ACK flag MUST send a PING frame with
  2160. the ACK flag set in response, with an identical payload. PING responses SHOULD be given
  2161. higher priority than any other frame.
  2162. </t>
  2163. <t>
  2164. The PING frame defines the following flags:
  2165. <list style="hanging">
  2166. <t hangText="ACK (0x1):">
  2167. Bit 1 being set indicates that this PING frame is a PING response. An endpoint MUST
  2168. set this flag in PING responses. An endpoint MUST NOT respond to PING frames
  2169. containing this flag.
  2170. </t>
  2171. </list>
  2172. </t>
  2173. <t>
  2174. PING frames are not associated with any individual stream. If a PING frame is received
  2175. with a stream identifier field value other than 0x0, the recipient MUST respond with a
  2176. <xref target="ConnectionErrorHandler">connection error</xref> of type
  2177. <x:ref>PROTOCOL_ERROR</x:ref>.
  2178. </t>
  2179. <t>
  2180. Receipt of a PING frame with a length field value other than 8 MUST be treated as a <xref
  2181. target="ConnectionErrorHandler">connection error</xref> of type
  2182. <x:ref>FRAME_SIZE_ERROR</x:ref>.
  2183. </t>
  2184. </section>
  2185. <section anchor="GOAWAY" title="GOAWAY">
  2186. <t>
  2187. The GOAWAY frame (type=0x7) informs the remote peer to stop creating streams on this
  2188. connection. GOAWAY can be sent by either the client or the server. Once sent, the sender
  2189. will ignore frames sent on any new streams with identifiers higher than the included last
  2190. stream identifier. Receivers of a GOAWAY frame MUST NOT open additional streams on the
  2191. connection, although a new connection can be established for new streams.
  2192. </t>
  2193. <t>
  2194. The purpose of this frame is to allow an endpoint to gracefully stop accepting new
  2195. streams, while still finishing processing of previously established streams. This enables
  2196. administrative actions, like server maintainance.
  2197. </t>
  2198. <t>
  2199. There is an inherent race condition between an endpoint starting new streams and the
  2200. remote sending a GOAWAY frame. To deal with this case, the GOAWAY contains the stream
  2201. identifier of the last peer-initiated stream which was or might be processed on the
  2202. sending endpoint in this connection. For instance, if the server sends a GOAWAY frame,
  2203. the identified stream is the highest numbered stream initiated by the client.
  2204. </t>
  2205. <t>
  2206. If the receiver of the GOAWAY has sent data on streams with a higher stream identifier
  2207. than what is indicated in the GOAWAY frame, those streams are not or will not be
  2208. processed. The receiver of the GOAWAY frame can treat the streams as though they had
  2209. never been created at all, thereby allowing those streams to be retried later on a new
  2210. connection.
  2211. </t>
  2212. <t>
  2213. Endpoints SHOULD always send a GOAWAY frame before closing a connection so that the remote
  2214. can know whether a stream has been partially processed or not. For example, if an HTTP
  2215. client sends a POST at the same time that a server closes a connection, the client cannot
  2216. know if the server started to process that POST request if the server does not send a
  2217. GOAWAY frame to indicate what streams it might have acted on.
  2218. </t>
  2219. <t>
  2220. An endpoint might choose to close a connection without sending GOAWAY for misbehaving
  2221. peers.
  2222. </t>
  2223. <figure title="GOAWAY Payload Format">
  2224. <artwork type="inline"><![CDATA[
  2225. 0 1 2 3
  2226. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2227. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2228. |R| Last-Stream-ID (31) |
  2229. +-+-------------------------------------------------------------+
  2230. | Error Code (32) |
  2231. +---------------------------------------------------------------+
  2232. | Additional Debug Data (*) |
  2233. +---------------------------------------------------------------+
  2234. ]]></artwork>
  2235. </figure>
  2236. <t>
  2237. The GOAWAY frame does not define any flags.
  2238. </t>
  2239. <t>
  2240. The GOAWAY frame applies to the connection, not a specific stream. An endpoint MUST treat
  2241. a <x:ref>GOAWAY</x:ref> frame with a stream identifier other than 0x0 as a <xref
  2242. target="ConnectionErrorHandler">connection error</xref> of type
  2243. <x:ref>PROTOCOL_ERROR</x:ref>.
  2244. </t>
  2245. <t>
  2246. The last stream identifier in the GOAWAY frame contains the highest numbered stream
  2247. identifier for which the sender of the GOAWAY frame might have taken some action on, or
  2248. might yet take action on. All streams up to and including the identified stream might
  2249. have been processed in some way. The last stream identifier can be set to 0 if no streams
  2250. were processed.
  2251. <list style="hanging">
  2252. <t hangText="Note:">
  2253. In this context, "processed" means that some data from the stream was passed to some
  2254. higher layer of software that might have taken some action as a result.
  2255. </t>
  2256. </list>
  2257. If a connection terminates without a GOAWAY frame, the last stream identifier is
  2258. effectively the highest possible stream identifier.
  2259. </t>
  2260. <t>
  2261. On streams with lower or equal numbered identifiers that were not closed completely prior
  2262. to the connection being closed, re-attempting requests, transactions, or any protocol
  2263. activity is not possible, with the exception of idempotent actions like HTTP GET, PUT, or
  2264. DELETE. Any protocol activity that uses higher numbered streams can be safely retried
  2265. using a new connection.
  2266. </t>
  2267. <t>
  2268. Activity on streams numbered lower or equal to the last stream identifier might still
  2269. complete successfully. The sender of a GOAWAY frame might gracefully shut down a
  2270. connection by sending a GOAWAY frame, maintaining the connection in an open state until
  2271. all in-progress streams complete.
  2272. </t>
  2273. <t>
  2274. An endpoint MAY send multiple GOAWAY frames if circumstances change. For instance, an
  2275. endpoint that sends GOAWAY with <x:ref>NO_ERROR</x:ref> during graceful shutdown could
  2276. subsequently encounter an condition that requires immediate termination of the connection.
  2277. The last stream identifier from the last GOAWAY frame received indicates which streams
  2278. could have been acted upon. Endpoints MUST NOT increase the value they send in the last
  2279. stream identifier, since the peers might already have retried unprocessed requests on
  2280. another connection.
  2281. </t>
  2282. <t>
  2283. A client that is unable to retry requests loses all requests that are in flight when the
  2284. server closes the connection. This is especially true for intermediaries that might
  2285. not be serving clients using HTTP/2. A server that is attempting to gracefully shut down
  2286. a connection SHOULD send an initial GOAWAY frame with the last stream identifier set to
  2287. 2<x:sup>31</x:sup>-1 and a <x:ref>NO_ERROR</x:ref> code. This signals to the client that
  2288. a shutdown is imminent and that no further requests can be initiated. After waiting at
  2289. least one round trip time, the server can send another GOAWAY frame with an updated last
  2290. stream identifier. This ensures that a connection can be cleanly shut down without losing
  2291. requests.
  2292. </t>
  2293. <t>
  2294. After sending a GOAWAY frame, the sender can discard frames for streams with identifiers
  2295. higher than the identified last stream. However, any frames that alter connection state
  2296. cannot be completely ignored. For instance, <x:ref>HEADERS</x:ref>,
  2297. <x:ref>PUSH_PROMISE</x:ref> and <x:ref>CONTINUATION</x:ref> frames MUST be minimally
  2298. processed to ensure the state maintained for header compression is consistent (see <xref
  2299. target="HeaderBlock"/>); similarly DATA frames MUST be counted toward the connection flow
  2300. control window. Failure to process these frames can cause flow control or header
  2301. compression state to become unsynchronized.
  2302. </t>
  2303. <t>
  2304. The GOAWAY frame also contains a 32-bit <xref target="ErrorCodes">error code</xref> that
  2305. contains the reason for closing the connection.
  2306. </t>
  2307. <t>
  2308. Endpoints MAY append opaque data to the payload of any GOAWAY frame. Additional debug
  2309. data is intended for diagnostic purposes only and carries no semantic value. Debug
  2310. information could contain security- or privacy-sensitive data. Logged or otherwise
  2311. persistently stored debug data MUST have adequate safeguards to prevent unauthorized
  2312. access.
  2313. </t>
  2314. </section>
  2315. <section anchor="WINDOW_UPDATE" title="WINDOW_UPDATE">
  2316. <t>
  2317. The WINDOW_UPDATE frame (type=0x8) is used to implement flow control; see <xref
  2318. target="FlowControl"/> for an overview.
  2319. </t>
  2320. <t>
  2321. Flow control operates at two levels: on each individual stream and on the entire
  2322. connection.
  2323. </t>
  2324. <t>
  2325. Both types of flow control are hop-by-hop; that is, only between the two endpoints.
  2326. Intermediaries do not forward WINDOW_UPDATE frames between dependent connections.
  2327. However, throttling of data transfer by any receiver can indirectly cause the propagation
  2328. of flow control information toward the original sender.
  2329. </t>
  2330. <t>
  2331. Flow control only applies to frames that are identified as being subject to flow control.
  2332. Of the frame types defined in this document, this includes only <x:ref>DATA</x:ref> frames.
  2333. Frames that are exempt from flow control MUST be accepted and processed, unless the
  2334. receiver is unable to assign resources to handling the frame. A receiver MAY respond with
  2335. a <xref target="StreamErrorHandler">stream error</xref> or <xref
  2336. target="ConnectionErrorHandler">connection error</xref> of type
  2337. <x:ref>FLOW_CONTROL_ERROR</x:ref> if it is unable to accept a frame.
  2338. </t>
  2339. <figure title="WINDOW_UPDATE Payload Format">
  2340. <artwork type="inline"><![CDATA[
  2341. 0 1 2 3
  2342. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2343. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2344. |R| Window Size Increment (31) |
  2345. +-+-------------------------------------------------------------+
  2346. ]]></artwork>
  2347. </figure>
  2348. <t>
  2349. The payload of a WINDOW_UPDATE frame is one reserved bit, plus an unsigned 31-bit integer
  2350. indicating the number of octets that the sender can transmit in addition to the existing
  2351. flow control window. The legal range for the increment to the flow control window is 1 to
  2352. 2<x:sup>31</x:sup>-1 (0x7fffffff) octets.
  2353. </t>
  2354. <t>
  2355. The WINDOW_UPDATE frame does not define any flags.
  2356. </t>
  2357. <t>
  2358. The WINDOW_UPDATE frame can be specific to a stream or to the entire connection. In the
  2359. former case, the frame's stream identifier indicates the affected stream; in the latter,
  2360. the value "0" indicates that the entire connection is the subject of the frame.
  2361. </t>
  2362. <t>
  2363. A receiver MUST treat the receipt of a WINDOW_UPDATE frame with an flow control window
  2364. increment of 0 as a <xref target="StreamErrorHandler">stream error</xref> of type
  2365. <x:ref>PROTOCOL_ERROR</x:ref>; errors on the connection flow control window MUST be
  2366. treated as a <xref target="ConnectionErrorHandler">connection error</xref>.
  2367. </t>
  2368. <t>
  2369. WINDOW_UPDATE can be sent by a peer that has sent a frame bearing the END_STREAM flag.
  2370. This means that a receiver could receive a WINDOW_UPDATE frame on a "half closed (remote)"
  2371. or "closed" stream. A receiver MUST NOT treat this as an error, see <xref
  2372. target="StreamStates"/>.
  2373. </t>
  2374. <t>
  2375. A receiver that receives a flow controlled frame MUST always account for its contribution
  2376. against the connection flow control window, unless the receiver treats this as a <xref
  2377. target="ConnectionErrorHandler">connection error</xref>. This is necessary even if the
  2378. frame is in error. Since the sender counts the frame toward the flow control window, if
  2379. the receiver does not, the flow control window at sender and receiver can become
  2380. different.
  2381. </t>
  2382. <section title="The Flow Control Window">
  2383. <t>
  2384. Flow control in HTTP/2 is implemented using a window kept by each sender on every
  2385. stream. The flow control window is a simple integer value that indicates how many octets
  2386. of data the sender is permitted to transmit; as such, its size is a measure of the
  2387. buffering capacity of the receiver.
  2388. </t>
  2389. <t>
  2390. Two flow control windows are applicable: the stream flow control window and the
  2391. connection flow control window. The sender MUST NOT send a flow controlled frame with a
  2392. length that exceeds the space available in either of the flow control windows advertised
  2393. by the receiver. Frames with zero length with the END_STREAM flag set (that is, an
  2394. empty <x:ref>DATA</x:ref> frame) MAY be sent if there is no available space in either
  2395. flow control window.
  2396. </t>
  2397. <t>
  2398. For flow control calculations, the 9 octet frame header is not counted.
  2399. </t>
  2400. <t>
  2401. After sending a flow controlled frame, the sender reduces the space available in both
  2402. windows by the length of the transmitted frame.
  2403. </t>
  2404. <t>
  2405. The receiver of a frame sends a WINDOW_UPDATE frame as it consumes data and frees up
  2406. space in flow control windows. Separate WINDOW_UPDATE frames are sent for the stream
  2407. and connection level flow control windows.
  2408. </t>
  2409. <t>
  2410. A sender that receives a WINDOW_UPDATE frame updates the corresponding window by the
  2411. amount specified in the frame.
  2412. </t>
  2413. <t>
  2414. A sender MUST NOT allow a flow control window to exceed 2<x:sup>31</x:sup>-1 octets.
  2415. If a sender receives a WINDOW_UPDATE that causes a flow control window to exceed this
  2416. maximum it MUST terminate either the stream or the connection, as appropriate. For
  2417. streams, the sender sends a <x:ref>RST_STREAM</x:ref> with the error code of
  2418. <x:ref>FLOW_CONTROL_ERROR</x:ref> code; for the connection, a <x:ref>GOAWAY</x:ref>
  2419. frame with a <x:ref>FLOW_CONTROL_ERROR</x:ref> code.
  2420. </t>
  2421. <t>
  2422. Flow controlled frames from the sender and WINDOW_UPDATE frames from the receiver are
  2423. completely asynchronous with respect to each other. This property allows a receiver to
  2424. aggressively update the window size kept by the sender to prevent streams from stalling.
  2425. </t>
  2426. </section>
  2427. <section anchor="InitialWindowSize" title="Initial Flow Control Window Size">
  2428. <t>
  2429. When an HTTP/2 connection is first established, new streams are created with an initial
  2430. flow control window size of 65,535 octets. The connection flow control window is 65,535
  2431. octets. Both endpoints can adjust the initial window size for new streams by including
  2432. a value for <x:ref>SETTINGS_INITIAL_WINDOW_SIZE</x:ref> in the <x:ref>SETTINGS</x:ref>
  2433. frame that forms part of the connection preface. The connection flow control window can
  2434. only be changed using WINDOW_UPDATE frames.
  2435. </t>
  2436. <t>
  2437. Prior to receiving a <x:ref>SETTINGS</x:ref> frame that sets a value for
  2438. <x:ref>SETTINGS_INITIAL_WINDOW_SIZE</x:ref>, an endpoint can only use the default
  2439. initial window size when sending flow controlled frames. Similarly, the connection flow
  2440. control window is set to the default initial window size until a WINDOW_UPDATE frame is
  2441. received.
  2442. </t>
  2443. <t>
  2444. A <x:ref>SETTINGS</x:ref> frame can alter the initial flow control window size for all
  2445. current streams. When the value of <x:ref>SETTINGS_INITIAL_WINDOW_SIZE</x:ref> changes,
  2446. a receiver MUST adjust the size of all stream flow control windows that it maintains by
  2447. the difference between the new value and the old value.
  2448. </t>
  2449. <t>
  2450. A change to <x:ref>SETTINGS_INITIAL_WINDOW_SIZE</x:ref> can cause the available space in
  2451. a flow control window to become negative. A sender MUST track the negative flow control
  2452. window, and MUST NOT send new flow controlled frames until it receives WINDOW_UPDATE
  2453. frames that cause the flow control window to become positive.
  2454. </t>
  2455. <t>
  2456. For example, if the client sends 60KB immediately on connection establishment, and the
  2457. server sets the initial window size to be 16KB, the client will recalculate the
  2458. available flow control window to be -44KB on receipt of the <x:ref>SETTINGS</x:ref>
  2459. frame. The client retains a negative flow control window until WINDOW_UPDATE frames
  2460. restore the window to being positive, after which the client can resume sending.
  2461. </t>
  2462. <t>
  2463. A <x:ref>SETTINGS</x:ref> frame cannot alter the connection flow control window.
  2464. </t>
  2465. <t>
  2466. An endpoint MUST treat a change to <x:ref>SETTINGS_INITIAL_WINDOW_SIZE</x:ref> that
  2467. causes any flow control window to exceed the maximum size as a <xref
  2468. target="ConnectionErrorHandler">connection error</xref> of type
  2469. <x:ref>FLOW_CONTROL_ERROR</x:ref>.
  2470. </t>
  2471. </section>
  2472. <section title="Reducing the Stream Window Size">
  2473. <t>
  2474. A receiver that wishes to use a smaller flow control window than the current size can
  2475. send a new <x:ref>SETTINGS</x:ref> frame. However, the receiver MUST be prepared to
  2476. receive data that exceeds this window size, since the sender might send data that
  2477. exceeds the lower limit prior to processing the <x:ref>SETTINGS</x:ref> frame.
  2478. </t>
  2479. <t>
  2480. After sending a SETTINGS frame that reduces the initial flow control window size, a
  2481. receiver has two options for handling streams that exceed flow control limits:
  2482. <list style="numbers">
  2483. <t>
  2484. The receiver can immediately send <x:ref>RST_STREAM</x:ref> with
  2485. <x:ref>FLOW_CONTROL_ERROR</x:ref> error code for the affected streams.
  2486. </t>
  2487. <t>
  2488. The receiver can accept the streams and tolerate the resulting head of line
  2489. blocking, sending WINDOW_UPDATE frames as it consumes data.
  2490. </t>
  2491. </list>
  2492. </t>
  2493. </section>
  2494. </section>
  2495. <section anchor="CONTINUATION" title="CONTINUATION">
  2496. <t>
  2497. The CONTINUATION frame (type=0x9) is used to continue a sequence of <xref
  2498. target="HeaderBlock">header block fragments</xref>. Any number of CONTINUATION frames can
  2499. be sent on an existing stream, as long as the preceding frame is on the same stream and is
  2500. a <x:ref>HEADERS</x:ref>, <x:ref>PUSH_PROMISE</x:ref> or CONTINUATION frame without the
  2501. END_HEADERS flag set.
  2502. </t>
  2503. <figure title="CONTINUATION Frame Payload">
  2504. <artwork type="inline"><![CDATA[
  2505. 0 1 2 3
  2506. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2507. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2508. | Header Block Fragment (*) ...
  2509. +---------------------------------------------------------------+
  2510. ]]></artwork>
  2511. </figure>
  2512. <t>
  2513. The CONTINUATION frame payload contains a <xref target="HeaderBlock">header block
  2514. fragment</xref>.
  2515. </t>
  2516. <t>
  2517. The CONTINUATION frame defines the following flag:
  2518. <list style="hanging">
  2519. <x:lt hangText="END_HEADERS (0x4):">
  2520. <t>
  2521. Bit 3 being set indicates that this frame ends a <xref target="HeaderBlock">header
  2522. block</xref>.
  2523. </t>
  2524. <t>
  2525. If the END_HEADERS bit is not set, this frame MUST be followed by another
  2526. CONTINUATION frame. A receiver MUST treat the receipt of any other type of frame or
  2527. a frame on a different stream as a <xref target="ConnectionErrorHandler">connection
  2528. error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>.
  2529. </t>
  2530. </x:lt>
  2531. </list>
  2532. </t>
  2533. <t>
  2534. The CONTINUATION frame changes the connection state as defined in <xref
  2535. target="HeaderBlock" />.
  2536. </t>
  2537. <t>
  2538. CONTINUATION frames MUST be associated with a stream. If a CONTINUATION frame is received
  2539. whose stream identifier field is 0x0, the recipient MUST respond with a <xref
  2540. target="ConnectionErrorHandler">connection error</xref> of type PROTOCOL_ERROR.
  2541. </t>
  2542. <t>
  2543. A CONTINUATION frame MUST be preceded by a <x:ref>HEADERS</x:ref>,
  2544. <x:ref>PUSH_PROMISE</x:ref> or CONTINUATION frame without the END_HEADERS flag set. A
  2545. recipient that observes violation of this rule MUST respond with a <xref
  2546. target="ConnectionErrorHandler"> connection error</xref> of type
  2547. <x:ref>PROTOCOL_ERROR</x:ref>.
  2548. </t>
  2549. </section>
  2550. </section>
  2551. <section anchor="ErrorCodes" title="Error Codes">
  2552. <t>
  2553. Error codes are 32-bit fields that are used in <x:ref>RST_STREAM</x:ref> and
  2554. <x:ref>GOAWAY</x:ref> frames to convey the reasons for the stream or connection error.
  2555. </t>
  2556. <t>
  2557. Error codes share a common code space. Some error codes apply only to either streams or the
  2558. entire connection and have no defined semantics in the other context.
  2559. </t>
  2560. <t>
  2561. The following error codes are defined:
  2562. <list style="hanging">
  2563. <t hangText="NO_ERROR (0x0):" anchor="NO_ERROR">
  2564. The associated condition is not as a result of an error. For example, a
  2565. <x:ref>GOAWAY</x:ref> might include this code to indicate graceful shutdown of a
  2566. connection.
  2567. </t>
  2568. <t hangText="PROTOCOL_ERROR (0x1):" anchor="PROTOCOL_ERROR">
  2569. The endpoint detected an unspecific protocol error. This error is for use when a more
  2570. specific error code is not available.
  2571. </t>
  2572. <t hangText="INTERNAL_ERROR (0x2):" anchor="INTERNAL_ERROR">
  2573. The endpoint encountered an unexpected internal error.
  2574. </t>
  2575. <t hangText="FLOW_CONTROL_ERROR (0x3):" anchor="FLOW_CONTROL_ERROR">
  2576. The endpoint detected that its peer violated the flow control protocol.
  2577. </t>
  2578. <t hangText="SETTINGS_TIMEOUT (0x4):" anchor="SETTINGS_TIMEOUT">
  2579. The endpoint sent a <x:ref>SETTINGS</x:ref> frame, but did not receive a response in a
  2580. timely manner. See <xref target="SettingsSync">Settings Synchronization</xref>.
  2581. </t>
  2582. <t hangText="STREAM_CLOSED (0x5):" anchor="STREAM_CLOSED">
  2583. The endpoint received a frame after a stream was half closed.
  2584. </t>
  2585. <t hangText="FRAME_SIZE_ERROR (0x6):" anchor="FRAME_SIZE_ERROR">
  2586. The endpoint received a frame with an invalid size.
  2587. </t>
  2588. <t hangText="REFUSED_STREAM (0x7):" anchor="REFUSED_STREAM">
  2589. The endpoint refuses the stream prior to performing any application processing, see
  2590. <xref target="Reliability"/> for details.
  2591. </t>
  2592. <t hangText="CANCEL (0x8):" anchor="CANCEL">
  2593. Used by the endpoint to indicate that the stream is no longer needed.
  2594. </t>
  2595. <t hangText="COMPRESSION_ERROR (0x9):" anchor="COMPRESSION_ERROR">
  2596. The endpoint is unable to maintain the header compression context for the connection.
  2597. </t>
  2598. <t hangText="CONNECT_ERROR (0xa):" anchor="CONNECT_ERROR">
  2599. The connection established in response to a <xref target="CONNECT">CONNECT
  2600. request</xref> was reset or abnormally closed.
  2601. </t>
  2602. <t hangText="ENHANCE_YOUR_CALM (0xb):" anchor="ENHANCE_YOUR_CALM">
  2603. The endpoint detected that its peer is exhibiting a behavior that might be generating
  2604. excessive load.
  2605. </t>
  2606. <t hangText="INADEQUATE_SECURITY (0xc):" anchor="INADEQUATE_SECURITY">
  2607. The underlying transport has properties that do not meet minimum security
  2608. requirements (see <xref target="TLSUsage"/>).
  2609. </t>
  2610. </list>
  2611. </t>
  2612. <t>
  2613. Unknown or unsupported error codes MUST NOT trigger any special behavior. These MAY be
  2614. treated by an implementation as being equivalent to <x:ref>INTERNAL_ERROR</x:ref>.
  2615. </t>
  2616. </section>
  2617. <section anchor="HTTPLayer" title="HTTP Message Exchanges">
  2618. <t>
  2619. HTTP/2 is intended to be as compatible as possible with current uses of HTTP. This means
  2620. that, from the application perspective, the features of the protocol are largely
  2621. unchanged. To achieve this, all request and response semantics are preserved, although the
  2622. syntax of conveying those semantics has changed.
  2623. </t>
  2624. <t>
  2625. Thus, the specification and requirements of HTTP/1.1 Semantics and Content <xref
  2626. target="RFC7231"/>, Conditional Requests <xref target="RFC7232"/>, Range Requests <xref
  2627. target="RFC7233"/>, Caching <xref target="RFC7234"/> and Authentication <xref
  2628. target="RFC7235"/> are applicable to HTTP/2. Selected portions of HTTP/1.1 Message Syntax
  2629. and Routing <xref target="RFC7230"/>, such as the HTTP and HTTPS URI schemes, are also
  2630. applicable in HTTP/2, but the expression of those semantics for this protocol are defined
  2631. in the sections below.
  2632. </t>
  2633. <section anchor="HttpSequence" title="HTTP Request/Response Exchange">
  2634. <t>
  2635. A client sends an HTTP request on a new stream, using a previously unused <xref
  2636. target="StreamIdentifiers">stream identifier</xref>. A server sends an HTTP response on
  2637. the same stream as the request.
  2638. </t>
  2639. <t>
  2640. An HTTP message (request or response) consists of:
  2641. <list style="numbers">
  2642. <t>
  2643. for a response only, zero or more <x:ref>HEADERS</x:ref> frames (each followed by zero
  2644. or more <x:ref>CONTINUATION</x:ref> frames) containing the message headers of
  2645. informational (1xx) HTTP responses (see <xref target="RFC7230" x:fmt=","
  2646. x:rel="#header.fields"/> and <xref target="RFC7231" x:fmt="," x:rel="#status.1xx"/>),
  2647. and
  2648. </t>
  2649. <t>
  2650. one <x:ref>HEADERS</x:ref> frame (followed by zero or more <x:ref>CONTINUATION</x:ref>
  2651. frames) containing the message headers (see <xref target="RFC7230" x:fmt=","
  2652. x:rel="#header.fields"/>), and
  2653. </t>
  2654. <t>
  2655. zero or more <x:ref>DATA</x:ref> frames containing the message payload (see <xref
  2656. target="RFC7230" x:fmt="," x:rel="#message.body"/>), and
  2657. </t>
  2658. <t>
  2659. optionally, one <x:ref>HEADERS</x:ref> frame, followed by zero or more
  2660. <x:ref>CONTINUATION</x:ref> frames containing the trailer-part, if present (see <xref
  2661. target="RFC7230" x:fmt="," x:rel="#chunked.trailer.part"/>).
  2662. </t>
  2663. </list>
  2664. The last frame in the sequence bears an END_STREAM flag, noting that a
  2665. <x:ref>HEADERS</x:ref> frame bearing the END_STREAM flag can be followed by
  2666. <x:ref>CONTINUATION</x:ref> frames that carry any remaining portions of the header block.
  2667. </t>
  2668. <t>
  2669. Other frames (from any stream) MUST NOT occur between either <x:ref>HEADERS</x:ref> frame
  2670. and any <x:ref>CONTINUATION</x:ref> frames that might follow.
  2671. </t>
  2672. <t>
  2673. Trailing header fields are carried in a header block that also terminates the stream.
  2674. That is, a sequence starting with a <x:ref>HEADERS</x:ref> frame, followed by zero or more
  2675. <x:ref>CONTINUATION</x:ref> frames, where the <x:ref>HEADERS</x:ref> frame bears an
  2676. END_STREAM flag. Header blocks after the first that do not terminate the stream are not
  2677. part of an HTTP request or response.
  2678. </t>
  2679. <t>
  2680. A <x:ref>HEADERS</x:ref> frame (and associated <x:ref>CONTINUATION</x:ref> frames) can
  2681. only appear at the start or end of a stream. An endpoint that receives a
  2682. <x:ref>HEADERS</x:ref> frame without the END_STREAM flag set after receiving a final
  2683. (non-informational) status code MUST treat the corresponding request or response as <xref
  2684. target="malformed">malformed</xref>.
  2685. </t>
  2686. <t>
  2687. An HTTP request/response exchange fully consumes a single stream. A request starts with
  2688. the <x:ref>HEADERS</x:ref> frame that puts the stream into an "open" state. The request
  2689. ends with a frame bearing END_STREAM, which causes the stream to become "half closed
  2690. (local)" for the client and "half closed (remote)" for the server. A response starts with
  2691. a <x:ref>HEADERS</x:ref> frame and ends with a frame bearing END_STREAM, which places the
  2692. stream in the "closed" state.
  2693. <!-- Yes, the response might be completed before the request does, but that's not a detail
  2694. we need to expand upon. It's complicated enough explaining this as it is. -->
  2695. </t>
  2696. <section anchor="informational-responses" title="Upgrading From HTTP/2">
  2697. <t>
  2698. HTTP/2 removes support for the 101 (Switching Protocols) informational status code
  2699. (<xref target="RFC7231" x:fmt="," x:rel="#status.101"/>).
  2700. </t>
  2701. <t>
  2702. The semantics of 101 (Switching Protocols) aren't applicable to a multiplexed protocol.
  2703. Alternative protocols are able to use the same mechanisms that HTTP/2 uses to negotiate
  2704. their use (see <xref target="starting"/>).
  2705. </t>
  2706. </section>
  2707. <section anchor="HttpHeaders" title="HTTP Header Fields">
  2708. <t>
  2709. HTTP header fields carry information as a series of key-value pairs. For a listing of
  2710. registered HTTP headers, see the Message Header Field Registry maintained at <eref
  2711. target="https://www.iana.org/assignments/message-headers"/>.
  2712. </t>
  2713. <section anchor="PseudoHeaderFields" title="Pseudo-Header Fields">
  2714. <t>
  2715. While HTTP/1.x used the message start-line (see <xref target="RFC7230" x:fmt=","
  2716. x:rel="#start.line"/>) to convey the target URI and method of the request, and the
  2717. status code for the response, HTTP/2 uses special pseudo-header fields beginning with
  2718. ':' character (ASCII 0x3a) for this purpose.
  2719. </t>
  2720. <t>
  2721. Pseudo-header fields are not HTTP header fields. Endpoints MUST NOT generate
  2722. pseudo-header fields other than those defined in this document.
  2723. </t>
  2724. <t>
  2725. Pseudo-header fields are only valid in the context in which they are defined.
  2726. Pseudo-header fields defined for requests MUST NOT appear in responses; pseudo-header
  2727. fields defined for responses MUST NOT appear in requests. Pseudo-header fields MUST
  2728. NOT appear in trailers. Endpoints MUST treat a request or response that contains
  2729. undefined or invalid pseudo-header fields as <xref
  2730. target="malformed">malformed</xref>.
  2731. </t>
  2732. <t>
  2733. Just as in HTTP/1.x, header field names are strings of ASCII characters that are
  2734. compared in a case-insensitive fashion. However, header field names MUST be converted
  2735. to lowercase prior to their encoding in HTTP/2. A request or response containing
  2736. uppercase header field names MUST be treated as <xref
  2737. target="malformed">malformed</xref>.
  2738. </t>
  2739. <t>
  2740. All pseudo-header fields MUST appear in the header block before regular header fields.
  2741. Any request or response that contains a pseudo-header field that appears in a header
  2742. block after a regular header field MUST be treated as <xref
  2743. target="malformed">malformed</xref>.
  2744. </t>
  2745. </section>
  2746. <section title="Connection-Specific Header Fields">
  2747. <t>
  2748. HTTP/2 does not use the <spanx style="verb">Connection</spanx> header field to
  2749. indicate connection-specific header fields; in this protocol, connection-specific
  2750. metadata is conveyed by other means. An endpoint MUST NOT generate a HTTP/2 message
  2751. containing connection-specific header fields; any message containing
  2752. connection-specific header fields MUST be treated as <xref
  2753. target="malformed">malformed</xref>.
  2754. </t>
  2755. <t>
  2756. This means that an intermediary transforming an HTTP/1.x message to HTTP/2 will need
  2757. to remove any header fields nominated by the Connection header field, along with the
  2758. Connection header field itself. Such intermediaries SHOULD also remove other
  2759. connection-specific header fields, such as Keep-Alive, Proxy-Connection,
  2760. Transfer-Encoding and Upgrade, even if they are not nominated by Connection.
  2761. </t>
  2762. <t>
  2763. One exception to this is the TE header field, which MAY be present in an HTTP/2
  2764. request, but when it is MUST NOT contain any value other than "trailers".
  2765. </t>
  2766. <t>
  2767. <list style="hanging">
  2768. <t hangText="Note:">
  2769. HTTP/2 purposefully does not support upgrade to another protocol. The handshake
  2770. methods described in <xref target="starting"/> are believed sufficient to
  2771. negotiate the use of alternative protocols.
  2772. </t>
  2773. </list>
  2774. </t>
  2775. </section>
  2776. <section anchor="HttpRequest" title="Request Pseudo-Header Fields">
  2777. <t>
  2778. The following pseudo-header fields are defined for HTTP/2 requests:
  2779. <list style="symbols">
  2780. <x:lt>
  2781. <t>
  2782. The <spanx style="verb">:method</spanx> pseudo-header field includes the HTTP
  2783. method (<xref target="RFC7231" x:fmt="," x:rel="#methods"/>).
  2784. </t>
  2785. </x:lt>
  2786. <x:lt>
  2787. <t>
  2788. The <spanx style="verb">:scheme</spanx> pseudo-header field includes the scheme
  2789. portion of the target URI (<xref target="RFC3986" x:fmt="," x:sec="3.1"/>).
  2790. </t>
  2791. <t>
  2792. <spanx style="verb">:scheme</spanx> is not restricted to <spanx
  2793. style="verb">http</spanx> and <spanx style="verb">https</spanx> schemed URIs. A
  2794. proxy or gateway can translate requests for non-HTTP schemes, enabling the use
  2795. of HTTP to interact with non-HTTP services.
  2796. </t>
  2797. </x:lt>
  2798. <x:lt>
  2799. <t>
  2800. The <spanx style="verb">:authority</spanx> pseudo-header field includes the
  2801. authority portion of the target URI (<xref target="RFC3986" x:fmt=","
  2802. x:sec="3.2"/>). The authority MUST NOT include the deprecated <spanx
  2803. style="verb">userinfo</spanx> subcomponent for <spanx style="verb">http</spanx>
  2804. or <spanx style="verb">https</spanx> schemed URIs.
  2805. </t>
  2806. <t>
  2807. To ensure that the HTTP/1.1 request line can be reproduced accurately, this
  2808. pseudo-header field MUST be omitted when translating from an HTTP/1.1 request
  2809. that has a request target in origin or asterisk form (see <xref
  2810. target="RFC7230" x:fmt="," x:rel="#request-target"/>). Clients that generate
  2811. HTTP/2 requests directly SHOULD use the <spanx>:authority</spanx> pseudo-header
  2812. field instead of the <spanx style="verb">Host</spanx> header field. An
  2813. intermediary that converts an HTTP/2 request to HTTP/1.1 MUST create a <spanx
  2814. style="verb">Host</spanx> header field if one is not present in a request by
  2815. copying the value of the <spanx style="verb">:authority</spanx> pseudo-header
  2816. field.
  2817. </t>
  2818. </x:lt>
  2819. <x:lt>
  2820. <t>
  2821. The <spanx style="verb">:path</spanx> pseudo-header field includes the path and
  2822. query parts of the target URI (the <spanx style="verb">path-absolute</spanx>
  2823. production from <xref target="RFC3986"/> and optionally a '?' character
  2824. followed by the <spanx style="verb">query</spanx> production, see <xref
  2825. target="RFC3986" x:fmt="," x:sec="3.3"/> and <xref target="RFC3986" x:fmt=","
  2826. x:sec="3.4"/>). A request in asterisk form includes the value '*' for the
  2827. <spanx style="verb">:path</spanx> pseudo-header field.
  2828. </t>
  2829. <t>
  2830. This pseudo-header field MUST NOT be empty for <spanx style="verb">http</spanx>
  2831. or <spanx style="verb">https</spanx> URIs; <spanx style="verb">http</spanx> or
  2832. <spanx style="verb">https</spanx> URIs that do not contain a path component
  2833. MUST include a value of '/'. The exception to this rule is an OPTIONS request
  2834. for an <spanx style="verb">http</spanx> or <spanx style="verb">https</spanx>
  2835. URI that does not include a path component; these MUST include a <spanx
  2836. style="verb">:path</spanx> pseudo-header field with a value of '*' (see <xref
  2837. target="RFC7230" x:fmt="," x:rel="#asterisk-form"/>).
  2838. </t>
  2839. </x:lt>
  2840. </list>
  2841. </t>
  2842. <t>
  2843. All HTTP/2 requests MUST include exactly one valid value for the <spanx
  2844. style="verb">:method</spanx>, <spanx style="verb">:scheme</spanx>, and <spanx
  2845. style="verb">:path</spanx> pseudo-header fields, unless it is a <xref
  2846. target="CONNECT">CONNECT request</xref>. An HTTP request that omits mandatory
  2847. pseudo-header fields is <xref target="malformed">malformed</xref>.
  2848. </t>
  2849. <t>
  2850. HTTP/2 does not define a way to carry the version identifier that is included in the
  2851. HTTP/1.1 request line.
  2852. </t>
  2853. </section>
  2854. <section anchor="HttpResponse" title="Response Pseudo-Header Fields">
  2855. <t>
  2856. For HTTP/2 responses, a single <spanx style="verb">:status</spanx> pseudo-header
  2857. field is defined that carries the HTTP status code field (see <xref target="RFC7231"
  2858. x:fmt="," x:rel="#status.codes"/>). This pseudo-header field MUST be included in all
  2859. responses, otherwise the response is <xref target="malformed">malformed</xref>.
  2860. </t>
  2861. <t>
  2862. HTTP/2 does not define a way to carry the version or reason phrase that is included in
  2863. an HTTP/1.1 status line.
  2864. </t>
  2865. </section>
  2866. <section anchor="CompressCookie" title="Compressing the Cookie Header Field">
  2867. <t>
  2868. The <xref target="COOKIE">Cookie header field</xref> can carry a significant amount of
  2869. redundant data.
  2870. </t>
  2871. <t>
  2872. The Cookie header field uses a semi-colon (";") to delimit cookie-pairs (or "crumbs").
  2873. This header field doesn't follow the list construction rules in HTTP (see <xref
  2874. target="RFC7230" x:fmt="," x:rel="#field.order"/>), which prevents cookie-pairs from
  2875. being separated into different name-value pairs. This can significantly reduce
  2876. compression efficiency as individual cookie-pairs are updated.
  2877. </t>
  2878. <t>
  2879. To allow for better compression efficiency, the Cookie header field MAY be split into
  2880. separate header fields, each with one or more cookie-pairs. If there are multiple
  2881. Cookie header fields after decompression, these MUST be concatenated into a single
  2882. octet string using the two octet delimiter of 0x3B, 0x20 (the ASCII string "; ")
  2883. before being passed into a non-HTTP/2 context, such as an HTTP/1.1 connection, or a
  2884. generic HTTP server application.
  2885. </t>
  2886. <figure>
  2887. <preamble>
  2888. Therefore, the following two lists of Cookie header fields are semantically
  2889. equivalent.
  2890. </preamble>
  2891. <artwork type="inline"><![CDATA[
  2892. cookie: a=b; c=d; e=f
  2893. cookie: a=b
  2894. cookie: c=d
  2895. cookie: e=f
  2896. ]]></artwork>
  2897. </figure>
  2898. </section>
  2899. <section anchor="malformed" title="Malformed Requests and Responses">
  2900. <t>
  2901. A malformed request or response is one that is an otherwise valid sequence of HTTP/2
  2902. frames, but is otherwise invalid due to the presence of extraneous frames, prohibited
  2903. header fields, the absence of mandatory header fields, or the inclusion of uppercase
  2904. header field names.
  2905. </t>
  2906. <t>
  2907. A request or response that includes an entity body can include a <spanx
  2908. style="verb">content-length</spanx> header field. A request or response is also
  2909. malformed if the value of a <spanx style="verb">content-length</spanx> header field
  2910. does not equal the sum of the <x:ref>DATA</x:ref> frame payload lengths that form the
  2911. body. A response that is defined to have no payload, as described in <xref
  2912. target="RFC7230" x:fmt="," x:rel="#header.content-length"/>, can have a non-zero
  2913. <spanx style="verb">content-length</spanx> header field, even though no content is
  2914. included in <x:ref>DATA</x:ref> frames.
  2915. </t>
  2916. <t>
  2917. Intermediaries that process HTTP requests or responses (i.e., any intermediary not
  2918. acting as a tunnel) MUST NOT forward a malformed request or response. Malformed
  2919. requests or responses that are detected MUST be treated as a <xref
  2920. target="StreamErrorHandler">stream error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>.
  2921. </t>
  2922. <t>
  2923. For malformed requests, a server MAY send an HTTP response prior to closing or
  2924. resetting the stream. Clients MUST NOT accept a malformed response. Note that these
  2925. requirements are intended to protect against several types of common attacks against
  2926. HTTP; they are deliberately strict, because being permissive can expose
  2927. implementations to these vulnerabilities.
  2928. </t>
  2929. </section>
  2930. </section>
  2931. <section title="Examples">
  2932. <t>
  2933. This section shows HTTP/1.1 requests and responses, with illustrations of equivalent
  2934. HTTP/2 requests and responses.
  2935. </t>
  2936. <t>
  2937. An HTTP GET request includes request header fields and no body and is therefore
  2938. transmitted as a single <x:ref>HEADERS</x:ref> frame, followed by zero or more
  2939. <x:ref>CONTINUATION</x:ref> frames containing the serialized block of request header
  2940. fields. The <x:ref>HEADERS</x:ref> frame in the following has both the END_HEADERS and
  2941. END_STREAM flags set; no <x:ref>CONTINUATION</x:ref> frames are sent:
  2942. </t>
  2943. <figure>
  2944. <artwork type="inline"><![CDATA[
  2945. GET /resource HTTP/1.1 HEADERS
  2946. Host: example.org ==> + END_STREAM
  2947. Accept: image/jpeg + END_HEADERS
  2948. :method = GET
  2949. :scheme = https
  2950. :path = /resource
  2951. host = example.org
  2952. accept = image/jpeg
  2953. ]]></artwork>
  2954. </figure>
  2955. <t>
  2956. Similarly, a response that includes only response header fields is transmitted as a
  2957. <x:ref>HEADERS</x:ref> frame (again, followed by zero or more
  2958. <x:ref>CONTINUATION</x:ref> frames) containing the serialized block of response header
  2959. fields.
  2960. </t>
  2961. <figure>
  2962. <artwork type="inline"><![CDATA[
  2963. HTTP/1.1 304 Not Modified HEADERS
  2964. ETag: "xyzzy" ==> + END_STREAM
  2965. Expires: Thu, 23 Jan ... + END_HEADERS
  2966. :status = 304
  2967. etag = "xyzzy"
  2968. expires = Thu, 23 Jan ...
  2969. ]]></artwork>
  2970. </figure>
  2971. <t>
  2972. An HTTP POST request that includes request header fields and payload data is transmitted
  2973. as one <x:ref>HEADERS</x:ref> frame, followed by zero or more
  2974. <x:ref>CONTINUATION</x:ref> frames containing the request header fields, followed by one
  2975. or more <x:ref>DATA</x:ref> frames, with the last <x:ref>CONTINUATION</x:ref> (or
  2976. <x:ref>HEADERS</x:ref>) frame having the END_HEADERS flag set and the final
  2977. <x:ref>DATA</x:ref> frame having the END_STREAM flag set:
  2978. </t>
  2979. <figure>
  2980. <artwork type="inline"><![CDATA[
  2981. POST /resource HTTP/1.1 HEADERS
  2982. Host: example.org ==> - END_STREAM
  2983. Content-Type: image/jpeg - END_HEADERS
  2984. Content-Length: 123 :method = POST
  2985. :path = /resource
  2986. {binary data} :scheme = https
  2987. CONTINUATION
  2988. + END_HEADERS
  2989. content-type = image/jpeg
  2990. host = example.org
  2991. content-length = 123
  2992. DATA
  2993. + END_STREAM
  2994. {binary data}
  2995. ]]></artwork>
  2996. <postamble>
  2997. Note that data contributing to any given header field could be spread between header
  2998. block fragments. The allocation of header fields to frames in this example is
  2999. illustrative only.
  3000. </postamble>
  3001. </figure>
  3002. <t>
  3003. A response that includes header fields and payload data is transmitted as a
  3004. <x:ref>HEADERS</x:ref> frame, followed by zero or more <x:ref>CONTINUATION</x:ref>
  3005. frames, followed by one or more <x:ref>DATA</x:ref> frames, with the last
  3006. <x:ref>DATA</x:ref> frame in the sequence having the END_STREAM flag set:
  3007. </t>
  3008. <figure>
  3009. <artwork type="inline"><![CDATA[
  3010. HTTP/1.1 200 OK HEADERS
  3011. Content-Type: image/jpeg ==> - END_STREAM
  3012. Content-Length: 123 + END_HEADERS
  3013. :status = 200
  3014. {binary data} content-type = image/jpeg
  3015. content-length = 123
  3016. DATA
  3017. + END_STREAM
  3018. {binary data}
  3019. ]]></artwork>
  3020. </figure>
  3021. <t>
  3022. Trailing header fields are sent as a header block after both the request or response
  3023. header block and all the <x:ref>DATA</x:ref> frames have been sent. The
  3024. <x:ref>HEADERS</x:ref> frame starting the trailers header block has the END_STREAM flag
  3025. set.
  3026. </t>
  3027. <figure>
  3028. <artwork type="inline"><![CDATA[
  3029. HTTP/1.1 200 OK HEADERS
  3030. Content-Type: image/jpeg ==> - END_STREAM
  3031. Transfer-Encoding: chunked + END_HEADERS
  3032. Trailer: Foo :status = 200
  3033. content-length = 123
  3034. 123 content-type = image/jpeg
  3035. {binary data} trailer = Foo
  3036. 0
  3037. Foo: bar DATA
  3038. - END_STREAM
  3039. {binary data}
  3040. HEADERS
  3041. + END_STREAM
  3042. + END_HEADERS
  3043. foo = bar
  3044. ]]></artwork>
  3045. </figure>
  3046. <figure>
  3047. <preamble>
  3048. An informational response using a 1xx status code other than 101 is transmitted as a
  3049. <x:ref>HEADERS</x:ref> frame, followed by zero or more <x:ref>CONTINUATION</x:ref>
  3050. frames:
  3051. </preamble>
  3052. <artwork type="inline"><![CDATA[
  3053. HTTP/1.1 103 BAR HEADERS
  3054. Extension-Field: bar ==> - END_STREAM
  3055. + END_HEADERS
  3056. :status = 103
  3057. extension-field = bar
  3058. ]]></artwork>
  3059. </figure>
  3060. </section>
  3061. <section anchor="Reliability" title="Request Reliability Mechanisms in HTTP/2">
  3062. <t>
  3063. In HTTP/1.1, an HTTP client is unable to retry a non-idempotent request when an error
  3064. occurs, because there is no means to determine the nature of the error. It is possible
  3065. that some server processing occurred prior to the error, which could result in
  3066. undesirable effects if the request were reattempted.
  3067. </t>
  3068. <t>
  3069. HTTP/2 provides two mechanisms for providing a guarantee to a client that a request has
  3070. not been processed:
  3071. <list style="symbols">
  3072. <t>
  3073. The <x:ref>GOAWAY</x:ref> frame indicates the highest stream number that might have
  3074. been processed. Requests on streams with higher numbers are therefore guaranteed to
  3075. be safe to retry.
  3076. </t>
  3077. <t>
  3078. The <x:ref>REFUSED_STREAM</x:ref> error code can be included in a
  3079. <x:ref>RST_STREAM</x:ref> frame to indicate that the stream is being closed prior to
  3080. any processing having occurred. Any request that was sent on the reset stream can
  3081. be safely retried.
  3082. </t>
  3083. </list>
  3084. </t>
  3085. <t>
  3086. Requests that have not been processed have not failed; clients MAY automatically retry
  3087. them, even those with non-idempotent methods.
  3088. </t>
  3089. <t>
  3090. A server MUST NOT indicate that a stream has not been processed unless it can guarantee
  3091. that fact. If frames that are on a stream are passed to the application layer for any
  3092. stream, then <x:ref>REFUSED_STREAM</x:ref> MUST NOT be used for that stream, and a
  3093. <x:ref>GOAWAY</x:ref> frame MUST include a stream identifier that is greater than or
  3094. equal to the given stream identifier.
  3095. </t>
  3096. <t>
  3097. In addition to these mechanisms, the <x:ref>PING</x:ref> frame provides a way for a
  3098. client to easily test a connection. Connections that remain idle can become broken as
  3099. some middleboxes (for instance, network address translators, or load balancers) silently
  3100. discard connection bindings. The <x:ref>PING</x:ref> frame allows a client to safely
  3101. test whether a connection is still active without sending a request.
  3102. </t>
  3103. </section>
  3104. </section>
  3105. <section anchor="PushResources" title="Server Push">
  3106. <t>
  3107. HTTP/2 allows a server to pre-emptively send (or "push") responses (along with
  3108. corresponding "promised" requests) to a client in association with a previous
  3109. client-initiated request. This can be useful when the server knows the client will need
  3110. to have those responses available in order to fully process the response to the original
  3111. request.
  3112. </t>
  3113. <t>
  3114. Pushing additional message exchanges in this fashion is optional, and is negotiated
  3115. between individual endpoints. The <x:ref>SETTINGS_ENABLE_PUSH</x:ref> setting can be set
  3116. to 0 to indicate that server push is disabled.
  3117. </t>
  3118. <t>
  3119. Promised requests MUST be cacheable (see <xref target="RFC7231" x:fmt=","
  3120. x:rel="#cacheable.methods"/>), MUST be safe (see <xref target="RFC7231" x:fmt=","
  3121. x:rel="#safe.methods"/>) and MUST NOT include a request body. Clients that receive a
  3122. promised request that is not cacheable, unsafe or that includes a request body MUST
  3123. reset the stream with a <xref target="StreamErrorHandler">stream error</xref> of type
  3124. <x:ref>PROTOCOL_ERROR</x:ref>.
  3125. </t>
  3126. <t>
  3127. Pushed responses that are cacheable (see <xref target="RFC7234" x:fmt=","
  3128. x:rel="#response.cacheability"/>) can be stored by the client, if it implements a HTTP
  3129. cache. Pushed responses are considered successfully validated on the origin server (e.g.,
  3130. if the "no-cache" cache response directive <xref target="RFC7234" x:fmt=","
  3131. x:rel="#cache-response-directive"/> is present) while the stream identified by the
  3132. promised stream ID is still open.
  3133. </t>
  3134. <t>
  3135. Pushed responses that are not cacheable MUST NOT be stored by any HTTP cache. They MAY
  3136. be made available to the application separately.
  3137. </t>
  3138. <t>
  3139. An intermediary can receive pushes from the server and choose not to forward them on to
  3140. the client. In other words, how to make use of the pushed information is up to that
  3141. intermediary. Equally, the intermediary might choose to make additional pushes to the
  3142. client, without any action taken by the server.
  3143. </t>
  3144. <t>
  3145. A client cannot push. Thus, servers MUST treat the receipt of a
  3146. <x:ref>PUSH_PROMISE</x:ref> frame as a <xref target="ConnectionErrorHandler">connection
  3147. error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>. Clients MUST reject any attempt to
  3148. change the <x:ref>SETTINGS_ENABLE_PUSH</x:ref> setting to a value other than 0 by treating
  3149. the message as a <xref target="ConnectionErrorHandler">connection error</xref> of type
  3150. <x:ref>PROTOCOL_ERROR</x:ref>.
  3151. </t>
  3152. <section anchor="PushRequests" title="Push Requests">
  3153. <t>
  3154. Server push is semantically equivalent to a server responding to a request; however, in
  3155. this case that request is also sent by the server, as a <x:ref>PUSH_PROMISE</x:ref>
  3156. frame.
  3157. </t>
  3158. <t>
  3159. The <x:ref>PUSH_PROMISE</x:ref> frame includes a header block that contains a complete
  3160. set of request header fields that the server attributes to the request. It is not
  3161. possible to push a response to a request that includes a request body.
  3162. </t>
  3163. <t>
  3164. Pushed responses are always associated with an explicit request from the client. The
  3165. <x:ref>PUSH_PROMISE</x:ref> frames sent by the server are sent on that explicit
  3166. request's stream. The <x:ref>PUSH_PROMISE</x:ref> frame also includes a promised stream
  3167. identifier, chosen from the stream identifiers available to the server (see <xref
  3168. target="StreamIdentifiers"/>).
  3169. </t>
  3170. <t>
  3171. The header fields in <x:ref>PUSH_PROMISE</x:ref> and any subsequent
  3172. <x:ref>CONTINUATION</x:ref> frames MUST be a valid and complete set of <xref
  3173. target="HttpRequest">request header fields</xref>. The server MUST include a method in
  3174. the <spanx style="verb">:method</spanx> header field that is safe and cacheable. If a
  3175. client receives a <x:ref>PUSH_PROMISE</x:ref> that does not include a complete and valid
  3176. set of header fields, or the <spanx style="verb">:method</spanx> header field identifies
  3177. a method that is not safe, it MUST respond with a <xref
  3178. target="StreamErrorHandler">stream error</xref> of type <x:ref>PROTOCOL_ERROR</x:ref>.
  3179. </t>
  3180. <t>
  3181. The server SHOULD send <x:ref>PUSH_PROMISE</x:ref> (<xref target="PUSH_PROMISE"/>)
  3182. frames prior to sending any frames that reference the promised responses. This avoids a
  3183. race where clients issue requests prior to receiving any <x:ref>PUSH_PROMISE</x:ref>
  3184. frames.
  3185. </t>
  3186. <t>
  3187. For example, if the server receives a request for a document containing embedded links
  3188. to multiple image files, and the server chooses to push those additional images to the
  3189. client, sending push promises before the <x:ref>DATA</x:ref> frames that contain the
  3190. image links ensures that the client is able to see the promises before discovering
  3191. embedded links. Similarly, if the server pushes responses referenced by the header block
  3192. (for instance, in Link header fields), sending the push promises before sending the
  3193. header block ensures that clients do not request them.
  3194. </t>
  3195. <t>
  3196. <x:ref>PUSH_PROMISE</x:ref> frames MUST NOT be sent by the client.
  3197. </t>
  3198. <t>
  3199. <x:ref>PUSH_PROMISE</x:ref> frames can be sent by the server in response to any
  3200. client-initiated stream, but the stream MUST be in either the "open" or "half closed
  3201. (remote)" state with respect to the server. <x:ref>PUSH_PROMISE</x:ref> frames are
  3202. interspersed with the frames that comprise a response, though they cannot be
  3203. interspersed with <x:ref>HEADERS</x:ref> and <x:ref>CONTINUATION</x:ref> frames that
  3204. comprise a single header block.
  3205. </t>
  3206. <t>
  3207. Sending a <x:ref>PUSH_PROMISE</x:ref> frame creates a new stream and puts the stream
  3208. into the “reserved (local)” state for the server and the “reserved (remote)” state for
  3209. the client.
  3210. </t>
  3211. </section>
  3212. <section anchor="PushResponses" title="Push Responses">
  3213. <t>
  3214. After sending the <x:ref>PUSH_PROMISE</x:ref> frame, the server can begin delivering the
  3215. pushed response as a <xref target="HttpResponse">response</xref> on a server-initiated
  3216. stream that uses the promised stream identifier. The server uses this stream to
  3217. transmit an HTTP response, using the same sequence of frames as defined in <xref
  3218. target="HttpSequence"/>. This stream becomes <xref target="StreamStates">"half closed"
  3219. to the client</xref> after the initial <x:ref>HEADERS</x:ref> frame is sent.
  3220. </t>
  3221. <t>
  3222. Once a client receives a <x:ref>PUSH_PROMISE</x:ref> frame and chooses to accept the
  3223. pushed response, the client SHOULD NOT issue any requests for the promised response
  3224. until after the promised stream has closed.
  3225. </t>
  3226. <t>
  3227. If the client determines, for any reason, that it does not wish to receive the pushed
  3228. response from the server, or if the server takes too long to begin sending the promised
  3229. response, the client can send an <x:ref>RST_STREAM</x:ref> frame, using either the
  3230. <x:ref>CANCEL</x:ref> or <x:ref>REFUSED_STREAM</x:ref> codes, and referencing the pushed
  3231. stream's identifier.
  3232. </t>
  3233. <t>
  3234. A client can use the <x:ref>SETTINGS_MAX_CONCURRENT_STREAMS</x:ref> setting to limit the
  3235. number of responses that can be concurrently pushed by a server. Advertising a
  3236. <x:ref>SETTINGS_MAX_CONCURRENT_STREAMS</x:ref> value of zero disables server push by
  3237. preventing the server from creating the necessary streams. This does not prohibit a
  3238. server from sending <x:ref>PUSH_PROMISE</x:ref> frames; clients need to reset any
  3239. promised streams that are not wanted.
  3240. </t>
  3241. <t>
  3242. Clients receiving a pushed response MUST validate that either the server is
  3243. authoritative (see <xref target="authority"/>), or the proxy that provided the pushed
  3244. response is configured for the corresponding request. For example, a server that offers
  3245. a certificate for only the <spanx style="verb">example.com</spanx> DNS-ID or Common Name
  3246. is not permitted to push a response for <spanx
  3247. style="verb">https://www.example.org/doc</spanx>.
  3248. </t>
  3249. <t>
  3250. The response for a <x:ref>PUSH_PROMISE</x:ref> stream begins with a
  3251. <x:ref>HEADERS</x:ref> frame, which immediately puts the stream into the “half closed
  3252. (remote)” state for the server and “half closed (local)” state for the client, and ends
  3253. with a frame bearing END_STREAM, which places the stream in the "closed" state.
  3254. <list style="hanging">
  3255. <t hangText="Note:">
  3256. The client never sends a frame with the END_STREAM flag for a server push.
  3257. </t>
  3258. </list>
  3259. </t>
  3260. </section>
  3261. </section>
  3262. <section anchor="CONNECT" title="The CONNECT Method">
  3263. <t>
  3264. In HTTP/1.x, the pseudo-method CONNECT (<xref target="RFC7231" x:fmt=","
  3265. x:rel="#CONNECT"/>) is used to convert an HTTP connection into a tunnel to a remote host.
  3266. CONNECT is primarily used with HTTP proxies to establish a TLS session with an origin
  3267. server for the purposes of interacting with <spanx style="verb">https</spanx> resources.
  3268. </t>
  3269. <t>
  3270. In HTTP/2, the CONNECT method is used to establish a tunnel over a single HTTP/2 stream to
  3271. a remote host, for similar purposes. The HTTP header field mapping works as defined in
  3272. <xref target="HttpRequest">Request Header Fields</xref>, with a few
  3273. differences. Specifically:
  3274. <list style="symbols">
  3275. <t>
  3276. The <spanx style="verb">:method</spanx> header field is set to <spanx
  3277. style="verb">CONNECT</spanx>.
  3278. </t>
  3279. <t>
  3280. The <spanx style="verb">:scheme</spanx> and <spanx style="verb">:path</spanx> header
  3281. fields MUST be omitted.
  3282. </t>
  3283. <t>
  3284. The <spanx style="verb">:authority</spanx> header field contains the host and port to
  3285. connect to (equivalent to the authority-form of the request-target of CONNECT
  3286. requests, see <xref target="RFC7230" x:fmt="," x:rel="#request-target"/>).
  3287. </t>
  3288. </list>
  3289. </t>
  3290. <t>
  3291. A proxy that supports CONNECT establishes a <xref target="TCP">TCP connection</xref> to
  3292. the server identified in the <spanx style="verb">:authority</spanx> header field. Once
  3293. this connection is successfully established, the proxy sends a <x:ref>HEADERS</x:ref>
  3294. frame containing a 2xx series status code to the client, as defined in <xref
  3295. target="RFC7231" x:fmt="," x:rel="#CONNECT"/>.
  3296. </t>
  3297. <t>
  3298. After the initial <x:ref>HEADERS</x:ref> frame sent by each peer, all subsequent
  3299. <x:ref>DATA</x:ref> frames correspond to data sent on the TCP connection. The payload of
  3300. any <x:ref>DATA</x:ref> frames sent by the client is transmitted by the proxy to the TCP
  3301. server; data received from the TCP server is assembled into <x:ref>DATA</x:ref> frames by
  3302. the proxy. Frame types other than <x:ref>DATA</x:ref> or stream management frames
  3303. (<x:ref>RST_STREAM</x:ref>, <x:ref>WINDOW_UPDATE</x:ref>, and <x:ref>PRIORITY</x:ref>)
  3304. MUST NOT be sent on a connected stream, and MUST be treated as a <xref
  3305. target="StreamErrorHandler">stream error</xref> if received.
  3306. </t>
  3307. <t>
  3308. The TCP connection can be closed by either peer. The END_STREAM flag on a
  3309. <x:ref>DATA</x:ref> frame is treated as being equivalent to the TCP FIN bit. A client is
  3310. expected to send a <x:ref>DATA</x:ref> frame with the END_STREAM flag set after receiving
  3311. a frame bearing the END_STREAM flag. A proxy that receives a <x:ref>DATA</x:ref> frame
  3312. with the END_STREAM flag set sends the attached data with the FIN bit set on the last TCP
  3313. segment. A proxy that receives a TCP segment with the FIN bit set sends a
  3314. <x:ref>DATA</x:ref> frame with the END_STREAM flag set. Note that the final TCP segment
  3315. or <x:ref>DATA</x:ref> frame could be empty.
  3316. </t>
  3317. <t>
  3318. A TCP connection error is signaled with <x:ref>RST_STREAM</x:ref>. A proxy treats any
  3319. error in the TCP connection, which includes receiving a TCP segment with the RST bit set,
  3320. as a <xref target="StreamErrorHandler">stream error</xref> of type
  3321. <x:ref>CONNECT_ERROR</x:ref>. Correspondingly, a proxy MUST send a TCP segment with the
  3322. RST bit set if it detects an error with the stream or the HTTP/2 connection.
  3323. </t>
  3324. </section>
  3325. </section>
  3326. <section anchor="HttpExtra" title="Additional HTTP Requirements/Considerations">
  3327. <t>
  3328. This section outlines attributes of the HTTP protocol that improve interoperability, reduce
  3329. exposure to known security vulnerabilities, or reduce the potential for implementation
  3330. variation.
  3331. </t>
  3332. <section title="Connection Management">
  3333. <t>
  3334. HTTP/2 connections are persistent. For best performance, it is expected clients will not
  3335. close connections until it is determined that no further communication with a server is
  3336. necessary (for example, when a user navigates away from a particular web page), or until
  3337. the server closes the connection.
  3338. </t>
  3339. <t>
  3340. Clients SHOULD NOT open more than one HTTP/2 connection to a given host and port pair,
  3341. where host is derived from a URI, a selected <xref target="ALT-SVC">alternative
  3342. service</xref>, or a configured proxy.
  3343. </t>
  3344. <t>
  3345. A client can create additional connections as replacements, either to replace connections
  3346. that are near to exhausting the available <xref target="StreamIdentifiers">stream
  3347. identifier space</xref>, to refresh the keying material for a TLS connection, or to
  3348. replace connections that have encountered <xref
  3349. target="ConnectionErrorHandler">errors</xref>.
  3350. </t>
  3351. <t>
  3352. A client MAY open multiple connections to the same IP address and TCP port using different
  3353. <xref target="TLS-EXT">Server Name Indication</xref> values or to provide different TLS
  3354. client certificates, but SHOULD avoid creating multiple connections with the same
  3355. configuration.
  3356. </t>
  3357. <t>
  3358. Servers are encouraged to maintain open connections for as long as possible, but are
  3359. permitted to terminate idle connections if necessary. When either endpoint chooses to
  3360. close the transport-layer TCP connection, the terminating endpoint SHOULD first send a
  3361. <x:ref>GOAWAY</x:ref> (<xref target="GOAWAY"/>) frame so that both endpoints can reliably
  3362. determine whether previously sent frames have been processed and gracefully complete or
  3363. terminate any necessary remaining tasks.
  3364. </t>
  3365. <section anchor="reuse" title="Connection Reuse">
  3366. <t>
  3367. Connections that are made to an origin servers, either directly or through a tunnel
  3368. created using the <xref target="CONNECT">CONNECT method</xref> MAY be reused for
  3369. requests with multiple different URI authority components. A connection can be reused
  3370. as long as the origin server is <xref target="authority">authoritative</xref>. For
  3371. <spanx style="verb">http</spanx> resources, this depends on the host having resolved to
  3372. the same IP address.
  3373. </t>
  3374. <t>
  3375. For <spanx style="verb">https</spanx> resources, connection reuse additionally depends
  3376. on having a certificate that is valid for the host in the URI. An origin server might
  3377. offer a certificate with multiple <spanx style="verb">subjectAltName</spanx> attributes,
  3378. or names with wildcards, one of which is valid for the authority in the URI. For
  3379. example, a certificate with a <spanx style="verb">subjectAltName</spanx> of <spanx
  3380. style="verb">*.example.com</spanx> might permit the use of the same connection for
  3381. requests to URIs starting with <spanx style="verb">https://a.example.com/</spanx> and
  3382. <spanx style="verb">https://b.example.com/</spanx>.
  3383. </t>
  3384. <t>
  3385. In some deployments, reusing a connection for multiple origins can result in requests
  3386. being directed to the wrong origin server. For example, TLS termination might be
  3387. performed by a middlebox that uses the TLS <xref target="TLS-EXT">Server Name Indication
  3388. (SNI)</xref> extension to select an origin server. This means that it is possible
  3389. for clients to send confidential information to servers that might not be the intended
  3390. target for the request, even though the server is otherwise authoritative.
  3391. </t>
  3392. <t>
  3393. A server that does not wish clients to reuse connections can indicate that it is not
  3394. authoritative for a request by sending a 421 (Misdirected Request) status code in response
  3395. to the request (see <xref target="MisdirectedRequest"/>).
  3396. </t>
  3397. <t>
  3398. A client that is configured to use a proxy over HTTP/2 directs requests to that proxy
  3399. through a single connection. That is, all requests sent via a proxy reuse the
  3400. connection to the proxy.
  3401. </t>
  3402. </section>
  3403. <section anchor="MisdirectedRequest" title="The 421 (Misdirected Request) Status Code">
  3404. <t>
  3405. The 421 (Misdirected Request) status code indicates that the request was directed at a
  3406. server that is not able to produce a response. This can be sent by a server that is not
  3407. configured to produce responses for the combination of scheme and authority that are
  3408. included in the request URI.
  3409. </t>
  3410. <t>
  3411. Clients receiving a 421 (Misdirected Request) response from a server MAY retry the
  3412. request - whether the request method is idempotent or not - over a different connection.
  3413. This is possible if a connection is reused (<xref target="reuse"/>) or if an alternative
  3414. service is selected (<xref target="ALT-SVC"/>).
  3415. </t>
  3416. <t>
  3417. This status code MUST NOT be generated by proxies.
  3418. </t>
  3419. <t>
  3420. A 421 response is cacheable by default; i.e., unless otherwise indicated by the method
  3421. definition or explicit cache controls (see <xref target="RFC7234"
  3422. x:rel="#heuristic.freshness" x:fmt="of"/>).
  3423. </t>
  3424. </section>
  3425. </section>
  3426. <section title="Use of TLS Features" anchor="TLSUsage">
  3427. <t>
  3428. Implementations of HTTP/2 MUST support <xref target="TLS12">TLS 1.2</xref> for HTTP/2 over
  3429. TLS. The general TLS usage guidance in <xref target="TLSBCP"/> SHOULD be followed, with
  3430. some additional restrictions that are specific to HTTP/2.
  3431. </t>
  3432. <t>
  3433. An implementation of HTTP/2 over TLS MUST use TLS 1.2 or higher with the restrictions on
  3434. feature set and cipher suite described in this section. Due to implementation
  3435. limitations, it might not be possible to fail TLS negotiation. An endpoint MUST
  3436. immediately terminate an HTTP/2 connection that does not meet these minimum requirements
  3437. with a <xref target="ConnectionErrorHandler">connection error</xref> of type
  3438. <x:ref>INADEQUATE_SECURITY</x:ref>.
  3439. </t>
  3440. <section anchor="TLSFeatures" title="TLS Features">
  3441. <t>
  3442. The TLS implementation MUST support the <xref target="TLS-EXT">Server Name Indication
  3443. (SNI)</xref> extension to TLS. HTTP/2 clients MUST indicate the target domain name when
  3444. negotiating TLS.
  3445. </t>
  3446. <t>
  3447. The TLS implementation MUST disable compression. TLS compression can lead to the
  3448. exposure of information that would not otherwise be revealed <xref target="RFC3749"/>.
  3449. Generic compression is unnecessary since HTTP/2 provides compression features that are
  3450. more aware of context and therefore likely to be more appropriate for use for
  3451. performance, security or other reasons.
  3452. </t>
  3453. <t>
  3454. The TLS implementation MUST disable renegotiation. An endpoint MUST treat a TLS
  3455. renegotiation as a <xref target="ConnectionErrorHandler">connection error</xref> of type
  3456. <x:ref>PROTOCOL_ERROR</x:ref>. Note that disabling renegotiation can result in
  3457. long-lived connections becoming unusable due to limits on the number of messages the
  3458. underlying cipher suite can encipher.
  3459. </t>
  3460. <t>
  3461. A client MAY use renegotiation to provide confidentiality protection for client
  3462. credentials offered in the handshake, but any renegotiation MUST occur prior to sending
  3463. the connection preface. A server SHOULD request a client certificate if it sees a
  3464. renegotiation request immediately after establishing a connection.
  3465. </t>
  3466. <t>
  3467. This effectively prevents the use of renegotiation in response to a request for a
  3468. specific protected resource. A future specification might provide a way to support this
  3469. use case. <!-- <cref> We are tracking this in a non-blocking fashion in issue #496 and
  3470. with a new draft. -->
  3471. </t>
  3472. </section>
  3473. <section title="TLS Cipher Suites">
  3474. <t>
  3475. The set of TLS cipher suites that are permitted in HTTP/2 is restricted. HTTP/2 MUST
  3476. only be used with cipher suites that have ephemeral key exchange, such as the <xref
  3477. target="TLS12">ephemeral Diffie-Hellman (DHE)</xref> or the <xref
  3478. target="RFC4492">elliptic curve variant (ECDHE)</xref>. Ephemeral key exchange MUST
  3479. have a minimum size of 2048 bits for DHE or security level of 128 bits for ECDHE.
  3480. Clients MUST accept DHE sizes of up to 4096 bits. HTTP MUST NOT be used with cipher
  3481. suites that use stream or block ciphers. Authenticated Encryption with Additional Data
  3482. (AEAD) modes, such as the <xref target="RFC5288">Galois Counter Model (GCM) mode for
  3483. AES</xref> are acceptable.
  3484. </t>
  3485. <t>
  3486. The effect of these restrictions is that TLS 1.2 implementations could have
  3487. non-intersecting sets of available cipher suites, since these prevent the use of the
  3488. cipher suite that TLS 1.2 makes mandatory. To avoid this problem, implementations of
  3489. HTTP/2 that use TLS 1.2 MUST support TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 <xref
  3490. target="TLS-ECDHE"/> with P256 <xref target="FIPS186"/>.
  3491. </t>
  3492. <t>
  3493. Clients MAY advertise support of cipher suites that are prohibited by the above
  3494. restrictions in order to allow for connection to servers that do not support HTTP/2.
  3495. This enables a fallback to protocols without these constraints without the additional
  3496. latency imposed by using a separate connection for fallback.
  3497. </t>
  3498. </section>
  3499. </section>
  3500. </section>
  3501. <section anchor="security" title="Security Considerations">
  3502. <section title="Server Authority" anchor="authority">
  3503. <t>
  3504. HTTP/2 relies on the HTTP/1.1 definition of authority for determining whether a server is
  3505. authoritative in providing a given response, see <xref target="RFC7230" x:fmt=","
  3506. x:rel="#establishing.authority"/>. This relies on local name resolution for the "http"
  3507. URI scheme, and the authenticated server identity for the "https" scheme (see <xref
  3508. target="RFC2818" x:fmt="," x:sec="3"/>).
  3509. </t>
  3510. </section>
  3511. <section title="Cross-Protocol Attacks">
  3512. <t>
  3513. In a cross-protocol attack, an attacker causes a client to initiate a transaction in one
  3514. protocol toward a server that understands a different protocol. An attacker might be able
  3515. to cause the transaction to appear as valid transaction in the second protocol. In
  3516. combination with the capabilities of the web context, this can be used to interact with
  3517. poorly protected servers in private networks.
  3518. </t>
  3519. <t>
  3520. Completing a TLS handshake with an ALPN identifier for HTTP/2 can be considered sufficient
  3521. protection against cross protocol attacks. ALPN provides a positive indication that a
  3522. server is willing to proceed with HTTP/2, which prevents attacks on other TLS-based
  3523. protocols.
  3524. </t>
  3525. <t>
  3526. The encryption in TLS makes it difficult for attackers to control the data which could be
  3527. used in a cross-protocol attack on a cleartext protocol.
  3528. </t>
  3529. <t>
  3530. The cleartext version of HTTP/2 has minimal protection against cross-protocol attacks.
  3531. The <xref target="ConnectionHeader">connection preface</xref> contains a string that is
  3532. designed to confuse HTTP/1.1 servers, but no special protection is offered for other
  3533. protocols. A server that is willing to ignore parts of an HTTP/1.1 request containing an
  3534. Upgrade header field in addition to the client connection preface could be exposed to a
  3535. cross-protocol attack.
  3536. </t>
  3537. </section>
  3538. <section title="Intermediary Encapsulation Attacks">
  3539. <t>
  3540. HTTP/2 header field names and values are encoded as sequences of octets with a length
  3541. prefix. This enables HTTP/2 to carry any string of octets as the name or value of a
  3542. header field. An intermediary that translates HTTP/2 requests or responses into HTTP/1.1
  3543. directly could permit the creation of corrupted HTTP/1.1 messages. An attacker might
  3544. exploit this behavior to cause the intermediary to create HTTP/1.1 messages with illegal
  3545. header fields, extra header fields, or even new messages that are entirely falsified.
  3546. </t>
  3547. <t>
  3548. Header field names or values that contain characters not permitted by HTTP/1.1, including
  3549. carriage return (ASCII 0xd) or line feed (ASCII 0xa) MUST NOT be translated verbatim by an
  3550. intermediary, as stipulated in <xref target="RFC7230" x:rel="#field.parsing" x:fmt=","/>.
  3551. </t>
  3552. <t>
  3553. Translation from HTTP/1.x to HTTP/2 does not produce the same opportunity to an attacker.
  3554. Intermediaries that perform translation to HTTP/2 MUST remove any instances of the <spanx
  3555. style="verb">obs-fold</spanx> production from header field values.
  3556. </t>
  3557. </section>
  3558. <section title="Cacheability of Pushed Responses">
  3559. <t>
  3560. Pushed responses do not have an explicit request from the client; the request
  3561. is provided by the server in the <x:ref>PUSH_PROMISE</x:ref> frame.
  3562. </t>
  3563. <t>
  3564. Caching responses that are pushed is possible based on the guidance provided by the origin
  3565. server in the Cache-Control header field. However, this can cause issues if a single
  3566. server hosts more than one tenant. For example, a server might offer multiple users each
  3567. a small portion of its URI space.
  3568. </t>
  3569. <t>
  3570. Where multiple tenants share space on the same server, that server MUST ensure that
  3571. tenants are not able to push representations of resources that they do not have authority
  3572. over. Failure to enforce this would allow a tenant to provide a representation that would
  3573. be served out of cache, overriding the actual representation that the authoritative tenant
  3574. provides.
  3575. </t>
  3576. <t>
  3577. Pushed responses for which an origin server is not authoritative (see
  3578. <xref target="authority"/>) are never cached or used.
  3579. </t>
  3580. </section>
  3581. <section anchor="dos" title="Denial of Service Considerations">
  3582. <t>
  3583. An HTTP/2 connection can demand a greater commitment of resources to operate than a
  3584. HTTP/1.1 connection. The use of header compression and flow control depend on a
  3585. commitment of resources for storing a greater amount of state. Settings for these
  3586. features ensure that memory commitments for these features are strictly bounded.
  3587. </t>
  3588. <t>
  3589. The number of <x:ref>PUSH_PROMISE</x:ref> frames is not constrained in the same fashion.
  3590. A client that accepts server push SHOULD limit the number of streams it allows to be in
  3591. the "reserved (remote)" state. Excessive number of server push streams can be treated as
  3592. a <xref target="StreamErrorHandler">stream error</xref> of type
  3593. <x:ref>ENHANCE_YOUR_CALM</x:ref>.
  3594. </t>
  3595. <t>
  3596. Processing capacity cannot be guarded as effectively as state capacity.
  3597. </t>
  3598. <t>
  3599. The <x:ref>SETTINGS</x:ref> frame can be abused to cause a peer to expend additional
  3600. processing time. This might be done by pointlessly changing SETTINGS parameters, setting
  3601. multiple undefined parameters, or changing the same setting multiple times in the same
  3602. frame. <x:ref>WINDOW_UPDATE</x:ref> or <x:ref>PRIORITY</x:ref> frames can be abused to
  3603. cause an unnecessary waste of resources.
  3604. </t>
  3605. <t>
  3606. Large numbers of small or empty frames can be abused to cause a peer to expend time
  3607. processing frame headers. Note however that some uses are entirely legitimate, such as
  3608. the sending of an empty <x:ref>DATA</x:ref> frame to end a stream.
  3609. </t>
  3610. <t>
  3611. Header compression also offers some opportunities to waste processing resources; see <xref
  3612. target="COMPRESSION" x:fmt="of" x:rel="#Security"/> for more details on potential abuses.
  3613. </t>
  3614. <t>
  3615. Limits in <x:ref>SETTINGS</x:ref> parameters cannot be reduced instantaneously, which
  3616. leaves an endpoint exposed to behavior from a peer that could exceed the new limits. In
  3617. particular, immediately after establishing a connection, limits set by a server are not
  3618. known to clients and could be exceeded without being an obvious protocol violation.
  3619. </t>
  3620. <t>
  3621. All these features - i.e., <x:ref>SETTINGS</x:ref> changes, small frames, header
  3622. compression - have legitimate uses. These features become a burden only when they are
  3623. used unnecessarily or to excess.
  3624. </t>
  3625. <t>
  3626. An endpoint that doesn't monitor this behavior exposes itself to a risk of denial of
  3627. service attack. Implementations SHOULD track the use of these features and set limits on
  3628. their use. An endpoint MAY treat activity that is suspicious as a <xref
  3629. target="ConnectionErrorHandler">connection error</xref> of type
  3630. <x:ref>ENHANCE_YOUR_CALM</x:ref>.
  3631. </t>
  3632. <section anchor="MaxHeaderBlock" title="Limits on Header Block Size">
  3633. <t>
  3634. A large <xref target="HeaderBlock">header block</xref> can cause an implementation to
  3635. commit a large amount of state. Header fields that are critical for routing can appear
  3636. toward the end of a header block, which prevents streaming of header fields to their
  3637. ultimate destination. For this an other reasons, such as ensuring cache correctness,
  3638. means that an endpoint might need to buffer the entire header block. Since there is no
  3639. hard limit to the size of a header block, some endpoints could be forced commit a large
  3640. amount of available memory for header fields.
  3641. </t>
  3642. <t>
  3643. An endpoint can use the <x:ref>SETTINGS_MAX_HEADER_LIST_SIZE</x:ref> to advise peers of
  3644. limits that might apply on the size of header blocks. This setting is only advisory, so
  3645. endpoints MAY choose to send header blocks that exceed this limit and risk having the
  3646. request or response being treated as malformed. This setting specific to a connection,
  3647. so any request or response could encounter a hop with a lower, unknown limit. An
  3648. intermediary can attempt to avoid this problem by passing on values presented by
  3649. different peers, but they are not obligated to do so.
  3650. </t>
  3651. <t>
  3652. A server that receives a larger header block than it is willing to handle can send an
  3653. HTTP 431 (Request Header Fields Too Large) status code <xref target="RFC6585"/>. A
  3654. client can discard responses that it cannot process. The header block MUST be processed
  3655. to ensure a consistent connection state, unless the connection is closed.
  3656. </t>
  3657. </section>
  3658. </section>
  3659. <section title="Use of Compression">
  3660. <t>
  3661. HTTP/2 enables greater use of compression for both header fields (<xref
  3662. target="HeaderBlock"/>) and entity bodies. Compression can allow an attacker to recover
  3663. secret data when it is compressed in the same context as data under attacker control.
  3664. </t>
  3665. <t>
  3666. There are demonstrable attacks on compression that exploit the characteristics of the web
  3667. (e.g., <xref target="BREACH"/>). The attacker induces multiple requests containing
  3668. varying plaintext, observing the length of the resulting ciphertext in each, which
  3669. reveals a shorter length when a guess about the secret is correct.
  3670. </t>
  3671. <t>
  3672. Implementations communicating on a secure channel MUST NOT compress content that includes
  3673. both confidential and attacker-controlled data unless separate compression dictionaries
  3674. are used for each source of data. Compression MUST NOT be used if the source of data
  3675. cannot be reliably determined. Generic stream compression, such as that provided by TLS
  3676. MUST NOT be used with HTTP/2 (<xref target="TLSFeatures"/>).
  3677. </t>
  3678. <t>
  3679. Further considerations regarding the compression of header fields are described in <xref
  3680. target="COMPRESSION"/>.
  3681. </t>
  3682. </section>
  3683. <section title="Use of Padding" anchor="padding">
  3684. <t>
  3685. Padding within HTTP/2 is not intended as a replacement for general purpose padding, such
  3686. as might be provided by <xref target="TLS12">TLS</xref>. Redundant padding could even be
  3687. counterproductive. Correct application can depend on having specific knowledge of the
  3688. data that is being padded.
  3689. </t>
  3690. <t>
  3691. To mitigate attacks that rely on compression, disabling or limiting compression might be
  3692. preferable to padding as a countermeasure.
  3693. </t>
  3694. <t>
  3695. Padding can be used to obscure the exact size of frame content, and is provided to
  3696. mitigate specific attacks within HTTP. For example, attacks where compressed content
  3697. includes both attacker-controlled plaintext and secret data (see for example, <xref
  3698. target="BREACH"/>).
  3699. </t>
  3700. <t>
  3701. Use of padding can result in less protection than might seem immediately obvious. At
  3702. best, padding only makes it more difficult for an attacker to infer length information by
  3703. increasing the number of frames an attacker has to observe. Incorrectly implemented
  3704. padding schemes can be easily defeated. In particular, randomized padding with a
  3705. predictable distribution provides very little protection; similarly, padding payloads to a
  3706. fixed size exposes information as payload sizes cross the fixed size boundary, which could
  3707. be possible if an attacker can control plaintext.
  3708. </t>
  3709. <t>
  3710. Intermediaries SHOULD retain padding for <x:ref>DATA</x:ref> frames, but MAY drop padding
  3711. for <x:ref>HEADERS</x:ref> and <x:ref>PUSH_PROMISE</x:ref> frames. A valid reason for an
  3712. intermediary to change the amount of padding of frames is to improve the protections that
  3713. padding provides.
  3714. </t>
  3715. </section>
  3716. <section title="Privacy Considerations">
  3717. <t>
  3718. Several characteristics of HTTP/2 provide an observer an opportunity to correlate actions
  3719. of a single client or server over time. This includes the value of settings, the manner
  3720. in which flow control windows are managed, the way priorities are allocated to streams,
  3721. timing of reactions to stimulus, and handling of any optional features.
  3722. </t>
  3723. <t>
  3724. As far as this creates observable differences in behavior, they could be used as a basis
  3725. for fingerprinting a specific client, as defined in <xref target="HTML5" x:fmt="of"
  3726. x:sec="1.8" x:rel="introduction.html#fingerprint"/>.
  3727. </t>
  3728. </section>
  3729. </section>
  3730. <section anchor="iana" title="IANA Considerations">
  3731. <t>
  3732. A string for identifying HTTP/2 is entered into the "Application Layer Protocol Negotiation
  3733. (ALPN) Protocol IDs" registry established in <xref target="TLS-ALPN"/>.
  3734. </t>
  3735. <t>
  3736. This document establishes a registry for frame types, settings, and error codes. These new
  3737. registries are entered into a new "Hypertext Transfer Protocol (HTTP) 2 Parameters" section.
  3738. </t>
  3739. <t>
  3740. This document registers the <spanx style="verb">HTTP2-Settings</spanx> header field for
  3741. use in HTTP; and the 421 (Misdirected Request) status code.
  3742. </t>
  3743. <t>
  3744. This document registers the <spanx style="verb">PRI</spanx> method for use in HTTP, to avoid
  3745. collisions with the <xref target="ConnectionHeader">connection preface</xref>.
  3746. </t>
  3747. <section anchor="iana-alpn" title="Registration of HTTP/2 Identification Strings">
  3748. <t>
  3749. This document creates two registrations for the identification of HTTP/2 in the
  3750. "Application Layer Protocol Negotiation (ALPN) Protocol IDs" registry established in <xref
  3751. target="TLS-ALPN"/>.
  3752. </t>
  3753. <t>
  3754. The "h2" string identifies HTTP/2 when used over TLS:
  3755. <list style="hanging">
  3756. <t hangText="Protocol:">HTTP/2 over TLS</t>
  3757. <t hangText="Identification Sequence:">0x68 0x32 ("h2")</t>
  3758. <t hangText="Specification:">This document</t>
  3759. </list>
  3760. </t>
  3761. <t>
  3762. The "h2c" string identifies HTTP/2 when used over cleartext TCP:
  3763. <list style="hanging">
  3764. <t hangText="Protocol:">HTTP/2 over TCP</t>
  3765. <t hangText="Identification Sequence:">0x68 0x32 0x63 ("h2c")</t>
  3766. <t hangText="Specification:">This document</t>
  3767. </list>
  3768. </t>
  3769. </section>
  3770. <section anchor="iana-frames" title="Frame Type Registry">
  3771. <t>
  3772. This document establishes a registry for HTTP/2 frame type codes. The "HTTP/2 Frame
  3773. Type" registry manages an 8-bit space. The "HTTP/2 Frame Type" registry operates under
  3774. either of the <xref target="RFC5226">"IETF Review" or "IESG Approval" policies</xref> for
  3775. values between 0x00 and 0xef, with values between 0xf0 and 0xff being reserved for
  3776. experimental use.
  3777. </t>
  3778. <t>
  3779. New entries in this registry require the following information:
  3780. <list style="hanging">
  3781. <t hangText="Frame Type:">
  3782. A name or label for the frame type.
  3783. </t>
  3784. <t hangText="Code:">
  3785. The 8-bit code assigned to the frame type.
  3786. </t>
  3787. <t hangText="Specification:">
  3788. A reference to a specification that includes a description of the frame layout,
  3789. it's semantics and flags that the frame type uses, including any parts of the frame
  3790. that are conditionally present based on the value of flags.
  3791. </t>
  3792. </list>
  3793. </t>
  3794. <t>
  3795. The entries in the following table are registered by this document.
  3796. </t>
  3797. <texttable align="left" suppress-title="true">
  3798. <ttcol>Frame Type</ttcol>
  3799. <ttcol>Code</ttcol>
  3800. <ttcol>Section</ttcol>
  3801. <c>DATA</c><c>0x0</c><c><xref target="DATA"/></c>
  3802. <c>HEADERS</c><c>0x1</c><c><xref target="HEADERS"/></c>
  3803. <c>PRIORITY</c><c>0x2</c><c><xref target="PRIORITY"/></c>
  3804. <c>RST_STREAM</c><c>0x3</c><c><xref target="RST_STREAM"/></c>
  3805. <c>SETTINGS</c><c>0x4</c><c><xref target="SETTINGS"/></c>
  3806. <c>PUSH_PROMISE</c><c>0x5</c><c><xref target="PUSH_PROMISE"/></c>
  3807. <c>PING</c><c>0x6</c><c><xref target="PING"/></c>
  3808. <c>GOAWAY</c><c>0x7</c><c><xref target="GOAWAY"/></c>
  3809. <c>WINDOW_UPDATE</c><c>0x8</c><c><xref target="WINDOW_UPDATE"/></c>
  3810. <c>CONTINUATION</c><c>0x9</c><c><xref target="CONTINUATION"/></c>
  3811. </texttable>
  3812. </section>
  3813. <section anchor="iana-settings" title="Settings Registry">
  3814. <t>
  3815. This document establishes a registry for HTTP/2 settings. The "HTTP/2 Settings" registry
  3816. manages a 16-bit space. The "HTTP/2 Settings" registry operates under the <xref
  3817. target="RFC5226">"Expert Review" policy</xref> for values in the range from 0x0000 to
  3818. 0xefff, with values between and 0xf000 and 0xffff being reserved for experimental use.
  3819. </t>
  3820. <t>
  3821. New registrations are advised to provide the following information:
  3822. <list style="hanging">
  3823. <t hangText="Name:">
  3824. A symbolic name for the setting. Specifying a setting name is optional.
  3825. </t>
  3826. <t hangText="Code:">
  3827. The 16-bit code assigned to the setting.
  3828. </t>
  3829. <t hangText="Initial Value:">
  3830. An initial value for the setting.
  3831. </t>
  3832. <t hangText="Specification:">
  3833. An optional reference to a specification that describes the use of the setting.
  3834. </t>
  3835. </list>
  3836. </t>
  3837. <t>
  3838. An initial set of setting registrations can be found in <xref target="SettingValues"/>.
  3839. </t>
  3840. <texttable align="left" suppress-title="true">
  3841. <ttcol>Name</ttcol>
  3842. <ttcol>Code</ttcol>
  3843. <ttcol>Initial Value</ttcol>
  3844. <ttcol>Specification</ttcol>
  3845. <c>HEADER_TABLE_SIZE</c>
  3846. <c>0x1</c><c>4096</c><c><xref target="SettingValues"/></c>
  3847. <c>ENABLE_PUSH</c>
  3848. <c>0x2</c><c>1</c><c><xref target="SettingValues"/></c>
  3849. <c>MAX_CONCURRENT_STREAMS</c>
  3850. <c>0x3</c><c>(infinite)</c><c><xref target="SettingValues"/></c>
  3851. <c>INITIAL_WINDOW_SIZE</c>
  3852. <c>0x4</c><c>65535</c><c><xref target="SettingValues"/></c>
  3853. <c>MAX_FRAME_SIZE</c>
  3854. <c>0x5</c><c>16384</c><c><xref target="SettingValues"/></c>
  3855. <c>MAX_HEADER_LIST_SIZE</c>
  3856. <c>0x6</c><c>(infinite)</c><c><xref target="SettingValues"/></c>
  3857. </texttable>
  3858. </section>
  3859. <section anchor="iana-errors" title="Error Code Registry">
  3860. <t>
  3861. This document establishes a registry for HTTP/2 error codes. The "HTTP/2 Error Code"
  3862. registry manages a 32-bit space. The "HTTP/2 Error Code" registry operates under the
  3863. <xref target="RFC5226">"Expert Review" policy</xref>.
  3864. </t>
  3865. <t>
  3866. Registrations for error codes are required to include a description of the error code. An
  3867. expert reviewer is advised to examine new registrations for possible duplication with
  3868. existing error codes. Use of existing registrations is to be encouraged, but not
  3869. mandated.
  3870. </t>
  3871. <t>
  3872. New registrations are advised to provide the following information:
  3873. <list style="hanging">
  3874. <t hangText="Name:">
  3875. A name for the error code. Specifying an error code name is optional.
  3876. </t>
  3877. <t hangText="Code:">
  3878. The 32-bit error code value.
  3879. </t>
  3880. <t hangText="Description:">
  3881. A brief description of the error code semantics, longer if no detailed specification
  3882. is provided.
  3883. </t>
  3884. <t hangText="Specification:">
  3885. An optional reference for a specification that defines the error code.
  3886. </t>
  3887. </list>
  3888. </t>
  3889. <t>
  3890. The entries in the following table are registered by this document.
  3891. </t>
  3892. <texttable align="left" suppress-title="true">
  3893. <ttcol>Name</ttcol>
  3894. <ttcol>Code</ttcol>
  3895. <ttcol>Description</ttcol>
  3896. <ttcol>Specification</ttcol>
  3897. <c>NO_ERROR</c><c>0x0</c>
  3898. <c>Graceful shutdown</c>
  3899. <c><xref target="ErrorCodes"/></c>
  3900. <c>PROTOCOL_ERROR</c><c>0x1</c>
  3901. <c>Protocol error detected</c>
  3902. <c><xref target="ErrorCodes"/></c>
  3903. <c>INTERNAL_ERROR</c><c>0x2</c>
  3904. <c>Implementation fault</c>
  3905. <c><xref target="ErrorCodes"/></c>
  3906. <c>FLOW_CONTROL_ERROR</c><c>0x3</c>
  3907. <c>Flow control limits exceeded</c>
  3908. <c><xref target="ErrorCodes"/></c>
  3909. <c>SETTINGS_TIMEOUT</c><c>0x4</c>
  3910. <c>Settings not acknowledged</c>
  3911. <c><xref target="ErrorCodes"/></c>
  3912. <c>STREAM_CLOSED</c><c>0x5</c>
  3913. <c>Frame received for closed stream</c>
  3914. <c><xref target="ErrorCodes"/></c>
  3915. <c>FRAME_SIZE_ERROR</c><c>0x6</c>
  3916. <c>Frame size incorrect</c>
  3917. <c><xref target="ErrorCodes"/></c>
  3918. <c>REFUSED_STREAM</c><c>0x7</c>
  3919. <c>Stream not processed</c>
  3920. <c><xref target="ErrorCodes"/></c>
  3921. <c>CANCEL</c><c>0x8</c>
  3922. <c>Stream cancelled</c>
  3923. <c><xref target="ErrorCodes"/></c>
  3924. <c>COMPRESSION_ERROR</c><c>0x9</c>
  3925. <c>Compression state not updated</c>
  3926. <c><xref target="ErrorCodes"/></c>
  3927. <c>CONNECT_ERROR</c><c>0xa</c>
  3928. <c>TCP connection error for CONNECT method</c>
  3929. <c><xref target="ErrorCodes"/></c>
  3930. <c>ENHANCE_YOUR_CALM</c><c>0xb</c>
  3931. <c>Processing capacity exceeded</c>
  3932. <c><xref target="ErrorCodes"/></c>
  3933. <c>INADEQUATE_SECURITY</c><c>0xc</c>
  3934. <c>Negotiated TLS parameters not acceptable</c>
  3935. <c><xref target="ErrorCodes"/></c>
  3936. </texttable>
  3937. </section>
  3938. <section title="HTTP2-Settings Header Field Registration">
  3939. <t>
  3940. This section registers the <spanx style="verb">HTTP2-Settings</spanx> header field in the
  3941. <xref target="BCP90">Permanent Message Header Field Registry</xref>.
  3942. <list style="hanging">
  3943. <t hangText="Header field name:">
  3944. HTTP2-Settings
  3945. </t>
  3946. <t hangText="Applicable protocol:">
  3947. http
  3948. </t>
  3949. <t hangText="Status:">
  3950. standard
  3951. </t>
  3952. <t hangText="Author/Change controller:">
  3953. IETF
  3954. </t>
  3955. <t hangText="Specification document(s):">
  3956. <xref target="Http2SettingsHeader"/> of this document
  3957. </t>
  3958. <t hangText="Related information:">
  3959. This header field is only used by an HTTP/2 client for Upgrade-based negotiation.
  3960. </t>
  3961. </list>
  3962. </t>
  3963. </section>
  3964. <section title="PRI Method Registration">
  3965. <t>
  3966. This section registers the <spanx style="verb">PRI</spanx> method in the HTTP Method
  3967. Registry (<xref target="RFC7231" x:fmt="," x:rel="#method.registry"/>).
  3968. <list style="hanging">
  3969. <t hangText="Method Name:">
  3970. PRI
  3971. </t>
  3972. <t hangText="Safe">
  3973. No
  3974. </t>
  3975. <t hangText="Idempotent">
  3976. No
  3977. </t>
  3978. <t hangText="Specification document(s)">
  3979. <xref target="ConnectionHeader"/> of this document
  3980. </t>
  3981. <t hangText="Related information:">
  3982. This method is never used by an actual client. This method will appear to be used
  3983. when an HTTP/1.1 server or intermediary attempts to parse an HTTP/2 connection
  3984. preface.
  3985. </t>
  3986. </list>
  3987. </t>
  3988. </section>
  3989. <section title="The 421 (Misdirected Request) HTTP Status Code"
  3990. anchor="iana-MisdirectedRequest">
  3991. <t>
  3992. This document registers the 421 (Misdirected Request) HTTP Status code in the Hypertext
  3993. Transfer Protocol (HTTP) Status Code Registry (<xref target="RFC7231" x:fmt=","
  3994. x:rel="#status.code.registry"/>).
  3995. </t>
  3996. <t>
  3997. <list style="hanging">
  3998. <t hangText="Status Code:">
  3999. 421
  4000. </t>
  4001. <t hangText="Short Description:">
  4002. Misdirected Request
  4003. </t>
  4004. <t hangText="Specification:">
  4005. <xref target="MisdirectedRequest"/> of this document
  4006. </t>
  4007. </list>
  4008. </t>
  4009. </section>
  4010. </section>
  4011. <section title="Acknowledgements">
  4012. <t>
  4013. This document includes substantial input from the following individuals:
  4014. <list style="symbols">
  4015. <t>
  4016. Adam Langley, Wan-Teh Chang, Jim Morrison, Mark Nottingham, Alyssa Wilk, Costin
  4017. Manolache, William Chan, Vitaliy Lvin, Joe Chan, Adam Barth, Ryan Hamilton, Gavin
  4018. Peters, Kent Alstad, Kevin Lindsay, Paul Amer, Fan Yang, Jonathan Leighton (SPDY
  4019. contributors).
  4020. </t>
  4021. <t>
  4022. Gabriel Montenegro and Willy Tarreau (Upgrade mechanism).
  4023. </t>
  4024. <t>
  4025. William Chan, Salvatore Loreto, Osama Mazahir, Gabriel Montenegro, Jitu Padhye, Roberto
  4026. Peon, Rob Trace (Flow control).
  4027. </t>
  4028. <t>
  4029. Mike Bishop (Extensibility).
  4030. </t>
  4031. <t>
  4032. Mark Nottingham, Julian Reschke, James Snell, Jeff Pinner, Mike Bishop, Herve Ruellan
  4033. (Substantial editorial contributions).
  4034. </t>
  4035. <t>
  4036. Kari Hurtta, Tatsuhiro Tsujikawa, Greg Wilkins, Poul-Henning Kamp.
  4037. </t>
  4038. <t>
  4039. Alexey Melnikov was an editor of this document during 2013.
  4040. </t>
  4041. <t>
  4042. A substantial proportion of Martin's contribution was supported by Microsoft during his
  4043. employment there.
  4044. </t>
  4045. </list>
  4046. </t>
  4047. </section>
  4048. </middle>
  4049. <back>
  4050. <references title="Normative References">
  4051. <reference anchor="COMPRESSION">
  4052. <front>
  4053. <title>HPACK - Header Compression for HTTP/2</title>
  4054. <author initials="H." surname="Ruellan" fullname="Herve Ruellan"/>
  4055. <author initials="R." surname="Peon" fullname="Roberto Peon"/>
  4056. <date month="July" year="2014" />
  4057. </front>
  4058. <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-header-compression-09" />
  4059. <x:source href="refs/draft-ietf-httpbis-header-compression-09.xml"/>
  4060. </reference>
  4061. <reference anchor="TCP">
  4062. <front>
  4063. <title abbrev="Transmission Control Protocol">
  4064. Transmission Control Protocol
  4065. </title>
  4066. <author initials="J." surname="Postel" fullname="Jon Postel">
  4067. <organization>University of Southern California (USC)/Information Sciences
  4068. Institute</organization>
  4069. </author>
  4070. <date year="1981" month="September" />
  4071. </front>
  4072. <seriesInfo name="STD" value="7" />
  4073. <seriesInfo name="RFC" value="793" />
  4074. </reference>
  4075. <reference anchor="RFC2119">
  4076. <front>
  4077. <title>
  4078. Key words for use in RFCs to Indicate Requirement Levels
  4079. </title>
  4080. <author initials="S." surname="Bradner" fullname="Scott Bradner">
  4081. <organization>Harvard University</organization>
  4082. <address><email>sob@harvard.edu</email></address>
  4083. </author>
  4084. <date month="March" year="1997"/>
  4085. </front>
  4086. <seriesInfo name="BCP" value="14"/>
  4087. <seriesInfo name="RFC" value="2119"/>
  4088. </reference>
  4089. <reference anchor="RFC2818">
  4090. <front>
  4091. <title>
  4092. HTTP Over TLS
  4093. </title>
  4094. <author initials="E." surname="Rescorla" fullname="Eric Rescorla"/>
  4095. <date month="May" year="2000"/>
  4096. </front>
  4097. <seriesInfo name="RFC" value="2818"/>
  4098. </reference>
  4099. <reference anchor="RFC3986">
  4100. <front>
  4101. <title abbrev="URI Generic Syntax">Uniform Resource Identifier (URI): Generic
  4102. Syntax</title>
  4103. <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee"></author>
  4104. <author initials="R." surname="Fielding" fullname="Roy T. Fielding"></author>
  4105. <author initials="L." surname="Masinter" fullname="Larry Masinter"></author>
  4106. <date year="2005" month="January" />
  4107. </front>
  4108. <seriesInfo name="STD" value="66" />
  4109. <seriesInfo name="RFC" value="3986" />
  4110. </reference>
  4111. <reference anchor="RFC4648">
  4112. <front>
  4113. <title>The Base16, Base32, and Base64 Data Encodings</title>
  4114. <author fullname="S. Josefsson" initials="S." surname="Josefsson"/>
  4115. <date year="2006" month="October"/>
  4116. </front>
  4117. <seriesInfo value="4648" name="RFC"/>
  4118. </reference>
  4119. <reference anchor="RFC5226">
  4120. <front>
  4121. <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
  4122. <author initials="T." surname="Narten" fullname="T. Narten"/>
  4123. <author initials="H." surname="Alvestrand" fullname="H. Alvestrand"/>
  4124. <date year="2008" month="May" />
  4125. </front>
  4126. <seriesInfo name="BCP" value="26" />
  4127. <seriesInfo name="RFC" value="5226" />
  4128. </reference>
  4129. <reference anchor="RFC5234">
  4130. <front>
  4131. <title>Augmented BNF for Syntax Specifications: ABNF</title>
  4132. <author initials="D." surname="Crocker" fullname="D. Crocker"/>
  4133. <author initials="P." surname="Overell" fullname="P. Overell"/>
  4134. <date year="2008" month="January" />
  4135. </front>
  4136. <seriesInfo name="STD" value="68" />
  4137. <seriesInfo name="RFC" value="5234" />
  4138. </reference>
  4139. <reference anchor="TLS12">
  4140. <front>
  4141. <title>The Transport Layer Security (TLS) Protocol Version 1.2</title>
  4142. <author initials="T." surname="Dierks" fullname="Tim Dierks"/>
  4143. <author initials="E." surname="Rescorla" fullname="Eric Rescorla"/>
  4144. <date year="2008" month="August" />
  4145. </front>
  4146. <seriesInfo name="RFC" value="5246" />
  4147. </reference>
  4148. <reference anchor="TLS-EXT">
  4149. <front>
  4150. <title>
  4151. Transport Layer Security (TLS) Extensions: Extension Definitions
  4152. </title>
  4153. <author initials="D." surname="Eastlake" fullname="D. Eastlake"/>
  4154. <date year="2011" month="January"/>
  4155. </front>
  4156. <seriesInfo name="RFC" value="6066"/>
  4157. </reference>
  4158. <reference anchor="TLS-ALPN">
  4159. <front>
  4160. <title>Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension</title>
  4161. <author initials="S." surname="Friedl" fullname="Stephan Friedl"></author>
  4162. <author initials="A." surname="Popov" fullname="Andrei Popov"></author>
  4163. <author initials="A." surname="Langley" fullname="Adam Langley"></author>
  4164. <author initials="E." surname="Stephan" fullname="Emile Stephan"></author>
  4165. <date month="July" year="2014" />
  4166. </front>
  4167. <seriesInfo name="RFC" value="7301" />
  4168. </reference>
  4169. <reference anchor="TLS-ECDHE">
  4170. <front>
  4171. <title>
  4172. TLS Elliptic Curve Cipher Suites with SHA-256/384 and AES Galois
  4173. Counter Mode (GCM)
  4174. </title>
  4175. <author initials="E." surname="Rescorla" fullname="E. Rescorla"/>
  4176. <date year="2008" month="August" />
  4177. </front>
  4178. <seriesInfo name="RFC" value="5289" />
  4179. </reference>
  4180. <reference anchor="FIPS186">
  4181. <front>
  4182. <title>
  4183. Digital Signature Standard (DSS)
  4184. </title>
  4185. <author><organization>NIST</organization></author>
  4186. <date year="2013" month="July" />
  4187. </front>
  4188. <seriesInfo name="FIPS" value="PUB 186-4" />
  4189. </reference>
  4190. <reference anchor="RFC7230">
  4191. <front>
  4192. <title>
  4193. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
  4194. <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
  4195. <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
  4196. <address><email>fielding@gbiv.com</email></address>
  4197. </author>
  4198. <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
  4199. <organization abbrev="greenbytes">greenbytes GmbH</organization>
  4200. <address><email>julian.reschke@greenbytes.de</email></address>
  4201. </author>
  4202. <date month="June" year="2014" />
  4203. </front>
  4204. <seriesInfo name="RFC" value="7230" />
  4205. <x:source href="refs/rfc7230.xml"
  4206. basename="https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230"/>
  4207. </reference>
  4208. <reference anchor="RFC7231">
  4209. <front>
  4210. <title>
  4211. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
  4212. <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
  4213. <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
  4214. <address><email>fielding@gbiv.com</email></address>
  4215. </author>
  4216. <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
  4217. <organization abbrev="greenbytes">greenbytes GmbH</organization>
  4218. <address><email>julian.reschke@greenbytes.de</email></address>
  4219. </author>
  4220. <date month="June" year="2014" />
  4221. </front>
  4222. <seriesInfo name="RFC" value="7231" />
  4223. <x:source href="refs/rfc7231.xml"
  4224. basename="https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7231"/>
  4225. </reference>
  4226. <reference anchor="RFC7232">
  4227. <front>
  4228. <title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
  4229. <author fullname="Roy T. Fielding" initials="R." role="editor" surname="Fielding">
  4230. <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
  4231. <address><email>fielding@gbiv.com</email></address>
  4232. </author>
  4233. <author fullname="Julian F. Reschke" initials="J. F." role="editor" surname="Reschke">
  4234. <organization abbrev="greenbytes">greenbytes GmbH</organization>
  4235. <address><email>julian.reschke@greenbytes.de</email></address>
  4236. </author>
  4237. <date month="June" year="2014" />
  4238. </front>
  4239. <seriesInfo name="RFC" value="7232" />
  4240. </reference>
  4241. <reference anchor="RFC7233">
  4242. <front>
  4243. <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
  4244. <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
  4245. <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
  4246. <address><email>fielding@gbiv.com</email></address>
  4247. </author>
  4248. <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
  4249. <organization abbrev="W3C">World Wide Web Consortium</organization>
  4250. <address><email>ylafon@w3.org</email></address>
  4251. </author>
  4252. <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
  4253. <organization abbrev="greenbytes">greenbytes GmbH</organization>
  4254. <address><email>julian.reschke@greenbytes.de</email></address>
  4255. </author>
  4256. <date month="June" year="2014" />
  4257. </front>
  4258. <seriesInfo name="RFC" value="7233" />
  4259. </reference>
  4260. <reference anchor="RFC7234">
  4261. <front>
  4262. <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
  4263. <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
  4264. <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
  4265. <address><email>fielding@gbiv.com</email></address>
  4266. </author>
  4267. <author fullname="Mark Nottingham" initials="M." role="editor" surname="Nottingham">
  4268. <organization>Akamai</organization>
  4269. <address><email>mnot@mnot.net</email></address>
  4270. </author>
  4271. <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
  4272. <organization abbrev="greenbytes">greenbytes GmbH</organization>
  4273. <address><email>julian.reschke@greenbytes.de</email></address>
  4274. </author>
  4275. <date month="June" year="2014" />
  4276. </front>
  4277. <seriesInfo name="RFC" value="7234"/>
  4278. <x:source href="refs/rfc7234.xml"
  4279. basename="https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7234"/>
  4280. </reference>
  4281. <reference anchor="RFC7235">
  4282. <front>
  4283. <title>Hypertext Transfer Protocol (HTTP/1.1): Authentication</title>
  4284. <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
  4285. <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
  4286. <address><email>fielding@gbiv.com</email></address>
  4287. </author>
  4288. <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
  4289. <organization abbrev="greenbytes">greenbytes GmbH</organization>
  4290. <address><email>julian.reschke@greenbytes.de</email></address>
  4291. </author>
  4292. <date month="June" year="2014" />
  4293. </front>
  4294. <seriesInfo name="RFC" value="7235"/>
  4295. <x:source href="refs/rfc7235.xml"
  4296. basename="https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7235"/>
  4297. </reference>
  4298. <reference anchor="COOKIE">
  4299. <front>
  4300. <title>HTTP State Management Mechanism</title>
  4301. <author initials="A." surname="Barth" fullname="A. Barth"/>
  4302. <date year="2011" month="April" />
  4303. </front>
  4304. <seriesInfo name="RFC" value="6265" />
  4305. </reference>
  4306. </references>
  4307. <references title="Informative References">
  4308. <reference anchor="RFC1323">
  4309. <front>
  4310. <title>
  4311. TCP Extensions for High Performance
  4312. </title>
  4313. <author initials="V." surname="Jacobson" fullname="Van Jacobson"></author>
  4314. <author initials="B." surname="Braden" fullname="Bob Braden"></author>
  4315. <author initials="D." surname="Borman" fullname="Dave Borman"></author>
  4316. <date year="1992" month="May" />
  4317. </front>
  4318. <seriesInfo name="RFC" value="1323" />
  4319. </reference>
  4320. <reference anchor="RFC3749">
  4321. <front>
  4322. <title>Transport Layer Security Protocol Compression Methods</title>
  4323. <author initials="S." surname="Hollenbeck" fullname="S. Hollenbeck"/>
  4324. <date year="2004" month="May" />
  4325. </front>
  4326. <seriesInfo name="RFC" value="3749" />
  4327. </reference>
  4328. <reference anchor="RFC6585">
  4329. <front>
  4330. <title>Additional HTTP Status Codes</title>
  4331. <author initials="M." surname="Nottingham" fullname="Mark Nottingham"/>
  4332. <author initials="R." surname="Fielding" fullname="Roy Fielding"/>
  4333. <date year="2012" month="April" />
  4334. </front>
  4335. <seriesInfo name="RFC" value="6585" />
  4336. </reference>
  4337. <reference anchor="RFC4492">
  4338. <front>
  4339. <title>
  4340. Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS)
  4341. </title>
  4342. <author initials="S." surname="Blake-Wilson" fullname="S. Blake-Wilson"/>
  4343. <author initials="N." surname="Bolyard" fullname="N. Bolyard"/>
  4344. <author initials="V." surname="Gupta" fullname="V. Gupta"/>
  4345. <author initials="C." surname="Hawk" fullname="C. Hawk"/>
  4346. <author initials="B." surname="Moeller" fullname="B. Moeller"/>
  4347. <date year="2006" month="May" />
  4348. </front>
  4349. <seriesInfo name="RFC" value="4492" />
  4350. </reference>
  4351. <reference anchor="RFC5288">
  4352. <front>
  4353. <title>
  4354. AES Galois Counter Mode (GCM) Cipher Suites for TLS
  4355. </title>
  4356. <author initials="J." surname="Salowey" fullname="J. Salowey"/>
  4357. <author initials="A." surname="Choudhury" fullname="A. Choudhury"/>
  4358. <author initials="D." surname="McGrew" fullname="D. McGrew"/>
  4359. <date year="2008" month="August" />
  4360. </front>
  4361. <seriesInfo name="RFC" value="5288" />
  4362. </reference>
  4363. <reference anchor='HTML5'
  4364. target='http://www.w3.org/TR/2014/CR-html5-20140731/'>
  4365. <front>
  4366. <title>HTML5</title>
  4367. <author fullname='Robin Berjon' surname='Berjon' initials='R.'/>
  4368. <author fullname='Steve Faulkner' surname='Faulkner' initials='S.'/>
  4369. <author fullname='Travis Leithead' surname='Leithead' initials='T.'/>
  4370. <author fullname='Erika Doyle Navara' surname='Doyle Navara' initials='E.'/>
  4371. <author fullname='Edward O&apos;Connor' surname='O&apos;Connor' initials='E.'/>
  4372. <author fullname='Silvia Pfeiffer' surname='Pfeiffer' initials='S.'/>
  4373. <date year='2014' month='July' day='31'/>
  4374. </front>
  4375. <seriesInfo name='W3C Candidate Recommendation' value='CR-html5-20140731'/>
  4376. <annotation>
  4377. Latest version available at
  4378. <eref target='http://www.w3.org/TR/html5/'/>.
  4379. </annotation>
  4380. </reference>
  4381. <reference anchor="TALKING" target="http://w2spconf.com/2011/papers/websocket.pdf">
  4382. <front>
  4383. <title>
  4384. Talking to Yourself for Fun and Profit
  4385. </title>
  4386. <author initials="L-S." surname="Huang"/>
  4387. <author initials="E." surname="Chen"/>
  4388. <author initials="A." surname="Barth"/>
  4389. <author initials="E." surname="Rescorla"/>
  4390. <author initials="C." surname="Jackson"/>
  4391. <date year="2011" />
  4392. </front>
  4393. </reference>
  4394. <reference anchor="BREACH"
  4395. target="http://breachattack.com/resources/BREACH%20-%20SSL,%20gone%20in%2030%20seconds.pdf">
  4396. <front>
  4397. <title>
  4398. BREACH: Reviving the CRIME Attack
  4399. </title>
  4400. <author initials="Y." surname="Gluck"/>
  4401. <author initials="N." surname="Harris"/>
  4402. <author initials="A." surname="Prado"/>
  4403. <date year="2013" month="July" day="12"/>
  4404. </front>
  4405. </reference>
  4406. <reference anchor="BCP90">
  4407. <front>
  4408. <title>Registration Procedures for Message Header Fields</title>
  4409. <author initials="G." surname="Klyne" fullname="G. Klyne">
  4410. <organization>Nine by Nine</organization>
  4411. <address><email>GK-IETF@ninebynine.org</email></address>
  4412. </author>
  4413. <author initials="M." surname="Nottingham" fullname="M. Nottingham">
  4414. <organization>BEA Systems</organization>
  4415. <address><email>mnot@pobox.com</email></address>
  4416. </author>
  4417. <author initials="J." surname="Mogul" fullname="J. Mogul">
  4418. <organization>HP Labs</organization>
  4419. <address><email>JeffMogul@acm.org</email></address>
  4420. </author>
  4421. <date year="2004" month="September" />
  4422. </front>
  4423. <seriesInfo name="BCP" value="90" />
  4424. <seriesInfo name="RFC" value="3864" />
  4425. </reference>
  4426. <reference anchor="TLSBCP">
  4427. <front>
  4428. <title>Recommendations for Secure Use of TLS and DTLS</title>
  4429. <author initials="Y" surname="Sheffer" fullname="Yaron Sheffer">
  4430. <organization />
  4431. </author>
  4432. <author initials="R" surname="Holz" fullname="Ralph Holz">
  4433. <organization />
  4434. </author>
  4435. <author initials="P" surname="Saint-Andre" fullname="Peter Saint-Andre">
  4436. <organization />
  4437. </author>
  4438. <date month="June" day="23" year="2014" />
  4439. </front>
  4440. <seriesInfo name="Internet-Draft" value="draft-ietf-uta-tls-bcp-01" />
  4441. </reference>
  4442. <reference anchor="ALT-SVC">
  4443. <front>
  4444. <title>
  4445. HTTP Alternative Services
  4446. </title>
  4447. <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
  4448. <organization>Akamai</organization>
  4449. </author>
  4450. <author initials="P." surname="McManus" fullname="Patrick McManus">
  4451. <organization>Mozilla</organization>
  4452. </author>
  4453. <author initials="J." surname="Reschke" fullname="Julian Reschke">
  4454. <organization>greenbytes</organization>
  4455. </author>
  4456. <date year="2014" month="April"/>
  4457. </front>
  4458. <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-alt-svc-02"/>
  4459. <x:source href="refs/draft-ietf-httpbis-alt-svc-02.xml"/>
  4460. </reference>
  4461. </references>
  4462. <section title="Change Log" anchor="change.log">
  4463. <t>
  4464. This section is to be removed by RFC Editor before publication.
  4465. </t>
  4466. <section title="Since draft-ietf-httpbis-http2-14" anchor="changes.since.draft-ietf-httpbis-http2-14">
  4467. <t>
  4468. Renamed Not Authoritative status code to Misdirected Request.
  4469. </t>
  4470. </section>
  4471. <section title="Since draft-ietf-httpbis-http2-13" anchor="changes.since.draft-ietf-httpbis-http2-13">
  4472. <t>
  4473. Pseudo-header fields are now required to appear strictly before regular ones.
  4474. </t>
  4475. <t>
  4476. Restored 1xx series status codes, except 101.
  4477. </t>
  4478. <t>
  4479. Changed frame length field 24-bits. Expanded frame header to 9 octets. Added a setting
  4480. to limit the damage.
  4481. </t>
  4482. <t>
  4483. Added a setting to advise peers of header set size limits.
  4484. </t>
  4485. <t>
  4486. Removed segments.
  4487. </t>
  4488. <t>
  4489. Made non-semantic-bearing <x:ref>HEADERS</x:ref> frames illegal in the HTTP mapping.
  4490. </t>
  4491. </section>
  4492. <section title="Since draft-ietf-httpbis-http2-12" anchor="changes.since.draft-ietf-httpbis-http2-12">
  4493. <t>
  4494. Restored extensibility options.
  4495. </t>
  4496. <t>
  4497. Restricting TLS cipher suites to AEAD only.
  4498. </t>
  4499. <t>
  4500. Removing Content-Encoding requirements.
  4501. </t>
  4502. <t>
  4503. Permitting the use of <x:ref>PRIORITY</x:ref> after stream close.
  4504. </t>
  4505. <t>
  4506. Removed ALTSVC frame.
  4507. </t>
  4508. <t>
  4509. Removed BLOCKED frame.
  4510. </t>
  4511. <t>
  4512. Reducing the maximum padding size to 256 octets; removing padding from
  4513. <x:ref>CONTINUATION</x:ref> frames.
  4514. </t>
  4515. <t>
  4516. Removed per-frame GZIP compression.
  4517. </t>
  4518. </section>
  4519. <section title="Since draft-ietf-httpbis-http2-11" anchor="changes.since.draft-ietf-httpbis-http2-11">
  4520. <t>
  4521. Added BLOCKED frame (at risk).
  4522. </t>
  4523. <t>
  4524. Simplified priority scheme.
  4525. </t>
  4526. <t>
  4527. Added <x:ref>DATA</x:ref> per-frame GZIP compression.
  4528. </t>
  4529. </section>
  4530. <section title="Since draft-ietf-httpbis-http2-10" anchor="changes.since.draft-ietf-httpbis-http2-10">
  4531. <t>
  4532. Changed "connection header" to "connection preface" to avoid confusion.
  4533. </t>
  4534. <t>
  4535. Added dependency-based stream prioritization.
  4536. </t>
  4537. <t>
  4538. Added "h2c" identifier to distinguish between cleartext and secured HTTP/2.
  4539. </t>
  4540. <t>
  4541. Adding missing padding to <x:ref>PUSH_PROMISE</x:ref>.
  4542. </t>
  4543. <t>
  4544. Integrate ALTSVC frame and supporting text.
  4545. </t>
  4546. <t>
  4547. Dropping requirement on "deflate" Content-Encoding.
  4548. </t>
  4549. <t>
  4550. Improving security considerations around use of compression.
  4551. </t>
  4552. </section>
  4553. <section title="Since draft-ietf-httpbis-http2-09" anchor="changes.since.draft-ietf-httpbis-http2-09">
  4554. <t>
  4555. Adding padding for data frames.
  4556. </t>
  4557. <t>
  4558. Renumbering frame types, error codes, and settings.
  4559. </t>
  4560. <t>
  4561. Adding INADEQUATE_SECURITY error code.
  4562. </t>
  4563. <t>
  4564. Updating TLS usage requirements to 1.2; forbidding TLS compression.
  4565. </t>
  4566. <t>
  4567. Removing extensibility for frames and settings.
  4568. </t>
  4569. <t>
  4570. Changing setting identifier size.
  4571. </t>
  4572. <t>
  4573. Removing the ability to disable flow control.
  4574. </t>
  4575. <t>
  4576. Changing the protocol identification token to "h2".
  4577. </t>
  4578. <t>
  4579. Changing the use of :authority to make it optional and to allow userinfo in non-HTTP
  4580. cases.
  4581. </t>
  4582. <t>
  4583. Allowing split on 0x0 for Cookie.
  4584. </t>
  4585. <t>
  4586. Reserved PRI method in HTTP/1.1 to avoid possible future collisions.
  4587. </t>
  4588. </section>
  4589. <section title="Since draft-ietf-httpbis-http2-08" anchor="changes.since.draft-ietf-httpbis-http2-08">
  4590. <t>
  4591. Added cookie crumbling for more efficient header compression.
  4592. </t>
  4593. <t>
  4594. Added header field ordering with the value-concatenation mechanism.
  4595. </t>
  4596. </section>
  4597. <section title="Since draft-ietf-httpbis-http2-07" anchor="changes.since.draft-ietf-httpbis-http2-07">
  4598. <t>
  4599. Marked draft for implementation.
  4600. </t>
  4601. </section>
  4602. <section title="Since draft-ietf-httpbis-http2-06" anchor="changes.since.draft-ietf-httpbis-http2-06">
  4603. <t>
  4604. Adding definition for CONNECT method.
  4605. </t>
  4606. <t>
  4607. Constraining the use of push to safe, cacheable methods with no request body.
  4608. </t>
  4609. <t>
  4610. Changing from :host to :authority to remove any potential confusion.
  4611. </t>
  4612. <t>
  4613. Adding setting for header compression table size.
  4614. </t>
  4615. <t>
  4616. Adding settings acknowledgement.
  4617. </t>
  4618. <t>
  4619. Removing unnecessary and potentially problematic flags from CONTINUATION.
  4620. </t>
  4621. <t>
  4622. Added denial of service considerations.
  4623. </t>
  4624. </section>
  4625. <section title="Since draft-ietf-httpbis-http2-05" anchor="changes.since.draft-ietf-httpbis-http2-05">
  4626. <t>
  4627. Marking the draft ready for implementation.
  4628. </t>
  4629. <t>
  4630. Renumbering END_PUSH_PROMISE flag.
  4631. </t>
  4632. <t>
  4633. Editorial clarifications and changes.
  4634. </t>
  4635. </section>
  4636. <section title="Since draft-ietf-httpbis-http2-04" anchor="changes.since.draft-ietf-httpbis-http2-04">
  4637. <t>
  4638. Added CONTINUATION frame for HEADERS and PUSH_PROMISE.
  4639. </t>
  4640. <t>
  4641. PUSH_PROMISE is no longer implicitly prohibited if SETTINGS_MAX_CONCURRENT_STREAMS is
  4642. zero.
  4643. </t>
  4644. <t>
  4645. Push expanded to allow all safe methods without a request body.
  4646. </t>
  4647. <t>
  4648. Clarified the use of HTTP header fields in requests and responses. Prohibited HTTP/1.1
  4649. hop-by-hop header fields.
  4650. </t>
  4651. <t>
  4652. Requiring that intermediaries not forward requests with missing or illegal routing
  4653. :-headers.
  4654. </t>
  4655. <t>
  4656. Clarified requirements around handling different frames after stream close, stream reset
  4657. and <x:ref>GOAWAY</x:ref>.
  4658. </t>
  4659. <t>
  4660. Added more specific prohibitions for sending of different frame types in various stream
  4661. states.
  4662. </t>
  4663. <t>
  4664. Making the last received setting value the effective value.
  4665. </t>
  4666. <t>
  4667. Clarified requirements on TLS version, extension and ciphers.
  4668. </t>
  4669. </section>
  4670. <section title="Since draft-ietf-httpbis-http2-03" anchor="changes.since.draft-ietf-httpbis-http2-03">
  4671. <t>
  4672. Committed major restructuring atrocities.
  4673. </t>
  4674. <t>
  4675. Added reference to first header compression draft.
  4676. </t>
  4677. <t>
  4678. Added more formal description of frame lifecycle.
  4679. </t>
  4680. <t>
  4681. Moved END_STREAM (renamed from FINAL) back to <x:ref>HEADERS</x:ref>/<x:ref>DATA</x:ref>.
  4682. </t>
  4683. <t>
  4684. Removed HEADERS+PRIORITY, added optional priority to <x:ref>HEADERS</x:ref> frame.
  4685. </t>
  4686. <t>
  4687. Added <x:ref>PRIORITY</x:ref> frame.
  4688. </t>
  4689. </section>
  4690. <section title="Since draft-ietf-httpbis-http2-02" anchor="changes.since.draft-ietf-httpbis-http2-02">
  4691. <t>
  4692. Added continuations to frames carrying header blocks.
  4693. </t>
  4694. <t>
  4695. Replaced use of "session" with "connection" to avoid confusion with other HTTP stateful
  4696. concepts, like cookies.
  4697. </t>
  4698. <t>
  4699. Removed "message".
  4700. </t>
  4701. <t>
  4702. Switched to TLS ALPN from NPN.
  4703. </t>
  4704. <t>
  4705. Editorial changes.
  4706. </t>
  4707. </section>
  4708. <section title="Since draft-ietf-httpbis-http2-01" anchor="changes.since.draft-ietf-httpbis-http2-01">
  4709. <t>
  4710. Added IANA considerations section for frame types, error codes and settings.
  4711. </t>
  4712. <t>
  4713. Removed data frame compression.
  4714. </t>
  4715. <t>
  4716. Added <x:ref>PUSH_PROMISE</x:ref>.
  4717. </t>
  4718. <t>
  4719. Added globally applicable flags to framing.
  4720. </t>
  4721. <t>
  4722. Removed zlib-based header compression mechanism.
  4723. </t>
  4724. <t>
  4725. Updated references.
  4726. </t>
  4727. <t>
  4728. Clarified stream identifier reuse.
  4729. </t>
  4730. <t>
  4731. Removed CREDENTIALS frame and associated mechanisms.
  4732. </t>
  4733. <t>
  4734. Added advice against naive implementation of flow control.
  4735. </t>
  4736. <t>
  4737. Added session header section.
  4738. </t>
  4739. <t>
  4740. Restructured frame header. Removed distinction between data and control frames.
  4741. </t>
  4742. <t>
  4743. Altered flow control properties to include session-level limits.
  4744. </t>
  4745. <t>
  4746. Added note on cacheability of pushed resources and multiple tenant servers.
  4747. </t>
  4748. <t>
  4749. Changed protocol label form based on discussions.
  4750. </t>
  4751. </section>
  4752. <section title="Since draft-ietf-httpbis-http2-00" anchor="changes.since.draft-ietf-httpbis-http2-00">
  4753. <t>
  4754. Changed title throughout.
  4755. </t>
  4756. <t>
  4757. Removed section on Incompatibilities with SPDY draft#2.
  4758. </t>
  4759. <t>
  4760. Changed <x:ref>INTERNAL_ERROR</x:ref> on <x:ref>GOAWAY</x:ref> to have a value of 2 <eref
  4761. target="https://groups.google.com/forum/?fromgroups#!topic/spdy-dev/cfUef2gL3iU"/>.
  4762. </t>
  4763. <t>
  4764. Replaced abstract and introduction.
  4765. </t>
  4766. <t>
  4767. Added section on starting HTTP/2.0, including upgrade mechanism.
  4768. </t>
  4769. <t>
  4770. Removed unused references.
  4771. </t>
  4772. <t>
  4773. Added <xref target="fc-principles">flow control principles</xref> based on <eref
  4774. target="https://tools.ietf.org/html/draft-montenegro-httpbis-http2-fc-principles-01"/>.
  4775. </t>
  4776. </section>
  4777. <section title="Since draft-mbelshe-httpbis-spdy-00" anchor="changes.since.draft-mbelshe-httpbis-spdy-00">
  4778. <t>
  4779. Adopted as base for draft-ietf-httpbis-http2.
  4780. </t>
  4781. <t>
  4782. Updated authors/editors list.
  4783. </t>
  4784. <t>
  4785. Added status note.
  4786. </t>
  4787. </section>
  4788. </section>
  4789. </back>
  4790. </rfc>
  4791. <!--
  4792. vim:et:tw=100:sw=2:
  4793. -->