From 18d1527c079e5f4c1e3ee0ccd1ca22f92f7969c9 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 8 Dec 2020 19:09:03 +0100 Subject: [PATCH] WinHttpHandler: apply [SupportedOSPlatform("windows10.0.19041")] on TcpKeepAlive properties (#45494) WINHTTP_OPTION_TCP_KEEPALIVE is only available since the May 2020 Update, so it's reasonable to decorate the TcpKeepalive API with [SupportedOSPlatform] --- .../ref/System.Net.Http.WinHttpHandler.cs | 3 +++ .../src/System/Net/Http/WinHttpHandler.cs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/libraries/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.cs index 12c8699..c9c63bb 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.cs @@ -44,8 +44,11 @@ namespace System.Net.Http public System.Func? ServerCertificateValidationCallback { get { throw null; } set { } } public System.Net.ICredentials? ServerCredentials { get { throw null; } set { } } public System.Security.Authentication.SslProtocols SslProtocols { get { throw null; } set { } } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows10.0.19041")] public bool TcpKeepAliveEnabled { get { throw null; } set { } } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows10.0.19041")] public System.TimeSpan TcpKeepAliveTime { get { throw null; } set { } } + [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows10.0.19041")] public System.TimeSpan TcpKeepAliveInterval { get { throw null; } set { } } public System.Net.Http.WindowsProxyUsePolicy WindowsProxyUsePolicy { get { throw null; } set { } } protected override void Dispose(bool disposing) { } diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs index 85a1251..0d9ce3f 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs @@ -7,6 +7,7 @@ using System.IO; using System.Net.Http.Headers; using System.Net.Security; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Text; @@ -418,9 +419,11 @@ namespace System.Net.Http /// Gets or sets a value indicating whether TCP keep-alive is enabled. /// /// + /// Only supported on Windows 10 version 2004 or newer. /// If enabled, the values of and will be forwarded /// to set WINHTTP_OPTION_TCP_KEEPALIVE, enabling and configuring TCP keep-alive for the backing TCP socket. /// + [SupportedOSPlatform("windows10.0.19041")] public bool TcpKeepAliveEnabled { get @@ -438,9 +441,11 @@ namespace System.Net.Http /// Gets or sets the TCP keep-alive timeout. /// /// + /// Only supported on Windows 10 version 2004 or newer. /// Has no effect if is . /// The default value of this property is 2 hours. /// + [SupportedOSPlatform("windows10.0.19041")] public TimeSpan TcpKeepAliveTime { get @@ -459,9 +464,11 @@ namespace System.Net.Http /// Gets or sets the TCP keep-alive interval. /// /// + /// Only supported on Windows 10 version 2004 or newer. /// Has no effect if is . /// The default value of this property is 1 second. /// + [SupportedOSPlatform("windows10.0.19041")] public TimeSpan TcpKeepAliveInterval { get -- 2.7.4