bradfitz/http2 — pull request #3 by jmhodges (2014-07-31 05:39:33+00:00)
Title: add streamHandler and check for Continuation

This starts us off with a place to handle stream logic. It adds a streamHandler for managing stream-specific state. It also checks for the use of Continuation frames after a Header frame.

The streamHandler will later take care of the creation of *http.Request objects and the timing out of too slow requests (e.g. the a Header comes in, but the Continuation or Data frames expected do not) and other stream. The long term design thinking is modeled after the Netty implementation that's been open sourced (and is used in TFE). streamHandler takes the role of http2.HttpStreamDecoder and clientConn of http2.HttpConnectionHandler.

However, if you look at that code, you'll note that the Continuation check is actually in HttpConnectionHandler which is actually preferable since you only need the FrameHeaders to do it. This requires the parsing code to become more state-machine-y and for us to inject serialized bytes. That's a bigger diff and I thought this might be better off as an introductory patch. I'm willing to do that larger patch, of course.

Also informative is the [HttpFrameDecoder](https://github.com/jpinner/http2/blob/master/src/main/java/com/twitter/http2/HttpFrameDecoder.java) and [Encoder](https://github.com/jpinner/http2/blob/master/src/main/java/com/twitter/http2/HttpFrameEncoder.java) classes in jpinner's project. That code is the framing code we use in TFE and is nice and state-machine-y.