diff --git a/src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs b/src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs index e48bc24d6b..c7a01fb219 100644 --- a/src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs +++ b/src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs @@ -22,6 +22,7 @@ // ----------------------------------------------------------------------- using System; +using Microsoft.Extensions.Internal; namespace Microsoft.Net.Http.Server { @@ -32,11 +33,12 @@ namespace Microsoft.Net.Http.Server static ComNetOS() { + var win8Version = new Version(6, 2); + #if NETSTANDARD1_3 // TODO: SkipIOCPCallbackOnSuccess doesn't work on Win7. Need a way to detect Win7 vs 8+. - IsWin8orLater = false; + IsWin8orLater = (new Version(RuntimeEnvironment.OperatingSystemVersion) >= win8Version); #else - var win8Version = new Version(6, 2); IsWin8orLater = (Environment.OSVersion.Version >= win8Version); #endif } diff --git a/src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs b/src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs index e184ac29c2..43a77a54d1 100644 --- a/src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs +++ b/src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs @@ -284,8 +284,7 @@ namespace Microsoft.Net.Http.Server public string Scheme => IsHttps ? Constants.HttpsScheme : Constants.HttpScheme; // HTTP.Sys allows you to upgrade anything to opaque unless content-length > 0 or chunked are specified. - // TODO: >= Win8 check https://github.com/aspnet/WebListener/issues/215 - internal bool IsUpgradable => !HasEntityBody; + internal bool IsUpgradable => !HasEntityBody && ComNetOS.IsWin8orLater; public string ContentType => Headers[HttpKnownHeaderNames.ContentType]; diff --git a/src/Microsoft.Net.Http.Server/WebSocketHelpers.cs b/src/Microsoft.Net.Http.Server/WebSocketHelpers.cs index 6d4822ab3e..8ee6466a00 100644 --- a/src/Microsoft.Net.Http.Server/WebSocketHelpers.cs +++ b/src/Microsoft.Net.Http.Server/WebSocketHelpers.cs @@ -67,8 +67,7 @@ namespace Microsoft.Net.Http.Server { get { - // https://github.com/aspnet/WebListener/issues/215 - return true; // TODO: ComNetOS.IsWin8orLater; + return ComNetOS.IsWin8orLater; } } diff --git a/src/Microsoft.Net.Http.Server/project.json b/src/Microsoft.Net.Http.Server/project.json index e82ad375c9..e23549b60d 100644 --- a/src/Microsoft.Net.Http.Server/project.json +++ b/src/Microsoft.Net.Http.Server/project.json @@ -26,6 +26,10 @@ }, "netstandard1.3": { "dependencies": { + "Microsoft.Extensions.RuntimeEnvironment.Sources": { + "type": "build", + "version": "1.1.0-*" + }, "Microsoft.Win32.Primitives": "4.0.1-*", "System.Diagnostics.Contracts": "4.0.1-*", "System.Diagnostics.Debug": "4.0.11-*",