HttpClient with H/3 supporting connection migration
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
It seems `HttpClient` (or msquic beneath) when using HTTP/3 does not support connection migration.
### Reproduction Steps
Create an ASP.NET Core application and host it using protocols Http1AndHttp2AndHttp3.
Adding a streaming SSE endpoint, for example:
```csharp
//...
app.MapGet("/stream", Streaming);
app.Run();
async IAsyncEnumerable StreamingRaw()
{
for (int i = 0; i < 100; i++)
{
await Task.Delay(1000);
yield return i.ToString();
}
}
IResult Streaming()
{
return Results.ServerSentEvents(StreamingRaw());
}
```
- Host this application on a server.
- Open the `/stream` endpoint from a browser (make sure the browser is using H/3).
- The response is streaming, and appears in the browser.
- Migrate the connection to a new IP address (I personally used wireguard to get a new IP address)
- The browser keeps streaming the response (at least Chromium based Edge does)
- Repeat this now using `HttpClient` (explicitly setting H/3 version on the request) -> the response stream is broken (stops forever) when the new IP address is received.
### Expected behavior
Response keeps streaming.
### Actual behavior
Response stops streaming.
### Regression?
_No response_
### Known Workarounds
_No response_
### Configuration
x64, .NET10 and .NET11, Windows 11
### Other information
_No response_
Contributor guide
Research direction
Start by reproducing the streaming `/stream` SSE scenario with `HttpClient` explicitly using HTTP/3, then compare its behavior with the browser during an IP migration. Trace the `HttpClient` HTTP/3 path and its interaction with msquic; done means the response stream continues after the connection receives a new IP address.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100