Uh oh!
There was an error while loading. Please reload this page.
Implement SocketsHttpHandler.InitialHttp2MaxConcurrentStreams - #132521
Conversation
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Tagging subscribers to this area: @karelz, @dotnet/ncl |
There was a problem hiding this comment.
Pull request overview
Adds a new SocketsHttpHandler configuration knob to cap how many HTTP/2 streams a new connection may open before the peer’s initial SETTINGS frame is observed, and adjusts the existing “last seen” SETTINGS_MAX_CONCURRENT_STREAMS behavior to respect that cap. This fits into the System.Net.Http connection-pooling and HTTP/2 stream management code paths.
Changes:
- Introduces
SocketsHttpHandler.InitialHttp2MaxConcurrentStreams(default 100, must be >= 1) and threads it through connection settings/pool initialization. - Updates HTTP/2 SETTINGS processing to only memorize server-advertised max-concurrent-streams values when they are lower than the configured initial cap.
- Adds functional tests validating round-tripping, validation, and the before-SETTINGS behavior/memoization behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs | Adds API validation/roundtrip tests and HTTP/2 loopback tests covering pre-SETTINGS stream limiting and memoization rules. |
| src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | Adds the new public property with validation and XML docs. |
| src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionSettings.cs | Stores/clones the new initial max concurrent streams setting. |
| src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs | Removes the hardcoded initial stream cap and updates SETTINGS_MAX_CONCURRENT_STREAMS handling/memoization logic. |
| src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs | Initializes per-pool “last seen” HTTP/2 max concurrent streams from the new setting. |
| src/libraries/System.Net.Http/src/System/Net/Http/HttpHandlerDefaults.cs | Introduces the default constant (100) for the new property, with rationale. |
| src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs | Adds the corresponding browser stub property throwing PNSE. |
| src/libraries/System.Net.Http/ref/System.Net.Http.cs | Exposes the new public API surface in the ref assembly. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
MihaZupan
commented
Aug 20, 2026
/backport to release/11.0 |
Started backporting to |
Implements #132457 for .NET 12. Potential backports to 11 will follow later.
0 is technically also a valid value for this property, but I blocked it for now since it requires a bit of extra code (see bae3040), while I don't see a good realistic scenario rn. We can always add support for it back later if someone cares.