55 Commits
Author SHA1 Message Date
Rick Newton-RogersandGeorge Barnett 335e5b5b9d Drop Swift 6.0 (#545)
Motivation:

Swift 6.0 is no longer supported, we should bump the tools version and
remove it from our CI.

Modifications:

* Bump the Swift tools version to Swift 6.1
* Remove Swift 6.0 jobs where appropriate in main.yml, pull_request.yml

Result:

Code reflects our support window.

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2026-04-07 12:14:31 +00:00
hamzahrmalik 0ba06c0251 Make NIOHPACK a product (#538)
## Motivation

- Users need to be able to create HPACKHeaders to pass into library such
as GRPC v1
- To create them, without relying on SPM weirdness, users should be
importing NIOHPACK
- To import NIOHPACK without relying on SPM weirdness, users should be
depending on NIOHPACK in Package.swift
- Users currently cannot depend on NIOHPACK in Package.swift, because
NIOHPACK is not a product

## Changes
Make NIOHPACK a product
2026-02-24 16:15:04 +00:00
Fabian FettandRick Newton-Rogers c2ba4cfbb8 Drop Swift 5.10, Use Swift 6 language mode (#525)
Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
2025-11-11 14:39:46 +00:00
Rick Newton-RogersandGeorge Barnett ee831fb9e7 Drop Swift 5.9 (#515)
Motivation:

Swift 5.9 is no longer supported, we should bump the tools version and
remove it from our CI.

Modifications:

* Bump the Swift tools version to Swift 5.10
* Remove Swift 5.9 jobs where appropriate in main.yml, pull_request.yml

Result:

Code reflects our support window.

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2025-05-07 07:59:35 +01:00
George Barnett 4281466512 Remove temporary shims (#514)
Motivation:

We added a couple of shims which were upstreamed to swift-nio and were
released in 2.82.0.

Modifications:

- Bump minimum verison of swift-nio
- Remove shims

Result:

Less code
2025-04-23 07:29:33 +01:00
George BarnettandRick Newton-Rogers 159ef997b2 Strict concurrency for tests (#507)
Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
2025-03-31 13:38:26 +01:00
George Barnett 9a582726cf Strict concurrency for perf tests and the h2 server (#509) 2025-03-31 11:31:38 +01:00
George Barnett 276b9cb73d Provide a senable view over the stream multiplexer (#506)
Motivation:

The HTTP2StreamMultiplexer isn't `Sendable`, but it has public API for
creating streams which must operate from off of the `EventLoop`.

Modifications:

- Add a `SendableView` over the multiplexer which only provides the
methods for creating streams. These are safe to call from any isolation
domain.

Result:

Can create streams from off of the EL.
2025-03-27 14:10:38 +00:00
George Barnett a7a0a9a118 Strict concurrency for NIOHPACK (#502)
Motivation:

To increase concurrency safety the NIOPHACK module should compile
without warning under strict concurrency checking.

Modifications:

- Add explicit Sendable annotations

Result:

No concurrency warnings.
2025-03-21 17:15:54 +00:00
Rick Newton-Rogers 84076bb64b Only apply standard swift settings on valid targets (#498)
Only apply standard swift settings on valid targets. The current check
ignores plugins but that is not comprehensive enough.
2025-03-07 15:06:17 +00:00
Rick Newton-Rogers 2083f5d7e8 Enable MemberImportVisibility check on all targets (#486)
Enable MemberImportVisibility check on all targets. Use a standard
string header and footer to bracket the new block for ease of updating
in the future with scripts.
2024-12-11 15:38:17 +00:00
Peter Adams 1118370ec4 Apply swift-format changes and CI (#472)
Motivation:

Standardised formatting makes the project cleaner to look at and work
on.

Modifications:

Setup swift-format with the same settings as Swift-NIO

Result:

Common formatting throughout
2024-10-29 13:09:54 +00:00
Peter Adams 31c8609808 Drop support for Swift 5.8 (#470)
Motivation:

Only the last 3 versions of Swift are supported.

Modifications:

Update the Swift tools version in Package.swift.
Remove code which can now never be compiled.
Remove legacy docker configuration.

Result:

Only Swift 5.9+ supported.
2024-10-23 15:06:45 +01:00
Peter Adams bc93af21b0 GitHub Actions to parity with existing CI (#469)
Motivation:

Want to move away from legacy CI.

Modifications:

Add configuration and update code to use GitHub actions.

Result:

GitHub Actions can be used for basic CI.
2024-10-23 14:02:30 +00:00
Franklin Schrans 88c3fc8b05 Remove upper bound for swift-docc-plugin version (#458)
Updates the swift-docc-plugin dependency to remove the upper bound
(fixed by https://github.com/swiftlang/swift-docc-plugin/pull/96).

~~This PR is in a draft state so that we can verify that
https://github.com/swiftlang/swift-docc-plugin/pull/96 resolves this
issue in this project before merging and creating a tag.~~

We've created the tag and I updated the PR.
2024-08-30 09:30:38 +01:00
Clinton Nkwocha ee1d1aa09b Upper-bound swift-docc-plugin dependency version (#456)
Motivation:

Building swift-nio-http2 with Swift 5.8 fails due to a compiler error
when building swift-docc-plugin
(https://github.com/swiftlang/swift-docc-plugin/issues/94).

Modifications:

- Adjust the dependency version of swift-docc-plugin from `from:
"1.0.0"` to `"1.0.0"..<"1.4.0"`.

Result:

Building swift-nio-http2 with Swift 5.8 will now be successful.
2024-08-28 09:45:47 +01:00
George Barnett a0c580be16 Raise minimum swift version to 5.8 (#436) 2024-03-11 08:48:54 +00:00
Rick Newton-Rogers 462ded73ad HTTP/2 Async API (#424)
We previously developed an async API for NIO HTTP/2 which was guarded under SPI. Now that the swift-nio async API is released we can reintroduce this code promoted to SPI.

This change introduces:
* `AsyncStreamMultiplexer` - an async variant of the HTTP/2 stream multiplexer which can be used to create outbound streams and provide access to an async sequence (`NIOHTTP2AsyncSequence`) of inbound streams
* New pipeline configuration functions (e.g. `configureAsyncHTTP2Pipeline`) to support the new async mode
2023-10-25 15:49:16 +01:00
Rick Newton-Rogers d6f9a3b90d Bump minimum Swift version to 5.7 (#420)
* Bump minimum Swift version to 5.7

Motivation:

Now that Swift 5.9 is GM we should update the supported versions and
remove 5.6

Modifications:

* Update `Package.swift`
* Remove `#if swift(>=5.7)` guards
* Delete the 5.6 docker compose file and make a 5.10 one
* Update 5.10 alloc limits
* Update docs

Result:

Remove support for Swift 5.6, add 5.10
2023-10-11 00:12:29 -07:00
Si Beaumont 2bf57336ec Update to latest NIO with updated protocol negotiation SPI (#414)
* Update to latest NIO with updated protocol negotiation API

Signed-off-by: Si Beaumont <beaumont@apple.com>

* fixup: Also replace deprecated get().waitForFinalResult()

Signed-off-by: Si Beaumont <beaumont@apple.com>

---------

Signed-off-by: Si Beaumont <beaumont@apple.com>
2023-08-08 14:36:51 +01:00
Franz Busch 7e4dd147b0 Adopt latest AsyncChannel changes (#411)
# Motivation
In my latest PR in NIO, I removed a bunch of API from the bootstrap methods to make the API easier to digest and reduce a number of duplicated code issues.

# Modification
This PR adopts the latest NIO changes and adapts the APIs in H2. More specifically, it removes the `NIOAsyncChannel` convenience methods and makes sure that everything aligns nicely with the proposes bootstrap APIs.

# Result
We now have the APIs in place to bootstrap a protocol negotiated H1/H2 server.
2023-07-26 13:48:25 +01:00
Rick Newton-Rogers 188fa9ba27 adopt NIOAsyncChannel.Configuration (#409)
Adopt NIOAsyncChannel.Configuration as the NIO SPI changed
2023-07-11 16:43:41 +01:00
Rick Newton-Rogers 83c04dbddb Generic helpers for HTTP/2 async pipelines (#401)
* Store HTTP/2 inbound streams as async sequence

Motivation:

In preparation for exposing APIs which surface HTTP/2 connections and
streams using structured concurrency this PR introduces a store for
inbound HTTP/2 streams.

Modifications:

Define types and methods for storing generic types which wrap `Channels`
corresponding to inbound HTTP/2 streams in an async sequence.

Result:

The new types are not yet exposed, this work introduces part of the
framework for future functionality.

* Expose (as spi) helpers for H2 async pipelines

Motivation:

This PR is the first step in exposing APIs which surface HTTP/2 connections and
streams using structured concurrency. This PR exposes the most abstract
spelling of this concept, assuming no particular types/forms for the
types involved in the stream channel types.

Modifications:

* Store a generic `streamInitializer` on the common inbound initializer
  which is used to initialize inbound streams before yielding them to
the continuation of streams.
* Expose pipeline configuration functions which assume HTTP/2 but
  nothing else about sream channel types.
* Provide internal functions for creating streams without configuring
  them. Configuring leads to activation so it can be helpful to allow
that step to be performed manually once any provided initialization
closures have beenn executed.

Result:

Adopters of the new SPI should be able to create outbound and deal with
inbound HTTP/2 stream channels using async streams.

Outside of SPI there should be no changes.
2023-07-03 11:19:04 +01:00
Rick Newton-Rogers befe813575 Implement direct stream (de)multiplexing in NIOHTTP2ChannelHandler (#380)
Motivation:

Less expensive stream multiplexing. To implement direct stream multiplexing (with an incomplete public API) to break up delivery and allow testing.

Modifications:

* Factor out common inbound stream multiplexer functionality from `HTTP2StreamMultiplexer` into `CommonInboundStreamMultiplexer` (first commit).
* Direct stream multiplexing is implemented as `InlineStreamMultiplexer`. It implements both the `HTTP2InboundStreamMultiplexer` and `HTTP2OutboundStreamMultiplexer` protocols.
* We expose `NIOHTTP2Hander.StreamMultiplexer` as a `public` view over the new multiplexer to allow stream creation.
* Adds various `propagate...` functions to relay signals such as read complete to the child channels held by the inline stream multiplexer.
* Adds a stub for `HTTP2StreamDelegate`  which will be completed in an upcoming PR. It will be responsible for surfacing stream open/close information.
* Adds conveniences to `NIOHTTP2Handler` for setting up a handler using the inline multiplexer
* Duplicate existing tests and modify to use the inline stream multiplexer where appropriate. `SimpleClientServerFramePayloadStreamTests.swift` and `HTTP2FramePayloadStreamMultiplexerTests.swift` were copied and modified

Result:

Default behavior should be unchanged at this time.
2023-03-30 15:45:20 +01:00
Cory Benfield cb6f87d9e0 Use Docc for documentation (#351)
Motivation

Documentation is nice, and we can help support users by providing useful
clear docs.

Modifications

Add Docc to 5.6 and later builds
Make sure symbol references work
Add overview docs

Result

Nice rendering docs
2022-08-09 06:44:21 +01:00
David Nadoba f9ab1c94c8 Use swift-atomics instead of NIOAtomics (#350)
`NIOAtomics` was deprecated in https://github.com/apple/swift-nio/pull/2204 in favor of `swift-atomics` https://github.com/apple/swift-atomics
2022-07-11 16:11:50 +01:00
Fabian Fett 72bcaf607b Fix warnings, that appeared after requiring Swift 5.4 (#338) 2022-04-21 09:19:52 -07:00
Fabian Fett dbfca164c1 Drop support for Swift 5.2 and 5.3 (#337)
As outlined in a [Swift forums post in November ’21](https://forums.swift.org/t/swiftnio-swift-version-support/53232), SwiftNIO will only support the latest non-patch Swift release and the 2 immediately prior non-patch versions.

- drop support for Swift 5.2 and 5.3. 
- update CI for Swift 5.4 to run on bionic instead of focal to ensure that we still test bionic.
2022-04-20 08:57:26 +02:00
Cory Benfield ac2a5afce3 Merge pull request from GHSA-q36x-r5x4-h4q6
Motivation

The HTTP2FrameDecoder is a complex object that was written early in the
development of swift-nio-http2. Its logical flow is complex, and it
hasn't been meaningfully rewritten in quite some time, so it's difficult
to work with and understand.

Annoyingly, some bugs have crept in over the years. Because of the
structure of the code it can be quite difficult to understand how the
parser actually works, and fixing a given issue can be difficult.

This patch aims to produce a substantial change to the HTTP2FrameDecoder
to make it easier to understand and maintain in the long run.

Modifications

This patch provides a complete rewrite of HTTP2FrameDecoder. It doesn't
do this by having a ground-up rewrite: instead, it's more like a
renovation, with the general scaffolding kept. The rewrite was performed
incrementally, keeping the existing test suite passing and writing new
tests when necessary.

The following major changes were made:

1. New states and edges were added to the state machine to handle
   padding.

   Prior to this change, padding was handled as part of frame payload
   decoding. This is not totally unreasonable, but it dispersed padding
   management widely and made it easy to have bugs slip in. This patch
   replaces this with a smaller set of locations.

   Padding is now handled in two distinct ways. For HEADERS and
   PUSH_PROMISE frames, trailing padding is still stripped as part of
   frame payload decode, but it's done so generically, and the padding
   bytes are never exposed to the individual frame parser. For DATA,
   there is a new state to handle trailing padding removal, which
   simplifies the highly complex logic around synthesised data frames.

   For all frames, the leading padding byte is handled by a new
   dedicated state which is used unconditionally, instead of attempting
   to opportunistically strip it. This simplifies the code flow.

   As a side benefit, this change means we can now accurately report the
   padding used on HEADERS and PUSH_PROMISE frames, even when they are
   part of a CONTINUATION sequence.

2. The synthesised DATA frame logic has been substantially reworked.

   With the removal of the padding logic from the state, we now know
   that so long as we have either got a byte of data to emit _or_ the
   DATA frame is zero length, we will always emit a frame. This has made
   it simpler to understand the control flow when synthesising DATA
   frames.

3. The monolithic state switch has been refactored into per-state
   methods.

   This helps manage the amount of state that each method can see, as
   well as to logically split them up. In addition, it allows us to
   recast state transformations as (fairly) pure functions.

   Additionally, this allowed the larger methods to be refactored with
   smaller helpers that are more obviously correct.

4. The frame payload parsers have been rewritten.

   The main goal here was to remove preflight length checks and unsafe
   code. The preflight length checks cause trouble when they disagree
   with the parsing code, so we now rely on the parsing code being
   correct with regard to length.

   Relatedly, we previously had two separate places where we
   communicated length: a frame header length and a ByteBuffer length.
   This was unnecessary duplication of information, so we instead use a
   ByteBuffer slice to manage the length. This ensures that we cannot
   over-parse a message.

   Finally, in places that used unsafe code or separate integer reads,
   we have refactored to stop using that unsafe code and to use combined
   integer reads.

5. Extraneous serialization code has been extracted.

   The HTTP2FrameEncoder was unnecessarily in this file, which took a
   large file and made it larger. I moved this out.

Result

The resulting parser is clearer and safer. Complex logic has been broken
out into smaller methods with less access to global data. The code
should be generally clearer.
2022-03-10 10:16:17 +00:00
Cory Benfield dbfc8fcd1a Clean up imports and dependencies. (#300)
Motivation:

With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.

Modifications:

- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded imports where necessary in tests.
- Note that the main modules still depend on NIO, which is necessary
    for backwards-compatibility reasons. This dependency is unused.

Result:

No need to use NIOPosix.
2021-09-14 11:30:04 +01:00
Fabian Fett 42bdcae4ac Use non-deprecated API for removing handlers (#297)
### Motivation:

`removeHandlers(channel:)` was deprecated in NIO 2.32.0.

### Modifications:

- Raise minimum required `NIO` version to 2.32.0
- Use `removeHandlers(pipeline:)`

### Result:

We don't use deprecated API.
2021-08-18 16:22:51 +02:00
David Evans 13b6a7a838 Update NIO to 2.30.0 (#293) 2021-06-23 14:04:28 +01:00
David Evans 488444b14c Remove support for Swift 5.0 and 5.1 (#292)
* Update package

* Update CI

* Add to readme
2021-06-23 08:37:07 +01:00
Johannes WeissandCory Benfield a5aef08b10 stop publishing the executable produts (#289)
Co-authored-by: Cory Benfield <lukasa@apple.com>
2021-06-09 09:33:15 +01:00
George Barnett 4e96d02e0e Add sync option support to HTTP2StreamChannel (#282)
Motivation:

SwiftNIO 2.27.0 added support for synchronous channel options allowing
callers to get options synchronously -- saving a future allocation -- if
they know they're on the correct event loop. 'HTTP2StreamChannel' should
support this.

Modifications:

- Add 'HTTP2StreamChannel.SynchronousOptions' with conformance to
  'NIOSynchronousChannelOptions'

Result:

Callers can get and set options synchronously on 'HTTP2StreamChannel'
2021-03-16 08:38:35 +00:00
Cory Benfield 54f15a6b16 Add benchmarks and improve benchmarking. (#256)
Motivation:

Performance benchmarking wants accurate numbers, and a wide range of
possible benchmarks. One way to get somewhat more accurate numbers is to
use a tool like Cachegrind to measure the instruction counts of a
program. Cachegrind allows us to isolate a number of noise-introducing
effects, as "number of executed instructions" is a much more stable
number than how long a program takes to run.

When running under cachegrind we want to change the way our performance
benchmarks work. Instead of running lots of times to try to average out
noise, we only want to run once to save ourselves time, as the benchmark
itself should be drastically more stable.

While we're here, let's add some much more isolated benchmarks than our
current "make lots of streams" benchmark. This is basically the same
logic, but it does less of NIO and so makes the impact of NIOHTTP2
substantially more prominent.

Modifications:

- Added a cachegrind build mode to the benchmarks.
- Added new benchmarks and alloc counters.

Result:

More info
2020-11-19 11:09:09 +00:00
Johannes WeissandJohannes Weiss e582d993e0 workaround SR-12781 (#208)
Motivation:

The compiler team aren't fixing https://bugs.swift.org/browse/SR-12781
so I guess it's on us :(.

Modifications:

- fix missing "NIOFoundationCompat" dependency
- workaround https://bugs.swift.org/browse/SR-12781 by introducing extra
  variables

Result:

compiles on 5.3

Co-authored-by: Johannes Weiss <johannes@jweiss.io>
2020-06-13 19:55:43 +01:00
Jake PrickettandJake Prickett 0c7d697b5f Update build_podspec and added SwiftNIOHPACK Dependency (#185)
Co-authored-by: Jake Prickett <jpricke1@ford.com>
2020-02-18 20:16:26 +00:00
Johannes Weiss c1bfb7ce3f fix new NIO and new Swift compiler warnings (#179) 2019-12-10 12:45:48 +00:00
Johannes Weiss 994c319e03 namespace ChannelOptions & fix deprecations (#166) 2019-10-28 16:11:12 +00:00
Johannes Weiss 9162b00fd5 fix dependencies: require NIO 2.3.0 (#154) 2019-09-10 12:08:04 +01:00
Johannes Weiss 522464d81e HTTP/2 peformance tests (#117)
Motivation:

NIO wants to be fast, we should have perf tests everywhere.

Modifications:

Start with one HTTP/2 perf test.

Result:

more perf tests.
2019-05-16 18:21:17 +01:00
Johannes Weiss a9fc7c17dd use SwiftNIO 2.0.0 (#72) 2019-03-26 09:25:02 +00:00
Johannes Weiss 7e17e72f41 update to latest EmbeddedChannel API (#68)
Motivation:

EmbeddedChannel's API has changed a litle bit, we should update.

Modifications:

update

Result:

code will continue to work
2019-03-22 14:05:10 +00:00
Tanner 049ba81fcc remove _NIOAPI1Shims since NIO 2 is in convergence (#59)
* remove _NIOAPI1Shims since NIO 2 is in convergence

* remove import in NIOHPACK
2019-03-13 19:45:28 +00:00
Tanner 48dccc54c3 depend on swift-nio 2.0.0 convergence (#58) 2019-03-13 18:48:09 +00:00
Cory Benfield 3c90345c36 Pure-Swift HTTP/2 implementation (#40)
* Updated to use SwiftNIO 1.10+ to gain access to HTTPHeaders internals.

* Add pure-Swift HTTP/2 protocol implementation.

Motivation:

Currently we use nghttp2 for our basic protocol implementation. This is
plenty workable, but provides us a number of limitations. It adds
complexity to our build system, provides us with external dependencies we
have little control over, limits our users' ability to express low-level
protocol semantics if they so wish, causes us to heap-allocate like crazy over
the lifetime of a connection, and brings a world of pain around reentrancy.

This set of limitations has motivated a desire to move away from using
nghttp2. This is a part of that dream.

Modifications:

- Add pure Swift protocol implementations.
- Test them.

Results:

Another step towards protocol independence.

* Initial basic parser code.

* Adding unit tests.

* Add NIOHTTP2FlowControlHandler

Motivation:

One of the things that nghttp2 used to do for us was to handle buffering
DATA frames until flow control allowed them to go out. For users that
want that behaviour, we need to replace the nghttp2 code with a new
ChannelHandler that can do this work.

Modifications:

- Added NIOHTTP2FlowControlHandler.

Result:

Users will have the same feature set as they did with nghttp2.

* Generate Linux test information.

* Documentation comment.

* Updated new tests from master to use new payload types.

* Updated following review.

Notable changes:

- Implemented unit tests for the ALTSVC (0xa) and ORIGIN (0xc) frame types.
- Additional DATA frames are synthesized to wrap individual payload chunks as they arrive. If the payload of a DATA frame with 4MB data arrives in 4 separate 1MB chunks, the decoder will emit 4 DATA frames, with only the last containing the END_STREAM flag (if that was set on the incoming frame).
- HEADERS / PUSH_PROMISE frames and any following CONTINUATION frames are now handled properly: header fragments from all frames are gathered up into a single buffer. Once a frame with END_HEADERS is encountered, the resultant accumulated buffer is sent for decoding along with the flags and stream ID of the original HEADERS / PUSH_PROMISE frame.
- HPACK encoders/decoders now live in the frame encoder/decoder types, rather than being attached to a stream.

* Updated Linux tests.

* Headers placed in relevant files.

* Add pure-Swift HTTP/2 protocol implementation.

Motivation:

Currently we use nghttp2 for our basic protocol implementation. This is
plenty workable, but provides us a number of limitations. It adds
complexity to our build system, provides us with external dependencies we
have little control over, limits our users' ability to express low-level
protocol semantics if they so wish, causes us to heap-allocate like crazy over
the lifetime of a connection, and brings a world of pain around reentrancy.

This set of limitations has motivated a desire to move away from using
nghttp2. This is a part of that dream.

Modifications:

- Add pure Swift protocol implementations.
- Test them.

Results:

Another step towards protocol independence.

* Revamped frame decoder state machine and API. Now uses separate input and output methods to manage multiple frames in a single buffer.

* Updated Linux tests.

* Bumped swift-nio version to 1.12.0 and updated `HTTPHeaders` -> `HPACKHeaders` conversion initializer to directly copy the buffer and map the header name/value indices.

* Set up HTTP2Parser in handlerAdded if the channel had been previously activated. (#36)

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.

(cherry picked from commit 88bd6d369a)

* Minor tweaks to get the tests passing

* Initial integration here

* Minor clearing up of the handler

* Get the tests compiling

* Fix header issues.

We now pass the frame parser to the various setting operations to let it
update the state. We also fixed some issues with specific settings.

* Remove ngthttp2-based impl, clean up stream ID

* Tests with new HTTP2StreamID

* Simple test cleanup

* Get remaining non-core tests passing

* Allow GOAWAY even when fully quiesced

* We don't buffer outbound frames any more

* Emit StreamClosed events on GoAway frame

* Notify stream creation and closure

* This test started failing

* Goodbye, C code! 🎉

* Send PING ACK automatically

* Updated based on PR feedback.

* Correctly handle 1XX responses

* Add SETTINGS_MAX_FRAME_SIZE support to flow controller

* Correctly account for flow control

* Define ConcurrentStreamsHandler

* Prepare for signalling connection state changes

* Better state change message propagation

* Refactor to use result with effect everywhere

* Don't lose flow control info on stream error

* Add basic flow control management to stream multiplexer

* Better pipeline in sample server

* Clean up some reentrancy concerns

* Move to Swift 5 and NIO 2

* Move to new Swift 5 for CI

* Allow wider range of choices of years

* Catch up to NIO 2 again
2019-02-21 11:52:49 +00:00
Johannes Weiss b737a3f5c6 require Swift 4.1 (#21)
Motivation:

We never supported Swift 4.0 in this repository and Swift 4.0 is quite a
pain mostly because of the Unsafe*Pointer API differences.

Changes:

Require 4.1

Result:

fewer lies, fixes #17
2018-09-10 08:23:42 +01:00
Jim Dovey 6f8f523684 Implementation of HPACK encoding and header tables (#10)
Motivation:

This is the beginning of removing the dependency on `nghttp2`.

Modifications:

I've added a new library target, `NIOHPACK`, which contains all the necessary pieces to implement HPACK encoding as specified in RFC 7541. There are unit tests exercising all the code and some additional edge cases around integer encoding, along with some performance tests for the Huffman encode/decode process. The latter currently takes longer to decode than to encode, which is worrying, but this is only really noticeable when encoding > 16KB strings as a rule; therefore I've decided not to pull out the optimization hammer just yet. Included in the unit tests are the inputs and outputs from all the examples in RFC 7541 and RFC 7540.

I've tried to match the coding style from the repo, but some of my own idioms may have crept in here & there. Please let me know if you see anything wrong in that regard.

Currently the static header table and Huffman encoding tables are implemented as Swift `let`s. For the static header table that's ok (only 62 entries), but the Huffman table is huge. I'm debating whether it's worth having that in a plain C file somewhere, but I'm not sure what the tradeoffs are vs. performance. Right now it seems to only affect compilation time, but I may be wrong.

Result:

In general, nothing will change: nothing in NIOHTTP2 is using this library yet. That part is what I'm working on now.
2018-08-16 09:51:13 +01:00
Cory Benfield 0a271b1cef Remove handlers from stream channel pipelines on shutdown. (#5)
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.
2018-05-18 14:05:12 +01:00