Skip to content

Remove canImport(HTTPAPIs) from ff-spi-for-httpapis branch#909

Merged
FranzBusch merged 11 commits into
swift-server:ff-spi-for-httpapisfrom
guoye-zhang:ff-spi-for-httpapis
Jun 6, 2026
Merged

Remove canImport(HTTPAPIs) from ff-spi-for-httpapis branch#909
FranzBusch merged 11 commits into
swift-server:ff-spi-for-httpapisfrom
guoye-zhang:ff-spi-for-httpapis

Conversation

@guoye-zhang
Copy link
Copy Markdown

fabianfett and others added 9 commits March 3, 2026 14:31
…ing (swift-server#895)

- Fix a `fatalError("Invalid state: idle")` crash in
`HTTP1ConnectionStateMachine.demandMoreResponseBodyParts()` that occurs
when a response completes before the request body finishes uploading
- The root cause is that `self.request` was only nilled out inside the
write-completion callback for `.sendRequestEnd`, creating a window where
`demandResponseBodyStream` could still see the old request and call into
the state machine after it had already transitioned to .idle
- The fix nils out `self.request` synchronously when handling
`.sendRequestEnd` (before the write completes), and moves
`requestBodyStreamSent()` to fire after the final action rather than
before it

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
…#897)

Replaces all the foundation imports.

One issue is that `HTTPClient.init?(httpsURLWithSocketPath socketPath:
String, uri: String = "/")` uses `addingPercentEncoding()` from
Foundation. So instead, we use a pure Swift impl. that does the same.

We also need to disable default traits from `swift-configuration` to
prevent linking Foundation, because the `JSON` trait does that.

This also adds a linkage test to prevent regressions to CI.
Motivation

In machines with more complex network topologies it is possible for us
to have multiple possible NICs we might want to use for a request. Users
may wish to vary this on a per-request or even a per-client basis.

This control can typically be expressed by offering a local address to
bind to before making the connection attempt.

Modifications

Allow users to express a preferred local address at request or client
scope.
Make this part of the connection pool key.
Bind the local address when specified.
Test all of this.

Results

More capable clients.
Motivation:

The cert used in some tests has expired so tests now fail

Modifications:

- Regenerate

Result:

Tests pass
Motivation:

Swift 6.0 has dropped out of the support policy

Modifications:

- Remove Package@swift-6.0.swift
- Ensure min tools version is 6.1

Result:

AHC only supports Swift 6.1+
…er#904)

Extending swift-server#878 to also allow configuring the proxy via ConfigReader

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
## Summary

- Adds `HTTPClient.Configuration.DNSResolver` with `.system` (default)
and `.randomized`
cases. When `.randomized` is selected, `NIORandomizedDNSResolver` is
installed on the
underlying `ClientBootstrap`, shuffling addresses returned by
`getaddrinfo`.
- Motivation: enables DNS-based load balancing for services that publish
multiple A/AAAA
records (e.g. Kubernetes headless services). The system resolver returns
addresses in a
deterministic order (typically RFC 6724 destination-address selection),
which defeats
  round-robin DNS — clients hammer the first address.

---------

Co-authored-by: Pavan sai kumar alladi <p_alladi@apple.com>
Co-authored-by: George Barnett <gbarnett@apple.com>
@FranzBusch FranzBusch merged commit a0ab907 into swift-server:ff-spi-for-httpapis Jun 6, 2026
34 of 35 checks passed
@guoye-zhang guoye-zhang deleted the ff-spi-for-httpapis branch June 6, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants