Add API ref docs for HTTPSys (#26649)

* Add API ref docs for HTTPSys

* Spacing

* Feedback
This commit is contained in:
William Godbe 2020-10-07 22:28:49 -07:00 committed by GitHub
parent 8f17d4a6bd
commit 8118a25e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 108 additions and 1 deletions

View File

@ -5,15 +5,39 @@ using System;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
// REVIEW: this appears to be very similar to System.Net.AuthenticationSchemes /// <summary>
/// Specifies protocols for authentication.
/// </summary>
[Flags] [Flags]
public enum AuthenticationSchemes public enum AuthenticationSchemes
{ {
/// <summary>
/// No authentication is enabled. This should only be used when HttpSysOptions.Authentication.AllowAnonymous is enabled (see <see cref="AuthenticationManager.AllowAnonymous"/>).
/// </summary>
None = 0x0, None = 0x0,
/// <summary>
/// Specifies basic authentication.
/// </summary>
Basic = 0x1, Basic = 0x1,
// Digest = 0x2, // TODO: Verify this is no longer supported by Http.Sys // Digest = 0x2, // TODO: Verify this is no longer supported by Http.Sys
/// <summary>
/// Specifies NTLM authentication.
/// </summary>
NTLM = 0x4, NTLM = 0x4,
/// <summary>
/// Negotiates with the client to determine the authentication scheme. If both client and server support Kerberos, it is used;
/// otherwise, NTLM is used.
/// </summary>
Negotiate = 0x8, Negotiate = 0x8,
/// <summary>
/// Specifies Kerberos authentication.
/// </summary>
Kerberos = 0x10 Kerberos = 0x10
} }
} }

View File

@ -31,6 +31,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Queue = new RequestQueue(queueName, UrlPrefix, _logger, receiver: true); Queue = new RequestQueue(queueName, UrlPrefix, _logger, receiver: true);
} }
/// <inheritdoc />
public void Dispose() public void Dispose()
{ {
Queue.UrlGroup?.Dispose(); Queue.UrlGroup?.Dispose();

View File

@ -3,6 +3,9 @@
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
/// <summary>
/// Constants for HttpSys.
/// </summary>
public static class HttpSysDefaults public static class HttpSysDefaults
{ {
/// <summary> /// <summary>

View File

@ -8,6 +8,9 @@ using System.Runtime.InteropServices;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
/// <summary>
/// Exception thrown by HttpSys when an error occurs
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")] [SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")]
public class HttpSysException : Win32Exception public class HttpSysException : Win32Exception
{ {
@ -28,6 +31,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
// the base class returns the HResult with this property // the base class returns the HResult with this property
// we need the Win32 Error Code, hence the override. // we need the Win32 Error Code, hence the override.
/// <inheritdoc />
public override int ErrorCode public override int ErrorCode
{ {
get get

View File

@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Http.Features;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
/// <summary>
/// Contains the options used by HttpSys.
/// </summary>
public class HttpSysOptions public class HttpSysOptions
{ {
private const uint MaximumRequestQueueNameLength = 260; private const uint MaximumRequestQueueNameLength = 260;
@ -26,6 +29,9 @@ namespace Microsoft.AspNetCore.Server.HttpSys
private long? _maxRequestBodySize = DefaultMaxRequestBodySize; private long? _maxRequestBodySize = DefaultMaxRequestBodySize;
private string _requestQueueName; private string _requestQueueName;
/// <summary>
/// Initializes a new <see cref="HttpSysOptions"/>.
/// </summary>
public HttpSysOptions() public HttpSysOptions()
{ {
} }

View File

@ -3,6 +3,9 @@
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
/// <summary>
/// Interface for delegating requests to other Http.Sys request queues.
/// </summary>
public interface IHttpSysRequestDelegationFeature public interface IHttpSysRequestDelegationFeature
{ {
/// <summary> /// <summary>
@ -15,6 +18,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
/// must not be read nor the response started before this is invoked. Check <see cref="CanDelegate"/> /// must not be read nor the response started before this is invoked. Check <see cref="CanDelegate"/>
/// before invoking. /// before invoking.
/// </summary> /// </summary>
/// <param name="destination">The rule maintaining the handle to the destination queue.</param>
void DelegateRequest(DelegationRule destination); void DelegateRequest(DelegationRule destination);
} }
} }

View File

@ -3,11 +3,16 @@
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
/// <summary>
/// This exposes the creation of delegation rules on request queues owned by the server.
/// </summary>
public interface IServerDelegationFeature public interface IServerDelegationFeature
{ {
/// <summary> /// <summary>
/// Create a delegation rule on request queue owned by the server. /// Create a delegation rule on request queue owned by the server.
/// </summary> /// </summary>
/// <param name="queueName">The name of the Http.Sys request queue.</param>
/// <param name="urlPrefix">The URL of the Http.Sys Url Prefix.</param>
/// <returns> /// <returns>
/// Creates a <see cref="DelegationRule"/> that can used to delegate individual requests. /// Creates a <see cref="DelegationRule"/> that can used to delegate individual requests.
/// </returns> /// </returns>

View File

@ -12,6 +12,7 @@
<!-- Ignore platform compatibility warnings for this project. We know this only works on windows.--> <!-- Ignore platform compatibility warnings for this project. We know this only works on windows.-->
<NoWarn>$(NoWarn);CA1416</NoWarn> <NoWarn>$(NoWarn);CA1416</NoWarn>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -7,6 +7,9 @@ using Microsoft.AspNetCore.HttpSys.Internal;
namespace Microsoft.AspNetCore.Server.HttpSys namespace Microsoft.AspNetCore.Server.HttpSys
{ {
/// <summary>
/// A set of URL parameters used to listen for incoming requests.
/// </summary>
public class UrlPrefix public class UrlPrefix
{ {
private UrlPrefix(bool isHttps, string scheme, string host, string port, int portValue, string path) private UrlPrefix(bool isHttps, string scheme, string host, string port, int portValue, string path)
@ -94,6 +97,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys
return new UrlPrefix(isHttps, scheme, host, port, portValue.Value, path); return new UrlPrefix(isHttps, scheme, host, port, portValue.Value, path);
} }
/// <summary>
/// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364698(v=vs.85).aspx
/// </summary>
/// <param name="prefix">The string that the <see cref="UrlPrefix"/> will be created from.</param>
public static UrlPrefix Create(string prefix) public static UrlPrefix Create(string prefix)
{ {
string scheme = null; string scheme = null;
@ -146,26 +153,58 @@ namespace Microsoft.AspNetCore.Server.HttpSys
return Create(scheme, host, port, path); return Create(scheme, host, port, path);
} }
/// <summary>
/// Gets a value that determines if the prefix's scheme is HTTPS.
/// </summary>
public bool IsHttps { get; } public bool IsHttps { get; }
/// <summary>
/// Gets the scheme used by the prefix.
/// </summary>
public string Scheme { get; } public string Scheme { get; }
/// <summary>
/// Gets the host domain name used by the prefix.
/// </summary>
public string Host { get; } public string Host { get; }
/// <summary>
/// Gets a string representation of the port used by the prefix.
/// </summary>
public string Port { get; } public string Port { get; }
internal string HostAndPort { get; } internal string HostAndPort { get; }
/// <summary>
/// Gets an integer representation of the port used by the prefix.
/// </summary>
public int PortValue { get; } public int PortValue { get; }
/// <summary>
/// Gets the path component of the prefix.
/// </summary>
public string Path { get; } public string Path { get; }
internal string PathWithoutTrailingSlash { get; } internal string PathWithoutTrailingSlash { get; }
/// <summary>
/// Gets a string representation of the prefix
/// </summary>
public string FullPrefix { get; } public string FullPrefix { get; }
/// <inheritdoc />
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return string.Equals(FullPrefix, Convert.ToString(obj), StringComparison.OrdinalIgnoreCase); return string.Equals(FullPrefix, Convert.ToString(obj), StringComparison.OrdinalIgnoreCase);
} }
/// <inheritdoc />
public override int GetHashCode() public override int GetHashCode()
{ {
return StringComparer.OrdinalIgnoreCase.GetHashCode(FullPrefix); return StringComparer.OrdinalIgnoreCase.GetHashCode(FullPrefix);
} }
/// <inheritdoc />
public override string ToString() public override string ToString()
{ {
return FullPrefix; return FullPrefix;

View File

@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
} }
/// <inheritdoc />
public int Count public int Count
{ {
get get
@ -41,16 +42,27 @@ namespace Microsoft.AspNetCore.Server.HttpSys
} }
} }
/// <summary>
/// Gets a value that determines if this collection is readOnly.
/// </summary>
public bool IsReadOnly public bool IsReadOnly
{ {
get { return false; } get { return false; }
} }
/// <summary>
/// Creates a <see cref="UrlPrefix"/> from the given string, and adds it to this collection.
/// </summary>
/// <param name="prefix">The string representing the <see cref="UrlPrefix"/> to add to this collection.</param>
public void Add(string prefix) public void Add(string prefix)
{ {
Add(UrlPrefix.Create(prefix)); Add(UrlPrefix.Create(prefix));
} }
/// <summary>
/// Adds a <see cref="UrlPrefix"/> to this collection.
/// </summary>
/// <param name="item">The prefix to add to this collection.</param>
public void Add(UrlPrefix item) public void Add(UrlPrefix item)
{ {
lock (_prefixes) lock (_prefixes)
@ -98,6 +110,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
return found; return found;
} }
/// <inheritdoc />
public void Clear() public void Clear()
{ {
lock (_prefixes) lock (_prefixes)
@ -110,6 +123,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
} }
} }
/// <inheritdoc />
public bool Contains(UrlPrefix item) public bool Contains(UrlPrefix item)
{ {
lock (_prefixes) lock (_prefixes)
@ -118,6 +132,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
} }
} }
/// <inheritdoc />
public void CopyTo(UrlPrefix[] array, int arrayIndex) public void CopyTo(UrlPrefix[] array, int arrayIndex)
{ {
lock (_prefixes) lock (_prefixes)
@ -126,11 +141,13 @@ namespace Microsoft.AspNetCore.Server.HttpSys
} }
} }
/// <inheritdoc />
public bool Remove(string prefix) public bool Remove(string prefix)
{ {
return Remove(UrlPrefix.Create(prefix)); return Remove(UrlPrefix.Create(prefix));
} }
/// <inheritdoc />
public bool Remove(UrlPrefix item) public bool Remove(UrlPrefix item)
{ {
lock (_prefixes) lock (_prefixes)
@ -156,6 +173,9 @@ namespace Microsoft.AspNetCore.Server.HttpSys
} }
} }
/// <summary>
/// Returns an enumerator that iterates through this collection.
/// </summary>
public IEnumerator<UrlPrefix> GetEnumerator() public IEnumerator<UrlPrefix> GetEnumerator()
{ {
lock (_prefixes) lock (_prefixes)