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

Mark some System.Net.HttpListener APIs as unsupported on browser #42063

Merged
merged 6 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +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; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
public System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy ExtendedProtectionPolicy { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.DisallowNullAttribute]
public System.Net.HttpListener.ExtendedProtectionSelector? ExtendedProtectionSelectorDelegate { get { throw null; } set { } }
Expand Down Expand Up @@ -87,21 +88,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 +130,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 All @@ -140,10 +148,14 @@ public partial class HttpListenerTimeoutManager
{
internal HttpListenerTimeoutManager() { }
public System.TimeSpan DrainEntityBody { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.TimeSpan EntityBody { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.TimeSpan HeaderWait { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } }
public System.TimeSpan IdleConnection { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public long MinSendBytesPerSecond { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.TimeSpan RequestQueue { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } }
}
}
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 @@ -78,6 +79,7 @@ public AuthenticationSchemes AuthenticationSchemes
}
}

[UnsupportedOSPlatform("browser")]
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
public ExtendedProtectionPolicy ExtendedProtectionPolicy
{
get => _extendedProtectionPolicy;
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 @@ -36,6 +36,7 @@ public TimeSpan IdleConnection
}
}

[UnsupportedOSPlatform("browser")]
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
public TimeSpan EntityBody
{
get => TimeSpan.Zero;
Expand All @@ -47,6 +48,7 @@ public TimeSpan EntityBody
}
}

[UnsupportedOSPlatform("browser")]
public TimeSpan HeaderWait
{
get => TimeSpan.Zero;
Expand All @@ -58,6 +60,7 @@ public TimeSpan HeaderWait
}
}

[UnsupportedOSPlatform("browser")]
public long MinSendBytesPerSecond
{
get => 0;
Expand All @@ -72,6 +75,7 @@ public long MinSendBytesPerSecond
}
}

[UnsupportedOSPlatform("browser")]
public TimeSpan RequestQueue
{
get => TimeSpan.Zero;
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.Versioning;
using Microsoft.Win32.SafeHandles;

namespace System.Net
Expand Down Expand Up @@ -95,6 +96,7 @@ public Version ProtocolVersion
}
}

[UnsupportedOSPlatform("browser")]
public void Abort()
{
if (Disposed)
Expand All @@ -106,6 +108,7 @@ public void Abort()
HttpListenerContext.Abort();
}

[UnsupportedOSPlatform("browser")]
public void Close()
{
try
Expand All @@ -118,6 +121,7 @@ public void Close()
}
}

[UnsupportedOSPlatform("browser")]
public void Close(byte[] responseEntity, bool willBlock)
{
CheckDisposed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private void SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan
// request, it resets the timer to give the connection another interval.
//
// Use TimeSpan.Zero to indiate that system defaults should be used.
[UnsupportedOSPlatform("browser")]
public TimeSpan EntityBody
{
get
Expand Down Expand Up @@ -115,6 +116,7 @@ public TimeSpan DrainEntityBody
// it up. The default timer is 2 minutes.
//
// Use TimeSpan.Zero to indiate that system defaults should be used.
[UnsupportedOSPlatform("browser")]
public TimeSpan RequestQueue
{
get
Expand Down Expand Up @@ -151,6 +153,7 @@ public TimeSpan IdleConnection
// This timeout is only enforced after the first request on the connection is routed to the application.
//
// Use TimeSpan.Zero to indiate that system defaults should be used.
[UnsupportedOSPlatform("browser")]
public TimeSpan HeaderWait
{
get
Expand All @@ -168,6 +171,7 @@ public TimeSpan HeaderWait
// bytes-per-second.
//
// To disable this timer set it to UInt32.MaxValue
[UnsupportedOSPlatform("browser")]
public long MinSendBytesPerSecond
{
get
Expand Down