Skip to content

Allow binding multiple addresses#79

Merged
FranzBusch merged 8 commits into
mainfrom
multiple-addresses
May 18, 2026
Merged

Allow binding multiple addresses#79
FranzBusch merged 8 commits into
mainfrom
multiple-addresses

Conversation

@gjcairo
Copy link
Copy Markdown
Collaborator

@gjcairo gjcairo commented May 13, 2026

This PR adds support for binding a NIOHTTPServer to multiple addresses simultaneously.

The configuration API now also accepts an array of BindTargets. All resulting channels are served concurrently using the same request handler.

The server treats its listening addresses as a unit: if any channel stops serving for any reason, all remaining channels are are also cancelled. This behaviour matches the current behaviour with a single listening address.

The listeningAddress property has been replaced by listeningAddresses, an array of addresses.

@gjcairo gjcairo added the 🆕 semver/minor Adds new public API. label May 13, 2026
@gjcairo gjcairo requested a review from FranzBusch May 13, 2026 15:25
Copy link
Copy Markdown
Collaborator

@ehaydenr ehaydenr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

Comment thread Sources/NIOHTTPServer/NIOHTTPServer+HTTP1_1.swift Outdated
Comment thread Sources/NIOHTTPServer/NIOHTTPServer+ListeningAddress.swift Outdated
Comment thread Sources/NIOHTTPServer/NIOHTTPServer.swift Outdated
Comment thread Tests/NIOHTTPServerTests/NIOHTTPServerTests.swift Outdated
@gjcairo gjcairo force-pushed the multiple-addresses branch from 76df44e to 4b38661 Compare May 14, 2026 13:30
@gjcairo gjcairo requested a review from aryan-25 May 14, 2026 13:30
@gjcairo gjcairo force-pushed the multiple-addresses branch from 7db71c8 to 1726688 Compare May 15, 2026 16:06
Copy link
Copy Markdown
Collaborator

@aryan-25 aryan-25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions, LGTM otherwise :)

Comment thread Tests/NIOHTTPServerTests/NIOHTTPServerTests.swift Outdated
Comment thread Sources/NIOHTTPServer/NIOHTTPServer+HTTP1_1.swift Outdated
Comment thread Tests/NIOHTTPServerTests/NIOHTTPServerTests.swift Outdated
@FranzBusch FranzBusch merged commit f8b5141 into main May 18, 2026
25 of 29 checks passed
@FranzBusch FranzBusch deleted the multiple-addresses branch May 18, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants