11 Commits
Author SHA1 Message Date
Jim Dovey f2c2534d4c More Swift-y types for HTTP/2 frame, flags, and settings. (#16)
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.
2018-08-23 14:56:20 +01:00
Cory Benfield 95b557d617 Fail writes when stream closed by rststream 2018-05-11 10:04:32 +01:00
Cory Benfield 9358a194ae Add support for PING frames 2018-05-04 14:46:42 +01:00
Cory Benfield 9b0b68e731 More expressive SETTINGS api 2018-05-03 16:23:43 +01:00
Cory Benfield 22e879d3cb Test breaching SETTINGS_MAX_CONCURRENT_STREAMS 2018-05-03 14:18:49 +01:00
Cory Benfield c937029ad4 Remove CONTINUATION (and so endHeaders).
We treat CONTINUATION frames as an implementation detail, which means the
endStream flag is also redundant. Let's remove both.
2018-05-03 10:48:54 +01:00
Cory Benfield 2cfbdb7ac5 Simple GoAway support 2018-05-02 14:42:55 +01:00
Cory Benfield ca89364e1e Don't make HTTP/2 know about request/response head 2018-04-30 11:44:08 +01:00
Cory Benfield 1ef32a0d3d Correct handling of stream IDs. 2018-04-27 15:40:18 +01:00
Cory Benfield 2044c89450 Improve HTTP2StreamChannel state handling.
Motivation:

The HTTP2StreamChannel needs to be aware of the HTTP/2 state machine,
at least at some level. This is to ensure it can map that state
machine onto the (unfortunately implicit) NIO stream state machine
and appropriately clean up resources like stream promises.

Modifications:

Lots. Added stream state tracking, refactored the frame structure,
stopped creating stream 0 as a sub-stream, and more.

Result:

We no longer crash when the curl TCP connection goes away.
2018-04-23 17:15:17 +01:00
Cory Benfield e4de5788a5 Initial support for writing DATA frames 2018-04-16 15:08:08 +01:00