465 Commits
Author SHA1 Message Date
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
1.36.0
2025-04-23 07:29:33 +01:00
Rick Newton-Rogers 31d5bdb86b update thresholds (#513)
update thresholds from Swift 6.0 thresholds
2025-04-14 11:59:58 +01:00
Rick Newton-Rogers 37c302e6da Enable Swift 6.1 jobs in CI (#512)
Motivation:

Swift 6.1 has been released, we should add it to our CI coverage.

Modifications:

Add additional Swift 6.1 jobs where appropriate in main.yml,
pull_request.yml

Result:

Improved test coverage.
2025-04-14 10:52:17 +01:00
Rick Newton-Rogers e574770917 Switch h2Spec tests to newer Swift test matrix (#511)
### Motivation:

To remove all uses of the older workflow so it can be removed to
simplify the workflows.

### Modifications:

* Switch h2Spec tests to use the newer Swift test matrix workflow,
`swift_test_matrix.yml`

### Result:

This should make no difference to the running of h2Spec tests.
2025-04-10 08:01:12 +01:00
Rick Newton-Rogers f98e90cbf6 Enable macOS CI on pull requests (#510)
Motivation:

* Improve test coverage

Modifications:

Enable macOS CI to be run on pull request commits and make the use of
the nightly runner pool for main.yml jobs explicit.

Result:

Improved test coverage.
2025-04-01 17:40:10 +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 61f6aa4142 Add explicit Sendable annotations (#505) 2025-03-27 14:01:05 +00:00
George BarnettandRick Newton-Rogers 0c020df343 Strict concurrency for pipeline helpers (#503)
Motivation:

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

Modifications:

- Add a few temporary internal helpers
- Annotate the pipeline helpers

Result:

Fewer concurrency warnings

Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
2025-03-27 11:33:37 +00:00
Rick Newton-Rogers 9f0d47ef62 Enable macOS CI on merge to main and daily timer (#504)
Enable macOS CI on merge to main and daily timer

### Motivation:

* Improve test coverage
* Check test pass/fail status
* Monitor CI throughput

### Modifications:

Enable macOS CI to be run on all merges to main and on a daily timer.

### Result:

Improved test coverage run out-of-band at the moment so we can get a
feeling for if any changes need to be made in the repo or in the CI
pipelines to ensure timely and stable checks.
2025-03-26 17:01:11 +01: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 b46cdf06d4 Update main.yml integration tests to use swift_test_matrix (#499)
Update main.yml integration tests to use `swift_test_matrix` as has been
done on the PR workflow. This brings it off the deprecated workflow and
should fix the nightly-6.1 issue
2025-03-14 14:50:09 +01: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 dc299eae72 Delete Thresholds/nightly-6.1.json symlink (#497)
Following on from https://github.com/apple/swift-nio-http2/pull/496
delete `Thresholds/nightly-6.1.json` which is no longer needed now that
the shared benchmarks workflow has been updated
2025-03-07 12:09:27 +00:00
Rick Newton-Rogers 41e1821e08 move nightly-next thresholds and add legacy symlink (#496)
Move nightly-next thresholds and add legacy symlink; see
https://github.com/apple/swift-nio/pull/3122
2025-03-03 15:47:09 +00:00
Rick Newton-Rogers 28b6e02d27 Rename nightly_6_1 params to nightly_next (#495)
Rename nightly_6_1 params to nightly_next; see
https://github.com/apple/swift-nio/pull/3122
2025-03-03 14:44:55 +00:00
George Barnett 1251530b26 Allow max reset stream frames to be configured (#494)
Motivation:

The maximum number of recently reset stream frames to track is limited
to a fixed value of 32. This should be configurable.

Modifications:

- Add it to the connection config and propagate it through

Result:

- Resolves #493
2025-02-28 13:54:05 +00:00
Rick Newton-Rogers d3b538740b CI use 6.1 nightlies (#490)
CI use 6.1 nightlies now that Swift development is happening in the 6.1
branch
2025-01-31 10:09:44 +00:00
Rick Newton-Rogers 8243b9f525 update benchmark thresholds to nightly 6.1 (#491)
NIO regressed the allocations in EmbeddedChannel by one in
https://github.com/apple/swift-nio/commit/2d72ada99957e8aa19245ccd013f55790be781d9,
This test is regressed by two and uses two embedded channels so it seems
the likely cause.
2025-01-31 09:03:40 +00:00
George Barnett 124e859117 Better handle new streams when server is quiescing (#481)
Motivation:

When the server is in the locally quiescing state and a client attempts
to open a new stream, the connection state machine treats receiving the
headers as a connection error. This results in the connection being
closed and in-flight requests being failed.

This can happen because of the inherent race between the server sending
a GOAWAY frame and the client receiving it, during which time the client
can open a stream not knowing it's doomed to failure.

Rather than the server treating this as a connection error, it should
reject the stream with a RST_STREAM frame and emit a stream error.

Modifications:

- Emit a stream error when receiving HEADERS in the locally quiesced
state

Result:

Better handling of new streams when the server is quiescing
2025-01-20 18:01:49 +00:00
Franz Busch 1e0c8234ed Update release.yml (#489)
Update the release.yml file with the latest label changes
2024-12-18 13:09:06 +00:00
Gus Cairo 170f4ca06b Don't fail closeFuture when an error occurs on closing (#487)
Strictly speaking, a `close` operation can't really fail (except when
the closing mode isn't supported or the channel is already closed). Even
if an error is encountered while closing a channel, or if an error
caused the channel to be closed, the end result is the same: the channel
will be closed.

In this case in particular, when streams are closed from the client
(i.e. by sending a RST_STREAM frame) the `HTTP2StreamChannel` would fail
the channel's `closeFuture`. This isn't appropriate however, as the
channel is successfully closed.

This change stops failing the stream channel's `closeFuture`. Instead,
if the close happens uncleanly, the error will be fired down the
pipeline and the `close` method's promise will be failed.
1.35.0
2024-12-16 15:38:34 +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
Franz Busch adbe5af20a Aligning semantic version label check name (#485) 2024-11-28 12:03:38 +00:00
Gus Cairo 1879e72392 Finish multiplexer's inbound streams in more cases (#483)
## Motivation
Currently, the multiplexer's inbound streams stream is finished only
when the channel becomes inactive.
There are some scenarios in which the channel may be closed before it
has a chance to become active, and the stream will never be finished.
This can cause any users iterating over the stream to hang.

## Modifications
This PR finishes the inbound streams stream when a connection error is
fired, and when the handler is removed.

## Result
Fewer bugs.
2024-11-15 10:45:47 +00:00
Rick Newton-Rogers bb19976697 unify scheduled and main yamls (#482) 2024-11-15 09:55:22 +00:00
Adam FowlerandGeorge Barnett 91136a6604 Make configureHTTP2AsyncSecureUpgrade public (#480)
Minor PR to make `configureHTTP2AsyncSecureUpgrade ` helper function
public

Co-authored-by: George Barnett <gbarnett@apple.com>
2024-11-14 10:57:17 +00:00
Adam Fowler 04a093d050 Add a variant of configureAsyncHTTPServerPipeline which takes a stream delegate (#471)
In the async HTTP2 pipeline there is no way to account for the opening
and closing of streams. This PR adds a variant of
`configureAsyncHTTPServerPipeline` (HTTP2 upgrade channel) that allows
the user to pass in a `NIOHTTP2StreamDelegate` to be applied to the
HTTP2 channel if the upgrade occurs.

This is similar to #439 which did the same HTTP2 only channels.
2024-11-14 10:27:14 +00:00
finagolfin 1959f760e7 Import new Android overlay instead in the tests (#479)
I added the `Bionic` import this summer in #448 and the compiler
accepted it then, but it started erroring a couple months later without
this full Android overlay, so add that instead.
2024-10-30 15:55:49 +00:00
Peter Adams 4bce87f3cf Enable ShellCheck CI (#478)
Motivation:

Complete enablement of all standard GitHub Actions workflows.

Modifications:

Describe the modifications you've done.

Result:

After your change, what will change.
2024-10-30 15:22:05 +00:00
Peter Adams 6c86975025 Remove unused dockerfiles and allocation scripts (#477)
Motivation:

Remove unused clutter from the repo.

Modifications:

Remove dockerfiles and scripts to getting allocation results

Result:

Cleaner repo.
2024-10-30 14:17:39 +00:00
Peter Adams 70643b7392 Add integration tests to GitHub Actions (#476)
Motivation:

Testing is good - we should check results on PRs.

Modifications:

Add integration tests to PR and scheduled GitHub Actions workflows.

Result:
Integration tests run.
2024-10-30 13:23:03 +00:00
Peter Adams a4f8c3f1c0 Add HTTP/2 spec tests to CI (#475)
Motivation:

More testing is better.

Modifications:

Setup github actions to run http/2 spec tests.

Result:

Testing against http/2 spec occurs on pull requests
2024-10-29 14:00:09 +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 93586110f2 Enable python lint in CI (#474)
Motivation:

More checking is better

Modifications:

Enable and configure flake8

Result:

More CI checks
2024-10-29 11:01:43 +00:00
Peter Adams fd48cf3099 Allow warnings in CI (#473)
Motivation:

NIO is getting stricter concurrency annotations.
This is breaking this project, allow warnings until things settle.

Modifications:

Alter CI flags to allow warnings.

Result:

CI will continue to work for now.
2024-10-29 10:25:04 +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
Peter Adams 482f425a94 Remove script for generating contributors list (#468)
Motivation:

We're no longer maintaining this list as it can be trivially obtained
from git history.

Modifications:

Remove script for generating contributors list.

Result:

One less script to maintain
2024-10-23 13:55:02 +01:00
George BarnettandCory Benfield eaa71bb6ae Add an article about multiplexing (#465)
Motivation:

It's hard to keep track of all the pieces that do multiplexing. When
making some changes I found myself writing down what each piece did and
how they fit together. I think this is generally useful information for
anyone maintaining the library.

Modifications:

- Add a DocC article about the different multiplexing approaches that's
aimed at _maintainers_ of NIOHTTP2.

Result:

Easier to learn about how multiplexing is done

---------

Co-authored-by: Cory Benfield <lukasa@apple.com>
1.34.1
2024-09-18 10:30:35 -07:00
George Barnett 6693a60432 Propagate ChannelShouldQuiesceEvent to child channels (#464)
Motivation:

NIO has a 'ChannelShouldQuiesceEvent' which channels can listen for in
order to know when they should quiesce. This is typically used to
initiate a graceful shutdown of an HTTP/2 server. However, child
channels aren't notified of this event so HTTP/2 servers must keep track
of streams separately in order to notify them when the server is
quiescing.

Modifications:

- Propagate the `ChannelShouldQuiesceEvent` to child channels

Result:

Child channels can watch for `ChannelShouldQuiesceEvent`s
2024-09-18 07:02:53 +01:00
Franz Busch 8e667f8070 Update release.yml (#459) 2024-09-06 12:55:49 +01:00
Clinton Nkwocha 376312d334 Handle race condition between sending GOAWAY and HEADERS (#457)
Motivation:

A potential race exists between a server sending a GOAWAY frame and a
client opening a new stream (i.e., sending a HEADERS frame before
receiving an already sent GOAWAY frame). If there are no open streams
when the server sends the GOAWAY frame, the connection state on the
server transitions to being fully quiesced, which throws a connection
error on receipt of a HEADERS frame.

Modifications:

- Adjust the connection state machine on the server to throw a stream
error (instead of a connection error), and consequently, send a
RST_STREAM frame to the client.

Result:

This condition will be treated as a stream-level error instead.
2024-09-06 11:59:15 +01:00
Clinton Nkwocha 9f6d865c81 Accept PING frames even when fully quiesced (#455)
Motivation:

When the connection is fully quiesced, an endpoint responds with a
connection error when it receives or tries to respond to a PING frame.
This behaviour is unnecessary.

Modifications:

- Adjust `HTTP2ConnectionStateMachine` to successfully receive and send
PING frames even when the connection is fully quiesced.

Result:

When the connection is fully quiesced, an endpoint will treat receipt
and sending of a PING frame as it would when the connection is active.
2024-08-30 03:50:01 -07: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
Franz Busch b5f7062b60 Adopt release.yml (#452)
# Motivation

We want to start using the GH based release notes drafting to make it easier for publishing new releases.

# Modification

This PR adds the `release.yml` and configured the correct labels
1.34.0
2024-07-29 03:18:51 -07:00
George Barnett 192c2f5ae8 Update allocation limits (#454)
Motivation:

The most recent NIO release reduce allocations, now our limits are too
high.

Modifications:

- Update alloc limits

Result:

CI passes
2024-07-29 11:08:24 +01:00
aryan-25 35b0b8f7e5 Fix bug where client ignores HEADERS frames on open stream when locally quiescing (#445)
Motivation:

Currently, HEADERS frames are ignored by the client on a client-initiated stream after the client sends a GOAWAY.

As per [Section 6.8 (GOAWAY) in RFC 9113](https://httpwg.org/specs/rfc9113#GOAWAY):
_"Once the GOAWAY is sent, the sender will ignore frames sent on streams **initiated by the receiver** if the stream has an identifier higher than the included last stream identifier."_

In this case, the client (sender) should **not** ignore the HEADERS frame as the stream is initiated by the _client_, not the receiver.

Modifications:

Fixed the condition in the `receiveHeaders` function (given `LocallyQuiescingState`) in `ReceivingHeadersState.swift` to work for _both_ the client and server roles -- before this change, the condition is only correct when `self.role == ConnectionRole.server`

Result:

HEADERS frames are not ignored by the client on a client-initiated stream when locally quiescing.
2024-07-18 06:55:30 -07:00