From 2018b82ffed128371b7e889ea71dd2828dc3ed3b Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Fri, 22 Mar 2019 14:41:06 -0700 Subject: [PATCH] React to breaking changes with M.A.Internal (#8638) --- ...tCore.Server.Kestrel.Core.netcoreapp3.0.cs | 74 +++++++++++++++++++ .../Core/src/Internal/Http/HttpMethod.cs | 2 +- .../Core/src/Internal/Http/HttpParser.cs | 2 +- .../Core/src/Internal/Http/HttpScheme.cs | 2 +- .../Core/src/Internal/Http/HttpVersion.cs | 2 +- .../src/Internal/Http/IHttpHeadersHandler.cs | 2 +- .../Core/src/Internal/Http/IHttpParser.cs | 2 +- .../Internal/Http/IHttpRequestLineHandler.cs | 2 +- .../Infrastructure/HttpUtilities.Generated.cs | 2 +- .../Internal/Infrastructure/HttpUtilities.cs | 2 +- .../Core/src/Properties/AssemblyInfo.cs | 1 - .../HttpUtilities/HttpUtilities.cs | 2 +- 12 files changed, 84 insertions(+), 11 deletions(-) diff --git a/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp3.0.cs b/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp3.0.cs index b957c75ee9..494c58056d 100644 --- a/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp3.0.cs +++ b/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp3.0.cs @@ -210,6 +210,80 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Features System.ReadOnlyMemory ApplicationProtocol { get; } } } +namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http +{ + public enum HttpMethod : byte + { + Connect = (byte)7, + Custom = (byte)9, + Delete = (byte)2, + Get = (byte)0, + Head = (byte)4, + None = (byte)255, + Options = (byte)8, + Patch = (byte)6, + Post = (byte)3, + Put = (byte)1, + Trace = (byte)5, + } + public partial class HttpParser : Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpParser where TRequestHandler : Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpHeadersHandler, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpRequestLineHandler + { + public HttpParser() { } + public HttpParser(bool showErrorDetails) { } + bool Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpParser.ParseHeaders(TRequestHandler handler, in System.Buffers.ReadOnlySequence buffer, out System.SequencePosition consumed, out System.SequencePosition examined, out int consumedBytes) { throw null; } + bool Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpParser.ParseRequestLine(TRequestHandler handler, in System.Buffers.ReadOnlySequence buffer, out System.SequencePosition consumed, out System.SequencePosition examined) { throw null; } + public bool ParseHeaders(TRequestHandler handler, in System.Buffers.ReadOnlySequence buffer, out System.SequencePosition consumed, out System.SequencePosition examined, out int consumedBytes) { throw null; } + public bool ParseRequestLine(TRequestHandler handler, in System.Buffers.ReadOnlySequence buffer, out System.SequencePosition consumed, out System.SequencePosition examined) { throw null; } + } + public enum HttpScheme + { + Http = 0, + Https = 1, + Unknown = -1, + } + public enum HttpVersion + { + Http10 = 0, + Http11 = 1, + Http2 = 2, + Unknown = -1, + } + public partial interface IHttpHeadersHandler + { + void OnHeader(System.Span name, System.Span value); + } + public partial interface IHttpParser where TRequestHandler : Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpHeadersHandler, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpRequestLineHandler + { + bool ParseHeaders(TRequestHandler handler, in System.Buffers.ReadOnlySequence buffer, out System.SequencePosition consumed, out System.SequencePosition examined, out int consumedBytes); + bool ParseRequestLine(TRequestHandler handler, in System.Buffers.ReadOnlySequence buffer, out System.SequencePosition consumed, out System.SequencePosition examined); + } + public partial interface IHttpRequestLineHandler + { + void OnStartLine(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod method, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpVersion version, System.Span target, System.Span path, System.Span query, System.Span customMethod, bool pathEncoded); + } +} +namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure +{ + public static partial class HttpUtilities + { + public const string Http10Version = "HTTP/1.0"; + public const string Http11Version = "HTTP/1.1"; + public const string Http2Version = "HTTP/2"; + public const string HttpsUriScheme = "https://"; + public const string HttpUriScheme = "http://"; + public static string GetAsciiOrUTF8StringNonNullCharacters(this System.Span span) { throw null; } + public static string GetAsciiStringEscaped(this System.Span span, int maxChars) { throw null; } + public static string GetAsciiStringNonNullCharacters(this System.Span span) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool GetKnownHttpScheme(this System.Span span, out Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpScheme knownScheme) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool GetKnownMethod(this System.Span span, out Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod method, out int length) { throw null; } + public static Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod GetKnownMethod(string value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool GetKnownVersion(this System.Span span, out Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpVersion knownVersion, out byte length) { throw null; } + public static bool IsHostHeaderValid(string hostText) { throw null; } + public static string MethodToString(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod method) { throw null; } + public static string SchemeToString(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpScheme scheme) { throw null; } + public static string VersionToString(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpVersion httpVersion) { throw null; } + } +} namespace Microsoft.AspNetCore.Server.Kestrel.Https { public enum ClientCertificateMode diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpMethod.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpMethod.cs index dd2caec33d..3e6ff0667e 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpMethod.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpMethod.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal enum HttpMethod: byte + public enum HttpMethod: byte { Get, Put, diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs index 5560eacfcd..3010aecc61 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class HttpParser : IHttpParser where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler + public class HttpParser : IHttpParser where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler { private bool _showErrorDetails; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpScheme.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpScheme.cs index 3bf3d6339f..dfd4642f3d 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpScheme.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpScheme.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal enum HttpScheme + public enum HttpScheme { Unknown = -1, Http = 0, diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpVersion.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpVersion.cs index a460904ec8..832a1c5616 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpVersion.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpVersion.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal enum HttpVersion + public enum HttpVersion { Unknown = -1, Http10 = 0, diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpHeadersHandler.cs b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpHeadersHandler.cs index 48734fc0c3..9a322f0da9 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpHeadersHandler.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpHeadersHandler.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal interface IHttpHeadersHandler + public interface IHttpHeadersHandler { void OnHeader(Span name, Span value); } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpParser.cs b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpParser.cs index fc56983a33..efd8e9445b 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpParser.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpParser.cs @@ -6,7 +6,7 @@ using System.Buffers; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal interface IHttpParser where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler + public interface IHttpParser where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler { bool ParseRequestLine(TRequestHandler handler, in ReadOnlySequence buffer, out SequencePosition consumed, out SequencePosition examined); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpRequestLineHandler.cs b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpRequestLineHandler.cs index b15931ae84..494d2c4453 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpRequestLineHandler.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpRequestLineHandler.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal interface IHttpRequestLineHandler + public interface IHttpRequestLineHandler { void OnStartLine(HttpMethod method, HttpVersion version, Span target, Span path, Span query, Span customMethod, bool pathEncoded); } diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.Generated.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.Generated.cs index 89443f3de0..1dd2e252c2 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.Generated.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.Generated.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure { - internal static partial class HttpUtilities + public static partial class HttpUtilities { // readonly primitive statics can be Jit'd to consts https://github.com/dotnet/coreclr/issues/1079 private static readonly ulong _httpConnectMethodLong = GetAsciiStringAsLong("CONNECT "); diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs index 176e24d1ba..7c5276259e 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure { - internal static partial class HttpUtilities + public static partial class HttpUtilities { public const string Http10Version = "HTTP/1.0"; public const string Http11Version = "HTTP/1.1"; diff --git a/src/Servers/Kestrel/Core/src/Properties/AssemblyInfo.cs b/src/Servers/Kestrel/Core/src/Properties/AssemblyInfo.cs index 68bba26c6e..706d5176fb 100644 --- a/src/Servers/Kestrel/Core/src/Properties/AssemblyInfo.cs +++ b/src/Servers/Kestrel/Core/src/Properties/AssemblyInfo.cs @@ -13,5 +13,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.Core.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("PlatformBenchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs b/src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs index f3fb605517..3b040a2648 100644 --- a/src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs +++ b/src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs @@ -69,7 +69,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure {{ - internal static partial class HttpUtilities + public static partial class HttpUtilities {{ // readonly primitive statics can be Jit'd to consts https://github.com/dotnet/coreclr/issues/1079 {0}