Skip to content

Commit

Permalink
WinHttpHandler: apply [SupportedOSPlatform("windows10.0.19041")] on T…
Browse files Browse the repository at this point in the history
…cpKeepAlive 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]
  • Loading branch information
antonfirsov authored Dec 8, 2020
1 parent f3176e0 commit 18d1527
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ public WinHttpHandler() { }
public System.Func<System.Net.Http.HttpRequestMessage, System.Security.Cryptography.X509Certificates.X509Certificate2, System.Security.Cryptography.X509Certificates.X509Chain, System.Net.Security.SslPolicyErrors, bool>? 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) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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;
Expand Down Expand Up @@ -418,9 +419,11 @@ public TimeSpan ReceiveDataTimeout
/// Gets or sets a value indicating whether TCP keep-alive is enabled.
/// </summary>
/// <remarks>
/// Only supported on Windows 10 version 2004 or newer.
/// If enabled, the values of <see cref="TcpKeepAliveInterval" /> and <see cref="TcpKeepAliveTime"/> will be forwarded
/// to set WINHTTP_OPTION_TCP_KEEPALIVE, enabling and configuring TCP keep-alive for the backing TCP socket.
/// </remarks>
[SupportedOSPlatform("windows10.0.19041")]
public bool TcpKeepAliveEnabled
{
get
Expand All @@ -438,9 +441,11 @@ public bool TcpKeepAliveEnabled
/// Gets or sets the TCP keep-alive timeout.
/// </summary>
/// <remarks>
/// Only supported on Windows 10 version 2004 or newer.
/// Has no effect if <see cref="TcpKeepAliveEnabled"/> is <see langword="false" />.
/// The default value of this property is 2 hours.
/// </remarks>
[SupportedOSPlatform("windows10.0.19041")]
public TimeSpan TcpKeepAliveTime
{
get
Expand All @@ -459,9 +464,11 @@ public TimeSpan TcpKeepAliveTime
/// Gets or sets the TCP keep-alive interval.
/// </summary>
/// <remarks>
/// Only supported on Windows 10 version 2004 or newer.
/// Has no effect if <see cref="TcpKeepAliveEnabled"/> is <see langword="false" />.
/// The default value of this property is 1 second.
/// </remarks>
[SupportedOSPlatform("windows10.0.19041")]
public TimeSpan TcpKeepAliveInterval
{
get
Expand Down

0 comments on commit 18d1527

Please sign in to comment.