By setting up the handler in the handlerAdded hook, HTTP2Parser supports
being added dynamically in a channelRead event, after the channel has sent
the channelActive event.
Motivation:
We'd done all our development against newer copies of nghttp2, that
behaved a bit differently. We should support Ubuntu's copy, at least
while nghttp2 is relevant to us.
Modifications:
- Shimmed over a version difference.
- Fixed the tests to stop relying on differences.
- Removed the Swift 4.0.3 dockerfiles as we don't support Swift
4.0 anyway.
Result:
Users can build against Ubuntu 16.04's nghttp2 package.
Motivation:
Child channels should not activate before their parents.
Modifications:
Delay activation if the parent channel is not currently active.
Activate during channelActive, if needed.
Result:
Easier to start HTTP/2 requests
Motivation:
Due to nghttp2's weird data provider model, all trailers go through a
similar send path as data frames. This includes the fact that the data
sender can go "idle". If the data sender is idle, and the user sends
trailers, we don't bother to tell nghttp2 to ask us for more data,
so the trailers sit there forever, feeling sad.
Modifications:
- Correctly restart the data provider when sending data.
Result:
Trailers will be emitted when the stream is idle.
Motivation:
Prior to bringing in my HTTP/2 encoder/decoder, I think my implementations of HTTP/2 frame flags as `OptionSet`s and settings as an enum (i.e. existentials) make for a nicer API, and provide somewhat more information for the compiler to work with when optimizing.
Modifications:
- `HTTP2Frame.FrameFlags` is now an `OptionSet`.
- `HTTP2Frame.FramePayload` now supports all current HTTP/2 frame types, can return their on-wire identifier, and can return the set of `HTTP2Frame.FrameFlags` that the frame allows.
- `HTTP2Setting` is now an enum with associated values, and includes the SETTINGS_ENABLE_CONNECT_PROTOCOL value.
- Added `NIOHTTP2Errors.InvalidSettings` error, used when bad settings are encountered by decoder.
- Updated tests to use the new `HTTP2Setting` type.
Result:
Not a lot changes, beyond the in-memory layout of some things. All these types still have nghttp2 conversion methods, and all tests still run successfully.
Motivation:
We shouldn't just crash if the client sends bad magic.
Changes:
Send an error through the pipeline instead of crashing on bad client
magic.
Result:
fewer crashes
Motivation:
Our dead stream cache should not cause us to crash when we can have more
active streams than the entire size of the cache. These things are
at least nominally unrelated.
Modifications:
Rewrote the code to avoid asserting that we'll always be able to shrink
down to the dead cache size.
Result:
Fewer crashes
Motivation:
Long-lived connections that have many inactive streams would cause
crashes. Crashes are, in my professional opinion, less than ideal
when they occur under expected usage cases.
Modifications:
- Fixed an inverted boolean check that would discard only *active*
streams.
- Made the cached stream count configurable, removing a TODO.
- Added tests.
Result:
Fewer crashes, better software.
Motivation:
Our tests were failing as a result of the previous commit changing the
HTTP/2 lifecycle.
Modifications:
Fired channelActive in a few tests, correctly propagated
channelInactive.
Result:
Tests should pass.
Motivation:
The example server had slowly bitrotted over time: some minor fixes were
needed.
Modifications:
I fixed it!
Result:
The example server works against a basic curl command.
Motivation:
While the HTTP2StreamMultiplexer could create channels in response to
inbound request streams on the server side, there was no interface for
creating channels locally.
That would make having a HTTP/2 client kinda tricky!
Modifications:
Added HTTP2StreamMultiplexer.createStreamChannel.
Result:
Possible to write HTTP/2 clients.
Motivation:
When closing a stream channel, it must remove its channel handlers.
Modifications:
Call ChannelCore.removeHandlers on shutdown.
Result:
Handlers are removed on channel shutdown.
Motivation:
Many users of HTTP/2 will not want to interact with the HTTP/2 protocol
directly, but instead to write generic HTTP applications on top of an
abstraction layer. These codecs provide part of that abstraction layer.
Modifications:
Added more codecs, fleshed them out, wrote many tests.
Result:
Easier application writing.