Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Length = the first three bytes<br />
Read the payload based on the length.<br />
Take the appropriate action based on the frame type.<br />
end loop<br />
This is much simpler to write and maintain. It also has a second extremely significant<br />
advantage over <strong>HTTP</strong>/1’s delimited format. Go back now and see if you see it as it is<br />
core to one of <strong>HTTP</strong>/2’s key benefits. With <strong>HTTP</strong>/1 you need to send a complete<br />
request or response before you can send another. Because of <strong>HTTP</strong>/2’s framing,<br />
request and responses can be interwoven, or multiplexed. Multiplexing helps get<br />
around problems such as head of line blocking which was described in section XXX.<br />
For a description of all frames please see Appendix A.<br />
Table 3-2. <strong>HTTP</strong>/2 Frame Types<br />
Name ID Description<br />
DATA 0x0 Carries the core content for a stream<br />
HEADERS 0x1 Contains the <strong>HTTP</strong> headers and optionally priorities<br />
PRIORITY 0x2 Indicates or changes the stream priority and dependencies<br />
RST_STREAM 0x3 Allows an end point to end a stream (generally an error case)<br />
SETTINGS 0x4 Communicates connection level parameters<br />
PUSH_PROMISE 0x5 Indicates to a client that a server is about to send something<br />
PING 0x6 Test connectivity and measure round trip time (RTT)<br />
GOAWAY 0x7 Tells an end point that the peer is done accepting new streams<br />
WINDOW_UPDATE 0x8 Communicates how many bytes an end point is willing to receive ( used for flow control )<br />
CONTINUATION 0x9 Used to extend HEADER blocks.<br />
Room for Extension<br />
<strong>HTTP</strong>/2 built in the ability to handle new frame types called extension frames. This<br />
provides a mechanism for client and server implementors to experiment with new<br />
frame types without having to create a whole new protocol. Since by specification any<br />
frame that is not understood by a consumer must be discarded, new frames on the<br />
wire should not affect the core protocol. Of course, if your application is reliant on a<br />
new frame and a proxy in the middle is dropping that frame then you might run into<br />
a few problems…<br />
Streams<br />
The <strong>HTTP</strong>/2 specification defines a stream as “an independent, bidirectional<br />
sequence of frames exchanged between the client and server within an <strong>HTTP</strong>/2 connection.”<br />
You can think of a stream as a series of frames making up an individual<br />
30 | Chapter 3: The Protocol