-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add SslApplicationProtocol.Http3 #56775
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
a012247
c80a0cb
67e695f
68c435f
c4fae73
a008e8e
3a24095
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 | ||
---|---|---|---|---|
|
@@ -10,13 +10,16 @@ namespace System.Net.Security | |||
public readonly struct SslApplicationProtocol : IEquatable<SslApplicationProtocol> | ||||
{ | ||||
private static readonly Encoding s_utf8 = Encoding.GetEncoding(Encoding.UTF8.CodePage, EncoderFallback.ExceptionFallback, DecoderFallback.ExceptionFallback); | ||||
private static readonly byte[] s_http3Utf8 = new byte[] { 0x68, 0x33 }; // "h3" | ||||
private static readonly byte[] s_http2Utf8 = new byte[] { 0x68, 0x32 }; // "h2" | ||||
private static readonly byte[] s_http11Utf8 = new byte[] { 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31 }; // "http/1.1" | ||||
|
||||
// Refer to IANA on ApplicationProtocols: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids | ||||
// h2 | ||||
/// <summary>Defines a <see cref="SslApplicationProtocol"/> instance for HTTP 3.0.</summary> | ||||
public static readonly SslApplicationProtocol Http3 = new SslApplicationProtocol(s_http3Utf8, copy: false); | ||||
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. @karelz, should this require preview? Should
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. ATM, we don't do that for Either way, if we decide to annotate this, we should be consistent and do the same thing with Http3 version. |
||||
/// <summary>Defines a <see cref="SslApplicationProtocol"/> instance for HTTP 2.0.</summary> | ||||
public static readonly SslApplicationProtocol Http2 = new SslApplicationProtocol(s_http2Utf8, copy: false); | ||||
// http/1.1 | ||||
/// <summary>Defines a <see cref="SslApplicationProtocol"/> instance for HTTP 1.1.</summary> | ||||
public static readonly SslApplicationProtocol Http11 = new SslApplicationProtocol(s_http11Utf8, copy: false); | ||||
|
||||
private readonly byte[] _readOnlyProtocol; | ||||
|
@@ -77,6 +80,7 @@ public override string ToString() | |||
{ | ||||
return | ||||
arr is null ? string.Empty : | ||||
ReferenceEquals(arr, s_http3Utf8) ? "h3" : | ||||
ReferenceEquals(arr, s_http2Utf8) ? "h2" : | ||||
ReferenceEquals(arr, s_http11Utf8) ? "http/1.1" : | ||||
s_utf8.GetString(arr); | ||||
|
Uh oh!
There was an error while loading. Please reload this page.