Skip to content

Commit

Permalink
Fix WinHttp StreamingTest backward compat version (#104722)
Browse files Browse the repository at this point in the history
* Add WS2022 to OsSupport check for Bidirectional Streaming

* Enable the disabled test

* Add helper property to PlatformDetection.Windows for WS2022

* Use helper property for WS2022
  • Loading branch information
liveans authored and pull[bot] committed Oct 7, 2024
1 parent 59ee134 commit 420ed22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static partial class PlatformDetection
public static bool IsWindows8xOrLater => IsWindowsVersionOrLater(6, 2);
public static bool IsWindows10OrLater => IsWindowsVersionOrLater(10, 0);
public static bool IsWindowsServer2019 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 17763;
public static bool IsWindowsServer2022 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 20348;
public static bool IsWindowsNanoServer => IsWindows && (IsNotWindowsIoTCore && GetWindowsInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase));
public static bool IsWindowsServerCore => IsWindows && GetWindowsInstallationType().Equals("Server Core", StringComparison.OrdinalIgnoreCase);
public static int WindowsVersion => IsWindows ? (int)GetWindowsVersion() : -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public BidirectionStreamingTest(ITestOutputHelper output) : base(output)

// Build number suggested by the WinHttp team.
// It can be reduced if bidirectional streaming is backported.
public static bool OsSupportsWinHttpBidirectionalStreaming => Environment.OSVersion.Version >= new Version(10, 0, 22357, 0);
public static bool OsSupportsWinHttpBidirectionalStreaming => Environment.OSVersion.Version >= new Version(10, 0, 22357, 0)
|| PlatformDetection.IsWindowsServer2022; // This is required
// because WINHTTP_FLAG_AUTOMATIC_CHUNKING is backported to WS2022.

public static bool TestsEnabled => OsSupportsWinHttpBidirectionalStreaming && PlatformDetection.SupportsAlpn;

Expand Down Expand Up @@ -324,7 +326,6 @@ async Task RunServer()
}

[ConditionalFact(nameof(TestsBackwardsCompatibilityEnabled))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/103754")]
public async Task BackwardsCompatibility_DowngradeToHttp11()
{
TaskCompletionSource<object> completeStreamTcs = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
Expand Down

0 comments on commit 420ed22

Please sign in to comment.