diff --git a/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs b/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs index 7247bfad69dd2..a331e1e5a1a91 100644 --- a/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs +++ b/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs @@ -43,10 +43,10 @@ internal ClientWebSocketOptions() { } public System.Net.Security.RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get { throw null; } set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public bool UseDefaultCredentials { get { throw null; } set { } } - public System.Version Version { get { throw null; } + public System.Version HttpVersion { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] set { } } - public System.Net.Http.HttpVersionPolicy VersionPolicy { get { throw null; } + public System.Net.Http.HttpVersionPolicy HttpVersionPolicy { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] set { } } public void AddSubProtocol(string subProtocol) { } diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs index fae2b88163c3e..1af88f4197c40 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs @@ -13,7 +13,7 @@ public sealed class ClientWebSocketOptions { private bool _isReadOnly; // After ConnectAsync is called the options cannot be modified. private List? _requestedSubProtocols; - private Version _version = HttpVersion.Version11; + private Version _version = Net.HttpVersion.Version11; private HttpVersionPolicy _versionPolicy = HttpVersionPolicy.RequestVersionOrLower; internal ClientWebSocketOptions() @@ -35,14 +35,14 @@ public bool UseDefaultCredentials set => throw new PlatformNotSupportedException(); } - public Version Version + public Version HttpVersion { get => _version; [UnsupportedOSPlatform("browser")] set => throw new PlatformNotSupportedException(); } - public System.Net.Http.HttpVersionPolicy VersionPolicy + public System.Net.Http.HttpVersionPolicy HttpVersionPolicy { get => _versionPolicy; [UnsupportedOSPlatform("browser")] diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs index 985fcc0180a35..ca3b958954e0a 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs @@ -26,10 +26,10 @@ public sealed class ClientWebSocketOptions internal X509CertificateCollection? _clientCertificates; internal WebHeaderCollection? _requestHeaders; internal List? _requestedSubProtocols; - private Version _version = HttpVersion.Version11; + private Version _version = Net.HttpVersion.Version11; private HttpVersionPolicy _versionPolicy = HttpVersionPolicy.RequestVersionOrLower; - public Version Version + public Version HttpVersion { get => _version; [UnsupportedOSPlatform("browser")] @@ -40,7 +40,7 @@ public Version Version } } - public HttpVersionPolicy VersionPolicy + public HttpVersionPolicy HttpVersionPolicy { get => _versionPolicy; [UnsupportedOSPlatform("browser")] diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs index 9b754cb761ac0..e7fa6c86ca18a 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs @@ -51,13 +51,13 @@ public async Task ConnectAsync(Uri uri, HttpMessageInvoker? handler, Cancellatio bool disposeHandler = true; try { - if (options.Version.Major >= 3 && options.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) + if (options.HttpVersion.Major >= 3 && options.HttpVersionPolicy != HttpVersionPolicy.RequestVersionOrLower) { throw new Exception(); } var request = new HttpRequestMessage(HttpMethod.Get, uri); - if (options.Version.Major >= 2 || (options.VersionPolicy == HttpVersionPolicy.RequestVersionOrHigher)) + if (options.HttpVersion.Major >= 2 || (options.HttpVersionPolicy == HttpVersionPolicy.RequestVersionOrHigher)) { request.Version = new Version(2, 0); } @@ -108,8 +108,8 @@ public async Task ConnectAsync(Uri uri, HttpMessageInvoker? handler, Cancellatio catch (HttpRequestException ex) { if (ex.Data.Contains("SETTINGS_ENABLE_CONNECT_PROTOCOL") && request.Version.Major == 2 - && (options.Version.Major == 2 && options.VersionPolicy == HttpVersionPolicy.RequestVersionOrLower - || options.Version.Major == 1 && options.VersionPolicy == HttpVersionPolicy.RequestVersionOrHigher)) + && (options.HttpVersion.Major == 2 && options.HttpVersionPolicy == HttpVersionPolicy.RequestVersionOrLower + || options.HttpVersion.Major == 1 && options.HttpVersionPolicy == HttpVersionPolicy.RequestVersionOrHigher)) { request.Version = new Version(1, 1); } @@ -343,17 +343,17 @@ static int ParseWindowBits(ReadOnlySpan value) /// The options controlling the request. private static void AddWebSocketHeaders(HttpRequestMessage request, string secKey, ClientWebSocketOptions options) { - request.Version = options.Version; + request.Version = options.HttpVersion; // always exact because we handle downgrade here request.VersionPolicy = HttpVersionPolicy.RequestVersionExact; - if (options.Version == HttpVersion.Version11) + if (options.HttpVersion == HttpVersion.Version11) { request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.Connection, HttpKnownHeaderNames.Upgrade); request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.Upgrade, "websocket"); request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.SecWebSocketKey, secKey); } - else if (options.Version == HttpVersion.Version20) + else if (options.HttpVersion == HttpVersion.Version20) { request.Method = HttpMethod.Connect; request.Headers.Protocol = "websocket"; @@ -408,7 +408,7 @@ static string GetDeflateOptions(WebSocketDeflateOptions options) private static void ValidateResponse(HttpResponseMessage response, string secValue, ClientWebSocketOptions options) { - if (options.Version == HttpVersion.Version11) + if (options.HttpVersion == HttpVersion.Version11) { if (response.StatusCode != HttpStatusCode.SwitchingProtocols) { @@ -420,7 +420,7 @@ private static void ValidateResponse(HttpResponseMessage response, string secVal ValidateHeader(response.Headers, HttpKnownHeaderNames.Upgrade, "websocket"); ValidateHeader(response.Headers, HttpKnownHeaderNames.SecWebSocketAccept, secValue); } - else if (options.Version == HttpVersion.Version20) + else if (options.HttpVersion == HttpVersion.Version20) { if (response.StatusCode != HttpStatusCode.OK) {