From 9288627fededcc2eb2bab2ff419b5a58dcea6d7d Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Mon, 15 Jun 2020 13:31:09 -0700 Subject: [PATCH] Fixing up build issues --- .../src/Microsoft.AspNetCore.Server.HttpSys.csproj | 1 + .../Core/src/Internal/Infrastructure/HttpUtilities.cs | 8 +++++++- .../src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj | 5 ++--- src/Shared/Http2cat/Http2Utilities.cs | 2 +- src/Shared/ServerInfrastructure/StringUtilities.cs | 7 ++----- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Servers/HttpSys/src/Microsoft.AspNetCore.Server.HttpSys.csproj b/src/Servers/HttpSys/src/Microsoft.AspNetCore.Server.HttpSys.csproj index 501aa01125..dabe46a33b 100644 --- a/src/Servers/HttpSys/src/Microsoft.AspNetCore.Server.HttpSys.csproj +++ b/src/Servers/HttpSys/src/Microsoft.AspNetCore.Server.HttpSys.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs index 39f38b4e21..ede9d52e2e 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs @@ -120,6 +120,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure } } + public static string GetAsciiOrUTF8StringNonNullCharacters(this Span span) + => GetAsciiOrUTF8StringNonNullCharacters((ReadOnlySpan)span); + + public static string GetAsciiOrUTF8StringNonNullCharacters(this ReadOnlySpan span) + => StringUtilities.GetAsciiOrUTF8StringNonNullCharacters(span, HeaderValueEncoding); + private static unsafe void GetAsciiStringNonNullCharacters(Span buffer, IntPtr state) { fixed (char* output = &MemoryMarshal.GetReference(buffer)) @@ -133,7 +139,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure } } - public static string GetRequestHeaderStringNonNullCharacters(this Span span, bool useLatin1) => + public static string GetRequestHeaderStringNonNullCharacters(this ReadOnlySpan span, bool useLatin1) => useLatin1 ? span.GetLatin1StringNonNullCharacters() : span.GetAsciiOrUTF8StringNonNullCharacters(HeaderValueEncoding); public static string GetAsciiStringEscaped(this ReadOnlySpan span, int maxChars) diff --git a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj index 59c2a87e41..5694b9d2b7 100644 --- a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj +++ b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj @@ -1,4 +1,4 @@ - + Core components of ASP.NET Core Kestrel cross-platform web server. @@ -20,9 +20,8 @@ - - + diff --git a/src/Shared/Http2cat/Http2Utilities.cs b/src/Shared/Http2cat/Http2Utilities.cs index b320850eaa..0cc3a77cf3 100644 --- a/src/Shared/Http2cat/Http2Utilities.cs +++ b/src/Shared/Http2cat/Http2Utilities.cs @@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Http2Cat return asciiString; } - public unsafe string GetAsciiOrUTF8StringNonNullCharacters(ReadOnlySpan span) + public unsafe string GetAsciiOrUTF8StringNonNullCharacters(this ReadOnlySpan span) { if (span.IsEmpty) { diff --git a/src/Shared/ServerInfrastructure/StringUtilities.cs b/src/Shared/ServerInfrastructure/StringUtilities.cs index 0d556f9fe4..8f6b01027a 100644 --- a/src/Shared/ServerInfrastructure/StringUtilities.cs +++ b/src/Shared/ServerInfrastructure/StringUtilities.cs @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure internal static class StringUtilities { private static string GetAsciiOrUTF8StringNonNullCharacters(this Span span, Encoding defaultEncoding) - => GetAsciiOrUTF8StringNonNullCharacters((ReadOnlySpan)span); + => GetAsciiOrUTF8StringNonNullCharacters((ReadOnlySpan)span, defaultEncoding); public static unsafe string GetAsciiOrUTF8StringNonNullCharacters(this ReadOnlySpan span, Encoding defaultEncoding) { @@ -50,11 +50,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure return resultString; } - - return resultString; } - private static readonly SpanAction s_getAsciiOrUtf8StringNonNullCharacters = GetAsciiOrUTF8StringNonNullCharacters; private static unsafe void GetAsciiOrUTF8StringNonNullCharacters(Span buffer, IntPtr state) @@ -71,7 +68,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure } } - public static unsafe string GetLatin1StringNonNullCharacters(this Span span) + public static unsafe string GetLatin1StringNonNullCharacters(this ReadOnlySpan span) { if (span.IsEmpty) {