Update default HTTP/2 settings#85
Merged
FranzBusch merged 1 commit intoMay 27, 2026
Merged
Conversation
Motivation: As part of passing the HTTP/2 configuration values to `NIOHTTP2Handler`, we [override](https://github.com/swift-server/swift-http-server/blob/32abef29361e9add364e50e1fc85ac761f7d0651/Sources/NIOHTTPServer/NIOHTTPServer.swift#L349) [`NIOHTTP2Handler`'s `ConnectionConfiguration`'s `initialSettings`](https://github.com/apple/swift-nio-http2/blob/61d1b44f6e4e118792be1cff88ee2bc0267c6f9a/Sources/NIOHTTP2/HTTP2ChannelHandler.swift#L1512). This means we do not use the sensible defaults provided for `ConnectionConfiguration`'s `initialSettings` by the [`nioDefaultSettings` property](https://github.com/apple/swift-nio-http2/blob/61d1b44f6e4e118792be1cff88ee2bc0267c6f9a/Sources/NIOHTTP2/HTTP2ChannelHandler.swift#L20), which sets `maxConcurrentStreams` to 100, and `maxHeaderListSize` to `1 << 14`. Modifications: - Updated the value of the `internal` `defaultMaxConcurrentStreams` property and the public `maxConcurrentStreams` property in `NIOHTTPServerConfiguration.HTTP2` from `nil` (translates to no limit on the max concurrent streams) to `100`. - The types of these properties were also updated from `Int?` to `Int`, which also required the initializer to be updated. Users can no longer express unlimited `maxConcurrentStreams` and must either provide a concrete limit or implicitly use the default value of `100`. - Updated the `swift-configuration` integration to reflect this change. - Added the values contained in `nioDefaultSettings` to the initial settings array that we override. - Raised the `swift-nio-http2` dependency version to `1.44.0` in order to use the `NIOHPACK` product, which provides the default value for `maxHeaderListSize`. Result: We now set sensible default HTTP/2 settings.
FranzBusch
approved these changes
May 27, 2026
gjcairo
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
As part of passing the HTTP/2 configuration values to
NIOHTTP2Handler, we overrideNIOHTTP2Handler'sConnectionConfiguration'sinitialSettings.This means we do not use the sensible defaults provided for
ConnectionConfiguration'sinitialSettingsby thenioDefaultSettingsproperty, which setsmaxConcurrentStreamsto 100, andmaxHeaderListSizeto1 << 14.Modifications:
Updated the value of the
internaldefaultMaxConcurrentStreamsproperty and the publicmaxConcurrentStreamsproperty inNIOHTTPServerConfiguration.HTTP2fromnil(translates to no limit on the max concurrent streams) to100.Int?toInt, which also required the initializer to be updated. Users can no longer express unlimitedmaxConcurrentStreamsand must either provide a concrete limit or implicitly use the default value of100.swift-configurationintegration to reflect this change.Added the values contained in
nioDefaultSettingsto the initial settings array that we override.Raised the
swift-nio-http2dependency version to1.44.0in order to use theNIOHPACKproduct, which provides the default value formaxHeaderListSize.Result:
We now set sensible default HTTP/2 settings.