Add doc strings for public APIs in Http.Abstractions and Routing.Abstractions (#26468)
* Add doc strings to Http.Abstractions and Routing.Abstractions * Address feedback from peer review * Update src/Http/Http.Abstractions/src/ConnectionInfo.cs Co-authored-by: James Newton-King <james@newtonking.com> Co-authored-by: James Newton-King <james@newtonking.com>
This commit is contained in:
parent
a218c3bea6
commit
e2b1b20633
|
|
@ -8,6 +8,9 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Microsoft.AspNetCore.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the underlying connection for a request.
|
||||
/// </summary>
|
||||
public abstract class ConnectionInfo
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -15,16 +18,35 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// </summary>
|
||||
public abstract string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IP address of the remote target. Can be null.
|
||||
/// </summary>
|
||||
public abstract IPAddress? RemoteIpAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the port of the remote target.
|
||||
/// </summary>
|
||||
public abstract int RemotePort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IP address of the local host.
|
||||
/// </summary>
|
||||
public abstract IPAddress? LocalIpAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the port of the local host.
|
||||
/// </summary>
|
||||
public abstract int LocalPort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client certificate.
|
||||
/// </summary>
|
||||
public abstract X509Certificate2? ClientCertificate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the client certificate.
|
||||
/// </summary>
|
||||
/// <returns>Asynchronously returns an <see cref="X509Certificate2" />. Can be null.</returns>
|
||||
public abstract Task<X509Certificate2?> GetClientCertificateAsync(CancellationToken cancellationToken = new CancellationToken());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ using Microsoft.Extensions.Primitives;
|
|||
|
||||
namespace Microsoft.AspNetCore.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for modifying an <see cref="IHeaderDictionary"/> instance.
|
||||
/// </summary>
|
||||
public static class HeaderDictionaryExtensions
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ using Microsoft.Net.Http.Headers;
|
|||
|
||||
namespace Microsoft.AspNetCore.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for modifying the `Trailer` response header
|
||||
/// and trailing headers in an <see cref="HttpResponse" />.
|
||||
/// </summary>
|
||||
public static class ResponseTrailerExtensions
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -105,6 +105,11 @@ namespace Microsoft.AspNetCore.Http
|
|||
return new FragmentString(fragmentValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates if the current fragment is equal to another fragment <paramref name="other"/>.
|
||||
/// </summary>
|
||||
/// <param name="other">A <see cref="FragmentString" /> to compare.</param>
|
||||
/// <returns><see langword="true" /> if the fragments are equal.</returns>
|
||||
public bool Equals(FragmentString other)
|
||||
{
|
||||
if (!HasValue && !other.HasValue)
|
||||
|
|
@ -114,6 +119,11 @@ namespace Microsoft.AspNetCore.Http
|
|||
return string.Equals(_value, other._value, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates if the current fragment is equal to an object <paramref name="obj"/>.
|
||||
/// </summary>
|
||||
/// <param name="obj">An object to compare.</param>
|
||||
/// <returns><see langword="true" /> if the fragments are equal.</returns>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
|
|
@ -123,16 +133,32 @@ namespace Microsoft.AspNetCore.Http
|
|||
return obj is FragmentString && Equals((FragmentString)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash code for the value.
|
||||
/// </summary>
|
||||
/// <returns>The hash code as an <see cref="int"/>.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (HasValue ? _value.GetHashCode() : 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates if one fragment is equal to another.
|
||||
/// </summary>
|
||||
/// <param name="left">A <see cref="FragmentString"/> instance.</param>
|
||||
/// <param name="right">A <see cref="FragmentString"/> instance.</param>
|
||||
/// <returns><see langword="true" /> if the fragments are equal.</returns>
|
||||
public static bool operator ==(FragmentString left, FragmentString right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evalutes if one framgent is not equal to another.
|
||||
/// </summary>
|
||||
/// <param name="left">A <see cref="FragmentString"/> instance.</param>
|
||||
/// <param name="right">A <see cref="FragmentString"/> instance.</param>
|
||||
/// <returns><see langword="true" /> if the fragments are not equal.</returns>
|
||||
public static bool operator !=(FragmentString left, FragmentString right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ namespace Microsoft.AspNetCore.Http
|
|||
get { return _value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the host is set.
|
||||
/// </summary>
|
||||
public bool HasValue
|
||||
{
|
||||
get { return !string.IsNullOrEmpty(_value); }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System;
|
|||
namespace Microsoft.AspNetCore.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains methods to verify the request method of an HTTP request.
|
||||
/// Contains methods to verify the request method of an HTTP request.
|
||||
/// </summary>
|
||||
public static class HttpMethods
|
||||
{
|
||||
|
|
@ -18,18 +18,45 @@ namespace Microsoft.AspNetCore.Http
|
|||
// and allow us to optimize comparisons when these constants are used.
|
||||
|
||||
// Please do NOT change these to 'const'
|
||||
/// <summary>
|
||||
/// HTTP "CONNECT" method.
|
||||
/// </summary>
|
||||
public static readonly string Connect = "CONNECT";
|
||||
/// <summary>
|
||||
/// HTTP "DELETE" method.
|
||||
/// </summary>
|
||||
public static readonly string Delete = "DELETE";
|
||||
/// <summary>
|
||||
/// HTTP "GET" method.
|
||||
/// </summary>
|
||||
public static readonly string Get = "GET";
|
||||
/// <summary>
|
||||
/// HTTP "HEAD" method.
|
||||
/// </summary>
|
||||
public static readonly string Head = "HEAD";
|
||||
/// <summary>
|
||||
/// HTTP "OPTIONS" method.
|
||||
/// </summary>
|
||||
public static readonly string Options = "OPTIONS";
|
||||
/// <summary>
|
||||
/// HTTP "PATCH" method.
|
||||
/// </summary>
|
||||
public static readonly string Patch = "PATCH";
|
||||
/// <summary>
|
||||
/// HTTP "POST" method.
|
||||
/// </summary>
|
||||
public static readonly string Post = "POST";
|
||||
/// <summary>
|
||||
/// HTTP "PUT" method.
|
||||
/// </summary>
|
||||
public static readonly string Put = "PUT";
|
||||
/// <summary>
|
||||
/// HTTP "TRACE" method.
|
||||
/// </summary>
|
||||
public static readonly string Trace = "TRACE";
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is CONNECT.
|
||||
/// Returns a value that indicates if the HTTP request method is CONNECT.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -41,7 +68,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is DELETE.
|
||||
/// Returns a value that indicates if the HTTP request method is DELETE.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -53,7 +80,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is GET.
|
||||
/// Returns a value that indicates if the HTTP request method is GET.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -65,7 +92,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is HEAD.
|
||||
/// Returns a value that indicates if the HTTP request method is HEAD.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -77,7 +104,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is OPTIONS.
|
||||
/// Returns a value that indicates if the HTTP request method is OPTIONS.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -89,7 +116,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is PATCH.
|
||||
/// Returns a value that indicates if the HTTP request method is PATCH.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -101,7 +128,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is POST.
|
||||
/// Returns a value that indicates if the HTTP request method is POST.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -113,7 +140,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is PUT.
|
||||
/// Returns a value that indicates if the HTTP request method is PUT.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -125,7 +152,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request method is TRACE.
|
||||
/// Returns a value that indicates if the HTTP request method is TRACE.
|
||||
/// </summary>
|
||||
/// <param name="method">The HTTP request method.</param>
|
||||
/// <returns>
|
||||
|
|
@ -156,7 +183,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
};
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP methods are the same.
|
||||
/// Returns a value that indicates if the HTTP methods are the same.
|
||||
/// </summary>
|
||||
/// <param name="methodA">The first HTTP request method to compare.</param>
|
||||
/// <param name="methodB">The second HTTP request method to compare.</param>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System;
|
|||
namespace Microsoft.AspNetCore.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains methods to verify the request protocol version of an HTTP request.
|
||||
/// Contains methods to verify the request protocol version of an HTTP request.
|
||||
/// </summary>
|
||||
public static class HttpProtocol
|
||||
{
|
||||
|
|
@ -18,13 +18,26 @@ namespace Microsoft.AspNetCore.Http
|
|||
// and allow us to optimize comparisons when these constants are used.
|
||||
|
||||
// Please do NOT change these to 'const'
|
||||
|
||||
/// <summary>
|
||||
/// HTTP protocol version 1.0.
|
||||
/// </summary>
|
||||
public static readonly string Http10 = "HTTP/1.0";
|
||||
/// <summary>
|
||||
/// HTTP protocol version 1.1.
|
||||
/// </summary>
|
||||
public static readonly string Http11 = "HTTP/1.1";
|
||||
/// <summary>
|
||||
/// HTTP protocol version 2.
|
||||
/// </summary>
|
||||
public static readonly string Http2 = "HTTP/2";
|
||||
/// <summary>
|
||||
/// HTTP protcol version 3.
|
||||
/// </summary>
|
||||
public static readonly string Http3 = "HTTP/3";
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/1.0.
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/1.0.
|
||||
/// </summary>
|
||||
/// <param name="protocol">The HTTP request protocol.</param>
|
||||
/// <returns>
|
||||
|
|
@ -36,7 +49,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/1.1.
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/1.1.
|
||||
/// </summary>
|
||||
/// <param name="protocol">The HTTP request protocol.</param>
|
||||
/// <returns>
|
||||
|
|
@ -48,7 +61,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/2.
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/2.
|
||||
/// </summary>
|
||||
/// <param name="protocol">The HTTP request protocol.</param>
|
||||
/// <returns>
|
||||
|
|
@ -60,7 +73,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/3.
|
||||
/// Returns a value that indicates if the HTTP request protocol is HTTP/3.
|
||||
/// </summary>
|
||||
/// <param name="protocol">The HTTP request protocol.</param>
|
||||
/// <returns>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>
|
|||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore</PackageTags>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
|
||||
/// <summary>
|
||||
/// Initialize the query string with a given value. This value must be in escaped and delimited format with
|
||||
/// a leading '?' character.
|
||||
/// a leading '?' character.
|
||||
/// </summary>
|
||||
/// <param name="value">The query string to be assigned to the Value property.</param>
|
||||
public QueryString(string? value)
|
||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
public bool HasValue => !string.IsNullOrEmpty(Value);
|
||||
|
||||
/// <summary>
|
||||
/// Provides the query string escaped in a way which is correct for combining into the URI representation.
|
||||
/// Provides the query string escaped in a way which is correct for combining into the URI representation.
|
||||
/// A leading '?' character will be included unless the Value is null or empty. Characters which are potentially
|
||||
/// dangerous are escaped.
|
||||
/// </summary>
|
||||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides the query string escaped in a way which is correct for combining into the URI representation.
|
||||
/// Provides the query string escaped in a way which is correct for combining into the URI representation.
|
||||
/// A leading '?' character will be included unless the Value is null or empty. Characters which are potentially
|
||||
/// dangerous are escaped.
|
||||
/// </summary>
|
||||
|
|
@ -170,6 +170,11 @@ namespace Microsoft.AspNetCore.Http
|
|||
return new QueryString(builder.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concatenates <paramref name="other"/> to the current query string.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="QueryString"/> to concatenate.</param>
|
||||
/// <returns>The concatenated <see cref="QueryString"/>.</returns>
|
||||
public QueryString Add(QueryString other)
|
||||
{
|
||||
if (!HasValue || Value!.Equals("?", StringComparison.Ordinal))
|
||||
|
|
@ -185,6 +190,13 @@ namespace Microsoft.AspNetCore.Http
|
|||
return new QueryString(Value + "&" + other.Value.Substring(1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concatenates a query string with <paramref name="name"/> and <paramref name="value"/>
|
||||
/// to the current query string.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the query string to concatenate.</param>
|
||||
/// <param name="value">The value of the query string to concatenate.</param>
|
||||
/// <returns>The concatenated <see cref="QueryString"/>.</returns>
|
||||
public QueryString Add(string name, string value)
|
||||
{
|
||||
if (name == null)
|
||||
|
|
@ -202,6 +214,11 @@ namespace Microsoft.AspNetCore.Http
|
|||
return new QueryString(builder.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evalutes if the current query string is equal to <paramref name="other"/>.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="QueryString"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if the ssquery strings are equal.</returns>
|
||||
public bool Equals(QueryString other)
|
||||
{
|
||||
if (!HasValue && !other.HasValue)
|
||||
|
|
@ -211,6 +228,11 @@ namespace Microsoft.AspNetCore.Http
|
|||
return string.Equals(Value, other.Value, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates if the current query string is equal to an object <paramref name="obj"/>.
|
||||
/// </summary>
|
||||
/// <param name="obj">An object to compare.</param>
|
||||
/// <returns><see langword="true" /> if the query strings are equal.</returns>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
|
|
@ -220,21 +242,43 @@ namespace Microsoft.AspNetCore.Http
|
|||
return obj is QueryString && Equals((QueryString)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a hash code for the value.
|
||||
/// </summary>
|
||||
/// <returns>The hash code as an <see cref="int"/>.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (HasValue ? Value!.GetHashCode() : 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates if one query string is equal to another.
|
||||
/// </summary>
|
||||
/// <param name="left">A <see cref="QueryString"/> instance.</param>
|
||||
/// <param name="right">A <see cref="QueryString"/> instance.</param>
|
||||
/// <returns><see langword="true" /> if the query strings are equal.</returns>
|
||||
public static bool operator ==(QueryString left, QueryString right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates if one query string is not equal to another.
|
||||
/// </summary>
|
||||
/// <param name="left">A <see cref="QueryString"/> instance.</param>
|
||||
/// <param name="right">A <see cref="QueryString"/> instance.</param>
|
||||
/// <returns><see langword="true" /> if the query strings are not equal.</returns>
|
||||
public static bool operator !=(QueryString left, QueryString right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concatenates <paramref name="left"/> and <paramref name="right"/> into a single query string.
|
||||
/// </summary>
|
||||
/// <param name="left">A <see cref="QueryString"/> instance.</param>
|
||||
/// <param name="right">A <see cref="QueryString"/> instance.</param>
|
||||
/// <returns>The concatenated <see cref="QueryString"/>.</returns>
|
||||
public static QueryString operator +(QueryString left, QueryString right)
|
||||
{
|
||||
return left.Add(right);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// </summary>
|
||||
public RequestDelegate RequestDelegate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string representation of the endpoint.
|
||||
/// </summary>
|
||||
public override string? ToString() => DisplayName ?? base.ToString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Routing
|
|||
|
||||
// We're calling this here for the side-effect of converting from properties
|
||||
// to array. We need to create the array even if we just set an existing value since
|
||||
// property storage is immutable.
|
||||
// property storage is immutable.
|
||||
EnsureCapacity(_count);
|
||||
|
||||
var index = FindIndex(key);
|
||||
|
|
@ -661,11 +661,16 @@ namespace Microsoft.AspNetCore.Routing
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public struct Enumerator : IEnumerator<KeyValuePair<string, object?>>
|
||||
{
|
||||
private readonly RouteValueDictionary _dictionary;
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new enumerator with the values provided in <paramref name="dictionary"/>.
|
||||
/// </summary>
|
||||
/// <param name="dictionary">A <see cref="RouteValueDictionary"/>.</param>
|
||||
public Enumerator(RouteValueDictionary dictionary)
|
||||
{
|
||||
if (dictionary == null)
|
||||
|
|
@ -679,15 +684,20 @@ namespace Microsoft.AspNetCore.Routing
|
|||
_index = 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public KeyValuePair<string, object?> Current { get; private set; }
|
||||
|
||||
object IEnumerator.Current => Current;
|
||||
|
||||
/// <summary>
|
||||
/// Releases resources used by the <see cref="Enumerator"/>.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
// Similar to the design of List<T>.Enumerator - Split into fast path and slow path for inlining friendliness
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool MoveNext()
|
||||
{
|
||||
|
|
@ -721,6 +731,7 @@ namespace Microsoft.AspNetCore.Routing
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Reset()
|
||||
{
|
||||
Current = default;
|
||||
|
|
|
|||
|
|
@ -3,77 +3,338 @@
|
|||
|
||||
namespace Microsoft.AspNetCore.Http
|
||||
{
|
||||
// Status Codes listed at http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
|
||||
/// <summary>
|
||||
/// A collection of contants for HTTP status codes.
|
||||
///
|
||||
/// Status Codes listed at http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
|
||||
/// </summary>
|
||||
public static class StatusCodes
|
||||
{
|
||||
/// <summary>
|
||||
/// HTTP status code 100.
|
||||
/// </summary>
|
||||
public const int Status100Continue = 100;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 101.
|
||||
/// </summary>
|
||||
public const int Status101SwitchingProtocols = 101;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 102.
|
||||
/// </summary>
|
||||
public const int Status102Processing = 102;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 200.
|
||||
/// </summary>
|
||||
public const int Status200OK = 200;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 201.
|
||||
/// </summary>
|
||||
public const int Status201Created = 201;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 202.
|
||||
/// </summary>
|
||||
public const int Status202Accepted = 202;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 203.
|
||||
/// </summary>
|
||||
public const int Status203NonAuthoritative = 203;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 204.
|
||||
/// </summary>
|
||||
public const int Status204NoContent = 204;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 205.
|
||||
/// </summary>
|
||||
public const int Status205ResetContent = 205;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 206.
|
||||
/// </summary>
|
||||
public const int Status206PartialContent = 206;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 207.
|
||||
/// </summary>
|
||||
public const int Status207MultiStatus = 207;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 208.
|
||||
/// </summary>
|
||||
public const int Status208AlreadyReported = 208;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 226.
|
||||
/// </summary>
|
||||
public const int Status226IMUsed = 226;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 300.
|
||||
/// </summary>
|
||||
public const int Status300MultipleChoices = 300;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 301.
|
||||
/// </summary>
|
||||
public const int Status301MovedPermanently = 301;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 302.
|
||||
/// </summary>
|
||||
public const int Status302Found = 302;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 303.
|
||||
/// </summary>
|
||||
public const int Status303SeeOther = 303;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 304.
|
||||
/// </summary>
|
||||
public const int Status304NotModified = 304;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 305.
|
||||
/// </summary>
|
||||
public const int Status305UseProxy = 305;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 306.
|
||||
/// </summary>
|
||||
public const int Status306SwitchProxy = 306; // RFC 2616, removed
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 307.
|
||||
/// </summary>
|
||||
public const int Status307TemporaryRedirect = 307;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 308.
|
||||
/// </summary>
|
||||
public const int Status308PermanentRedirect = 308;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 400.
|
||||
/// </summary>
|
||||
|
||||
public const int Status400BadRequest = 400;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 401.
|
||||
/// </summary>
|
||||
public const int Status401Unauthorized = 401;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 402.
|
||||
/// </summary>
|
||||
public const int Status402PaymentRequired = 402;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 403.
|
||||
/// </summary>
|
||||
public const int Status403Forbidden = 403;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 404.
|
||||
/// </summary>
|
||||
public const int Status404NotFound = 404;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 405.
|
||||
/// </summary>
|
||||
public const int Status405MethodNotAllowed = 405;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 406.
|
||||
/// </summary>
|
||||
public const int Status406NotAcceptable = 406;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 407.
|
||||
/// </summary>
|
||||
public const int Status407ProxyAuthenticationRequired = 407;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 408.
|
||||
/// </summary>
|
||||
public const int Status408RequestTimeout = 408;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 409.
|
||||
/// </summary>
|
||||
public const int Status409Conflict = 409;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 410.
|
||||
/// </summary>
|
||||
public const int Status410Gone = 410;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 411.
|
||||
/// </summary>
|
||||
public const int Status411LengthRequired = 411;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 412.
|
||||
/// </summary>
|
||||
public const int Status412PreconditionFailed = 412;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 413.
|
||||
/// </summary>
|
||||
public const int Status413RequestEntityTooLarge = 413; // RFC 2616, renamed
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 413.
|
||||
/// </summary>
|
||||
public const int Status413PayloadTooLarge = 413; // RFC 7231
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 414.
|
||||
/// </summary>
|
||||
public const int Status414RequestUriTooLong = 414; // RFC 2616, renamed
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 414.
|
||||
/// </summary>
|
||||
public const int Status414UriTooLong = 414; // RFC 7231
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 415.
|
||||
/// </summary>
|
||||
public const int Status415UnsupportedMediaType = 415;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 416.
|
||||
/// </summary>
|
||||
public const int Status416RequestedRangeNotSatisfiable = 416; // RFC 2616, renamed
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 416.
|
||||
/// </summary>
|
||||
public const int Status416RangeNotSatisfiable = 416; // RFC 7233
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 417.
|
||||
/// </summary>
|
||||
public const int Status417ExpectationFailed = 417;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 418.
|
||||
/// </summary>
|
||||
public const int Status418ImATeapot = 418;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 419.
|
||||
/// </summary>
|
||||
public const int Status419AuthenticationTimeout = 419; // Not defined in any RFC
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 422.
|
||||
/// </summary>
|
||||
public const int Status421MisdirectedRequest = 421;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 422.
|
||||
/// </summary>
|
||||
public const int Status422UnprocessableEntity = 422;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 423.
|
||||
/// </summary>
|
||||
public const int Status423Locked = 423;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 424.
|
||||
/// </summary>
|
||||
public const int Status424FailedDependency = 424;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 426.
|
||||
/// </summary>
|
||||
public const int Status426UpgradeRequired = 426;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 428.
|
||||
/// </summary>
|
||||
public const int Status428PreconditionRequired = 428;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 429.
|
||||
/// </summary>
|
||||
public const int Status429TooManyRequests = 429;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 431.
|
||||
/// </summary>
|
||||
public const int Status431RequestHeaderFieldsTooLarge = 431;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 451.
|
||||
/// </summary>
|
||||
public const int Status451UnavailableForLegalReasons = 451;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 500.
|
||||
/// </summary>
|
||||
|
||||
public const int Status500InternalServerError = 500;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 501.
|
||||
/// </summary>
|
||||
public const int Status501NotImplemented = 501;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 502.
|
||||
/// </summary>
|
||||
public const int Status502BadGateway = 502;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 503.
|
||||
/// </summary>
|
||||
public const int Status503ServiceUnavailable = 503;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 504.
|
||||
/// </summary>
|
||||
public const int Status504GatewayTimeout = 504;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 505.
|
||||
/// </summary>
|
||||
public const int Status505HttpVersionNotsupported = 505;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 506.
|
||||
/// </summary>
|
||||
public const int Status506VariantAlsoNegotiates = 506;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 507.
|
||||
/// </summary>
|
||||
public const int Status507InsufficientStorage = 507;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 508.
|
||||
/// </summary>
|
||||
public const int Status508LoopDetected = 508;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 510.
|
||||
/// </summary>
|
||||
public const int Status510NotExtended = 510;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code 511.
|
||||
/// </summary>
|
||||
public const int Status511NetworkAuthenticationRequired = 511;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,22 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Microsoft.AspNetCore.Routing
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IRouter
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously routes based on the current <paramref name="context"/>.
|
||||
/// </summary>
|
||||
/// <param name="context">A <see cref="RouteContext"/> instance.</param>
|
||||
Task RouteAsync(RouteContext context);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the URL that is assicated with the route details provided in <paramref name="context"/>
|
||||
/// </summary>
|
||||
/// <param name="context">A <see cref="VirtualPathContext"/> instance.</param>
|
||||
/// <returns>A <see cref="VirtualPathData"/> object. Can be null.</returns>
|
||||
VirtualPathData? GetVirtualPath(VirtualPathContext context);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
namespace Microsoft.AspNetCore.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures options for generated URLs.
|
||||
/// </summary>
|
||||
public class LinkOptions
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -13,7 +16,7 @@ namespace Microsoft.AspNetCore.Routing
|
|||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether a generated query strings are lowercase.
|
||||
/// This property will be unless <see cref="LowercaseUrls" /> is also <c>true</c>.
|
||||
/// This property will be false unless <see cref="LowercaseUrls" /> is also <c>true</c>.
|
||||
/// </summary>
|
||||
public bool? LowercaseQueryStrings { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Microsoft.AspNetCore.Routing.IRouter
|
|||
Microsoft.AspNetCore.Routing.RouteData</Description>
|
||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;routing</PackageTags>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
|
|
|||
Loading…
Reference in New Issue