Repository navigation
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. |
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
makazeu
marked this pull request as ready for review
October 11, 2026 03:32
This was referenced Oct 11, 2026
makazeu
marked this pull request as draft
October 12, 2026 08:06
Member
|
Closing in favour of #135617 |
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.
Closes #135103.
Summary
Fix IPv6 proxy connection-pool partitioning in
SocketsHttpHandlerby including the proxy's scope-preservingIdnHostinHttpConnectionKeyequality and hashing.This is a handler-local fix. It does not change
Uri.Equals,Uri.GetHashCode, or any public API.Problem
These proxy URIs identify different scoped endpoints:
However, URI equality and hashing ignore the IPv6 scope ID. Previously,
HttpConnectionKeyrelied on those operations to compareProxyUri, allowing both endpoints to select the same connection pool.A pool retains the proxy URI with which it was created. Consequently, a later request selecting
%2can still attempt to connect through%1. This can happen even if the first connection attempt failed; it is not limited to reusing an established connection.Implementation
For IPv6 proxy URIs:
IdnHostvalues in addition to the existing URI comparison.IdnHostwith the existing connection-key hash.IdnHostpreserves the scope ID while canonicalizing the IPv6 address. This distinguishes scoped endpoints without treating equivalent compressed and expanded address spellings as different proxies.The existing comparisons for connection kind, destination host, port, SSL host name, and identity remain unchanged. Existing URI equivalence rules are retained, with an additional scope-sensitive constraint for IPv6 proxies. The shared key applies this fix to HTTP proxy pools, CONNECT tunnels, and SOCKS tunnels.
Changing global URI equality or other URI-keyed caches is intentionally outside the scope of this PR.
Local verification of
IdnHostA small experiment using the existing PowerShell runtime, .NET 10.0.12, confirmed that
Hostexcludes the scope ID whileIdnHostpreserves it:HostIdnHost[fe80::1%1][fe80::1]fe80::1%1[fe80::1%2][fe80::1]fe80::1%2[fe80::1%eth0][fe80::1]fe80::1%eth0[fe80::1][fe80::1]fe80::1[FE80:0000:0000:0000:0000:0000:0000:0001%1][fe80::1]fe80::1%1All five cases matched their expected values. This experiment verifies existing URI behavior on the installed runtime; it is not a run against repository-built binaries and does not require network access.
Regression coverage
HttpConnectionKeyTest.Equals_ProxyUris_DistinguishesIPv6Scopecovers 13 URI pairs, including different numeric and named scopes, absent versus present scope, case-sensitive scope names, canonical IPv6 spellings, and existing URI equivalence rules. Each pair exercises both SSL-host hashing branches and checks symmetric equality, collection behavior, and equal-key hash consistency.Proxy_IPv6ScopeChange_ConnectsToSelectedProxycovers 12 combinations of HTTP/HTTPS/SOCKS5 proxies, HTTP/HTTPS destinations, and HTTP/1.1/HTTP/2 request policies. It changesWebProxy.Addressfrom%1to%2and verifies the endpoint supplied toConnectCallback. The callback deliberately throws before opening a socket, so these tests validate endpoint selection without requiring IPv6 interfaces or protocol negotiation.Validation
Earlier local validation on Windows ARM64, Release, completed before the local toolchain was removed:
System.Net.Httplibrary buildNo repository builds or tests were rerun while preparing this description. Cross-platform validation remains for CI.
Performance considerations
The scope check adds work to connection-key operations, including ordinary proxy lookups. Previously collected Windows ARM64 BenchmarkDotNet measurements showed the following representative DNS-proxy results:
These are isolated key-operation measurements, not end-to-end HTTP throughput results. No managed allocations were reported in the measured steady-state operations.
Resolves #135103
Note
This pull request description was generated with GitHub Copilot.