Disable AltSvc blocklist for prenegotiated HTTP/3 connections
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
When working with an HTTP/3 only server, `HttpClient` refuses to reconnect to the server if the previous connection attempt failed or an established was aborted.
Since the server is HTTP/3 only, `HttpClient` will not be able to create new HTTP/3 connections to the server by upgrading from HTTP/1 or HTTP/2. Thus a wait of 10 minutes is forced by the AltSvc blocklist.
### Reproduction Steps
Server:
```csharp
using Microsoft.AspNetCore.Server.Kestrel.Core;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseKestrel((context, options) =>
{
options.ListenAnyIP(5000, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http3;
listenOptions.UseHttps();
});
});
var app = builder.Build();
app.MapGet("/hello", () =>
{
return "Hello World";
});
app.Run();
```
Client:
```csharp
using System.Net;
var client = new HttpClient(new SocketsHttpHandler
{
EnableMultipleHttp3Connections = true,
PooledConnectionIdleTimeout = Timeout.InfiniteTimeSpan,
KeepAlivePingDelay = TimeSpan.FromSeconds(60),
KeepAlivePingTimeout = TimeSpan.FromSeconds(30),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always,
})
{
DefaultRequestVersion = HttpVersion.Version30,
DefaultVersionPolicy = HttpVersionPolicy.RequestVersionExact
};
while (true)
{
try
{
Console.WriteLine(await client.GetStringAsync("https://localhost:5000/hello"));
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
await Task.Delay(1000);
}
```
Run the server after starting the client. Or run the client after starting the server and then restart the server after receiving several requests.
### Expected behavior
`HttpClient` should reconnect immediately when the server is started.
### Actual behavior
`HttpClient` reconnects to the server after waiting for 10 minutes.
### Regression?
_No response_
### Known Workarounds
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.