-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Remove premature QuicListener.IsSupported check #44755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,7 +1,6 @@ | ||||
// Licensed to the .NET Foundation under one or more agreements. | ||||
// The .NET Foundation licenses this file to you under the MIT license. | ||||
|
||||
using System.Net.Quic; | ||||
using Microsoft.AspNetCore.Connections; | ||||
using Microsoft.AspNetCore.Server.Kestrel.Transport.Quic; | ||||
using Microsoft.Extensions.DependencyInjection; | ||||
|
@@ -20,15 +19,11 @@ public static class WebHostBuilderQuicExtensions | |||
/// <returns>The <see cref="IWebHostBuilder"/>.</returns> | ||||
public static IWebHostBuilder UseQuic(this IWebHostBuilder hostBuilder) | ||||
{ | ||||
if (QuicListener.IsSupported) | ||||
// QuicListener.IsSupported has performance costs. Always register the QUIC factory and then check for support when binding an endpoint. | ||||
return hostBuilder.ConfigureServices(services => | ||||
halter73 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The presence of a registered multiplexed transport factory is tested when figuring out if an endpoint supports HTTP/3. For example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. This isn't relevant if you have HTTP/3 disabled which is the .NET 7 default. Or if you have only HTTP/3 enabled which would throw either way. But if you have If we backport this to 7 (which I still think we should do), we might just have to swallow the NotSupportedException thrown from BindAsync in the Http1AndHttp2AndHttp3 case. Fortunately, that's not the default in 7, and I don't see many people manually setting that unless they are running on a platform that supports QUIC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should ask the S.N.Q team to look at improving There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
dotnet/runtime#73153 enabled HTTP/3 for HttpClient by default for 7.0 rc1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The developer still has to opt-in by changing the request version or policy. |
||||
{ | ||||
return hostBuilder.ConfigureServices(services => | ||||
{ | ||||
services.AddSingleton<IMultiplexedConnectionListenerFactory, QuicTransportFactory>(); | ||||
}); | ||||
} | ||||
|
||||
return hostBuilder; | ||||
services.AddSingleton<IMultiplexedConnectionListenerFactory, QuicTransportFactory>(); | ||||
}); | ||||
} | ||||
|
||||
/// <summary> | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a unit test for this error? We could have a test that always runs that checks for
QuicListener.IsSupported
and expects an error if it is false.