Commit Graph
225 Commits
Author SHA1 Message Date
Rick Newton-Rogers 85ec2ccc2e Enable Swift 6.2 jobs in CI
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 16:07:33 +01:00
Rick Newton-Rogers 558a605b34 Enable Swift 6.2 jobs in CI (#287)
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 13:13:22 +00:00
Honza Dvorsky 52446476e7 Build docs for NIOCertificateReloading (#285)
### Motivation:

Currently docs on SPI don't include NIOCertificateReloading.

### Modifications:

Added NIOCertificateReloading to the list of targets to build docs for.

### Result:

Docs on SPI.
2025-08-08 08:13:44 +01:00
Raphael babbd0ca25 Enable release mode builds (#284)
### 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 08:57:51 +01:00
hamzahrmalik a55c3dd3a8 Callback for certificate reload failures (#283)
Callback for certificate reload failures

### Motivation:

Users might want to emit a metric or log when rotation fails.

### Modifications:

Add a new callback which is called whenever a reload fails. This
callback is given an instance of CertificateLoadFailure which contains
the error. The CertificateLoadFailure type allows us to evolve this in
future
1.29.0
2025-07-23 15:16:42 +01:00
hamzahrmalik 614cedd4b1 Make a new variant of makeReloaderValidatingSources which takes a Configuration (#282)
In #281 we added a Configuration object. Now it's possible to create a
TimedCertificateReloader with a single configuration parameter. The
makeReloaderValidatingSources function should be updated to also take
this parameter
2025-07-22 17:14:25 +01:00
hamzahrmalik 0abfca1a17 Add callback in TimedCertificateReloader to listen for reloads (#281)
Add callback in TimedCertificateReloader to listen for reloads

### Motivation:

Adopter might want to know when a certificate was reloaded, e.g. to emit
a log or metric

### Modifications:

- Add a new callback in the reloader which is called whenever a reload
happens. The closure is passed a struct which tells us which cert and
key were read, and whether or not theyre 'new'
- Change the initializer to take a config struct to make this more
extensible going forward
2025-07-22 09:57:48 +01:00
Rafael Cepeda be2fa03ee3 Changed GHA workflows to require explicit sendable on macOS. (#280)
Added a parameter to macOS to require explicit sendable.
2025-07-09 12:52:19 +01:00
Orhan Yigit YazicilarandGeorge Barnett 774c274789 Split RequestResponseHandlers into Sendable and non-Sendable variants (#279)
Motivation:
`RequestResponseHandler` and `RequestResponseWithIDHandler` previously
allowed non-`Sendable` Requests to move across event loops by wrapping
it in `UnsafeTransfer`, which disabled the compiler's sendability
checking. Requiring every Response to be `Sendable` would solve the
safety issue but it limits how the handlers can be used.

Modifications:
* Extracted the common logic of both handlers into a single state
machine.
* Modified the original implementations to have Request conform to
`Sendable`
* Introduced two new variants that don't care if the Request is
`Sendable` as promises moving to different event loops would be failed
with an error.
* Removed the UnsafeTransfer type as it is not used anymore.
* Added unit tests to confirm that the Sendable variants allow for
promises for different event loops and non-Sendable variants fail the
promises with an Error.

Result:
* Compiler's sendability checks are restored for the handlers.

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2025-07-03 13:00:21 +01:00
Rick Newton-Rogers 07afea89d6 Add static SDK CI workflow (#252)
Add static SDK CI workflow which runs on commits to PRs, merges to main
and daily on main.
2025-06-26 11:53:48 +01:00
Raphael c6714eeaa4 Responsiveness fallback handler (#278)
### Motivation:

The SimpleResponsivenessRequestMux knows how to handle a few different
requests. For those it doesn’t know how to handle, it responds with a
404.

It would be helpful if the handler had a mode where it optionally
forwards requests it doesn’t know how to handle to a fallback channel
handler so that users can respond to these requests.

### Modifications:

The mux has a new initializer that can configure it to accept unexpected
requests, i.e., those not defined by itself. In this case it will
forward requests down the pipeline. However, its default behavior
remains the same: respond with a 404.

### Result:

When setting up the mux, users can add additional handler to the
pipeline and configure the mux to forward its requests.
2025-06-19 10:35:30 +01:00
Franz Busch 145db1962f TimedCertificateReloader prevents non-self-signed certificates from b… (#274)
…eing loaded

Fix certificate check and make sure all code paths throw an error.

### Motivation:

TimedCertificateReloader currently has an invalid check that
accidecanlly enforces self-signed certificates. Additionally some code
paths of `reload()` did not throw an error which made it hard for the
call site to judge if the reloader was initialized successfully or not.
Further, the missing errors also meant that the `run()` method would
never be able to log these.

### Modifications:

* Updated the certificate check to validate the the public key of the
private key matches the cert's public key (instead of checking the
signature).
* Added three new error cases.

### Result:

* A caller can now be sure that their certificate and private key pair
are valid after calling `reload()` the first time.
* Errors in future reloads will be surfaced using the provided logger
and do not go unnoticed.
* You can actually use the reloader with normal certificates.
1.28.0
2025-05-30 12:31:14 +00:00
Franz Busch 24cb15c9bc Support certificate chains from single PEM in TimedCertificateReloader (#273)
## Motivation

The new `TimedCertificateReloader` currently only supports loading PEM
files with a single cert. It is often the case that a single PEM file
contains an entire certificate chain.

## Modification

Modifies the code to support loading an entire certificate chain from a
single PEM file.

## Result

PEM based certificate chain support in our new
`TimedCertificateReloader`
1.27.1
2025-05-20 14:25:46 +00:00
Rick Newton-Rogers 72a23eafe0 Update README.md Swift version table (#271)
Update README.md Swift version table
2025-05-15 16:52:55 +01:00
Gus Cairo 949cf2d3c8 Add a TimedCertificateReloader (#269)
This PR adds a `CertificateReloader` protocol and a
`TimedCertificateReloader` implementation.

A `CertificateReloader` allows for certificate-key pairs to be observed
and updated. A `TimedCertificateReloader` does this every set interval
of time.

This PR also provides an extension on `TLSConfiguration` to enable this
reloading ability in NIO applications, so that updated certificates and
keys can be used during SSL handshakes; as well as conformance of the
`TimedCertificateReloader` to `swift-service-lifecycle`'s `Service`
protocol, for easy composition.
1.27.0
2025-05-14 13:37:05 +01:00
Rick Newton-Rogers 0fc472ba34 Drop Swift 5.9 (#270)
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.
2025-05-07 05:52:53 +00:00
Rick Newton-Rogers f1f6f77219 Enable Swift 6.1 jobs in CI (#268)
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.
1.26.0
2025-04-14 10:40:54 +01:00
Marc Prud'hommeaux 8526b90bc4 Ignore return value of signal() on Android (#266)
See https://github.com/apple/swift-nio/pull/3181 and
https://github.com/apple/swift-nio/issues/3180
2025-04-09 13:16:39 +00:00
George Barnett a0189d045c Strict concurrency for NIOResumableUpload (#265)
HTTPResumableUpload contains the core logic. It uses an event loop to
synchronize its state internally. Some methods are safe to call from off
of that event loop and have been moved to a new sendable view. The
HTTPResumableUpload type is marked as explicitly not sendable.

As such, most other types now hold on to the sendable view and use that
as the interface to HTTPResumableUpload.

HTTPResumableUploadChannel must be sendable (it's a Channel) and now
uses safe abstractions (where possible).
2025-04-08 09:21:01 +01:00
George Barnett b6b5e1133f Strict concurrency for NIONFS3 and NIONFS3Tests (#264) 2025-04-07 15:09:17 +01:00
Rick Newton-Rogers 96bce550c6 Enable macOS CI on pull requests (#258)
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-02 13:08:30 +00:00
George Barnett cf3de22478 Strict concurrency for NIOExtrasPerformanceTester (#263) 2025-04-02 12:26:48 +00:00
George Barnett 1a16877a1b Strict concurrency for HTTPServerWithQuiescingDemo (#262) 2025-04-02 13:20:46 +01:00
George Barnett c92af9d4ef Strict concurrency for HTTPTypes and friends (#259) 2025-04-01 15:44:08 +00:00
George Barnett 7241067079 Strict concurrency for NIOHTTPResponsiveness and NIOHTTPResponsivenessTests (#261) 2025-04-01 15:32:33 +00:00
George Barnett dbfdade581 Strict concurrency for NIOWritePCAPDemo, NIOWritePartialPCAPDemo and NIOSOCKSClient (#260) 2025-04-01 15:27:24 +00:00
George Barnett dc6987e77e Strict concurrency for NIOSOCKS (#256) 2025-04-01 14:33:46 +00:00
George Barnett 0447b0359e Strict concurrency for NIOHTTPCompression (#257) 2025-04-01 15:29:54 +01:00
George Barnett 20c59b2d64 Strict concurrency for NIOExtras and NIOExtrasTests (#254) 2025-03-31 11:53:06 +01:00
Rick Newton-Rogers d8a178ea78 Enable macOS CI on merge to main and daily timer (#255)
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-28 14:29:37 +00:00
Honza Dvorsky ae4d6b4b9a Add a missing import to CNIOLinux (#251)
### Motivation:

Stricter import rules mean that using the `sin_addr` property on Linux
requires the explicit CNIOLinux import.

### Modifications:

Added the missing import.

### Result:

Fixes a CI diagnostic.
2025-03-11 12:10:01 +00:00
Rick Newton-Rogers 5308c07e83 Only apply standard swift settings on valid targets (#250)
Only apply standard swift settings on valid targets. The current check
ignores plugins but that is not comprehensive enough.
2025-03-07 15:06:05 +00:00
Rick Newton-Rogers 395a46efbb Rename nightly_6_1 params to nightly_next (#249)
Rename nightly_6_1 params to nightly_next; see
https://github.com/apple/swift-nio/pull/3122
2025-03-03 14:45:37 +00:00
Guoye Zhang 00f3f72d2f Eliminate hasPrefix usage for pseudo HTTP header names (#248)
UTF8 view is faster than hasPrefix

rdar://144395951
1.25.0
2025-02-15 18:14:17 -08:00
Rick Newton-Rogers 926c3e19e7 Avoid integer overrun in NIOHTTPResponsiveness (#247)
We use 8*10^9 in `NIOHTTPResponsiveness` however this number will
overrun the integer size on platforms with 32-bit pointer-width such as
watchOS.

This change drops down to use 1*10^9 on such platforms.
2025-01-31 16:00:41 +00:00
Rick Newton-Rogers c96e65891d CI use 6.1 nightlies (#246)
CI use 6.1 nightlies now that Swift development is happening in the 6.1
branch
2025-01-30 09:45:57 +00:00
Eric RosenbergandGeorge Barnett 4804de1953 Responsiveness under Working Conditions (#242)
Implementation of
https://datatracker.ietf.org/doc/draft-ietf-ippm-responsiveness/ (draft
5) with flexible download and upload handlers to suit other use cases as
well.

### Motivation:

The provided handlers are useful for measuring responsiveness and
testing things like performance of proxies

### Modifications:

Add `NIOHTTPResponsiveness` and `NIOHTTPResponsivenessServer`

### Result:

We'll now have an implementation of the Responsiveness under Working
Conditions draft

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2025-01-21 17:14:26 +00:00
Marc Prud'hommeauxandGeorge Barnett aa0d902637 Android support (#244)
Add Android support

### Motivation:

Support the Android platform.

### Modifications:

Add Android imports and fix the default temporary directory to be
correct for the OS.

### Result:

The package will build and test on Android.

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2025-01-14 16:48:42 +00:00
George Barnett 74a143a79f Fix warnings (#245)
Motivation:

The latest NIO release deprecated a number of APIs and added more
Sendable contraints.

Modifications:

- Use sync APIs where possible
- Use `_deprecated` but not `@deprecated` NIOFileHandle API
- Stop using NIOAny

Result:

No warnings
2025-01-14 11:24:08 +00:00
Eric Rosenberg 066c8e4ccd support h2 stream resets through user events (#241)
Allow applications to trigger HTTP/2 stream resets while using
NIOHTTPTypesHTTP2's codecs

### Motivation:

Resetting streams with specific error codes is required by some
applications such as those implementing the CONNECT method
(see https://datatracker.ietf.org/doc/html/rfc9113#section-8.5-8).
Unfortunately, the HTTP2ToHTTP codecs don't expose this capability to
applications.

### Modifications:

Introduce an outbound user event applications can trigger when needing
to reset an HTTP/2 stream.

### Result:

Now applications can trigger HTTP/2 stream resets while using the codecs
provided by NIOHTTPTypesHTTP2
2025-01-07 08:05:05 +00:00
Franz Busch 892863568e Update release.yml (#243)
Update the release.yml file with the latest label changes
2024-12-18 14:09:33 +01:00
Rick Newton-Rogers 5c7978016e Enable MemberImportVisibility check on all targets (#240)
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-13 15:07:05 +01:00
fde9d65d2e Import HTTP resumable upload sample code (#203)
Support HTTP resumable upload.

### Motivation:

Supporting HTTP resumable upload protocol defined in
https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-resumable-upload-05

* Interop version 3: iOS 17.0, macOS 14.0
* Interop version 5: iOS 18.0, macOS 15.0
* Interop version 6: iOS 18.1, macOS 15.1

### Modifications:

2 new public classes, `HTTPResumableUploadHandler` and
`HTTPResumableUploadContext`, and a few other supporting objects to
manage resumable uploads and translate them into regular uploads.

---------

Co-authored-by: Jonathan Flat <jflat@apple.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
2024-12-11 07:39:13 +00:00
Franz Busch 3efabe7202 Aligning semantic version label check name (#239) 2024-11-28 12:02:48 +00:00
Rick Newton-Rogers a32874df06 remove unused Swift 6 language mode workflow (#237)
remove unused Swift 6 language mode workflow
2024-11-15 09:54:46 +00:00
Rick Newton-Rogers 646bbeb9e6 add .editorconfig file (#236)
add .editorconfig file
2024-11-15 09:51:09 +00:00
Rick Newton-Rogers 608de0d0a1 Unify main.yml and scheduled.yml, remove 5_8 ref (#235)
### Motivation:

* `main.yml` and `scheduled.yml` are mostly duplicative.
* Scheduled runs failed because of a deprecated reference to a Swift 5.8
pipeline

### Modifications:

* Unify `main.yml` and `scheduled.yml`
* Remove the reference to the 5.8 pipeline

### Result:

Working scheduled runs.
2024-10-29 10:58:40 +00:00
Rick Newton-Rogers 3f776e9aaf Migrate CI to use GitHub Actions. (#234)
### Motivation:

To migrate to GitHub actions and centralised infrastructure.

### Modifications:

Changes of note:
* Adopt swift-format using rules from SwiftNIO
* Remove scripts and docker files which are no longer needed

### Result:

Feature parity with old CI.
2024-10-28 14:00:57 +00:00
Cory Benfield 11b7d82b51 Use .git in Package.swift paths (#233)
Resolves #232.
2024-10-23 07:54:37 +01:00
Rick Newton-RogersandRick Newton-Rogers 2e9746cfc5 LineBasedFrameDecoderTest cleanup (#230)
Remove extraneous `print` statement.

Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
1.24.1
2024-09-11 17:04:50 +01:00