Skip to content

Allow creating H2C connections over HTTP CONNECT proxy tunnels#129485

Draft
MihaZupan wants to merge 1 commit into
dotnet:mainfrom
MihaZupan:http-h2cOverProxy
Draft

Allow creating H2C connections over HTTP CONNECT proxy tunnels#129485
MihaZupan wants to merge 1 commit into
dotnet:mainfrom
MihaZupan:http-h2cOverProxy

Conversation

@MihaZupan

Copy link
Copy Markdown
Member

Closes #99689

@MihaZupan MihaZupan added this to the 11.0.0 milestone Jun 16, 2026
@MihaZupan MihaZupan self-assigned this Jun 16, 2026
Copilot AI review requested due to automatic review settings June 16, 2026 22:50
@MihaZupan

Copy link
Copy Markdown
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates SocketsHttpHandler’s proxy connection pooling so that cleartext HTTP/2 (h2c) requests sent via an HTTP(S) proxy can be carried over a CONNECT tunnel (similar to existing non-secure WebSocket proxy tunneling support), enabling HTTP/2 in scenarios that previously fell back to HTTP/1.1-only proxy forwarding.

Changes:

  • Route cleartext HTTP/2 proxy requests to the ProxyTunnel connection kind (CONNECT tunneling) when HTTP/2 is required/preferred.
  • Enable HTTP/2 pooling/usage for HttpConnectionKind.ProxyTunnel.
  • Add a functional test validating when CONNECT tunneling is used vs. absolute-form forwarding through the proxy.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs Adds coverage for CONNECT tunneling behavior for HTTPS and cleartext HTTP/2 proxy scenarios.
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPoolManager.cs Adjusts connection key selection to use CONNECT tunneling for cleartext HTTP/2 through HTTP(S) proxies.
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionKind.cs Updates enum comments to reflect HTTP/1.1-only proxy forwarding vs. CONNECT tunneling use cases (including h2c).
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http2.cs Allows pooled HTTP/2 connections for ProxyTunnel pools (debug invariant update).
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs Enables HTTP/2 for ProxyTunnel pools by no longer force-disabling it in the constructor switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpClient does not support cleartext HTTP/2 over http(s) proxies

2 participants