Commit Graph
481 Commits
Author SHA1 Message Date
Salman Muin Kayser Chishti d6deec96fb Upgrade GitHub Actions for Node 24 compatibility
Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
2026-03-02 09:28:38 +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
Rick Newton-Rogers fb87ca810f switch from main to 0.0.7 for swiftlang workflows (#537)
Motivation

* `@main` references to `swiftlang/github-workflows` are deprecated.

Modifications

* Replace `@main` with `@0.0.7` in all workflow files.

Result

* Workflow files reference a pinned version of
`swiftlang/github-workflows`.
2026-02-20 13:26:37 +00:00
aryan-25 b6571f3db4 Add a server connection manager (#532)
Motivation:

`NIOHTTP2Handler` currently does not support graceful shutdown because
it does not action upon a `ChannelShouldQuiesceEvent` event. See issue
https://github.com/apple/swift-nio-http2/issues/336.

Per the
[comment](https://github.com/apple/swift-nio-http2/issues/336#issuecomment-2252862397)
on that issue,
[`gRPC-swift-nio-transport`](https://github.com/grpc/grpc-swift-nio-transport)
implements this functionality in a separate channel handler, named
[`ServerConnectionManagementHandler`](https://github.com/grpc/grpc-swift-nio-transport/blob/main/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift).
We should introduce this to this repo too.

Modifications:

- Added `ServerConnectionManagementHandler` from
`gRPC-swift-nio-transport` with some slight modifications such as
removing gRPC-specific functionality like policing client pings.
- Added a new `configureAsyncHTTP2Pipeline` helper, which takes a
connection manager configuration as an argument and sets the
connection manager up alongside `NIOHTTP2Handler`.

Result:

Addresses issue https://github.com/apple/swift-nio-http2/issues/336.
1.40.0
2026-02-18 08:08:55 +00:00
Fabian Fett 979f431f1f Optimize HTTP2ToHTTP1 client codec to reduce empty data frames (#535)
The codec now caches the most recent outbound frame and only writes it
on flush or when receiving `.end`. This lets us set `endStream=true` on
the final data or headers frame instead of sending a separate empty data
frame.

Changes:
- Introduced `PendingFrameWrite` to cache frame payload and promise
- Modified `processOutboundData` to return optional frames instead of
writing immediately
- Added `flush()` method to both client codecs to handle cached writes
- Promise merging ensures correct completion notification when combining
frames
1.39.1
2026-02-10 10:16:27 +00:00
aryan-25 c1bb956720 Update allocation thresholds (#534)
Motivation:

The nightly CI checks for Integration Tests started failing since run
https://github.com/apple/swift-nio-http2/actions/runs/19310336168/job/55228659542
(on 12 November 2025) due to multiple allocation benchmark tests
exceeding their allocation thresholds.

The date these failures started coincides with [release 2.89.0 of
`swift-nio`](https://github.com/apple/swift-nio/releases/tag/2.89.0). In
particular, all failing allocation benchmarks use `EmbeddedChannel`, and
`EmbeddedChannel` was changed in [a PR contained in that
release](https://github.com/apple/swift-nio/pull/3442) that introduced
some changes leading to greater allocations.

[Another change to
`EmbeddedChannel`](https://github.com/apple/swift-nio/pull/3495) in
`swift-nio`'s latest release
([2.94.0](https://github.com/apple/swift-nio/releases)) has also
increased the number of allocations in benchmarks using
`EmbeddedChannel`.

As such, we should update the allocation thresholds for affected tests
accordingly.

Modifications:

Updated the allocation threshold for all affected tests across all
versions.

Result:

Integration tests should no longer fail.
2026-02-09 12:41:37 +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>
1.39.0
2025-11-11 14:39:46 +00:00
Rick Newton-Rogers 7205ab8219 Add explicit read permissions to workflows (#529)
Motivation:

* More secure GitHub Actions workflows

Modifications:

Add explicit 'contents: read' permissions to workflows that did not have
explicit permissions defined. This follows GitHub Actions security best
practices by limiting the default GITHUB_TOKEN permissions.

Result:

An extra layer of security.
2025-10-30 17:29:25 +00:00
Rick Newton-Rogers b450646b59 Enable Swift 6.2 jobs in CI (#526)
Motivation:

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

Modifications:

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

Result:

Improved test coverage.
2025-09-22 12:42:17 +00:00
Raphael 95c084ae51 Enable release mode builds (#524)
### Motivation:

Some errors do not show up in debug builds. Enabling release mode builds
improves the CI coverage.

### Modifications:

Enable release mode builds for pull requests and scheduled builds on
main.

### Result:

Improved CI coverage.
2025-07-30 09:00:19 +01:00
George Barnett 5e9e99ec96 Add a frame delegate (#522)
Motivation:

Frames written from a child channel may not be written immediately by
the connection channel. For example, a DATA frame written on a stream
may be larger than the max frame size imposed on the connection and so
the connection channel will have to slice it into multiple frames. Or
the connection may not be writable and may delay the transmission of the
frame. This behaviour isn't currently observable but is useful to know
about.

Modifications:

- Add a frame delegate which is notified when certain frames are written
by the connection channel.

Result:

Users can observer when headers and data frames are written into the
connection channel.
1.38.0
2025-07-18 15:30:36 +01:00
Gus Cairo f0e94525a7 Add GlitchesMonitor (#518)
Add a `GlitchesMonitor` that will terminate a connection if too many glitches are triggered.
See https://github.com/HTTPWorkshop/workshop2024/blob/main/talks/1.%20Security/glitches.pdf for details.
2025-07-16 16:19:40 +01:00
Gus Cairo bf0645a009 Update allocation thresholds (#520) 2025-07-03 16:39:55 +01:00
Rick Newton-Rogers 5ca52e2f07 Add static SDK CI workflow (#500)
Add static SDK CI workflow which runs on commits to PRs, merges to main
and daily on main.
1.37.0
2025-06-26 10:16:36 +00:00
Gus Cairo 623755c0cd Enable warnings as errors (#517) 2025-05-14 14:17:48 +01: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
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