Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/5.0-rc2] Backport Additional Browser Unsupported Attribute Changes #42267

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libraries/System.IO.Pipes/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
<UnsupportedOSPlatforms>browser</UnsupportedOSPlatforms>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/libraries/System.Net.Http/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
</Project>
17 changes: 17 additions & 0 deletions src/libraries/System.Net.Http/ref/System.Net.Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,44 @@ public partial class HttpClientHandler : System.Net.Http.HttpMessageHandler
{
public HttpClientHandler() { }
public bool AllowAutoRedirect { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool CheckCertificateRevocationList { get { throw null; } set { } }
public System.Net.Http.ClientCertificateOption ClientCertificateOptions { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.CookieContainer CookieContainer { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.ICredentials? Credentials { get { throw null; } set { } }
public static System.Func<System.Net.Http.HttpRequestMessage, System.Security.Cryptography.X509Certificates.X509Certificate2?, System.Security.Cryptography.X509Certificates.X509Chain?, System.Net.Security.SslPolicyErrors, bool> DangerousAcceptAnyServerCertificateValidator { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.ICredentials? DefaultProxyCredentials { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public int MaxAutomaticRedirections { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public int MaxConnectionsPerServer { get { throw null; } set { } }
public long MaxRequestContentBufferSize { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public int MaxResponseHeadersLength { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool PreAuthenticate { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, object?> Properties { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.IWebProxy? Proxy { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Func<System.Net.Http.HttpRequestMessage, System.Security.Cryptography.X509Certificates.X509Certificate2?, System.Security.Cryptography.X509Certificates.X509Chain?, System.Net.Security.SslPolicyErrors, bool>? ServerCertificateCustomValidationCallback { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Security.Authentication.SslProtocols SslProtocols { get { throw null; } set { } }
public virtual bool SupportsAutomaticDecompression { get { throw null; } }
public virtual bool SupportsProxy { get { throw null; } }
public virtual bool SupportsRedirectConfiguration { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool UseCookies { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool UseDefaultCredentials { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool UseProxy { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
protected internal override System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; }
Expand Down Expand Up @@ -325,6 +341,7 @@ protected override void SerializeToStream(System.IO.Stream stream, System.Net.Tr
protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context, System.Threading.CancellationToken cancellationToken) { throw null; }
protected internal override bool TryComputeLength(out long length) { throw null; }
}
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public sealed partial class SocketsHttpHandler : System.Net.Http.HttpMessageHandler
{
public SocketsHttpHandler() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using System.Collections.Generic;
using System.IO;
using System.Net.Security;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;

namespace System.Net.Http
{
[UnsupportedOSPlatform("browser")]
public sealed class SocketsHttpHandler : HttpMessageHandler
{
public static bool IsSupported => false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Globalization;
using System.Net.Security;
using System.Collections.Generic;
using System.Runtime.Versioning;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
Expand Down Expand Up @@ -52,12 +53,14 @@ protected override void Dispose(bool disposing)
public virtual bool SupportsProxy => _underlyingHandler.SupportsProxy;
public virtual bool SupportsRedirectConfiguration => _underlyingHandler.SupportsRedirectConfiguration;

[UnsupportedOSPlatform("browser")]
public bool UseCookies
{
get => _underlyingHandler.UseCookies;
set => _underlyingHandler.UseCookies = value;
}

[UnsupportedOSPlatform("browser")]
public CookieContainer CookieContainer
{
get => _underlyingHandler.CookieContainer;
Expand All @@ -72,36 +75,42 @@ public CookieContainer CookieContainer
}
}

[UnsupportedOSPlatform("browser")]
public DecompressionMethods AutomaticDecompression
{
get => _underlyingHandler.AutomaticDecompression;
set => _underlyingHandler.AutomaticDecompression = value;
}

[UnsupportedOSPlatform("browser")]
public bool UseProxy
{
get => _underlyingHandler.UseProxy;
set => _underlyingHandler.UseProxy = value;
}

[UnsupportedOSPlatform("browser")]
public IWebProxy? Proxy
{
get => _underlyingHandler.Proxy;
set => _underlyingHandler.Proxy = value;
}

[UnsupportedOSPlatform("browser")]
public ICredentials? DefaultProxyCredentials
{
get => _underlyingHandler.DefaultProxyCredentials;
set => _underlyingHandler.DefaultProxyCredentials = value;
}

[UnsupportedOSPlatform("browser")]
public bool PreAuthenticate
{
get => _underlyingHandler.PreAuthenticate;
set => _underlyingHandler.PreAuthenticate = value;
}

[UnsupportedOSPlatform("browser")]
public bool UseDefaultCredentials
{
// SocketsHttpHandler doesn't have a separate UseDefaultCredentials property. There
Expand All @@ -124,6 +133,7 @@ public bool UseDefaultCredentials
}
}

[UnsupportedOSPlatform("browser")]
public ICredentials? Credentials
{
get => _underlyingHandler.Credentials;
Expand All @@ -136,12 +146,14 @@ public bool AllowAutoRedirect
set => _underlyingHandler.AllowAutoRedirect = value;
}

[UnsupportedOSPlatform("browser")]
public int MaxAutomaticRedirections
{
get => _underlyingHandler.MaxAutomaticRedirections;
set => _underlyingHandler.MaxAutomaticRedirections = value;
}

[UnsupportedOSPlatform("browser")]
public int MaxConnectionsPerServer
{
get => _underlyingHandler.MaxConnectionsPerServer;
Expand Down Expand Up @@ -181,6 +193,7 @@ public long MaxRequestContentBufferSize
}
}

[UnsupportedOSPlatform("browser")]
public int MaxResponseHeadersLength
{
get => _underlyingHandler.MaxResponseHeadersLength;
Expand Down Expand Up @@ -220,6 +233,7 @@ public ClientCertificateOption ClientCertificateOptions
}
}

[UnsupportedOSPlatform("browser")]
public X509CertificateCollection ClientCertificates
{
get
Expand All @@ -234,6 +248,7 @@ public X509CertificateCollection ClientCertificates
}
}

[UnsupportedOSPlatform("browser")]
public Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool>? ServerCertificateCustomValidationCallback
{
#if TARGETS_BROWSER
Expand All @@ -251,6 +266,7 @@ public X509CertificateCollection ClientCertificates
#endif
}

[UnsupportedOSPlatform("browser")]
public bool CheckCertificateRevocationList
{
get => _underlyingHandler.SslOptions.CertificateRevocationCheckMode == X509RevocationMode.Online;
Expand All @@ -261,6 +277,7 @@ public bool CheckCertificateRevocationList
}
}

[UnsupportedOSPlatform("browser")]
public SslProtocols SslProtocols
{
get => _underlyingHandler.SslOptions.EnabledSslProtocols;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
using System.Diagnostics;
using System.IO;
using System.Net.Security;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using System.Text;

namespace System.Net.Http
{
[UnsupportedOSPlatform("browser")]
public sealed class SocketsHttpHandler : HttpMessageHandler
{
private readonly HttpConnectionSettings _settings = new HttpConnectionSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public HttpListener() { }
public System.Net.AuthenticationSchemes AuthenticationSchemes { get { throw null; } set { } }
public System.Net.AuthenticationSchemeSelector? AuthenticationSchemeSelectorDelegate { get { throw null; } set { } }
public System.Security.Authentication.ExtendedProtection.ServiceNameCollection DefaultServiceNames { get { throw null; } }
public System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy ExtendedProtectionPolicy { get { throw null; } set { } }
public System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy ExtendedProtectionPolicy { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] set { } }
[System.Diagnostics.CodeAnalysis.DisallowNullAttribute]
public System.Net.HttpListener.ExtendedProtectionSelector? ExtendedProtectionSelectorDelegate { get { throw null; } set { } }
public bool IgnoreWriteExceptions { get { throw null; } set { } }
Expand Down Expand Up @@ -87,21 +87,25 @@ internal HttpListenerRequest() { }
public string HttpMethod { get { throw null; } }
public System.IO.Stream InputStream { get { throw null; } }
public bool IsAuthenticated { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool IsLocal { get { throw null; } }
public bool IsSecureConnection { get { throw null; } }
public bool IsWebSocketRequest { get { throw null; } }
public bool KeepAlive { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.IPEndPoint LocalEndPoint { get { throw null; } }
public System.Version ProtocolVersion { get { throw null; } }
public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } }
public string? RawUrl { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.IPEndPoint RemoteEndPoint { get { throw null; } }
public System.Guid RequestTraceIdentifier { get { throw null; } }
public string? ServiceName { get { throw null; } }
public System.Net.TransportContext TransportContext { get { throw null; } }
public System.Uri? Url { get { throw null; } }
public System.Uri? UrlReferrer { get { throw null; } }
public string UserAgent { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public string UserHostAddress { get { throw null; } }
public string UserHostName { get { throw null; } }
public string[]? UserLanguages { get { throw null; } }
Expand All @@ -125,11 +129,14 @@ internal HttpListenerResponse() { }
public bool SendChunked { get { throw null; } set { } }
public int StatusCode { get { throw null; } set { } }
public string StatusDescription { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Abort() { }
public void AddHeader(string name, string value) { }
public void AppendCookie(System.Net.Cookie cookie) { }
public void AppendHeader(string name, string value) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Close() { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Close(byte[] responseEntity, bool willBlock) { }
public void CopyFrom(System.Net.HttpListenerResponse templateResponse) { }
public void Redirect(string url) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
using System.Security.Authentication.ExtendedProtection;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -81,6 +82,7 @@ public AuthenticationSchemes AuthenticationSchemes
public ExtendedProtectionPolicy ExtendedProtectionPolicy
{
get => _extendedProtectionPolicy;
[UnsupportedOSPlatform("browser")]
set
{
CheckDisposed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Globalization;
using System.Net.WebSockets;
using System.Reflection;
using System.Runtime.Versioning;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -110,6 +111,7 @@ public Encoding ContentEncoding

public string? ContentType => Headers[HttpKnownHeaderNames.ContentType];

[UnsupportedOSPlatform("browser")]
public bool IsLocal => LocalEndPoint!.Address.Equals(RemoteEndPoint!.Address);

public bool IsWebSocketRequest
Expand Down Expand Up @@ -206,6 +208,7 @@ public NameValueCollection QueryString

public string UserAgent => Headers[HttpKnownHeaderNames.UserAgent]!;

[UnsupportedOSPlatform("browser")]
public string UserHostAddress => LocalEndPoint!.ToString();

public string UserHostName => Headers[HttpKnownHeaderNames.Host]!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.Versioning;
using System.Security.Authentication.ExtendedProtection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
Expand Down Expand Up @@ -373,8 +374,10 @@ public Stream InputStream

public bool IsSecureConnection => _context.Connection.IsSecure;

[UnsupportedOSPlatform("browser")]
public IPEndPoint? LocalEndPoint => _context.Connection.LocalEndPoint;

[UnsupportedOSPlatform("browser")]
public IPEndPoint? RemoteEndPoint => _context.Connection.RemoteEndPoint;

public Guid RequestTraceIdentifier { get; } = Guid.NewGuid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

using System.Globalization;
using System.IO;
using System.Runtime.Versioning;
using System.Text;

namespace System.Net
Expand Down Expand Up @@ -92,6 +93,7 @@ public int StatusCode

private void Dispose() => Close(true);

[UnsupportedOSPlatform("browser")]
public void Close()
{
if (Disposed)
Expand All @@ -100,6 +102,7 @@ public void Close()
Close(false);
}

[UnsupportedOSPlatform("browser")]
public void Abort()
{
if (Disposed)
Expand All @@ -114,6 +117,7 @@ private void Close(bool force)
_httpContext!.Connection.Close(force);
}

[UnsupportedOSPlatform("browser")]
public void Close(byte[] responseEntity, bool willBlock)
{
CheckDisposed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.IO;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Authentication.ExtendedProtection;
using System.Security.Cryptography;
Expand Down Expand Up @@ -288,6 +289,7 @@ public bool HasEntityBody
}
}

[UnsupportedOSPlatform("browser")]
public IPEndPoint RemoteEndPoint
{
get
Expand All @@ -301,6 +303,7 @@ public IPEndPoint RemoteEndPoint
}
}

[UnsupportedOSPlatform("browser")]
public IPEndPoint LocalEndPoint
{
get
Expand Down
Loading