From 688054e4d25a7cae92f282e45f94041f5ee3d415 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Tue, 25 Jun 2019 08:53:14 -0700 Subject: [PATCH 01/21] Remove HttpUtlities from the public API surface (#11539) --- ...tCore.Server.Kestrel.Core.netcoreapp3.0.cs | 23 ------------------- .../Infrastructure/HttpUtilities.Generated.cs | 2 +- .../Internal/Infrastructure/HttpUtilities.cs | 2 +- .../HttpUtilities/HttpUtilities.cs | 2 +- 4 files changed, 3 insertions(+), 26 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 64277f5f9d..bdcd739d6d 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 @@ -240,29 +240,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http 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; } - public static string GetHeaderName(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/Infrastructure/HttpUtilities.Generated.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.Generated.cs index 1dd2e252c2..89443f3de0 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 { - public static partial class HttpUtilities + internal 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 5c266d85df..3f3013aeab 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 { - public static partial class HttpUtilities + internal static partial class HttpUtilities { public const string Http10Version = "HTTP/1.0"; public const string Http11Version = "HTTP/1.1"; diff --git a/src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs b/src/Servers/Kestrel/tools/CodeGenerator/HttpUtilities/HttpUtilities.cs index 3b040a2648..f3fb605517 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 {{ - public static partial class HttpUtilities + internal static partial class HttpUtilities {{ // readonly primitive statics can be Jit'd to consts https://github.com/dotnet/coreclr/issues/1079 {0} From eba671ec886868453de0408052649d0715d0c248 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Jun 2019 09:24:36 -0700 Subject: [PATCH 02/21] Fixup ref assemblies again (#11528) --- ...etCore.Components.netstandard2.0.Manual.cs | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.Manual.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.Manual.cs index e706648edf..8df845d88b 100644 --- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.Manual.cs +++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.Manual.cs @@ -102,6 +102,21 @@ namespace Microsoft.AspNetCore.Components public void Configure(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterCollection parameters) { throw null; } } + + public partial class PageDisplay : Microsoft.AspNetCore.Components.IComponent + { + public PageDisplay() { } + [Microsoft.AspNetCore.Components.ParameterAttribute] + public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} + [Microsoft.AspNetCore.Components.ParameterAttribute] + public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} + [Microsoft.AspNetCore.Components.ParameterAttribute] + public System.Type Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} + [Microsoft.AspNetCore.Components.ParameterAttribute] + public System.Collections.Generic.IDictionary PageParameters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} + public void Configure(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } + public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterCollection parameters) { throw null; } + } } namespace Microsoft.AspNetCore.Components.Forms @@ -231,24 +246,6 @@ namespace Microsoft.AspNetCore.Components.Forms } } -namespace Microsoft.AspNetCore.Components.Layouts -{ - public partial class PageDisplay : Microsoft.AspNetCore.Components.IComponent - { - public PageDisplay() { } - [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} - [Microsoft.AspNetCore.Components.ParameterAttribute] - public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} - [Microsoft.AspNetCore.Components.ParameterAttribute] - public System.Type Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} - [Microsoft.AspNetCore.Components.ParameterAttribute] - public System.Collections.Generic.IDictionary PageParameters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} - public void Configure(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } - public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterCollection parameters) { throw null; } - } -} - namespace Microsoft.AspNetCore.Components.Routing { public partial class NavLink : Microsoft.AspNetCore.Components.IComponent, System.IDisposable @@ -270,7 +267,9 @@ namespace Microsoft.AspNetCore.Components.Routing public System.Reflection.Assembly AppAssembly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} [Microsoft.AspNetCore.Components.ParameterAttribute] public Microsoft.AspNetCore.Components.RenderFragment NotFoundContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} + [Microsoft.AspNetCore.Components.ParameterAttribute] public Microsoft.AspNetCore.Components.RenderFragment NotAuthorizedContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} + [Microsoft.AspNetCore.Components.ParameterAttribute] public Microsoft.AspNetCore.Components.RenderFragment AuthorizingContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; }} public void Configure(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public void Dispose() { } From 550710f3045527161482fcf64c0e61c86932c01c Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Tue, 25 Jun 2019 10:06:16 -0700 Subject: [PATCH 03/21] Update components E2E test to use splatting (#11518) This test was already in place, and just needs some updates to work with Razor syntax instead of .cs --- .../DuplicateAttributesComponent.razor | 6 --- ...licateAttributesOnElementChildComponent.cs | 37 ------------------- ...ateAttributesOnElementChildComponent.razor | 23 ++++++++++++ 3 files changed, 23 insertions(+), 43 deletions(-) delete mode 100644 src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.cs create mode 100644 src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor diff --git a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor index 6993a5e400..80f8521de7 100644 --- a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesComponent.razor @@ -7,18 +7,12 @@
@functions { - void SomeMethod() - { - } - Dictionary elementValues = new Dictionary() { { "bool", true }, diff --git a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.cs b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.cs deleted file mode 100644 index 055ecf7149..0000000000 --- a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.RenderTree; - -namespace BasicTestApp -{ - // Written in C# for flexibility and because we don't currently have the ability to write this in .razor. - public class DuplicateAttributesOnElementChildComponent : ComponentBase - { - [Parameter] public string StringAttributeBefore { get; private set; } - [Parameter] public bool BoolAttributeBefore { get; private set; } - [Parameter] public string StringAttributeAfter { get; private set; } - [Parameter] public bool? BoolAttributeAfter { get; private set; } - - [Parameter(CaptureUnmatchedValues = true)] public Dictionary UnmatchedValues { get; private set; } - - protected override void BuildRenderTree(RenderTreeBuilder builder) - { - builder.OpenElement(0, "div"); - builder.AddAttribute(1, "string", StringAttributeBefore); - builder.AddAttribute(2, "bool", BoolAttributeBefore); - builder.AddMultipleAttributes(3, UnmatchedValues); - if (StringAttributeAfter != null) - { - builder.AddAttribute(4, "string", StringAttributeAfter); - } - if (BoolAttributeAfter != null) - { - builder.AddAttribute(5, "bool", BoolAttributeAfter); - } - builder.CloseElement(); - } - } -} diff --git a/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor new file mode 100644 index 0000000000..27048982f1 --- /dev/null +++ b/src/Components/test/testassets/BasicTestApp/DuplicateAttributesOnElementChildComponent.razor @@ -0,0 +1,23 @@ +@if (StringAttributeBefore != null) +{ +
+
+} +else +{ +
+
+} + +@code { + [Parameter] public string StringAttributeBefore { get; private set; } + [Parameter] public bool BoolAttributeBefore { get; private set; } + [Parameter] public string StringAttributeAfter { get; private set; } + [Parameter] public bool? BoolAttributeAfter { get; private set; } + + [Parameter(CaptureUnmatchedValues = true)] public Dictionary UnmatchedValues { get; private set; } +} From b10c8a6fc33e982912742bd906d7e503443943c9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Jun 2019 10:53:43 -0700 Subject: [PATCH 04/21] Eagerly read IAsyncEnumerable{object} instances before formatting (#11118) * Eagerly read IAsyncEnumerable{object} instances before formatting Fixes https://github.com/aspnet/AspNetCore/issues/4833 --- ...osoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs | 3 + .../Infrastructure/AsyncEnumerableReader.cs | 102 ++++++++++++++ .../Infrastructure/ObjectResultExecutor.cs | 61 ++++++++- .../SystemTextJsonResultExecutor.cs | 25 +++- src/Mvc/Mvc.Core/src/MvcOptions.cs | 13 ++ .../src/Properties/Resources.Designer.cs | 14 ++ src/Mvc/Mvc.Core/src/Resources.resx | 5 +- .../test/AcceptedAtActionResultTests.cs | 3 +- .../test/AcceptedAtRouteResultTests.cs | 3 +- src/Mvc/Mvc.Core/test/AcceptedResultTests.cs | 3 +- .../test/CreatedAtActionResultTests.cs | 3 +- .../test/CreatedAtRouteResultTests.cs | 3 +- src/Mvc/Mvc.Core/test/CreatedResultTests.cs | 3 +- .../test/HttpNotFoundObjectResultTest.cs | 3 +- .../Mvc.Core/test/HttpOkObjectResultTest.cs | 3 +- .../AsyncEnumerableReaderTest.cs | 84 ++++++++++++ .../ControllerActionInvokerTest.cs | 3 +- .../JsonResultExecutorTestBase.cs | 26 ++++ .../ObjectResultExecutorTest.cs | 124 ++++++++++++++++-- .../SystemTextJsonResultExecutorTest.cs | 5 +- src/Mvc/Mvc.Core/test/ObjectResultTests.cs | 6 +- ...osoft.AspNetCore.Mvc.NewtonsoftJson.csproj | 2 + .../src/NewtonsoftJsonLoggerExtensions.cs | 12 -- .../src/NewtonsoftJsonResultExecutor.cs | 44 ++++++- .../src/Properties/Resources.Designer.cs | 14 ++ src/Mvc/Mvc.NewtonsoftJson/src/Resources.resx | 59 +++++---- ....AspNetCore.Mvc.NewtonsoftJson.Test.csproj | 1 + .../AsyncEnumerableTestBase.cs | 97 ++++++++++++++ .../InputObjectValidationTests.cs | 12 +- .../TestJsonSerializationOptionsProvider.cs | 15 +++ .../Controllers/AsyncEnumerableController.cs | 48 +++++++ .../test/WebSites/FormatterWebSite/Startup.cs | 2 + 32 files changed, 727 insertions(+), 74 deletions(-) create mode 100644 src/Mvc/Mvc.Core/src/Infrastructure/AsyncEnumerableReader.cs create mode 100644 src/Mvc/Mvc.Core/test/Infrastructure/AsyncEnumerableReaderTest.cs create mode 100644 src/Mvc/test/Mvc.FunctionalTests/AsyncEnumerableTestBase.cs create mode 100644 src/Mvc/test/Mvc.FunctionalTests/TestJsonSerializationOptionsProvider.cs create mode 100644 src/Mvc/test/WebSites/FormatterWebSite/Controllers/AsyncEnumerableController.cs diff --git a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs index feeba2cc12..a895709b24 100644 --- a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs +++ b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs @@ -875,6 +875,7 @@ namespace Microsoft.AspNetCore.Mvc public Microsoft.AspNetCore.Mvc.Filters.FilterCollection Filters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public Microsoft.AspNetCore.Mvc.Formatters.FormatterMappings FormatterMappings { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public Microsoft.AspNetCore.Mvc.Formatters.FormatterCollection InputFormatters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int MaxIAsyncEnumerableBufferLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int MaxModelBindingCollectionSize { get { throw null; } set { } } public int MaxModelBindingRecursionDepth { get { throw null; } set { } } public int MaxModelValidationErrors { get { throw null; } set { } } @@ -2086,7 +2087,9 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure } public partial class ObjectResultExecutor : Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor { + [System.ObsoleteAttribute("This constructor is obsolete and will be removed in a future release.")] public ObjectResultExecutor(Microsoft.AspNetCore.Mvc.Infrastructure.OutputFormatterSelector formatterSelector, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) { } + public ObjectResultExecutor(Microsoft.AspNetCore.Mvc.Infrastructure.OutputFormatterSelector formatterSelector, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptions mvcOptions) { } protected Microsoft.AspNetCore.Mvc.Infrastructure.OutputFormatterSelector FormatterSelector { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected Microsoft.Extensions.Logging.ILogger Logger { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } protected System.Func WriterFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/AsyncEnumerableReader.cs b/src/Mvc/Mvc.Core/src/Infrastructure/AsyncEnumerableReader.cs new file mode 100644 index 0000000000..846e8f19d5 --- /dev/null +++ b/src/Mvc/Mvc.Core/src/Infrastructure/AsyncEnumerableReader.cs @@ -0,0 +1,102 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.Core; +using Microsoft.Extensions.Internal; + +#if JSONNET +namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson +#else +namespace Microsoft.AspNetCore.Mvc.Infrastructure +#endif +{ + using ReaderFunc = Func, Task>; + + /// + /// Type that reads an instance into a + /// generic collection instance. + /// + /// + /// This type is used to create a strongly typed synchronous instance from + /// an . An accurate is required for XML formatters to + /// correctly serialize. + /// + internal sealed class AsyncEnumerableReader + { + private readonly MethodInfo Converter = typeof(AsyncEnumerableReader).GetMethod( + nameof(ReadInternal), + BindingFlags.NonPublic | BindingFlags.Instance); + + private readonly ConcurrentDictionary _asyncEnumerableConverters = + new ConcurrentDictionary(); + private readonly MvcOptions _mvcOptions; + + /// + /// Initializes a new instance of . + /// + /// Accessor to . + public AsyncEnumerableReader(MvcOptions mvcOptions) + { + _mvcOptions = mvcOptions; + } + + /// + /// Reads a into an . + /// + /// The to read. + /// The . + public Task ReadAsync(IAsyncEnumerable value) + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + + var type = value.GetType(); + if (!_asyncEnumerableConverters.TryGetValue(type, out var result)) + { + var enumerableType = ClosedGenericMatcher.ExtractGenericInterface(type, typeof(IAsyncEnumerable<>)); + Debug.Assert(enumerableType != null); + + var enumeratedObjectType = enumerableType.GetGenericArguments()[0]; + + var converter = (ReaderFunc)Converter + .MakeGenericMethod(enumeratedObjectType) + .CreateDelegate(typeof(ReaderFunc), this); + + _asyncEnumerableConverters.TryAdd(type, converter); + result = converter; + } + + return result(value); + } + + private async Task ReadInternal(IAsyncEnumerable value) + { + var asyncEnumerable = (IAsyncEnumerable)value; + var result = new List(); + var count = 0; + + await foreach (var item in asyncEnumerable) + { + if (count++ >= _mvcOptions.MaxIAsyncEnumerableBufferLimit) + { + throw new InvalidOperationException(Resources.FormatObjectResultExecutor_MaxEnumerationExceeded( + nameof(AsyncEnumerableReader), + value.GetType())); + } + + result.Add(item); + } + + return result; + } + } +} diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs b/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs index 6c5179d222..3dd2ddc845 100644 --- a/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs +++ b/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Mvc.Infrastructure { @@ -18,16 +19,35 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure /// public class ObjectResultExecutor : IActionResultExecutor { + private readonly AsyncEnumerableReader _asyncEnumerableReader; + /// /// Creates a new . /// /// The . /// The . /// The . + [Obsolete("This constructor is obsolete and will be removed in a future release.")] public ObjectResultExecutor( OutputFormatterSelector formatterSelector, IHttpResponseStreamWriterFactory writerFactory, ILoggerFactory loggerFactory) + : this(formatterSelector, writerFactory, loggerFactory, mvcOptions: null) + { + } + + /// + /// Creates a new . + /// + /// The . + /// The . + /// The . + /// Accessor to . + public ObjectResultExecutor( + OutputFormatterSelector formatterSelector, + IHttpResponseStreamWriterFactory writerFactory, + ILoggerFactory loggerFactory, + IOptions mvcOptions) { if (formatterSelector == null) { @@ -47,6 +67,8 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure FormatterSelector = formatterSelector; WriterFactory = writerFactory.CreateWriter; Logger = loggerFactory.CreateLogger(); + var options = mvcOptions?.Value ?? throw new ArgumentNullException(nameof(mvcOptions)); + _asyncEnumerableReader = new AsyncEnumerableReader(options); } /// @@ -87,16 +109,37 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure InferContentTypes(context, result); var objectType = result.DeclaredType; + if (objectType == null || objectType == typeof(object)) { objectType = result.Value?.GetType(); } + var value = result.Value; + + if (value is IAsyncEnumerable asyncEnumerable) + { + return ExecuteAsyncEnumerable(context, result, asyncEnumerable); + } + + return ExecuteAsyncCore(context, result, objectType, value); + } + + private async Task ExecuteAsyncEnumerable(ActionContext context, ObjectResult result, IAsyncEnumerable asyncEnumerable) + { + Log.BufferingAsyncEnumerable(Logger, asyncEnumerable); + + var enumerated = await _asyncEnumerableReader.ReadAsync(asyncEnumerable); + await ExecuteAsyncCore(context, result, enumerated.GetType(), enumerated); + } + + private Task ExecuteAsyncCore(ActionContext context, ObjectResult result, Type objectType, object value) + { var formatterContext = new OutputFormatterWriteContext( context.HttpContext, WriterFactory, objectType, - result.Value); + value); var selectedFormatter = FormatterSelector.SelectFormatter( formatterContext, @@ -138,5 +181,21 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure result.ContentTypes.Add("application/problem+xml"); } } + + private static class Log + { + private static readonly Action _bufferingAsyncEnumerable; + + static Log() + { + _bufferingAsyncEnumerable = LoggerMessage.Define( + LogLevel.Debug, + new EventId(1, "BufferingAsyncEnumerable"), + "Buffering IAsyncEnumerable instance of type '{Type}'."); + } + + public static void BufferingAsyncEnumerable(ILogger logger, IAsyncEnumerable asyncEnumerable) + => _bufferingAsyncEnumerable(logger, asyncEnumerable.GetType().FullName, null); + } } } diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/SystemTextJsonResultExecutor.cs b/src/Mvc/Mvc.Core/src/Infrastructure/SystemTextJsonResultExecutor.cs index 49d1b3c653..16da9325d2 100644 --- a/src/Mvc/Mvc.Core/src/Infrastructure/SystemTextJsonResultExecutor.cs +++ b/src/Mvc/Mvc.Core/src/Infrastructure/SystemTextJsonResultExecutor.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.IO; using System.Text; using System.Text.Json; @@ -25,13 +26,16 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure private readonly JsonOptions _options; private readonly ILogger _logger; + private readonly AsyncEnumerableReader _asyncEnumerableReader; public SystemTextJsonResultExecutor( IOptions options, - ILogger logger) + ILogger logger, + IOptions mvcOptions) { _options = options.Value; _logger = logger; + _asyncEnumerableReader = new AsyncEnumerableReader(mvcOptions.Value); } public async Task ExecuteAsync(ActionContext context, JsonResult result) @@ -70,8 +74,15 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure var writeStream = GetWriteStream(context.HttpContext, resolvedContentTypeEncoding); try { - var type = result.Value?.GetType() ?? typeof(object); - await JsonSerializer.WriteAsync(writeStream, result.Value, type, jsonSerializerOptions); + var value = result.Value; + if (value is IAsyncEnumerable asyncEnumerable) + { + Log.BufferingAsyncEnumerable(_logger, asyncEnumerable); + value = await _asyncEnumerableReader.ReadAsync(asyncEnumerable); + } + + var type = value?.GetType() ?? typeof(object); + await JsonSerializer.WriteAsync(writeStream, value, type, jsonSerializerOptions); await writeStream.FlushAsync(); } finally @@ -123,11 +134,19 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure new EventId(1, "JsonResultExecuting"), "Executing JsonResult, writing value of type '{Type}'."); + private static readonly Action _bufferingAsyncEnumerable = LoggerMessage.Define( + LogLevel.Debug, + new EventId(2, "BufferingAsyncEnumerable"), + "Buffering IAsyncEnumerable instance of type '{Type}'."); + public static void JsonResultExecuting(ILogger logger, object value) { var type = value == null ? "null" : value.GetType().FullName; _jsonResultExecuting(logger, type, null); } + + public static void BufferingAsyncEnumerable(ILogger logger, IAsyncEnumerable asyncEnumerable) + => _bufferingAsyncEnumerable(logger, asyncEnumerable.GetType().FullName, null); } } } diff --git a/src/Mvc/Mvc.Core/src/MvcOptions.cs b/src/Mvc/Mvc.Core/src/MvcOptions.cs index 2cb5f9fa72..46cf9c63a3 100644 --- a/src/Mvc/Mvc.Core/src/MvcOptions.cs +++ b/src/Mvc/Mvc.Core/src/MvcOptions.cs @@ -359,6 +359,19 @@ namespace Microsoft.AspNetCore.Mvc } } + /// + /// Gets or sets the most number of entries of an that + /// that will buffer. + /// + /// When is an instance of , + /// will eagerly read the enumeration and add to a synchronous collection + /// prior to invoking the selected formatter. + /// This property determines the most number of entries that the executor is allowed to buffer. + /// + /// + /// Defaults to 8192. + public int MaxIAsyncEnumerableBufferLimit { get; set; } = 8192; + IEnumerator IEnumerable.GetEnumerator() => _switches.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => _switches.GetEnumerator(); diff --git a/src/Mvc/Mvc.Core/src/Properties/Resources.Designer.cs b/src/Mvc/Mvc.Core/src/Properties/Resources.Designer.cs index 2878cafd4c..c5a777379b 100644 --- a/src/Mvc/Mvc.Core/src/Properties/Resources.Designer.cs +++ b/src/Mvc/Mvc.Core/src/Properties/Resources.Designer.cs @@ -1746,6 +1746,20 @@ namespace Microsoft.AspNetCore.Mvc.Core internal static string FormatProperty_MustBeInstanceOfType(object p0, object p1, object p2) => string.Format(CultureInfo.CurrentCulture, GetString("Property_MustBeInstanceOfType"), p0, p1, p2); + /// + /// '{0}' reached the configured maximum size of the buffer when enumerating a value of type `{1}'. This limit is in place to prevent infinite streams of `IAsyncEnumerable` from continuing indefinitely. If this is not a programming mistake, consider ways to reduce the collection size, or consider manually converting '{1}' into a list rather than increasing the limit. + /// + internal static string ObjectResultExecutor_MaxEnumerationExceeded + { + get => GetString("ObjectResultExecutor_MaxEnumerationExceeded"); + } + + /// + /// '{0}' reached the configured maximum size of the buffer when enumerating a value of type `{1}'. This limit is in place to prevent infinite streams of `IAsyncEnumerable` from continuing indefinitely. If this is not a programming mistake, consider ways to reduce the collection size, or consider manually converting '{1}' into a list rather than increasing the limit. + /// + internal static string FormatObjectResultExecutor_MaxEnumerationExceeded(object p0, object p1) + => string.Format(CultureInfo.CurrentCulture, GetString("ObjectResultExecutor_MaxEnumerationExceeded"), p0, p1); + private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name); diff --git a/src/Mvc/Mvc.Core/src/Resources.resx b/src/Mvc/Mvc.Core/src/Resources.resx index bbf596d558..43d3e79b84 100644 --- a/src/Mvc/Mvc.Core/src/Resources.resx +++ b/src/Mvc/Mvc.Core/src/Resources.resx @@ -503,5 +503,8 @@ Property '{0}.{1}' must be an instance of type '{2}'. - + + + '{0}' reached the configured maximum size of the buffer when enumerating a value of type '{1}'. This limit is in place to prevent infinite streams of 'IAsyncEnumerable<>' from continuing indefinitely. If this is not a programming mistake, consider ways to reduce the collection size, or consider manually converting '{1}' into a list rather than increasing the limit. + diff --git a/src/Mvc/Mvc.Core/test/AcceptedAtActionResultTests.cs b/src/Mvc/Mvc.Core/test/AcceptedAtActionResultTests.cs index 721b58ca9b..ba2cfed7ac 100644 --- a/src/Mvc/Mvc.Core/test/AcceptedAtActionResultTests.cs +++ b/src/Mvc/Mvc.Core/test/AcceptedAtActionResultTests.cs @@ -275,7 +275,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/AcceptedAtRouteResultTests.cs b/src/Mvc/Mvc.Core/test/AcceptedAtRouteResultTests.cs index 2200131971..63dab76bc0 100644 --- a/src/Mvc/Mvc.Core/test/AcceptedAtRouteResultTests.cs +++ b/src/Mvc/Mvc.Core/test/AcceptedAtRouteResultTests.cs @@ -183,7 +183,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/AcceptedResultTests.cs b/src/Mvc/Mvc.Core/test/AcceptedResultTests.cs index 07ca76072e..da714c3f50 100644 --- a/src/Mvc/Mvc.Core/test/AcceptedResultTests.cs +++ b/src/Mvc/Mvc.Core/test/AcceptedResultTests.cs @@ -139,7 +139,8 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/CreatedAtActionResultTests.cs b/src/Mvc/Mvc.Core/test/CreatedAtActionResultTests.cs index cad29a3043..be493c9eda 100644 --- a/src/Mvc/Mvc.Core/test/CreatedAtActionResultTests.cs +++ b/src/Mvc/Mvc.Core/test/CreatedAtActionResultTests.cs @@ -97,7 +97,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/CreatedAtRouteResultTests.cs b/src/Mvc/Mvc.Core/test/CreatedAtRouteResultTests.cs index 65410977a0..50eb7ba12b 100644 --- a/src/Mvc/Mvc.Core/test/CreatedAtRouteResultTests.cs +++ b/src/Mvc/Mvc.Core/test/CreatedAtRouteResultTests.cs @@ -110,7 +110,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/CreatedResultTests.cs b/src/Mvc/Mvc.Core/test/CreatedResultTests.cs index 6d3eefc85b..22e6b13637 100644 --- a/src/Mvc/Mvc.Core/test/CreatedResultTests.cs +++ b/src/Mvc/Mvc.Core/test/CreatedResultTests.cs @@ -98,7 +98,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/HttpNotFoundObjectResultTest.cs b/src/Mvc/Mvc.Core/test/HttpNotFoundObjectResultTest.cs index 498a12c57a..42ef48b2f0 100644 --- a/src/Mvc/Mvc.Core/test/HttpNotFoundObjectResultTest.cs +++ b/src/Mvc/Mvc.Core/test/HttpNotFoundObjectResultTest.cs @@ -75,7 +75,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/HttpOkObjectResultTest.cs b/src/Mvc/Mvc.Core/test/HttpOkObjectResultTest.cs index 13f5572c4e..49fac14fff 100644 --- a/src/Mvc/Mvc.Core/test/HttpOkObjectResultTest.cs +++ b/src/Mvc/Mvc.Core/test/HttpOkObjectResultTest.cs @@ -76,7 +76,8 @@ namespace Microsoft.AspNetCore.Mvc services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); return services.BuildServiceProvider(); } diff --git a/src/Mvc/Mvc.Core/test/Infrastructure/AsyncEnumerableReaderTest.cs b/src/Mvc/Mvc.Core/test/Infrastructure/AsyncEnumerableReaderTest.cs new file mode 100644 index 0000000000..27baf232c9 --- /dev/null +++ b/src/Mvc/Mvc.Core/test/Infrastructure/AsyncEnumerableReaderTest.cs @@ -0,0 +1,84 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Infrastructure +{ + public class AsyncEnumerableReaderTest + { + [Fact] + public async Task ReadAsync_ReadsIAsyncEnumerable() + { + // Arrange + var options = new MvcOptions(); + var reader = new AsyncEnumerableReader(options); + + // Act + var result = await reader.ReadAsync(TestEnumerable()); + + // Assert + var collection = Assert.IsAssignableFrom>(result); + Assert.Equal(new[] { "0", "1", "2", }, collection); + } + + [Fact] + public async Task ReadAsync_ReadsIAsyncEnumerable_ImplementingMultipleAsyncEnumerableInterfaces() + { + // This test ensures the reader does not fail if you have a type that implements IAsyncEnumerable for multiple Ts + // Arrange + var options = new MvcOptions(); + var reader = new AsyncEnumerableReader(options); + + // Act + var result = await reader.ReadAsync(new MultiAsyncEnumerable()); + + // Assert + var collection = Assert.IsAssignableFrom>(result); + Assert.Equal(new[] { "0", "1", "2", }, collection); + } + + [Fact] + public async Task ReadAsync_ThrowsIfBufferimitIsReached() + { + // Arrange + var enumerable = TestEnumerable(11); + var expected = $"'AsyncEnumerableReader' reached the configured maximum size of the buffer when enumerating a value of type '{enumerable.GetType()}'. " + + "This limit is in place to prevent infinite streams of 'IAsyncEnumerable<>' from continuing indefinitely. If this is not a programming mistake, " + + $"consider ways to reduce the collection size, or consider manually converting '{enumerable.GetType()}' into a list rather than increasing the limit."; + var options = new MvcOptions { MaxIAsyncEnumerableBufferLimit = 10 }; + var reader = new AsyncEnumerableReader(options); + + // Act + var ex = await Assert.ThrowsAsync(() => reader.ReadAsync(enumerable)); + + // Assert + Assert.Equal(expected, ex.Message); + } + + public static async IAsyncEnumerable TestEnumerable(int count = 3) + { + await Task.Yield(); + for (var i = 0; i < count; i++) + { + yield return i.ToString(); + } + } + + public class MultiAsyncEnumerable : IAsyncEnumerable, IAsyncEnumerable + { + public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) + { + return TestEnumerable().GetAsyncEnumerator(cancellationToken); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + => GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs b/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs index 70ce4124e1..dda560bba4 100644 --- a/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs +++ b/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs @@ -1567,7 +1567,8 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure services.AddSingleton>(new ObjectResultExecutor( new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); httpContext.Response.Body = new MemoryStream(); httpContext.RequestServices = services.BuildServiceProvider(); diff --git a/src/Mvc/Mvc.Core/test/Infrastructure/JsonResultExecutorTestBase.cs b/src/Mvc/Mvc.Core/test/Infrastructure/JsonResultExecutorTestBase.cs index 5c025909b0..884f4f213e 100644 --- a/src/Mvc/Mvc.Core/test/Infrastructure/JsonResultExecutorTestBase.cs +++ b/src/Mvc/Mvc.Core/test/Infrastructure/JsonResultExecutorTestBase.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; @@ -310,6 +311,24 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure Assert.StartsWith("Property 'JsonResult.SerializerSettings' must be an instance of type", ex.Message); } + [Fact] + public async Task ExecuteAsync_SerializesAsyncEnumerables() + { + // Arrange + var expected = Encoding.UTF8.GetBytes(JsonSerializer.ToString(new[] { "Hello", "world" })); + + var context = GetActionContext(); + var result = new JsonResult(TestAsyncEnumerable()); + var executor = CreateExecutor(); + + // Act + await executor.ExecuteAsync(context, result); + + // Assert + var written = GetWrittenBytes(context.HttpContext); + Assert.Equal(expected, written); + } + protected IActionResultExecutor CreateExecutor() => CreateExecutor(NullLoggerFactory.Instance); protected abstract IActionResultExecutor CreateExecutor(ILoggerFactory loggerFactory); @@ -354,5 +373,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure { public string Property { get; set; } } + + private async IAsyncEnumerable TestAsyncEnumerable() + { + await Task.Yield(); + yield return "Hello"; + yield return "world"; + } } } diff --git a/src/Mvc/Mvc.Core/test/Infrastructure/ObjectResultExecutorTest.cs b/src/Mvc/Mvc.Core/test/Infrastructure/ObjectResultExecutorTest.cs index 207d04161f..8ab2d76678 100644 --- a/src/Mvc/Mvc.Core/test/Infrastructure/ObjectResultExecutorTest.cs +++ b/src/Mvc/Mvc.Core/test/Infrastructure/ObjectResultExecutorTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; @@ -209,8 +210,8 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure public async Task ExecuteAsync_FallsBackOnFormattersInOptions() { // Arrange - var options = Options.Create(new MvcOptions()); - options.Value.OutputFormatters.Add(new TestJsonOutputFormatter()); + var options = new MvcOptions(); + options.OutputFormatters.Add(new TestJsonOutputFormatter()); var executor = CreateExecutor(options: options); @@ -300,8 +301,8 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure string expectedContentType) { // Arrange - var options = Options.Create(new MvcOptions()); - options.Value.RespectBrowserAcceptHeader = false; + var options = new MvcOptions(); + options.RespectBrowserAcceptHeader = false; var executor = CreateExecutor(options: options); @@ -337,8 +338,8 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure string expectedContentType) { // Arrange - var options = Options.Create(new MvcOptions()); - options.Value.RespectBrowserAcceptHeader = true; + var options = new MvcOptions(); + options.RespectBrowserAcceptHeader = true; var executor = CreateExecutor(options: options); @@ -360,6 +361,106 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure MediaTypeAssert.Equal(expectedContentType, responseContentType); } + [Fact] + public async Task ObjectResult_ReadsAsyncEnumerables() + { + // Arrange + var executor = CreateExecutor(); + var result = new ObjectResult(AsyncEnumerable()); + var formatter = new TestJsonOutputFormatter(); + result.Formatters.Add(formatter); + + var actionContext = new ActionContext() + { + HttpContext = GetHttpContext(), + }; + + // Act + await executor.ExecuteAsync(actionContext, result); + + // Assert + var formatterContext = formatter.LastOutputFormatterContext; + Assert.Equal(typeof(List), formatterContext.ObjectType); + var value = Assert.IsType>(formatterContext.Object); + Assert.Equal(new[] { "Hello 0", "Hello 1", "Hello 2", "Hello 3", }, value); + } + + [Fact] + public async Task ObjectResult_Throws_IfEnumerableThrows() + { + // Arrange + var executor = CreateExecutor(); + var result = new ObjectResult(AsyncEnumerable(throwError: true)); + var formatter = new TestJsonOutputFormatter(); + result.Formatters.Add(formatter); + + var actionContext = new ActionContext() + { + HttpContext = GetHttpContext(), + }; + + // Act & Assert + await Assert.ThrowsAsync(() => executor.ExecuteAsync(actionContext, result)); + } + + [Fact] + public async Task ObjectResult_AsyncEnumeration_AtLimit() + { + // Arrange + var count = 24; + var executor = CreateExecutor(options: new MvcOptions { MaxIAsyncEnumerableBufferLimit = count }); + var result = new ObjectResult(AsyncEnumerable(count: count)); + var formatter = new TestJsonOutputFormatter(); + result.Formatters.Add(formatter); + + var actionContext = new ActionContext() + { + HttpContext = GetHttpContext(), + }; + + // Act + await executor.ExecuteAsync(actionContext, result); + + // Assert + var formatterContext = formatter.LastOutputFormatterContext; + var value = Assert.IsType>(formatterContext.Object); + Assert.Equal(24, value.Count); + } + + [Theory] + [InlineData(25)] + [InlineData(1024)] + public async Task ObjectResult_Throws_IfEnumerationExceedsLimit(int count) + { + // Arrange + var executor = CreateExecutor(options: new MvcOptions { MaxIAsyncEnumerableBufferLimit = 24 }); + var result = new ObjectResult(AsyncEnumerable(count: count)); + var formatter = new TestJsonOutputFormatter(); + result.Formatters.Add(formatter); + + var actionContext = new ActionContext() + { + HttpContext = GetHttpContext(), + }; + + // Act & Assert + var ex = await Assert.ThrowsAsync(() => executor.ExecuteAsync(actionContext, result)); + } + + private static async IAsyncEnumerable AsyncEnumerable(int count = 4, bool throwError = false) + { + await Task.Yield(); + for (var i = 0; i < count; i++) + { + yield return $"Hello {i}"; + } + + if (throwError) + { + throw new TimeZoneNotFoundException(); + } + } + private static IServiceCollection CreateServices() { var services = new ServiceCollection(); @@ -379,10 +480,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure return httpContext; } - private static ObjectResultExecutor CreateExecutor(IOptions options = null) + private static ObjectResultExecutor CreateExecutor(MvcOptions options = null) { - var selector = new DefaultOutputFormatterSelector(options ?? Options.Create(new MvcOptions()), NullLoggerFactory.Instance); - return new ObjectResultExecutor(selector, new TestHttpResponseStreamWriterFactory(), NullLoggerFactory.Instance); + options ??= new MvcOptions(); + var optionsAccessor = Options.Create(options); + var selector = new DefaultOutputFormatterSelector(optionsAccessor, NullLoggerFactory.Instance); + return new ObjectResultExecutor(selector, new TestHttpResponseStreamWriterFactory(), NullLoggerFactory.Instance, optionsAccessor); } private class CannotWriteFormatter : IOutputFormatter @@ -409,8 +512,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure SupportedEncodings.Add(Encoding.UTF8); } + public OutputFormatterWriteContext LastOutputFormatterContext { get; private set; } + public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding) { + LastOutputFormatterContext = context; return Task.FromResult(0); } } diff --git a/src/Mvc/Mvc.Core/test/Infrastructure/SystemTextJsonResultExecutorTest.cs b/src/Mvc/Mvc.Core/test/Infrastructure/SystemTextJsonResultExecutorTest.cs index 80c20f7a15..5fd36427de 100644 --- a/src/Mvc/Mvc.Core/test/Infrastructure/SystemTextJsonResultExecutorTest.cs +++ b/src/Mvc/Mvc.Core/test/Infrastructure/SystemTextJsonResultExecutorTest.cs @@ -11,7 +11,10 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure { protected override IActionResultExecutor CreateExecutor(ILoggerFactory loggerFactory) { - return new SystemTextJsonResultExecutor(Options.Create(new JsonOptions()), loggerFactory.CreateLogger()); + return new SystemTextJsonResultExecutor( + Options.Create(new JsonOptions()), + loggerFactory.CreateLogger(), + Options.Create(new MvcOptions())); } protected override object GetIndentedSettings() diff --git a/src/Mvc/Mvc.Core/test/ObjectResultTests.cs b/src/Mvc/Mvc.Core/test/ObjectResultTests.cs index 7b818ad97b..5f210f2921 100644 --- a/src/Mvc/Mvc.Core/test/ObjectResultTests.cs +++ b/src/Mvc/Mvc.Core/test/ObjectResultTests.cs @@ -97,10 +97,12 @@ namespace Microsoft.AspNetCore.Mvc private static IServiceProvider CreateServices() { var services = new ServiceCollection(); + var options = Options.Create(new MvcOptions()); services.AddSingleton>(new ObjectResultExecutor( - new DefaultOutputFormatterSelector(Options.Create(new MvcOptions()), NullLoggerFactory.Instance), + new DefaultOutputFormatterSelector(options, NullLoggerFactory.Instance), new TestHttpResponseStreamWriterFactory(), - NullLoggerFactory.Instance)); + NullLoggerFactory.Instance, + options)); services.AddSingleton(NullLoggerFactory.Instance); return services.BuildServiceProvider(); diff --git a/src/Mvc/Mvc.NewtonsoftJson/src/Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj b/src/Mvc/Mvc.NewtonsoftJson/src/Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj index 285e6f5142..2c81323847 100644 --- a/src/Mvc/Mvc.NewtonsoftJson/src/Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj +++ b/src/Mvc/Mvc.NewtonsoftJson/src/Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj @@ -6,6 +6,7 @@ true aspnetcore;aspnetcoremvc;json true + $(DefineConstants);JSONNET @@ -21,5 +22,6 @@ + diff --git a/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonLoggerExtensions.cs b/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonLoggerExtensions.cs index dfad01025e..a8be4c7917 100644 --- a/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonLoggerExtensions.cs +++ b/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonLoggerExtensions.cs @@ -10,7 +10,6 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson { private static readonly Action _jsonInputFormatterException; - private static readonly Action _jsonResultExecuting; static NewtonsoftJsonLoggerExtensions() { @@ -18,22 +17,11 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson LogLevel.Debug, new EventId(1, "JsonInputException"), "JSON input formatter threw an exception."); - - _jsonResultExecuting = LoggerMessage.Define( - LogLevel.Information, - new EventId(1, "JsonResultExecuting"), - "Executing JsonResult, writing value of type '{Type}'."); } public static void JsonInputException(this ILogger logger, Exception exception) { _jsonInputFormatterException(logger, exception); } - - public static void JsonResultExecuting(this ILogger logger, object value) - { - var type = value == null ? "null" : value.GetType().FullName; - _jsonResultExecuting(logger, type, null); - } } } diff --git a/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonResultExecutor.cs b/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonResultExecutor.cs index 1dc0b26fab..eac7d6400a 100644 --- a/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonResultExecutor.cs +++ b/src/Mvc/Mvc.NewtonsoftJson/src/NewtonsoftJsonResultExecutor.cs @@ -3,10 +3,9 @@ using System; using System.Buffers; -using System.IO; +using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.WebUtilities; @@ -32,6 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson private readonly MvcOptions _mvcOptions; private readonly MvcNewtonsoftJsonOptions _jsonOptions; private readonly IArrayPool _charPool; + private readonly AsyncEnumerableReader _asyncEnumerableReader; /// /// Creates a new . @@ -73,6 +73,7 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson _mvcOptions = mvcOptions?.Value ?? throw new ArgumentNullException(nameof(mvcOptions)); _jsonOptions = jsonOptions.Value; _charPool = new JsonArrayPool(charPool); + _asyncEnumerableReader = new AsyncEnumerableReader(_mvcOptions); } /// @@ -111,7 +112,7 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson response.StatusCode = result.StatusCode.Value; } - _logger.JsonResultExecuting(result.Value); + Log.JsonResultExecuting(_logger, result.Value); var responseStream = response.Body; FileBufferingWriteStream fileBufferingWriteStream = null; @@ -131,7 +132,14 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson jsonWriter.AutoCompleteOnClose = false; var jsonSerializer = JsonSerializer.Create(jsonSerializerSettings); - jsonSerializer.Serialize(jsonWriter, result.Value); + var value = result.Value; + if (result.Value is IAsyncEnumerable asyncEnumerable) + { + Log.BufferingAsyncEnumerable(_logger, asyncEnumerable); + value = await _asyncEnumerableReader.ReadAsync(asyncEnumerable); + } + + jsonSerializer.Serialize(jsonWriter, value); } if (fileBufferingWriteStream != null) @@ -168,5 +176,33 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson return settingsFromResult; } } + + private static class Log + { + private static readonly Action _jsonResultExecuting; + private static readonly Action _bufferingAsyncEnumerable; + + static Log() + { + _jsonResultExecuting = LoggerMessage.Define( + LogLevel.Information, + new EventId(1, "JsonResultExecuting"), + "Executing JsonResult, writing value of type '{Type}'."); + + _bufferingAsyncEnumerable = LoggerMessage.Define( + LogLevel.Debug, + new EventId(1, "BufferingAsyncEnumerable"), + "Buffering IAsyncEnumerable instance of type '{Type}'."); + } + + public static void JsonResultExecuting(ILogger logger, object value) + { + var type = value == null ? "null" : value.GetType().FullName; + _jsonResultExecuting(logger, type, null); + } + + public static void BufferingAsyncEnumerable(ILogger logger, IAsyncEnumerable asyncEnumerable) + => _bufferingAsyncEnumerable(logger, asyncEnumerable.GetType().FullName, null); + } } } diff --git a/src/Mvc/Mvc.NewtonsoftJson/src/Properties/Resources.Designer.cs b/src/Mvc/Mvc.NewtonsoftJson/src/Properties/Resources.Designer.cs index b089148e77..82aedac1ec 100644 --- a/src/Mvc/Mvc.NewtonsoftJson/src/Properties/Resources.Designer.cs +++ b/src/Mvc/Mvc.NewtonsoftJson/src/Properties/Resources.Designer.cs @@ -108,6 +108,20 @@ namespace Microsoft.AspNetCore.Mvc.NewtonsoftJson internal static string FormatTempData_CannotSerializeType(object p0, object p1) => string.Format(CultureInfo.CurrentCulture, GetString("TempData_CannotSerializeType"), p0, p1); + /// + /// '{0}' reached the configured maximum size of the buffer when enumerating a value of type `{1}'. This limit is in place to prevent infinite streams of `IAsyncEnumerable` from continuing indefinitely. If this is not a programming mistake, consider ways to reduce the collection size, or consider manually converting '{1}' into a list rather than increasing the limit. + /// + internal static string ObjectResultExecutor_MaxEnumerationExceeded + { + get => GetString("ObjectResultExecutor_MaxEnumerationExceeded"); + } + + /// + /// '{0}' reached the configured maximum size of the buffer when enumerating a value of type `{1}'. This limit is in place to prevent infinite streams of `IAsyncEnumerable` from continuing indefinitely. If this is not a programming mistake, consider ways to reduce the collection size, or consider manually converting '{1}' into a list rather than increasing the limit. + /// + internal static string FormatObjectResultExecutor_MaxEnumerationExceeded(object p0, object p1) + => string.Format(CultureInfo.CurrentCulture, GetString("ObjectResultExecutor_MaxEnumerationExceeded"), p0, p1); + private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name); diff --git a/src/Mvc/Mvc.NewtonsoftJson/src/Resources.resx b/src/Mvc/Mvc.NewtonsoftJson/src/Resources.resx index cedf5cbcde..4887c8adbc 100644 --- a/src/Mvc/Mvc.NewtonsoftJson/src/Resources.resx +++ b/src/Mvc/Mvc.NewtonsoftJson/src/Resources.resx @@ -1,17 +1,17 @@  - @@ -126,6 +126,9 @@ Parameter '{0}' must be an instance of {1} provided by the '{2}' package. Configure the correct instance using '{3}' in your startup. + + '{0}' reached the configured maximum size of the buffer when enumerating a value of type '{1}'. This limit is in place to prevent infinite streams of 'IAsyncEnumerable<>' from continuing indefinitely. If this is not a programming mistake, consider ways to reduce the collection size, or consider manually converting '{1}' into a list rather than increasing the limit. + Property '{0}.{1}' must be an instance of type '{2}'. @@ -138,4 +141,4 @@ The '{0}' cannot serialize an object of type '{1}'. - \ No newline at end of file + diff --git a/src/Mvc/Mvc.NewtonsoftJson/test/Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test.csproj b/src/Mvc/Mvc.NewtonsoftJson/test/Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test.csproj index 734fc8d429..0cf127eac9 100644 --- a/src/Mvc/Mvc.NewtonsoftJson/test/Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test.csproj +++ b/src/Mvc/Mvc.NewtonsoftJson/test/Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Mvc/test/Mvc.FunctionalTests/AsyncEnumerableTestBase.cs b/src/Mvc/test/Mvc.FunctionalTests/AsyncEnumerableTestBase.cs new file mode 100644 index 0000000000..75160338f0 --- /dev/null +++ b/src/Mvc/test/Mvc.FunctionalTests/AsyncEnumerableTestBase.cs @@ -0,0 +1,97 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using System.Xml.Linq; +using FormatterWebSite; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.FunctionalTests +{ + public class AsyncEnumerableTestBase : IClassFixture> + { + public AsyncEnumerableTestBase(MvcTestFixture fixture) + { + Client = fixture.CreateDefaultClient(); + } + + public HttpClient Client { get; } + + [Fact] + public Task AsyncEnumerableReturnedWorks() => AsyncEnumerableWorks(); + + [Fact] + public Task AsyncEnumerableWrappedInTask() => AsyncEnumerableWorks(); + + private async Task AsyncEnumerableWorks() + { + // Act + var response = await Client.GetAsync("asyncenumerable/getallprojects"); + + // Assert + await response.AssertStatusCodeAsync(HttpStatusCode.OK); + + var content = await response.Content.ReadAsStringAsync(); + + // Some sanity tests to verify things serialized correctly. + var projects = JsonSerializer.Parse>(content, TestJsonSerializerOptionsProvider.Options); + Assert.Equal(10, projects.Count); + Assert.Equal("Project0", projects[0].Name); + Assert.Equal("Project9", projects[9].Name); + } + + [Fact] + public async Task AsyncEnumerableExceptionsAreThrown() + { + // Act + var response = await Client.GetAsync("asyncenumerable/GetAllProjectsWithError"); + + // Assert + await response.AssertStatusCodeAsync(HttpStatusCode.InternalServerError); + + var content = await response.Content.ReadAsStringAsync(); + + // Verify that the exception shows up in the callstack + Assert.Contains(nameof(InvalidTimeZoneException), content); + } + + [Fact] + public async Task AsyncEnumerableWithXmlFormatterWorks() + { + // Arrange + var request = new HttpRequestMessage(HttpMethod.Get, "asyncenumerable/getallprojects"); + request.Headers.Add("Accept", "application/xml"); + + // Act + var response = await Client.SendAsync(request); + + // Assert + await response.AssertStatusCodeAsync(HttpStatusCode.OK); + + var content = await response.Content.ReadAsStringAsync(); + + // Some sanity tests to verify things serialized correctly. + var xml = XDocument.Parse(content); + var @namespace = xml.Root.Name.NamespaceName; + var projects = xml.Root.Elements(XName.Get("Project", @namespace)); + Assert.Equal(10, projects.Count()); + + Assert.Equal("Project0", GetName(projects.ElementAt(0))); + Assert.Equal("Project9", GetName(projects.ElementAt(9))); + + string GetName(XElement element) + { + var name = element.Element(XName.Get("Name", @namespace)); + Assert.NotNull(name); + + return name.Value; + } + } + } +} diff --git a/src/Mvc/test/Mvc.FunctionalTests/InputObjectValidationTests.cs b/src/Mvc/test/Mvc.FunctionalTests/InputObjectValidationTests.cs index 78c3ce254c..97290f7278 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/InputObjectValidationTests.cs +++ b/src/Mvc/test/Mvc.FunctionalTests/InputObjectValidationTests.cs @@ -261,9 +261,13 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests Content = new StringContent(@"{ ""Id"": ""S-1-5-21-1004336348-1177238915-682003330-512"" }", Encoding.UTF8, "application/json"), }; - // Act & Assert - var ex = await Assert.ThrowsAsync(() => Client.SendAsync(requestMessage)); - Assert.Equal(expected, ex.Message); + // Act + var response = await Client.SendAsync(requestMessage); + + // Assert + await response.AssertStatusCodeAsync(HttpStatusCode.InternalServerError); + var content = await response.Content.ReadAsStringAsync(); + Assert.Contains(expected, content); } [Fact] @@ -356,4 +360,4 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests }); } } -} \ No newline at end of file +} diff --git a/src/Mvc/test/Mvc.FunctionalTests/TestJsonSerializationOptionsProvider.cs b/src/Mvc/test/Mvc.FunctionalTests/TestJsonSerializationOptionsProvider.cs new file mode 100644 index 0000000000..4a418cb0f6 --- /dev/null +++ b/src/Mvc/test/Mvc.FunctionalTests/TestJsonSerializationOptionsProvider.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Text.Json; + +namespace Microsoft.AspNetCore.Mvc.FunctionalTests +{ + internal static class TestJsonSerializerOptionsProvider + { + public static JsonSerializerOptions Options = new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + }; + } +} diff --git a/src/Mvc/test/WebSites/FormatterWebSite/Controllers/AsyncEnumerableController.cs b/src/Mvc/test/WebSites/FormatterWebSite/Controllers/AsyncEnumerableController.cs new file mode 100644 index 0000000000..864e385c76 --- /dev/null +++ b/src/Mvc/test/WebSites/FormatterWebSite/Controllers/AsyncEnumerableController.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace FormatterWebSite.Controllers +{ + [ApiController] + [Route("{controller}/{action}")] + public class AsyncEnumerableController : ControllerBase + { + [HttpGet] + public IAsyncEnumerable GetAllProjects() + => GetAllProjectsCore(); + + [HttpGet] + public async Task> GetAllProjectsAsTask() + { + await Task.Yield(); + return GetAllProjectsCore(); + } + + [HttpGet] + public IAsyncEnumerable GetAllProjectsWithError() + => GetAllProjectsCore(true); + + public async IAsyncEnumerable GetAllProjectsCore(bool throwError = false) + { + await Task.Delay(5); + for (var i = 0; i < 10; i++) + { + if (throwError && i == 5) + { + throw new InvalidTimeZoneException(); + } + + yield return new Project + { + Id = i, + Name = $"Project{i}", + }; + } + } + } +} diff --git a/src/Mvc/test/WebSites/FormatterWebSite/Startup.cs b/src/Mvc/test/WebSites/FormatterWebSite/Startup.cs index ba036d9a08..ac3d04966f 100644 --- a/src/Mvc/test/WebSites/FormatterWebSite/Startup.cs +++ b/src/Mvc/test/WebSites/FormatterWebSite/Startup.cs @@ -26,6 +26,8 @@ namespace FormatterWebSite public void Configure(IApplicationBuilder app) { + app.UseDeveloperExceptionPage(); + app.UseRouting(); app.UseEndpoints(endpoints => { From 9016794111d725be590589b7f385cad6ba40a226 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Jun 2019 11:05:45 -0700 Subject: [PATCH 05/21] Fixup templates (#11351) * Fixup templates --- .../Pages/FetchData.razor | 2 +- ...roller.cs => WeatherForecastController.cs} | 21 +++++-- .../WebApi-FSharp.fsproj.in | 3 +- .../Services/GreeterService.cs | 7 ++- .../Data/WeatherForecastService.cs | 2 +- .../Pages/Error.cshtml.cs | 7 ++- .../Pages/Index.cshtml.cs | 7 ++- .../Pages/Privacy.cshtml.cs | 7 ++- .../Controllers/HomeController.cs | 9 +-- .../Controllers/HomeController.fs | 3 +- .../Controllers/WeatherController.cs | 51 ----------------- .../Controllers/WeatherForecastController.cs | 45 +++++++++++++++ .../content/WebApi-CSharp/WeatherForecast.cs | 15 +++++ .../Controllers/WeatherController.fs | 34 ----------- .../Controllers/WeatherForecastController.fs | 26 +++++++++ .../content/WebApi-FSharp/WeatherForecast.fs | 11 ++++ .../app/fetch-data/fetch-data.component.ts | 2 +- .../Controllers/SampleDataController.cs | 57 ------------------- .../Controllers/WeatherForecastController.cs | 45 +++++++++++++++ .../Angular-CSharp/Pages/Error.cshtml.cs | 7 ++- .../content/Angular-CSharp/WeatherForecast.cs | 15 +++++ .../ClientApp/src/components/FetchData.js | 4 +- .../OidcConfigurationController.cs | 6 +- .../Controllers/SampleDataController.cs | 57 ------------------- .../Controllers/WeatherForecastController.cs | 45 +++++++++++++++ .../React-CSharp/Pages/Error.cshtml.cs | 7 ++- .../content/React-CSharp/WeatherForecast.cs | 15 +++++ .../ClientApp/src/store/WeatherForecasts.ts | 2 +- .../Controllers/SampleDataController.cs | 51 ----------------- .../Controllers/WeatherForecastController.cs | 45 +++++++++++++++ .../ReactRedux-CSharp/WeatherForecast.cs | 15 +++++ .../test/WebApiTemplateTest.cs | 4 +- .../test/template-baselines.json | 24 +++++--- 33 files changed, 351 insertions(+), 300 deletions(-) rename src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/{SampleDataController.cs => WeatherForecastController.cs} (58%) delete mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherController.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/WeatherForecast.cs delete mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherController.fs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherForecastController.fs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/WeatherForecast.fs delete mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/SampleDataController.cs create mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/WeatherForecastController.cs create mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/WeatherForecast.cs delete mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/SampleDataController.cs create mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/WeatherForecastController.cs create mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/WeatherForecast.cs delete mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs create mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/WeatherForecastController.cs create mode 100644 src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/WeatherForecast.cs diff --git a/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Pages/FetchData.razor b/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Pages/FetchData.razor index 553979536a..ea1ba916c9 100644 --- a/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Pages/FetchData.razor +++ b/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Pages/FetchData.razor @@ -40,6 +40,6 @@ else protected override async Task OnInitAsync() { - forecasts = await Http.GetJsonAsync("api/SampleData/WeatherForecasts"); + forecasts = await Http.GetJsonAsync("weatherforecast"); } } diff --git a/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/SampleDataController.cs b/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/WeatherForecastController.cs similarity index 58% rename from src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/SampleDataController.cs rename to src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/WeatherForecastController.cs index 2a7d8a515c..93cb808582 100644 --- a/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/SampleDataController.cs +++ b/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/WeatherForecastController.cs @@ -7,16 +7,24 @@ using System.Threading.Tasks; namespace BlazorHosted_CSharp.Server.Controllers { - [Route("api/[controller]")] - public class SampleDataController : Controller + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase { - private static string[] Summaries = new[] + private static readonly string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; - [HttpGet("[action]")] - public IEnumerable WeatherForecasts() + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() { var rng = new Random(); return Enumerable.Range(1, 5).Select(index => new WeatherForecast @@ -24,7 +32,8 @@ namespace BlazorHosted_CSharp.Server.Controllers Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] - }); + }) + .ToArray(); } } } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-FSharp.fsproj.in b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-FSharp.fsproj.in index c6017dc6c8..714aa82b2e 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/WebApi-FSharp.fsproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/WebApi-FSharp.fsproj.in @@ -7,7 +7,8 @@ - + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Services/GreeterService.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Services/GreeterService.cs index b10d62ad78..da0169c658 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Services/GreeterService.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Services/GreeterService.cs @@ -9,11 +9,12 @@ namespace GrpcService_CSharp { public class GreeterService : Greeter.GreeterBase { - private readonly ILogger logger; - public GreeterService(ILogger _logger) + private readonly ILogger _logger; + public GreeterService(ILogger logger) { - logger = _logger; + _logger = logger; } + public override Task SayHello(HelloRequest request, ServerCallContext context) { return Task.FromResult(new HelloReply diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Data/WeatherForecastService.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Data/WeatherForecastService.cs index 1e27490eda..9d2bfa5f1d 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Data/WeatherForecastService.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Data/WeatherForecastService.cs @@ -6,7 +6,7 @@ namespace RazorComponentsWeb_CSharp.Data { public class WeatherForecastService { - private static string[] Summaries = new[] + private static readonly string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Error.cshtml.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Error.cshtml.cs index dc4b9b8028..302c5ce4a6 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Error.cshtml.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Error.cshtml.cs @@ -16,12 +16,13 @@ namespace Company.WebApplication1.Pages public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - private readonly ILogger logger; + private readonly ILogger _logger; - public ErrorModel(ILogger _logger) + public ErrorModel(ILogger logger) { - logger = _logger; + _logger = logger; } + public void OnGet() { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs index 293b9fa78b..6d6d56fe2a 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs @@ -10,12 +10,13 @@ namespace Company.WebApplication1.Pages { public class IndexModel : PageModel { - private readonly ILogger logger; + private readonly ILogger _logger; - public IndexModel(ILogger _logger) + public IndexModel(ILogger logger) { - logger = _logger; + _logger = logger; } + public void OnGet() { diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Privacy.cshtml.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Privacy.cshtml.cs index 6262f55647..9816502ea1 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Privacy.cshtml.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Privacy.cshtml.cs @@ -10,12 +10,13 @@ namespace Company.WebApplication1.Pages { public class PrivacyModel : PageModel { - private readonly ILogger logger; + private readonly ILogger _logger; - public PrivacyModel(ILogger _logger) + public PrivacyModel(ILogger logger) { - logger = _logger; + _logger = logger; } + public void OnGet() { } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs index e90b06bf1f..ff1e748995 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs @@ -7,8 +7,8 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; #endif using Microsoft.AspNetCore.Mvc; -using Company.WebApplication1.Models; using Microsoft.Extensions.Logging; +using Company.WebApplication1.Models; namespace Company.WebApplication1.Controllers { @@ -17,12 +17,13 @@ namespace Company.WebApplication1.Controllers #endif public class HomeController : Controller { - private readonly ILogger logger; + private readonly ILogger _logger; - public HomeController(ILogger _logger) + public HomeController(ILogger logger) { - logger = _logger; + _logger = logger; } + public IActionResult Index() { return View(); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Controllers/HomeController.fs b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Controllers/HomeController.fs index 2ee1330225..8f7da1f178 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Controllers/HomeController.fs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Controllers/HomeController.fs @@ -7,9 +7,8 @@ open System.Threading.Tasks open Microsoft.AspNetCore.Mvc open Microsoft.Extensions.Logging -type HomeController (_logger : ILogger) = +type HomeController (logger : ILogger) = inherit Controller() - let mutable logger = _logger member this.Index () = this.View() diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherController.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherController.cs deleted file mode 100644 index 05931f13ef..0000000000 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherController.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -#if (!NoAuth) -using Microsoft.AspNetCore.Authorization; -#endif -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; - -namespace Company.WebApplication1.Controllers -{ -#if (!NoAuth) - [Authorize] -#endif - - [Route("api/SampleData/[controller]")] - [ApiController] - public class WeatherController : ControllerBase - { - private readonly ILogger logger; - - public WeatherController(ILogger _logger) - { - logger = _logger; - } - [HttpGet] - public ActionResult GetWeatherForecasts(string location, TemperatureUnit unit) - { - var rng = new Random(); - return new WeatherResult - { - Location = location, - Temperature = rng.Next(-20, 55), - TemperatureUnit = unit - }; - } - } - - public enum TemperatureUnit - { - Celsius, - Fahrenheit - } - public class WeatherResult - { - public int Temperature { get; set; } - public TemperatureUnit TemperatureUnit { get; set; } - public string Location { get; set; } - } -} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000000..097eb58460 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +#if (!NoAuth) +using Microsoft.AspNetCore.Authorization; +#endif +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace Company.WebApplication1.Controllers +{ +#if (!NoAuth) + [Authorize] +#endif + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + var rng = new Random(); + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/WeatherForecast.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/WeatherForecast.cs new file mode 100644 index 0000000000..128b347369 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace Company.WebApplication1 +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherController.fs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherController.fs deleted file mode 100644 index 4b9629f24a..0000000000 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherController.fs +++ /dev/null @@ -1,34 +0,0 @@ -namespace WebApplication1.Controllers - -open System -open System.Collections.Generic -open System.Linq -open System.Threading.Tasks -open Microsoft.AspNetCore.Mvc -open Microsoft.Extensions.Logging - -type public TemperatureUnit = - | Celsius=0 - | Fahrenheit=1 - -type WeatherResult = { - Location: string - TemperatureUnit: TemperatureUnit - Temperature: int -} - -[] -[] -type WeatherController (_logger : ILogger) = - inherit ControllerBase() - let mutable logger = _logger - - [] - member this.Get(location:string, unit: TemperatureUnit) = - let rnd = System.Random() - let result:WeatherResult = { - Location = location; - Temperature = rnd.Next(-20,55); - TemperatureUnit = unit - } - ActionResult(result) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherForecastController.fs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherForecastController.fs new file mode 100644 index 0000000000..45c42e8e12 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Controllers/WeatherForecastController.fs @@ -0,0 +1,26 @@ +namespace Company.WebApplication1.Controllers + +open System +open System.Collections.Generic +open System.Linq +open System.Threading.Tasks +open Microsoft.AspNetCore.Mvc +open Microsoft.Extensions.Logging +open Company.WebApplication1 + +[] +[] +type WeatherForecastController (logger : ILogger) = + inherit ControllerBase() + + let summaries = [| "Freezing"; "Bracing"; "Chilly"; "Cool"; "Mild"; "Warm"; "Balmy"; "Hot"; "Sweltering"; "Scorching" |] + + [] + member __.Get() : WeatherForecast[] = + let rng = System.Random() + [| + for index in 0..4 -> + { Date = DateTime.Now.AddDays(float index) + TemperatureC = rng.Next(-20,55) + Summary = summaries.[rng.Next(summaries.Length)] } + |] diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/WeatherForecast.fs b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/WeatherForecast.fs new file mode 100644 index 0000000000..34e1d8e301 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/WeatherForecast.fs @@ -0,0 +1,11 @@ +namespace Company.WebApplication1 + +open System + +type WeatherForecast = + { Date: DateTime + TemperatureC: int + Summary: string } + + member this.TemperatureF = + 32 + (int (float this.TemperatureC / 0.5556)) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/fetch-data/fetch-data.component.ts b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/fetch-data/fetch-data.component.ts index c120befb86..992dba2618 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/fetch-data/fetch-data.component.ts +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/fetch-data/fetch-data.component.ts @@ -9,7 +9,7 @@ export class FetchDataComponent { public forecasts: WeatherForecast[]; constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) { - http.get(baseUrl + 'api/SampleData/WeatherForecasts').subscribe(result => { + http.get(baseUrl + 'weatherforecast').subscribe(result => { this.forecasts = result; }, error => console.error(error)); } diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/SampleDataController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/SampleDataController.cs deleted file mode 100644 index bf4e077dd2..0000000000 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/SampleDataController.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -#if (IndividualLocalAuth) -using Microsoft.AspNetCore.Authorization; -#endif -using Microsoft.Extensions.Logging; - -namespace Company.WebApplication1.Controllers -{ - #if (IndividualLocalAuth) - [Authorize] - #endif - [Route("api/[controller]")] - public class SampleDataController : Controller - { - private readonly ILogger logger; - - public SampleDataController(ILogger _logger) - { - logger = _logger; - } - private static string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - [HttpGet("[action]")] - public IEnumerable WeatherForecasts() - { - var rng = new Random(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - DateFormatted = DateTime.Now.AddDays(index).ToString("d"), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }); - } - - public class WeatherForecast - { - public string DateFormatted { get; set; } - public int TemperatureC { get; set; } - public string Summary { get; set; } - - public int TemperatureF - { - get - { - return 32 + (int)(TemperatureC / 0.5556); - } - } - } - } -} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/WeatherForecastController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000000..097eb58460 --- /dev/null +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/WeatherForecastController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +#if (!NoAuth) +using Microsoft.AspNetCore.Authorization; +#endif +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace Company.WebApplication1.Controllers +{ +#if (!NoAuth) + [Authorize] +#endif + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + var rng = new Random(); + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml.cs index 0b31293ed8..b31bc6addd 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml.cs @@ -12,12 +12,13 @@ namespace Company.WebApplication1.Pages [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public class ErrorModel : PageModel { - private readonly ILogger logger; + private readonly ILogger _logger; - public ErrorModel(ILogger _logger) + public ErrorModel(ILogger logger) { - logger = _logger; + _logger = logger; } + public string RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/WeatherForecast.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/WeatherForecast.cs new file mode 100644 index 0000000000..128b347369 --- /dev/null +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace Company.WebApplication1 +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/FetchData.js b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/FetchData.js index be9cbe4ede..3e3a1f3c21 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/FetchData.js +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/FetchData.js @@ -57,13 +57,13 @@ export class FetchData extends Component { async populateWeatherData() { ////#if (IndividualLocalAuth) const token = await authService.getAccessToken(); - const response = await fetch('api/SampleData/WeatherForecasts', { + const response = await fetch('weatherforecast', { headers: !token ? {} : { 'Authorization': `Bearer ${token}` } }); const data = await response.json(); this.setState({ forecasts: data, loading: false }); ////#else - const response = await fetch('api/SampleData/WeatherForecasts'); + const response = await fetch('weatherforecast'); const data = await response.json(); this.setState({ forecasts: data, loading: false }); ////#endif diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs index 75e26da4e9..cdcc89182a 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs @@ -6,12 +6,12 @@ namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { - private readonly ILogger logger; + private readonly ILogger _logger; - public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger _logger) + public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger logger) { ClientRequestParametersProvider = clientRequestParametersProvider; - logger = _logger; + _logger = logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/SampleDataController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/SampleDataController.cs deleted file mode 100644 index a4f2e22d56..0000000000 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/SampleDataController.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -#if (IndividualLocalAuth) -using Microsoft.AspNetCore.Authorization; -#endif -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; - -namespace Company.WebApplication1.Controllers -{ -#if (IndividualLocalAuth) - [Authorize] -#endif - [Route("api/[controller]")] - public class SampleDataController : Controller - { - private readonly ILogger logger; - - public SampleDataController(ILogger _logger) - { - logger = _logger; - } - private static string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - [HttpGet("[action]")] - public IEnumerable WeatherForecasts() - { - var rng = new Random(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - DateFormatted = DateTime.Now.AddDays(index).ToString("d"), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }); - } - - public class WeatherForecast - { - public string DateFormatted { get; set; } - public int TemperatureC { get; set; } - public string Summary { get; set; } - - public int TemperatureF - { - get - { - return 32 + (int)(TemperatureC / 0.5556); - } - } - } - } -} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/WeatherForecastController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000000..097eb58460 --- /dev/null +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/WeatherForecastController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +#if (!NoAuth) +using Microsoft.AspNetCore.Authorization; +#endif +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace Company.WebApplication1.Controllers +{ +#if (!NoAuth) + [Authorize] +#endif + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + var rng = new Random(); + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs index 0b31293ed8..b31bc6addd 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs @@ -12,12 +12,13 @@ namespace Company.WebApplication1.Pages [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public class ErrorModel : PageModel { - private readonly ILogger logger; + private readonly ILogger _logger; - public ErrorModel(ILogger _logger) + public ErrorModel(ILogger logger) { - logger = _logger; + _logger = logger; } + public string RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/WeatherForecast.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/WeatherForecast.cs new file mode 100644 index 0000000000..128b347369 --- /dev/null +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace Company.WebApplication1 +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/WeatherForecasts.ts b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/WeatherForecasts.ts index e43f996075..97e53ff86f 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/WeatherForecasts.ts +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/WeatherForecasts.ts @@ -45,7 +45,7 @@ export const actionCreators = { // Only load data if it's something we don't already have (and are not already loading) const appState = getState(); if (appState && appState.weatherForecasts && startDateIndex !== appState.weatherForecasts.startDateIndex) { - fetch(`api/SampleData/WeatherForecasts?startDateIndex=${startDateIndex}`) + fetch(`weatherforecast`) .then(response => response.json() as Promise) .then(data => { dispatch({ type: 'RECEIVE_WEATHER_FORECASTS', startDateIndex: startDateIndex, forecasts: data }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs deleted file mode 100644 index 3b182badaf..0000000000 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; - -namespace Company.WebApplication1.Controllers -{ - [Route("api/[controller]")] - public class SampleDataController : Controller - { - private readonly ILogger logger; - - public SampleDataController(ILogger _logger) - { - logger = _logger; - } - private static string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - [HttpGet("[action]")] - public IEnumerable WeatherForecasts(int startDateIndex) - { - var rng = new Random(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - DateFormatted = DateTime.Now.AddDays(index + startDateIndex).ToString("d"), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }); - } - - public class WeatherForecast - { - public string DateFormatted { get; set; } - public int TemperatureC { get; set; } - public string Summary { get; set; } - - public int TemperatureF - { - get - { - return 32 + (int)(TemperatureC / 0.5556); - } - } - } - } -} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/WeatherForecastController.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000000..097eb58460 --- /dev/null +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/WeatherForecastController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +#if (!NoAuth) +using Microsoft.AspNetCore.Authorization; +#endif +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace Company.WebApplication1.Controllers +{ +#if (!NoAuth) + [Authorize] +#endif + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + var rng = new Random(); + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/WeatherForecast.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/WeatherForecast.cs new file mode 100644 index 0000000000..128b347369 --- /dev/null +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace Company.WebApplication1 +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } + } +} diff --git a/src/ProjectTemplates/test/WebApiTemplateTest.cs b/src/ProjectTemplates/test/WebApiTemplateTest.cs index 5f21ac7b2c..4a761a4214 100644 --- a/src/ProjectTemplates/test/WebApiTemplateTest.cs +++ b/src/ProjectTemplates/test/WebApiTemplateTest.cs @@ -48,7 +48,7 @@ namespace Templates.Test aspNetProcess.Process.HasExited, ErrorMessages.GetFailedProcessMessageOrEmpty("Run built project", Project, aspNetProcess.Process)); - await aspNetProcess.AssertOk("/api/SampleData/Weather"); + await aspNetProcess.AssertOk("weatherforecast"); await aspNetProcess.AssertNotFound("/"); } @@ -59,7 +59,7 @@ namespace Templates.Test ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", Project, aspNetProcess.Process)); - await aspNetProcess.AssertOk("/api/SampleData/Weather"); + await aspNetProcess.AssertOk("weatherforecast"); await aspNetProcess.AssertNotFound("/"); } } diff --git a/src/ProjectTemplates/test/template-baselines.json b/src/ProjectTemplates/test/template-baselines.json index 565cbecd16..5d610cc2f5 100644 --- a/src/ProjectTemplates/test/template-baselines.json +++ b/src/ProjectTemplates/test/template-baselines.json @@ -398,7 +398,8 @@ "appsettings.json", "Program.cs", "Startup.cs", - "Controllers/WeatherController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Properties/launchSettings.json" ], "AuthOption": "IndividualB2C" @@ -411,7 +412,8 @@ "appsettings.json", "Program.cs", "Startup.cs", - "Controllers/WeatherController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Properties/launchSettings.json" ], "AuthOption": "SingleOrg" @@ -424,7 +426,8 @@ "appsettings.json", "Program.cs", "Startup.cs", - "Controllers/WeatherController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Properties/launchSettings.json" ], "AuthOption": "None" @@ -437,7 +440,8 @@ "appsettings.json", "Program.cs", "Startup.cs", - "Controllers/WeatherController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Properties/launchSettings.json" ], "AuthOption": "Windows" @@ -450,7 +454,8 @@ "appsettings.json", "Program.fs", "Startup.fs", - "Controllers/WeatherController.fs", + "WeatherForecast.fs", + "Controllers/WeatherForecastController.fs", "Properties/launchSettings.json" ] } @@ -1157,7 +1162,8 @@ "ClientApp/README.md", "ClientApp/tsconfig.json", "ClientApp/tslint.json", - "Controllers/SampleDataController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Pages/_ViewImports.cshtml", "Pages/Error.cshtml", "Pages/Error.cshtml.cs", @@ -1194,7 +1200,8 @@ "ClientApp/package-lock.json", "ClientApp/package.json", "ClientApp/README.md", - "Controllers/SampleDataController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Pages/_ViewImports.cshtml", "Pages/Error.cshtml", "Pages/Error.cshtml.cs", @@ -1236,7 +1243,8 @@ "ClientApp/package.json", "ClientApp/README.md", "ClientApp/tsconfig.json", - "Controllers/SampleDataController.cs", + "WeatherForecast.cs", + "Controllers/WeatherForecastController.cs", "Pages/_ViewImports.cshtml", "Pages/Error.cshtml", "Pages/Error.cshtml.cs", From ea385e20aa051d080aec21a69c797e9ecac55964 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Tue, 25 Jun 2019 11:56:40 -0700 Subject: [PATCH 06/21] Use a mutex to guard cert creation on windows (#11546) - It should prevent some test flakyness around importing certs in some cases. --- .../Kestrel/shared/test/TestResources.cs | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/Servers/Kestrel/shared/test/TestResources.cs b/src/Servers/Kestrel/shared/test/TestResources.cs index 626922afc1..d335617c7d 100644 --- a/src/Servers/Kestrel/shared/test/TestResources.cs +++ b/src/Servers/Kestrel/shared/test/TestResources.cs @@ -1,8 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.IO; +using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; +using System.Threading; +using Xunit; namespace Microsoft.AspNetCore.Testing { @@ -13,14 +17,28 @@ namespace Microsoft.AspNetCore.Testing public static string TestCertificatePath { get; } = Path.Combine(_baseDir, "testCert.pfx"); public static string GetCertPath(string name) => Path.Combine(_baseDir, name); - public static X509Certificate2 GetTestCertificate() - { - return new X509Certificate2(TestCertificatePath, "testPassword"); - } + private const int MutexTimeout = 120 * 1000; + private static readonly Mutex importPfxMutex = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? + new Mutex(initiallyOwned: false, "Global\\KestrelTests.Certificates.LoadPfxCertificate") : + null; - public static X509Certificate2 GetTestCertificate(string certName) + public static X509Certificate2 GetTestCertificate(string certName = "testCert.pfx") { - return new X509Certificate2(GetCertPath(certName), "testPassword"); + // On Windows, applications should not import PFX files in parallel to avoid a known system-level + // race condition bug in native code which can cause crashes/corruption of the certificate state. + if (importPfxMutex != null) + { + Assert.True(importPfxMutex.WaitOne(MutexTimeout), "Cannot acquire the global certificate mutex."); + } + + try + { + return new X509Certificate2(GetCertPath(certName), "testPassword"); + } + finally + { + importPfxMutex?.ReleaseMutex(); + } } } } From cc1f23c5f8afb7d2a00405f19811d2372c4fcec2 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 25 Jun 2019 13:23:20 -0700 Subject: [PATCH 07/21] Make Middleware internal and remove internal namespaces (#11538) --- .../{Internal => }/CORSLoggerExtensions.cs | 2 +- .../CORS/src/Infrastructure/CorsMiddleware.cs | 1 - .../CORS/src/Infrastructure/CorsService.cs | 1 - .../src/DatabaseErrorPageMiddleware.cs | 1 - ...ticsEntityFrameworkCoreLoggerExtensions.cs | 2 +- .../src/MigrationsEndPointMiddleware.cs | 1 - .../DeveloperExceptionPageMiddleware.cs | 1 - .../DiagnosticsLoggerExtensions.cs | 2 +- .../ExceptionHandlerMiddleware.cs | 1 - .../{internal => }/HstsLoggingExtensions.cs | 2 +- .../HttpsPolicy/src/HstsMiddleware.cs | 1 - .../{internal => }/HttpsLoggingExtensions.cs | 2 +- .../src/HttpsRedirectionMiddleware.cs | 1 - .../RequestCultureProviderLoggerExtensions.cs | 2 +- .../src/RequestLocalizationMiddleware.cs | 1 - .../CacheEntry/CacheEntryHelpers.cs | 2 +- .../CacheEntry/CachedResponse.cs | 2 +- .../CacheEntry/CachedVaryByRules.cs | 2 +- .../src/{Internal => }/FastGuid.cs | 2 +- .../Interfaces/IResponseCache.cs | 2 +- .../Interfaces/IResponseCacheEntry.cs | 2 +- .../Interfaces/IResponseCachingKeyProvider.cs | 2 +- .../IResponseCachingPolicyProvider.cs | 2 +- .../{Internal => }/Interfaces/ISystemClock.cs | 2 +- .../src/{Internal => }/LoggerExtensions.cs | 2 +- .../{Internal => }/MemoryCachedResponse.cs | 2 +- .../src/{Internal => }/MemoryResponseCache.cs | 2 +- .../{Internal => }/ResponseCachingContext.cs | 2 +- .../ResponseCachingKeyProvider.cs | 2 +- .../src/ResponseCachingMiddleware.cs | 1 - .../src/ResponseCachingOptions.cs | 1 - .../ResponseCachingPolicyProvider.cs | 2 +- .../src/ResponseCachingServicesExtensions.cs | 1 - .../{Internal => }/SendFileFeatureWrapper.cs | 2 +- .../src/Streams/ResponseCachingStream.cs | 2 +- .../src/Streams/SegmentReadStream.cs | 2 +- .../src/Streams/SegmentWriteStream.cs | 2 +- .../src/Streams/StreamUtilities.cs | 2 +- .../{Internal => }/StringBuilderExtensions.cs | 2 +- .../src/{Internal => }/SystemClock.cs | 2 +- .../test/ResponseCachingKeyProviderTests.cs | 1 - .../test/ResponseCachingMiddlewareTests.cs | 1 - .../ResponseCachingPolicyProviderTests.cs | 1 - .../test/SegmentReadStreamTests.cs | 1 - .../test/SegmentWriteStreamTests.cs | 1 - .../ResponseCaching/test/TestUtils.cs | 3 +- .../ResponseCompressionLoggingExtensions.cs | 2 +- .../src/ResponseCompressionProvider.cs | 1 - ...rosoft.AspNetCore.Rewrite.netcoreapp3.0.cs | 639 ------------------ .../ApacheModRewrite/ApacheModRewriteRule.cs | 4 +- .../ApacheModRewrite/Condition.cs | 4 +- .../ApacheModRewrite/ConditionEvaluator.cs | 4 +- .../ConditionPatternParser.cs | 4 +- .../ApacheModRewrite/ConditionType.cs | 4 +- .../ApacheModRewrite/CookieActionFactory.cs | 6 +- .../ApacheModRewrite/FileParser.cs | 4 +- .../ApacheModRewrite/FlagParser.cs | 4 +- .../ApacheModRewrite/FlagType.cs | 4 +- .../{Internal => }/ApacheModRewrite/Flags.cs | 4 +- .../ApacheModRewrite/OperationType.cs | 4 +- .../ParsedModRewriteCondition.cs | 4 +- .../ApacheModRewrite/RuleBuilder.cs | 8 +- .../ApacheModRewrite/RuleRegexParser.cs | 4 +- .../ApacheModRewrite/SegmentType.cs | 4 +- .../ApacheModRewrite/ServerVariables.cs | 6 +- .../ApacheModRewrite/TestStringParser.cs | 6 +- .../ApacheModRewrite/Tokenizer.cs | 4 +- .../src/ApacheModRewriteOptionsExtensions.cs | 2 +- .../{Internal => }/BackReferenceCollection.cs | 4 +- .../src/{Internal => }/DelegateRule.cs | 4 +- .../IISUrlRewrite/ActionType.cs | 4 +- .../{Internal => }/IISUrlRewrite/Condition.cs | 4 +- .../IISUrlRewrite/ConditionCollection.cs | 4 +- .../IISUrlRewrite/ConditionEvaluator.cs | 4 +- .../IISUrlRewrite/IISRewriteMap.cs | 4 +- .../IISUrlRewrite/IISRewriteMapCollection.cs | 4 +- .../IISUrlRewrite/IISUrlRewriteRule.cs | 4 +- .../IISUrlRewrite/InputParser.cs | 6 +- .../InvalidUrlRewriteFormatException.cs | 4 +- .../IISUrlRewrite/LogicalGrouping.cs | 4 +- .../{Internal => }/IISUrlRewrite/MatchType.cs | 4 +- .../IISUrlRewrite/PatternSyntax.cs | 4 +- .../IISUrlRewrite/RedirectType.cs | 4 +- .../IISUrlRewrite/RewriteMapParser.cs | 4 +- .../IISUrlRewrite/RewriteTags.cs | 4 +- .../IISUrlRewrite/ServerVariables.cs | 6 +- .../IISUrlRewrite/UriMatchCondition.cs | 6 +- .../IISUrlRewrite/UriMatchPart.cs | 4 +- .../IISUrlRewrite/UrlRewriteFileParser.cs | 8 +- .../IISUrlRewrite/UrlRewriteRuleBuilder.cs | 6 +- .../src/IISUrlRewriteOptionsExtensions.cs | 2 +- .../src/{Internal => }/MatchResults.cs | 4 +- .../src/{Internal => }/ParserContext.cs | 4 +- .../Rewrite/src/{Internal => }/Pattern.cs | 4 +- .../src/{Internal => }/PatternSegment.cs | 4 +- .../PatternSegments/ConditionMatchSegment.cs | 4 +- .../PatternSegments/DateTimeSegment.cs | 4 +- .../PatternSegments/HeaderSegment.cs | 4 +- .../IISServerVariableSegment.cs | 2 +- .../PatternSegments/IsHttpsModSegment.cs | 4 +- .../PatternSegments/IsHttpsUrlSegment.cs | 4 +- .../PatternSegments/IsIPV6Segment.cs | 5 +- .../PatternSegments/LiteralSegment.cs | 4 +- .../PatternSegments/LocalAddressSegment.cs | 4 +- .../PatternSegments/LocalPortSegment.cs | 4 +- .../PatternSegments/QueryStringSegment.cs | 4 +- .../PatternSegments/RemoteAddressSegment.cs | 4 +- .../PatternSegments/RemotePortSegment.cs | 4 +- .../PatternSegments/RequestFilenameSegment.cs | 4 +- .../PatternSegments/RequestMethodSegment.cs | 4 +- .../PatternSegments/RewriteMapSegment.cs | 6 +- .../PatternSegments/RuleMatchSegment.cs | 4 +- .../PatternSegments/SchemeSegment.cs | 4 +- .../PatternSegments/ServerProtocolSegment.cs | 4 +- .../PatternSegments/ToLowerSegment.cs | 4 +- .../PatternSegments/UrlEncodeSegment.cs | 4 +- .../PatternSegments/UrlSegment.cs | 6 +- .../src/{Internal => }/RedirectRule.cs | 4 +- .../src/{Internal => }/RedirectToHttpsRule.cs | 4 +- .../src/{Internal => }/RedirectToWwwRule.cs | 4 +- .../Rewrite/src/RewriteOptionsExtensions.cs | 1 - .../Rewrite/src/{Internal => }/RewriteRule.cs | 4 +- .../Rewrite/src/{Internal => }/UrlAction.cs | 4 +- .../{Internal => }/UrlActions/AbortAction.cs | 4 +- .../UrlActions/ChangeCookieAction.cs | 4 +- .../UrlActions/CustomResponseAction.cs | 4 +- .../UrlActions/ForbiddenAction.cs | 4 +- .../{Internal => }/UrlActions/GoneAction.cs | 4 +- .../{Internal => }/UrlActions/NoneAction.cs | 4 +- .../UrlActions/RedirectAction.cs | 4 +- .../UrlActions/RewriteAction.cs | 4 +- .../Rewrite/src/{Internal => }/UrlMatch.cs | 4 +- .../{Internal => }/UrlMatches/ExactMatch.cs | 4 +- .../UrlMatches/FileSizeMatch.cs | 4 +- .../{Internal => }/UrlMatches/IntegerMatch.cs | 4 +- .../UrlMatches/IntegerOperation.cs | 4 +- .../UrlMatches/IsDirectoryMatch.cs | 4 +- .../{Internal => }/UrlMatches/IsFileMatch.cs | 4 +- .../{Internal => }/UrlMatches/RegexMatch.cs | 4 +- .../{Internal => }/UrlMatches/StringMatch.cs | 4 +- .../UrlMatches/StringOperation.cs | 4 +- .../ConditionPatternParserTest.cs | 76 +-- .../CookieActionFactoryTest.cs | 2 +- .../test/ApacheModRewrite/FlagParserTest.cs | 2 +- .../ApacheModRewrite/FormatExceptionTests.cs | 2 +- .../ApacheModRewrite/RewriteTokenizerTest.cs | 2 +- .../test/ApacheModRewrite/RuleBuilderTest.cs | 5 +- .../ApacheModRewrite/RuleRegexParserTest.cs | 2 +- .../ApacheModRewrite/TestStringParserTests.cs | 5 +- .../test/IISUrlRewrite/FileParserTests.cs | 7 +- .../FormatExceptionHandlingTests.cs | 2 +- .../test/IISUrlRewrite/InputParserTests.cs | 5 +- ...dUrlRewriteFormatExceptionHandlingTests.cs | 2 +- .../test/IISUrlRewrite/MiddleWareTests.cs | 17 +- .../IISUrlRewrite/RewriteMapParserTests.cs | 2 +- .../test/IISUrlRewrite/ServerVariableTests.cs | 106 +-- .../UrlRewriteApplicationTests.cs | 2 +- .../ConditionMatchSegmentTests.cs | 3 +- .../PatternSegments/DateTimeSegmentTests.cs | 2 +- .../PatternSegments/HeaderSegmentTests.cs | 2 +- .../PatternSegments/IsHttpsModSegmentTests.cs | 2 +- .../PatternSegments/IsHttpsSegmentTests.cs | 2 +- .../PatternSegments/IsIPV6SegmentTests.cs | 2 +- .../PatternSegments/LIteralSegmentTests.cs | 2 +- .../LocalAddressSegmentTests.cs | 2 +- .../PatternSegments/LocalPortSegmentTests.cs | 2 +- .../QueryStringSegmentTests.cs | 2 +- .../RemoteAddressSegmentTests.cs | 2 +- .../PatternSegments/RemotePortSegmentTests.cs | 2 +- .../RequestFilenameSegmentTests.cs | 2 +- .../RequestMethodSegmentTests.cs | 2 +- .../PatternSegments/RuleMatchSegmentTests.cs | 3 +- .../PatternSegments/SchemeSegmentTests.cs | 2 +- .../ServerProtocolSegmentTests.cs | 2 +- .../PatternSegments/ToLowerSegmentTests.cs | 3 +- .../PatternSegments/UrlEncodeSegmentTests.cs | 3 +- .../test/PatternSegments/UrlSegmentTests.cs | 32 +- .../test/UrlActions/AbortActionTests.cs | 2 +- .../UrlActions/ChangeCookieActionTests.cs | 2 +- .../test/UrlActions/ForbiddenActionTests.cs | 2 +- .../test/UrlActions/GoneActionTests.cs | 2 +- .../test/UrlMatches/ExactMatchTests.cs | 5 +- .../test/UrlMatches/IntegerMatchTests.cs | 27 +- .../test/UrlMatches/StringMatchTests.cs | 24 +- .../src/{Internal => }/Constants.cs | 2 +- .../src/{Internal => }/HandshakeHelpers.cs | 2 +- .../WebSockets/src/WebSocketMiddleware.cs | 1 - .../UnitTests/WebSocketMiddlewareTests.cs | 1 - .../test/UnitTests/WebSocketPair.cs | 1 - 189 files changed, 407 insertions(+), 1081 deletions(-) rename src/Middleware/CORS/src/{Internal => }/CORSLoggerExtensions.cs (99%) rename src/Middleware/Diagnostics.EntityFrameworkCore/src/{Internal => }/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs (99%) rename src/Middleware/Diagnostics/src/{Internal => }/DiagnosticsLoggerExtensions.cs (97%) rename src/Middleware/HttpsPolicy/src/{internal => }/HstsLoggingExtensions.cs (96%) rename src/Middleware/HttpsPolicy/src/{internal => }/HttpsLoggingExtensions.cs (98%) rename src/Middleware/Localization/src/{Internal => }/RequestCultureProviderLoggerExtensions.cs (96%) rename src/Middleware/ResponseCaching/src/{Internal => }/CacheEntry/CacheEntryHelpers.cs (97%) rename src/Middleware/ResponseCaching/src/{Internal => }/CacheEntry/CachedResponse.cs (89%) rename src/Middleware/ResponseCaching/src/{Internal => }/CacheEntry/CachedVaryByRules.cs (88%) rename src/Middleware/ResponseCaching/src/{Internal => }/FastGuid.cs (97%) rename src/Middleware/ResponseCaching/src/{Internal => }/Interfaces/IResponseCache.cs (97%) rename src/Middleware/ResponseCaching/src/{Internal => }/Interfaces/IResponseCacheEntry.cs (80%) rename src/Middleware/ResponseCaching/src/{Internal => }/Interfaces/IResponseCachingKeyProvider.cs (95%) rename src/Middleware/ResponseCaching/src/{Internal => }/Interfaces/IResponseCachingPolicyProvider.cs (97%) rename src/Middleware/ResponseCaching/src/{Internal => }/Interfaces/ISystemClock.cs (89%) rename src/Middleware/ResponseCaching/src/{Internal => }/LoggerExtensions.cs (99%) rename src/Middleware/ResponseCaching/src/{Internal => }/MemoryCachedResponse.cs (91%) rename src/Middleware/ResponseCaching/src/{Internal => }/MemoryResponseCache.cs (98%) rename src/Middleware/ResponseCaching/src/{Internal => }/ResponseCachingContext.cs (98%) rename src/Middleware/ResponseCaching/src/{Internal => }/ResponseCachingKeyProvider.cs (99%) rename src/Middleware/ResponseCaching/src/{Internal => }/ResponseCachingPolicyProvider.cs (99%) rename src/Middleware/ResponseCaching/src/{Internal => }/SendFileFeatureWrapper.cs (95%) rename src/Middleware/ResponseCaching/src/{Internal => }/StringBuilderExtensions.cs (92%) rename src/Middleware/ResponseCaching/src/{Internal => }/SystemClock.cs (89%) rename src/Middleware/ResponseCompression/src/{internal => }/ResponseCompressionLoggingExtensions.cs (98%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/ApacheModRewriteRule.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/Condition.cs (87%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/ConditionEvaluator.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/ConditionPatternParser.cs (99%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/ConditionType.cs (73%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/CookieActionFactory.cs (96%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/FileParser.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/FlagParser.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/FlagType.cs (86%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/Flags.cs (95%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/OperationType.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/ParsedModRewriteCondition.cs (87%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/RuleBuilder.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/RuleRegexParser.cs (88%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/SegmentType.cs (75%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/ServerVariables.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/TestStringParser.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/ApacheModRewrite/Tokenizer.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/BackReferenceCollection.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/DelegateRule.cs (84%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/ActionType.cs (75%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/Condition.cs (87%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/ConditionCollection.cs (93%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/ConditionEvaluator.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/IISRewriteMap.cs (92%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/IISRewriteMapCollection.cs (89%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/IISUrlRewriteRule.cs (95%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/InputParser.cs (98%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/InvalidUrlRewriteFormatException.cs (89%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/LogicalGrouping.cs (70%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/MatchType.cs (73%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/PatternSyntax.cs (72%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/RedirectType.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/RewriteMapParser.cs (92%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/RewriteTags.cs (95%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/ServerVariables.cs (96%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/UriMatchCondition.cs (84%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/UriMatchPart.cs (69%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/UrlRewriteFileParser.cs (98%) rename src/Middleware/Rewrite/src/{Internal => }/IISUrlRewrite/UrlRewriteRuleBuilder.cs (95%) rename src/Middleware/Rewrite/src/{Internal => }/MatchResults.cs (87%) rename src/Middleware/Rewrite/src/{Internal => }/ParserContext.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/Pattern.cs (92%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegment.cs (79%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/ConditionMatchSegment.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/DateTimeSegment.cs (96%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/HeaderSegment.cs (83%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/IISServerVariableSegment.cs (93%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/IsHttpsModSegment.cs (83%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/IsHttpsUrlSegment.cs (83%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/IsIPV6Segment.cs (85%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/LiteralSegment.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/LocalAddressSegment.cs (78%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/LocalPortSegment.cs (81%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/QueryStringSegment.cs (83%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/RemoteAddressSegment.cs (78%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/RemotePortSegment.cs (80%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/RequestFilenameSegment.cs (77%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/RequestMethodSegment.cs (77%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/RewriteMapSegment.cs (81%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/RuleMatchSegment.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/SchemeSegment.cs (78%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/ServerProtocolSegment.cs (80%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/ToLowerSegment.cs (89%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/UrlEncodeSegment.cs (90%) rename src/Middleware/Rewrite/src/{Internal => }/PatternSegments/UrlSegment.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/RedirectRule.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/RedirectToHttpsRule.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/RedirectToWwwRule.cs (96%) rename src/Middleware/Rewrite/src/{Internal => }/RewriteRule.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/UrlAction.cs (82%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/AbortAction.cs (86%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/ChangeCookieAction.cs (95%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/CustomResponseAction.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/ForbiddenAction.cs (83%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/GoneAction.cs (84%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/NoneAction.cs (85%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/RedirectAction.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/UrlActions/RewriteAction.cs (97%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatch.cs (79%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/ExactMatch.cs (90%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/FileSizeMatch.cs (84%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/IntegerMatch.cs (95%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/IntegerOperation.cs (75%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/IsDirectoryMatch.cs (83%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/IsFileMatch.cs (84%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/RegexMatch.cs (87%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/StringMatch.cs (94%) rename src/Middleware/Rewrite/src/{Internal => }/UrlMatches/StringOperation.cs (74%) rename src/Middleware/WebSockets/src/{Internal => }/Constants.cs (90%) rename src/Middleware/WebSockets/src/{Internal => }/HandshakeHelpers.cs (98%) diff --git a/src/Middleware/CORS/src/Internal/CORSLoggerExtensions.cs b/src/Middleware/CORS/src/CORSLoggerExtensions.cs similarity index 99% rename from src/Middleware/CORS/src/Internal/CORSLoggerExtensions.cs rename to src/Middleware/CORS/src/CORSLoggerExtensions.cs index 58886c37c9..4a4313e92d 100644 --- a/src/Middleware/CORS/src/Internal/CORSLoggerExtensions.cs +++ b/src/Middleware/CORS/src/CORSLoggerExtensions.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.Cors.Internal +namespace Microsoft.AspNetCore.Cors { internal static class CORSLoggerExtensions { diff --git a/src/Middleware/CORS/src/Infrastructure/CorsMiddleware.cs b/src/Middleware/CORS/src/Infrastructure/CorsMiddleware.cs index d376370cc6..ed3f743dfc 100644 --- a/src/Middleware/CORS/src/Infrastructure/CorsMiddleware.cs +++ b/src/Middleware/CORS/src/Infrastructure/CorsMiddleware.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNetCore.Cors.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; diff --git a/src/Middleware/CORS/src/Infrastructure/CorsService.cs b/src/Middleware/CORS/src/Infrastructure/CorsService.cs index 26c3bb042b..7552d81574 100644 --- a/src/Middleware/CORS/src/Infrastructure/CorsService.cs +++ b/src/Middleware/CORS/src/Infrastructure/CorsService.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using Microsoft.AspNetCore.Cors.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs b/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs index 0183f402d3..26db9dcb22 100644 --- a/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs +++ b/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Internal; using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Views; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; diff --git a/src/Middleware/Diagnostics.EntityFrameworkCore/src/Internal/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs b/src/Middleware/Diagnostics.EntityFrameworkCore/src/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs similarity index 99% rename from src/Middleware/Diagnostics.EntityFrameworkCore/src/Internal/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs rename to src/Middleware/Diagnostics.EntityFrameworkCore/src/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs index d7696a5bab..8128ac1baf 100644 --- a/src/Middleware/Diagnostics.EntityFrameworkCore/src/Internal/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs +++ b/src/Middleware/Diagnostics.EntityFrameworkCore/src/DiagnosticsEntityFrameworkCoreLoggerExtensions.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Internal +namespace Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore { internal static class DiagnosticsEntityFrameworkCoreLoggerExtensions { diff --git a/src/Middleware/Diagnostics.EntityFrameworkCore/src/MigrationsEndPointMiddleware.cs b/src/Middleware/Diagnostics.EntityFrameworkCore/src/MigrationsEndPointMiddleware.cs index 4562bf4218..0a37bf7f3e 100644 --- a/src/Middleware/Diagnostics.EntityFrameworkCore/src/MigrationsEndPointMiddleware.cs +++ b/src/Middleware/Diagnostics.EntityFrameworkCore/src/MigrationsEndPointMiddleware.cs @@ -5,7 +5,6 @@ using System; using System.Net; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Internal; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; diff --git a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs index 437bad32f4..c503194d6c 100644 --- a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs +++ b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddleware.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Diagnostics.Internal; using Microsoft.AspNetCore.Diagnostics.RazorViews; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; diff --git a/src/Middleware/Diagnostics/src/Internal/DiagnosticsLoggerExtensions.cs b/src/Middleware/Diagnostics/src/DiagnosticsLoggerExtensions.cs similarity index 97% rename from src/Middleware/Diagnostics/src/Internal/DiagnosticsLoggerExtensions.cs rename to src/Middleware/Diagnostics/src/DiagnosticsLoggerExtensions.cs index 347cc622b1..995bbc6786 100644 --- a/src/Middleware/Diagnostics/src/Internal/DiagnosticsLoggerExtensions.cs +++ b/src/Middleware/Diagnostics/src/DiagnosticsLoggerExtensions.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.Diagnostics.Internal +namespace Microsoft.AspNetCore.Diagnostics { internal static class DiagnosticsLoggerExtensions { diff --git a/src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerMiddleware.cs b/src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerMiddleware.cs index e7c324f8bb..eece3f0135 100644 --- a/src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerMiddleware.cs +++ b/src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerMiddleware.cs @@ -6,7 +6,6 @@ using System.Diagnostics; using System.Runtime.ExceptionServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Diagnostics.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Middleware/HttpsPolicy/src/internal/HstsLoggingExtensions.cs b/src/Middleware/HttpsPolicy/src/HstsLoggingExtensions.cs similarity index 96% rename from src/Middleware/HttpsPolicy/src/internal/HstsLoggingExtensions.cs rename to src/Middleware/HttpsPolicy/src/HstsLoggingExtensions.cs index b9e495db56..82bf87c173 100644 --- a/src/Middleware/HttpsPolicy/src/internal/HstsLoggingExtensions.cs +++ b/src/Middleware/HttpsPolicy/src/HstsLoggingExtensions.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.HttpsPolicy.Internal +namespace Microsoft.AspNetCore.HttpsPolicy { internal static class HstsLoggingExtensions { diff --git a/src/Middleware/HttpsPolicy/src/HstsMiddleware.cs b/src/Middleware/HttpsPolicy/src/HstsMiddleware.cs index d192785064..80f92a6443 100644 --- a/src/Middleware/HttpsPolicy/src/HstsMiddleware.cs +++ b/src/Middleware/HttpsPolicy/src/HstsMiddleware.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.HttpsPolicy.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; diff --git a/src/Middleware/HttpsPolicy/src/internal/HttpsLoggingExtensions.cs b/src/Middleware/HttpsPolicy/src/HttpsLoggingExtensions.cs similarity index 98% rename from src/Middleware/HttpsPolicy/src/internal/HttpsLoggingExtensions.cs rename to src/Middleware/HttpsPolicy/src/HttpsLoggingExtensions.cs index 4bbf6b1904..cc71022f68 100644 --- a/src/Middleware/HttpsPolicy/src/internal/HttpsLoggingExtensions.cs +++ b/src/Middleware/HttpsPolicy/src/HttpsLoggingExtensions.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.HttpsPolicy.Internal +namespace Microsoft.AspNetCore.HttpsPolicy { internal static class HttpsLoggingExtensions { diff --git a/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs b/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs index 72b63f578f..1e860a0e87 100644 --- a/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs +++ b/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; -using Microsoft.AspNetCore.HttpsPolicy.Internal; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Middleware/Localization/src/Internal/RequestCultureProviderLoggerExtensions.cs b/src/Middleware/Localization/src/RequestCultureProviderLoggerExtensions.cs similarity index 96% rename from src/Middleware/Localization/src/Internal/RequestCultureProviderLoggerExtensions.cs rename to src/Middleware/Localization/src/RequestCultureProviderLoggerExtensions.cs index c8583ce486..a35d8ede63 100644 --- a/src/Middleware/Localization/src/Internal/RequestCultureProviderLoggerExtensions.cs +++ b/src/Middleware/Localization/src/RequestCultureProviderLoggerExtensions.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Localization.Internal +namespace Microsoft.AspNetCore.Localization { internal static class RequestCultureProviderLoggerExtensions { diff --git a/src/Middleware/Localization/src/RequestLocalizationMiddleware.cs b/src/Middleware/Localization/src/RequestLocalizationMiddleware.cs index f91260f63d..c6ec3e1c06 100644 --- a/src/Middleware/Localization/src/RequestLocalizationMiddleware.cs +++ b/src/Middleware/Localization/src/RequestLocalizationMiddleware.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Localization.Internal; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; diff --git a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers.cs b/src/Middleware/ResponseCaching/src/CacheEntry/CacheEntryHelpers.cs similarity index 97% rename from src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers.cs rename to src/Middleware/ResponseCaching/src/CacheEntry/CacheEntryHelpers.cs index 842e56cbf3..de97be1f0f 100644 --- a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers.cs +++ b/src/Middleware/ResponseCaching/src/CacheEntry/CacheEntryHelpers.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal static class CacheEntryHelpers { diff --git a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs b/src/Middleware/ResponseCaching/src/CacheEntry/CachedResponse.cs similarity index 89% rename from src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs rename to src/Middleware/ResponseCaching/src/CacheEntry/CachedResponse.cs index b7713843a9..e880691333 100644 --- a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs +++ b/src/Middleware/ResponseCaching/src/CacheEntry/CachedResponse.cs @@ -5,7 +5,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class CachedResponse : IResponseCacheEntry { diff --git a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs b/src/Middleware/ResponseCaching/src/CacheEntry/CachedVaryByRules.cs similarity index 88% rename from src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs rename to src/Middleware/ResponseCaching/src/CacheEntry/CachedVaryByRules.cs index e9dc67024a..6b8023440e 100644 --- a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs +++ b/src/Middleware/ResponseCaching/src/CacheEntry/CachedVaryByRules.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class CachedVaryByRules : IResponseCacheEntry { diff --git a/src/Middleware/ResponseCaching/src/Internal/FastGuid.cs b/src/Middleware/ResponseCaching/src/FastGuid.cs similarity index 97% rename from src/Middleware/ResponseCaching/src/Internal/FastGuid.cs rename to src/Middleware/ResponseCaching/src/FastGuid.cs index 571227516b..0570f13351 100644 --- a/src/Middleware/ResponseCaching/src/Internal/FastGuid.cs +++ b/src/Middleware/ResponseCaching/src/FastGuid.cs @@ -4,7 +4,7 @@ using System; using System.Threading; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class FastGuid { diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCache.cs similarity index 97% rename from src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs rename to src/Middleware/ResponseCaching/src/Interfaces/IResponseCache.cs index f76c5d7452..4ca2c6e8d1 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs +++ b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCache.cs @@ -4,7 +4,7 @@ using System; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal interface IResponseCache { diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCacheEntry.cs similarity index 80% rename from src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs rename to src/Middleware/ResponseCaching/src/Interfaces/IResponseCacheEntry.cs index c27570b899..62590c33d7 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs +++ b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCacheEntry.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal interface IResponseCacheEntry { diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCachingKeyProvider.cs similarity index 95% rename from src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs rename to src/Middleware/ResponseCaching/src/Interfaces/IResponseCachingKeyProvider.cs index 22da5aec00..b3ce9fc4a7 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs +++ b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCachingKeyProvider.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal interface IResponseCachingKeyProvider { diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCachingPolicyProvider.cs similarity index 97% rename from src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs rename to src/Middleware/ResponseCaching/src/Interfaces/IResponseCachingPolicyProvider.cs index 8862b74f4c..3717971e9a 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs +++ b/src/Middleware/ResponseCaching/src/Interfaces/IResponseCachingPolicyProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal interface IResponseCachingPolicyProvider { diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/ISystemClock.cs b/src/Middleware/ResponseCaching/src/Interfaces/ISystemClock.cs similarity index 89% rename from src/Middleware/ResponseCaching/src/Internal/Interfaces/ISystemClock.cs rename to src/Middleware/ResponseCaching/src/Interfaces/ISystemClock.cs index 4b560e3dad..c68f982927 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/ISystemClock.cs +++ b/src/Middleware/ResponseCaching/src/Interfaces/ISystemClock.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { /// /// Abstracts the system clock to facilitate testing. diff --git a/src/Middleware/ResponseCaching/src/Internal/LoggerExtensions.cs b/src/Middleware/ResponseCaching/src/LoggerExtensions.cs similarity index 99% rename from src/Middleware/ResponseCaching/src/Internal/LoggerExtensions.cs rename to src/Middleware/ResponseCaching/src/LoggerExtensions.cs index c77dc3bfa3..f45bc2fb87 100644 --- a/src/Middleware/ResponseCaching/src/Internal/LoggerExtensions.cs +++ b/src/Middleware/ResponseCaching/src/LoggerExtensions.cs @@ -5,7 +5,7 @@ using System; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { /// /// Defines *all* the logger messages produced by response caching diff --git a/src/Middleware/ResponseCaching/src/Internal/MemoryCachedResponse.cs b/src/Middleware/ResponseCaching/src/MemoryCachedResponse.cs similarity index 91% rename from src/Middleware/ResponseCaching/src/Internal/MemoryCachedResponse.cs rename to src/Middleware/ResponseCaching/src/MemoryCachedResponse.cs index d24e63a9ff..1a96453502 100644 --- a/src/Middleware/ResponseCaching/src/Internal/MemoryCachedResponse.cs +++ b/src/Middleware/ResponseCaching/src/MemoryCachedResponse.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class MemoryCachedResponse { diff --git a/src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs b/src/Middleware/ResponseCaching/src/MemoryResponseCache.cs similarity index 98% rename from src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs rename to src/Middleware/ResponseCaching/src/MemoryResponseCache.cs index 10eb67aaa9..554ab361d8 100644 --- a/src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs +++ b/src/Middleware/ResponseCaching/src/MemoryResponseCache.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class MemoryResponseCache : IResponseCache { diff --git a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs b/src/Middleware/ResponseCaching/src/ResponseCachingContext.cs similarity index 98% rename from src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs rename to src/Middleware/ResponseCaching/src/ResponseCachingContext.cs index e135583d4a..53ec2fbdb2 100644 --- a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingContext.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class ResponseCachingContext { diff --git a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs b/src/Middleware/ResponseCaching/src/ResponseCachingKeyProvider.cs similarity index 99% rename from src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs rename to src/Middleware/ResponseCaching/src/ResponseCachingKeyProvider.cs index 6b9b654404..f35a28f7b6 100644 --- a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingKeyProvider.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class ResponseCachingKeyProvider : IResponseCachingKeyProvider { diff --git a/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs b/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs index d936729197..b370841e8e 100644 --- a/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging; using Microsoft.Extensions.ObjectPool; diff --git a/src/Middleware/ResponseCaching/src/ResponseCachingOptions.cs b/src/Middleware/ResponseCaching/src/ResponseCachingOptions.cs index 4fa75e2135..0a97efa7e3 100644 --- a/src/Middleware/ResponseCaching/src/ResponseCachingOptions.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingOptions.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.ComponentModel; -using Microsoft.AspNetCore.ResponseCaching.Internal; namespace Microsoft.AspNetCore.ResponseCaching { diff --git a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs b/src/Middleware/ResponseCaching/src/ResponseCachingPolicyProvider.cs similarity index 99% rename from src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs rename to src/Middleware/ResponseCaching/src/ResponseCachingPolicyProvider.cs index 54a045c5af..3cb94ab005 100644 --- a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingPolicyProvider.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class ResponseCachingPolicyProvider : IResponseCachingPolicyProvider { diff --git a/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs b/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs index eccb641b59..bbcbc38999 100644 --- a/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.ResponseCaching; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.ObjectPool; diff --git a/src/Middleware/ResponseCaching/src/Internal/SendFileFeatureWrapper.cs b/src/Middleware/ResponseCaching/src/SendFileFeatureWrapper.cs similarity index 95% rename from src/Middleware/ResponseCaching/src/Internal/SendFileFeatureWrapper.cs rename to src/Middleware/ResponseCaching/src/SendFileFeatureWrapper.cs index 65ac5850f8..edc71edd76 100644 --- a/src/Middleware/ResponseCaching/src/Internal/SendFileFeatureWrapper.cs +++ b/src/Middleware/ResponseCaching/src/SendFileFeatureWrapper.cs @@ -5,7 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class SendFileFeatureWrapper : IHttpSendFileFeature { diff --git a/src/Middleware/ResponseCaching/src/Streams/ResponseCachingStream.cs b/src/Middleware/ResponseCaching/src/Streams/ResponseCachingStream.cs index 6a0c162be4..a788778e94 100644 --- a/src/Middleware/ResponseCaching/src/Streams/ResponseCachingStream.cs +++ b/src/Middleware/ResponseCaching/src/Streams/ResponseCachingStream.cs @@ -6,7 +6,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class ResponseCachingStream : Stream { diff --git a/src/Middleware/ResponseCaching/src/Streams/SegmentReadStream.cs b/src/Middleware/ResponseCaching/src/Streams/SegmentReadStream.cs index 8234d135a9..35958933e0 100644 --- a/src/Middleware/ResponseCaching/src/Streams/SegmentReadStream.cs +++ b/src/Middleware/ResponseCaching/src/Streams/SegmentReadStream.cs @@ -7,7 +7,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class SegmentReadStream : Stream { diff --git a/src/Middleware/ResponseCaching/src/Streams/SegmentWriteStream.cs b/src/Middleware/ResponseCaching/src/Streams/SegmentWriteStream.cs index 81df72a9d1..9faa32ca76 100644 --- a/src/Middleware/ResponseCaching/src/Streams/SegmentWriteStream.cs +++ b/src/Middleware/ResponseCaching/src/Streams/SegmentWriteStream.cs @@ -7,7 +7,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal class SegmentWriteStream : Stream { diff --git a/src/Middleware/ResponseCaching/src/Streams/StreamUtilities.cs b/src/Middleware/ResponseCaching/src/Streams/StreamUtilities.cs index d128a9f8f2..0303e43fbf 100644 --- a/src/Middleware/ResponseCaching/src/Streams/StreamUtilities.cs +++ b/src/Middleware/ResponseCaching/src/Streams/StreamUtilities.cs @@ -5,7 +5,7 @@ using System; using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal static class StreamUtilities { diff --git a/src/Middleware/ResponseCaching/src/Internal/StringBuilderExtensions.cs b/src/Middleware/ResponseCaching/src/StringBuilderExtensions.cs similarity index 92% rename from src/Middleware/ResponseCaching/src/Internal/StringBuilderExtensions.cs rename to src/Middleware/ResponseCaching/src/StringBuilderExtensions.cs index 40169d66bc..f0ed673859 100644 --- a/src/Middleware/ResponseCaching/src/Internal/StringBuilderExtensions.cs +++ b/src/Middleware/ResponseCaching/src/StringBuilderExtensions.cs @@ -3,7 +3,7 @@ using System.Text; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { internal static class StringBuilderExtensions { diff --git a/src/Middleware/ResponseCaching/src/Internal/SystemClock.cs b/src/Middleware/ResponseCaching/src/SystemClock.cs similarity index 89% rename from src/Middleware/ResponseCaching/src/Internal/SystemClock.cs rename to src/Middleware/ResponseCaching/src/SystemClock.cs index e4462d803f..c08ddc4f0d 100644 --- a/src/Middleware/ResponseCaching/src/Internal/SystemClock.cs +++ b/src/Middleware/ResponseCaching/src/SystemClock.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNetCore.ResponseCaching.Internal +namespace Microsoft.AspNetCore.ResponseCaching { /// /// Provides access to the normal system clock. diff --git a/src/Middleware/ResponseCaching/test/ResponseCachingKeyProviderTests.cs b/src/Middleware/ResponseCaching/test/ResponseCachingKeyProviderTests.cs index 36bd3da0c8..b207b601ac 100644 --- a/src/Middleware/ResponseCaching/test/ResponseCachingKeyProviderTests.cs +++ b/src/Middleware/ResponseCaching/test/ResponseCachingKeyProviderTests.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Xunit; namespace Microsoft.AspNetCore.ResponseCaching.Tests diff --git a/src/Middleware/ResponseCaching/test/ResponseCachingMiddlewareTests.cs b/src/Middleware/ResponseCaching/test/ResponseCachingMiddlewareTests.cs index 2fb9849993..43970711ea 100644 --- a/src/Middleware/ResponseCaching/test/ResponseCachingMiddlewareTests.cs +++ b/src/Middleware/ResponseCaching/test/ResponseCachingMiddlewareTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging.Testing; using Microsoft.Extensions.Primitives; diff --git a/src/Middleware/ResponseCaching/test/ResponseCachingPolicyProviderTests.cs b/src/Middleware/ResponseCaching/test/ResponseCachingPolicyProviderTests.cs index 4f1307b4bc..8c3f55c367 100644 --- a/src/Middleware/ResponseCaching/test/ResponseCachingPolicyProviderTests.cs +++ b/src/Middleware/ResponseCaching/test/ResponseCachingPolicyProviderTests.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.Logging.Testing; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/src/Middleware/ResponseCaching/test/SegmentReadStreamTests.cs b/src/Middleware/ResponseCaching/test/SegmentReadStreamTests.cs index 5247df3096..6520f785a0 100644 --- a/src/Middleware/ResponseCaching/test/SegmentReadStreamTests.cs +++ b/src/Middleware/ResponseCaching/test/SegmentReadStreamTests.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Xunit; namespace Microsoft.AspNetCore.ResponseCaching.Tests diff --git a/src/Middleware/ResponseCaching/test/SegmentWriteStreamTests.cs b/src/Middleware/ResponseCaching/test/SegmentWriteStreamTests.cs index 6043128e7b..251b7e8777 100644 --- a/src/Middleware/ResponseCaching/test/SegmentWriteStreamTests.cs +++ b/src/Middleware/ResponseCaching/test/SegmentWriteStreamTests.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Linq; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Xunit; namespace Microsoft.AspNetCore.ResponseCaching.Tests diff --git a/src/Middleware/ResponseCaching/test/TestUtils.cs b/src/Middleware/ResponseCaching/test/TestUtils.cs index 319c1d590f..d98ba511bb 100644 --- a/src/Middleware/ResponseCaching/test/TestUtils.cs +++ b/src/Middleware/ResponseCaching/test/TestUtils.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; @@ -22,7 +21,7 @@ using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; using Xunit; -using ISystemClock = Microsoft.AspNetCore.ResponseCaching.Internal.ISystemClock; +using ISystemClock = Microsoft.AspNetCore.ResponseCaching.ISystemClock; namespace Microsoft.AspNetCore.ResponseCaching.Tests { diff --git a/src/Middleware/ResponseCompression/src/internal/ResponseCompressionLoggingExtensions.cs b/src/Middleware/ResponseCompression/src/ResponseCompressionLoggingExtensions.cs similarity index 98% rename from src/Middleware/ResponseCompression/src/internal/ResponseCompressionLoggingExtensions.cs rename to src/Middleware/ResponseCompression/src/ResponseCompressionLoggingExtensions.cs index bf16682498..114bd69fdb 100644 --- a/src/Middleware/ResponseCompression/src/internal/ResponseCompressionLoggingExtensions.cs +++ b/src/Middleware/ResponseCompression/src/ResponseCompressionLoggingExtensions.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.Logging; -namespace Microsoft.AspNetCore.ResponseCompression.Internal +namespace Microsoft.AspNetCore.ResponseCompression { internal static class ResponseCompressionLoggingExtensions { diff --git a/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs b/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs index a0e00b077a..ad29ab7b2c 100644 --- a/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs +++ b/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.ResponseCompression.Internal; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Middleware/Rewrite/ref/Microsoft.AspNetCore.Rewrite.netcoreapp3.0.cs b/src/Middleware/Rewrite/ref/Microsoft.AspNetCore.Rewrite.netcoreapp3.0.cs index 6dff9e0d5e..4a2f965186 100644 --- a/src/Middleware/Rewrite/ref/Microsoft.AspNetCore.Rewrite.netcoreapp3.0.cs +++ b/src/Middleware/Rewrite/ref/Microsoft.AspNetCore.Rewrite.netcoreapp3.0.cs @@ -69,642 +69,3 @@ namespace Microsoft.AspNetCore.Rewrite SkipRemainingRules = 2, } } -namespace Microsoft.AspNetCore.Rewrite.Internal -{ - public partial class BackReferenceCollection - { - public BackReferenceCollection(string reference) { } - public BackReferenceCollection(System.Text.RegularExpressions.GroupCollection references) { } - public string this[int index] { get { throw null; } } - public void Add(Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection references) { } - } - public partial class DelegateRule : Microsoft.AspNetCore.Rewrite.IRule - { - public DelegateRule(System.Action onApplyRule) { } - public void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public partial class MatchResults - { - public static readonly Microsoft.AspNetCore.Rewrite.Internal.MatchResults EmptyFailure; - public static readonly Microsoft.AspNetCore.Rewrite.Internal.MatchResults EmptySuccess; - public MatchResults() { } - public Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection BackReferences { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool Success { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ParserContext - { - public readonly string Template; - public ParserContext(string condition) { } - public char Current { get { throw null; } } - public int Index { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool Back() { throw null; } - public string Capture() { throw null; } - public int GetIndex() { throw null; } - public bool HasNext() { throw null; } - public void Mark() { } - public bool Next() { throw null; } - } - public partial class Pattern - { - public Pattern(System.Collections.Generic.IList patternSegments) { } - public System.Collections.Generic.IList PatternSegments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public abstract partial class PatternSegment - { - protected PatternSegment() { } - public abstract string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences); - } - public partial class RedirectRule : Microsoft.AspNetCore.Rewrite.IRule - { - public RedirectRule(string regex, string replacement, int statusCode) { } - public System.Text.RegularExpressions.Regex InitialMatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Replacement { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public virtual void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public partial class RedirectToHttpsRule : Microsoft.AspNetCore.Rewrite.IRule - { - public RedirectToHttpsRule() { } - public int? SSLPort { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public partial class RedirectToWwwRule : Microsoft.AspNetCore.Rewrite.IRule - { - public readonly string[] _domains; - public readonly int _statusCode; - public RedirectToWwwRule(int statusCode) { } - public RedirectToWwwRule(int statusCode, params string[] domains) { } - public virtual void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public partial class RewriteRule : Microsoft.AspNetCore.Rewrite.IRule - { - public RewriteRule(string regex, string replacement, bool stopProcessing) { } - public System.Text.RegularExpressions.Regex InitialMatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Replacement { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool StopProcessing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public virtual void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public abstract partial class UrlAction - { - protected UrlAction() { } - protected Microsoft.AspNetCore.Rewrite.Internal.Pattern Url { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public abstract void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences); - } - public abstract partial class UrlMatch - { - protected UrlMatch() { } - protected bool Negate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public abstract Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string input, Microsoft.AspNetCore.Rewrite.RewriteContext context); - } -} -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite -{ - public partial class ApacheModRewriteRule : Microsoft.AspNetCore.Rewrite.IRule - { - public ApacheModRewriteRule(Microsoft.AspNetCore.Rewrite.Internal.UrlMatch initialMatch, System.Collections.Generic.IList conditions, System.Collections.Generic.IList urlActions) { } - public System.Collections.Generic.IList Actions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IList Conditions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Rewrite.Internal.UrlMatch InitialMatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public virtual void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public partial class Condition - { - public Condition() { } - public Microsoft.AspNetCore.Rewrite.Internal.Pattern Input { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Rewrite.Internal.UrlMatch Match { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool OrNext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public static partial class ConditionEvaluator - { - public static Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(System.Collections.Generic.IEnumerable conditions, Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection backReferences) { throw null; } - public static Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(System.Collections.Generic.IEnumerable conditions, Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection backReferences, bool trackAllCaptures) { throw null; } - } - public partial class ConditionPatternParser - { - public ConditionPatternParser() { } - public Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ParsedModRewriteInput ParseActionCondition(string condition) { throw null; } - } - public enum ConditionType - { - Regex = 0, - PropertyTest = 1, - StringComp = 2, - IntComp = 3, - } - public partial class CookieActionFactory - { - public CookieActionFactory() { } - public Microsoft.AspNetCore.Rewrite.Internal.UrlActions.ChangeCookieAction Create(string flagValue) { throw null; } - } - public partial class FileParser - { - public FileParser() { } - public System.Collections.Generic.IList Parse(System.IO.TextReader input) { throw null; } - } - public partial class FlagParser - { - public FlagParser() { } - public Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.Flags Parse(string flagString) { throw null; } - } - public partial class Flags - { - public Flags() { } - public Flags(System.Collections.Generic.IDictionary flags) { } - public System.Collections.Generic.IDictionary FlagDictionary { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string this[Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.FlagType flag] { get { throw null; } set { } } - public bool GetValue(Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.FlagType flag, out string value) { throw null; } - public bool HasFlag(Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.FlagType flag) { throw null; } - public void SetFlag(Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.FlagType flag, string value) { } - } - public enum FlagType - { - EscapeBackreference = 0, - Chain = 1, - Cookie = 2, - DiscardPath = 3, - Env = 4, - End = 5, - Forbidden = 6, - Gone = 7, - Handler = 8, - Last = 9, - Next = 10, - NoCase = 11, - NoEscape = 12, - NoSubReq = 13, - NoVary = 14, - Or = 15, - Proxy = 16, - PassThrough = 17, - QSAppend = 18, - QSDiscard = 19, - QSLast = 20, - Redirect = 21, - Skip = 22, - Type = 23, - } - public enum OperationType - { - None = 0, - Equal = 1, - Greater = 2, - GreaterEqual = 3, - Less = 4, - LessEqual = 5, - NotEqual = 6, - Directory = 7, - RegularFile = 8, - ExistingFile = 9, - SymbolicLink = 10, - Size = 11, - ExistingUrl = 12, - Executable = 13, - } - public partial class ParsedModRewriteInput - { - public ParsedModRewriteInput() { } - public ParsedModRewriteInput(bool invert, Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ConditionType conditionType, Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.OperationType operationType, string operand) { } - public Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ConditionType ConditionType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool Invert { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Operand { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.OperationType OperationType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class RuleBuilder - { - public RuleBuilder() { } - public void AddAction(Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern, Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.Flags flags) { } - public void AddConditionFromParts(Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern, Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ParsedModRewriteInput input, Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.Flags flags) { } - public void AddMatch(Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ParsedModRewriteInput input, Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.Flags flags) { } - public void AddRule(string rule) { } - public Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ApacheModRewriteRule Build() { throw null; } - } - public partial class RuleRegexParser - { - public RuleRegexParser() { } - public Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite.ParsedModRewriteInput ParseRuleRegex(string regex) { throw null; } - } - public enum SegmentType - { - Literal = 0, - ServerParameter = 1, - ConditionParameter = 2, - RuleParameter = 3, - } - public static partial class ServerVariables - { - public static Microsoft.AspNetCore.Rewrite.Internal.PatternSegment FindServerVariable(string serverVariable, Microsoft.AspNetCore.Rewrite.Internal.ParserContext context) { throw null; } - } - public partial class TestStringParser - { - public TestStringParser() { } - public Microsoft.AspNetCore.Rewrite.Internal.Pattern Parse(string testString) { throw null; } - } - public partial class Tokenizer - { - public Tokenizer() { } - public System.Collections.Generic.IList Tokenize(string rule) { throw null; } - } -} -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite -{ - public enum ActionType - { - None = 0, - Rewrite = 1, - Redirect = 2, - CustomResponse = 3, - AbortRequest = 4, - } - public partial class Condition - { - public Condition() { } - public Microsoft.AspNetCore.Rewrite.Internal.Pattern Input { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Rewrite.Internal.UrlMatch Match { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class ConditionCollection : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public ConditionCollection() { } - public ConditionCollection(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.LogicalGrouping grouping, bool trackAllCaptures) { } - public int Count { get { throw null; } } - public Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.LogicalGrouping Grouping { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.Condition this[int index] { get { throw null; } } - public bool TrackAllCaptures { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void Add(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.Condition condition) { } - public void AddConditions(System.Collections.Generic.IEnumerable conditions) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public static partial class ConditionEvaluator - { - public static Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.ConditionCollection conditions, Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection backReferences) { throw null; } - } - public partial class IISRewriteMap - { - public IISRewriteMap(string name) { } - public string this[string key] { get { throw null; } set { } } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public partial class IISRewriteMapCollection : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public IISRewriteMapCollection() { } - public int Count { get { throw null; } } - public Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.IISRewriteMap this[string key] { get { throw null; } } - public void Add(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.IISRewriteMap rewriteMap) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class IISUrlRewriteRule : Microsoft.AspNetCore.Rewrite.IRule - { - public IISUrlRewriteRule(string name, Microsoft.AspNetCore.Rewrite.Internal.UrlMatch initialMatch, Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.ConditionCollection conditions, Microsoft.AspNetCore.Rewrite.Internal.UrlAction action) { } - public IISUrlRewriteRule(string name, Microsoft.AspNetCore.Rewrite.Internal.UrlMatch initialMatch, Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.ConditionCollection conditions, Microsoft.AspNetCore.Rewrite.Internal.UrlAction action, bool global) { } - public Microsoft.AspNetCore.Rewrite.Internal.UrlAction Action { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.ConditionCollection Conditions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool Global { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Rewrite.Internal.UrlMatch InitialMatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public virtual void ApplyRule(Microsoft.AspNetCore.Rewrite.RewriteContext context) { } - } - public partial class InputParser - { - public InputParser() { } - public InputParser(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.IISRewriteMapCollection rewriteMaps, bool alwaysUseManagedServerVariables) { } - public Microsoft.AspNetCore.Rewrite.Internal.Pattern ParseInputString(string testString) { throw null; } - public Microsoft.AspNetCore.Rewrite.Internal.Pattern ParseInputString(string testString, Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UriMatchPart uriMatchPart) { throw null; } - } - public partial class InvalidUrlRewriteFormatException : System.FormatException - { - public InvalidUrlRewriteFormatException(System.Xml.Linq.XElement element, string message) { } - public InvalidUrlRewriteFormatException(System.Xml.Linq.XElement element, string message, System.Exception innerException) { } - public int LineNumber { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public int LinePosition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public enum LogicalGrouping - { - MatchAll = 0, - MatchAny = 1, - } - public enum MatchType - { - Pattern = 0, - IsFile = 1, - IsDirectory = 2, - } - public enum PatternSyntax - { - ECMAScript = 0, - Wildcard = 1, - ExactMatch = 2, - } - public enum RedirectType - { - Permanent = 301, - Found = 302, - SeeOther = 303, - Temporary = 307, - } - public static partial class RewriteMapParser - { - public static Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.IISRewriteMapCollection Parse(System.Xml.Linq.XElement xmlRoot) { throw null; } - } - public static partial class RewriteTags - { - public const string Action = "action"; - public const string Add = "add"; - public const string AppendQueryString = "appendQueryString"; - public const string Conditions = "conditions"; - public const string Enabled = "enabled"; - public const string GlobalRules = "globalRules"; - public const string IgnoreCase = "ignoreCase"; - public const string Input = "input"; - public const string Key = "key"; - public const string LogicalGrouping = "logicalGrouping"; - public const string LogRewrittenUrl = "logRewrittenUrl"; - public const string Match = "match"; - public const string MatchPattern = "matchPattern"; - public const string MatchType = "matchType"; - public const string Name = "name"; - public const string Negate = "negate"; - public const string Pattern = "pattern"; - public const string PatternSyntax = "patternSyntax"; - public const string RedirectType = "redirectType"; - public const string Rewrite = "rewrite"; - public const string RewriteMap = "rewriteMap"; - public const string RewriteMaps = "rewriteMaps"; - public const string Rule = "rule"; - public const string Rules = "rules"; - public const string StatusCode = "statusCode"; - public const string StatusDescription = "statusDescription"; - public const string StatusReason = "statusReason"; - public const string StopProcessing = "stopProcessing"; - public const string SubStatusCode = "subStatusCode"; - public const string TrackAllCaptures = "trackAllCaptures"; - public const string Type = "type"; - public const string Url = "url"; - public const string Value = "value"; - } - public static partial class ServerVariables - { - public static Microsoft.AspNetCore.Rewrite.Internal.PatternSegment FindServerVariable(string serverVariable, Microsoft.AspNetCore.Rewrite.Internal.ParserContext context, Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UriMatchPart uriMatchPart, bool alwaysUseManagedServerVariables) { throw null; } - } - public partial class UriMatchCondition : Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.Condition - { - public UriMatchCondition(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.InputParser inputParser, string input, string pattern, Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UriMatchPart uriMatchPart, bool ignoreCase, bool negate) { } - } - public enum UriMatchPart - { - Full = 0, - Path = 1, - } - public partial class UrlRewriteFileParser - { - public UrlRewriteFileParser() { } - public System.Collections.Generic.IList Parse(System.IO.TextReader reader, bool alwaysUseManagedServerVariables) { throw null; } - } - public partial class UrlRewriteRuleBuilder - { - public UrlRewriteRuleBuilder() { } - public bool Enabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool Global { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UriMatchPart UriMatchPart { get { throw null; } } - public void AddUrlAction(Microsoft.AspNetCore.Rewrite.Internal.UrlAction action) { } - public void AddUrlCondition(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.Condition condition) { } - public void AddUrlConditions(System.Collections.Generic.IEnumerable conditions) { } - public void AddUrlMatch(string input, bool ignoreCase = true, bool negate = false, Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.PatternSyntax patternSyntax = Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.PatternSyntax.ECMAScript) { } - public Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.IISUrlRewriteRule Build() { throw null; } - public void ConfigureConditionBehavior(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.LogicalGrouping logicalGrouping, bool trackAllCaptures) { } - } -} -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments -{ - public partial class ConditionMatchSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public ConditionMatchSegment(int index) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class DateTimeSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public DateTimeSegment(string segment) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReference) { throw null; } - } - public partial class HeaderSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public HeaderSegment(string header) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class IsHttpsModSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public IsHttpsModSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class IsHttpsUrlSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public IsHttpsUrlSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class IsIPV6Segment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public IsIPV6Segment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class LiteralSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public LiteralSegment(string literal) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class LocalAddressSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public LocalAddressSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class LocalPortSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public LocalPortSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class QueryStringSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public QueryStringSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackRefernces, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class RemoteAddressSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public RemoteAddressSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class RemotePortSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public RemotePortSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class RequestFileNameSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public RequestFileNameSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class RequestMethodSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public RequestMethodSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class RewriteMapSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public RewriteMapSegment(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.IISRewriteMap rewriteMap, Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class RuleMatchSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public RuleMatchSegment(int index) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class SchemeSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public SchemeSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class ServerProtocolSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public ServerProtocolSegment() { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class ToLowerSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public ToLowerSegment(Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class UrlEncodeSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public UrlEncodeSegment(Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } - public partial class UrlSegment : Microsoft.AspNetCore.Rewrite.Internal.PatternSegment - { - public UrlSegment() { } - public UrlSegment(Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UriMatchPart uriMatchPart) { } - public override string Evaluate(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { throw null; } - } -} -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions -{ - public partial class AbortAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public AbortAction() { } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class ChangeCookieAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public ChangeCookieAction(string name) { } - public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.TimeSpan Lifetime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class CustomResponseAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public CustomResponseAction(int statusCode) { } - public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string StatusDescription { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string StatusReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class ForbiddenAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public ForbiddenAction() { } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class GoneAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public GoneAction() { } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class NoneAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public NoneAction(Microsoft.AspNetCore.Rewrite.RuleResult result) { } - public Microsoft.AspNetCore.Rewrite.RuleResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class RedirectAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public RedirectAction(int statusCode, Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern, bool queryStringAppend) { } - public RedirectAction(int statusCode, Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern, bool queryStringAppend, bool queryStringDelete, bool escapeBackReferences) { } - public bool EscapeBackReferences { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool QueryStringAppend { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool QueryStringDelete { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } - public partial class RewriteAction : Microsoft.AspNetCore.Rewrite.Internal.UrlAction - { - public RewriteAction(Microsoft.AspNetCore.Rewrite.RuleResult result, Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern, bool queryStringAppend) { } - public RewriteAction(Microsoft.AspNetCore.Rewrite.RuleResult result, Microsoft.AspNetCore.Rewrite.Internal.Pattern pattern, bool queryStringAppend, bool queryStringDelete, bool escapeBackReferences) { } - public bool EscapeBackReferences { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool QueryStringAppend { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool QueryStringDelete { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Rewrite.RuleResult Result { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override void ApplyAction(Microsoft.AspNetCore.Rewrite.RewriteContext context, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection ruleBackReferences, Microsoft.AspNetCore.Rewrite.Internal.BackReferenceCollection conditionBackReferences) { } - } -} -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches -{ - public partial class ExactMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public ExactMatch(bool ignoreCase, string input, bool negate) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string pattern, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public partial class FileSizeMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public FileSizeMatch(bool negate) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string input, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public partial class IntegerMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public IntegerMatch(int value, Microsoft.AspNetCore.Rewrite.Internal.UrlMatches.IntegerOperationType operation) { } - public IntegerMatch(string value, Microsoft.AspNetCore.Rewrite.Internal.UrlMatches.IntegerOperationType operation) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string input, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public enum IntegerOperationType - { - Equal = 0, - Greater = 1, - GreaterEqual = 2, - Less = 3, - LessEqual = 4, - NotEqual = 5, - } - public partial class IsDirectoryMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public IsDirectoryMatch(bool negate) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string pattern, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public partial class IsFileMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public IsFileMatch(bool negate) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string pattern, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public partial class RegexMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public RegexMatch(System.Text.RegularExpressions.Regex match, bool negate) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string pattern, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public partial class StringMatch : Microsoft.AspNetCore.Rewrite.Internal.UrlMatch - { - public StringMatch(string value, Microsoft.AspNetCore.Rewrite.Internal.UrlMatches.StringOperationType operation, bool ignoreCase) { } - public override Microsoft.AspNetCore.Rewrite.Internal.MatchResults Evaluate(string input, Microsoft.AspNetCore.Rewrite.RewriteContext context) { throw null; } - } - public enum StringOperationType - { - Equal = 0, - Greater = 1, - GreaterEqual = 2, - Less = 3, - LessEqual = 4, - } -} diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ApacheModRewriteRule.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/ApacheModRewriteRule.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ApacheModRewriteRule.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/ApacheModRewriteRule.cs index d93875fb7f..51f5f3355e 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ApacheModRewriteRule.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/ApacheModRewriteRule.cs @@ -4,9 +4,9 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Rewrite.Logging; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class ApacheModRewriteRule : IRule + internal class ApacheModRewriteRule : IRule { public UrlMatch InitialMatch { get; } public IList Conditions { get; } diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Condition.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/Condition.cs similarity index 87% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Condition.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/Condition.cs index 01db0eb1bd..34a5698041 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Condition.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/Condition.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class Condition + internal class Condition { public Pattern Input { get; set; } public UrlMatch Match { get; set; } diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionEvaluator.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/ConditionEvaluator.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionEvaluator.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/ConditionEvaluator.cs index 0038c5bab2..4785b1caab 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionEvaluator.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/ConditionEvaluator.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public static class ConditionEvaluator + internal static class ConditionEvaluator { public static MatchResults Evaluate(IEnumerable conditions, RewriteContext context, BackReferenceCollection backReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionPatternParser.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/ConditionPatternParser.cs similarity index 99% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionPatternParser.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/ConditionPatternParser.cs index 53d841b0c7..a5b64c227a 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionPatternParser.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/ConditionPatternParser.cs @@ -4,13 +4,13 @@ using System; using System.Globalization; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { /// /// Parses the "CondPattern" portion of the RewriteCond. /// RewriteCond TestString CondPattern /// - public class ConditionPatternParser + internal class ConditionPatternParser { private const char Not = '!'; private const char Dash = '-'; diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionType.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/ConditionType.cs similarity index 73% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionType.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/ConditionType.cs index 0624bbfede..fae17d1d8c 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ConditionType.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/ConditionType.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public enum ConditionType + internal enum ConditionType { Regex, PropertyTest, diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/CookieActionFactory.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/CookieActionFactory.cs similarity index 96% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/CookieActionFactory.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/CookieActionFactory.cs index 27cb805064..b4217f8b60 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/CookieActionFactory.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/CookieActionFactory.cs @@ -3,11 +3,11 @@ using System; using System.Globalization; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlActions; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class CookieActionFactory + internal class CookieActionFactory { /// /// Creates a for details. diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FileParser.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/FileParser.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FileParser.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/FileParser.cs index d301a401a3..8bb1fdf006 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FileParser.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/FileParser.cs @@ -5,9 +5,9 @@ using System; using System.Collections.Generic; using System.IO; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class FileParser + internal class FileParser { public IList Parse(TextReader input) { diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FlagParser.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/FlagParser.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FlagParser.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/FlagParser.cs index 3d736d7b56..b40d7c5322 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FlagParser.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/FlagParser.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class FlagParser + internal class FlagParser { private readonly IDictionary _ruleFlagLookup = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "b", FlagType.EscapeBackreference}, diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FlagType.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/FlagType.cs similarity index 86% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FlagType.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/FlagType.cs index 67ea9875bf..7567428d34 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/FlagType.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/FlagType.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public enum FlagType + internal enum FlagType { EscapeBackreference, Chain, diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Flags.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/Flags.cs similarity index 95% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Flags.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/Flags.cs index 0f5fac2c25..a180d65ef8 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Flags.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/Flags.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { // For more information of flags, and what flags we currently support: // https://github.com/aspnet/BasicMiddleware/issues/66 // http://httpd.apache.org/docs/current/expr.html#vars - public class Flags + internal class Flags { public IDictionary FlagDictionary { get; } diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/OperationType.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/OperationType.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/OperationType.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/OperationType.cs index 1f22902d57..483fb0b03f 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/OperationType.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/OperationType.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public enum OperationType + internal enum OperationType { None, Equal, diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ParsedModRewriteCondition.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/ParsedModRewriteCondition.cs similarity index 87% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ParsedModRewriteCondition.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/ParsedModRewriteCondition.cs index 759ab51307..df56fadf85 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ParsedModRewriteCondition.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/ParsedModRewriteCondition.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class ParsedModRewriteInput + internal class ParsedModRewriteInput { public bool Invert { get; set; } public ConditionType ConditionType { get; set; } diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/RuleBuilder.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/RuleBuilder.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/RuleBuilder.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/RuleBuilder.cs index 2dd1c58c9e..b75db70da2 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/RuleBuilder.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/RuleBuilder.cs @@ -6,12 +6,12 @@ using System.Collections.Generic; using System.Globalization; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlMatches; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class RuleBuilder + internal class RuleBuilder { private IList _conditions; internal IList _actions = new List(); diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/RuleRegexParser.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/RuleRegexParser.cs similarity index 88% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/RuleRegexParser.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/RuleRegexParser.cs index e8c0eeec69..7003926773 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/RuleRegexParser.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/RuleRegexParser.cs @@ -3,9 +3,9 @@ using System; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public class RuleRegexParser + internal class RuleRegexParser { public ParsedModRewriteInput ParseRuleRegex(string regex) { diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/SegmentType.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/SegmentType.cs similarity index 75% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/SegmentType.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/SegmentType.cs index ee47c978cf..1d67818d36 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/SegmentType.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/SegmentType.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { - public enum SegmentType + internal enum SegmentType { Literal, ServerParameter, diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ServerVariables.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/ServerVariables.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ServerVariables.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/ServerVariables.cs index afb3a72053..fbebb2225c 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/ServerVariables.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/ServerVariables.cs @@ -2,15 +2,15 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { /// /// mod_rewrite lookups for specific string constants. /// - public static class ServerVariables + internal static class ServerVariables { /// diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/TestStringParser.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/TestStringParser.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/TestStringParser.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/TestStringParser.cs index 151a9c7c10..73bda20d1d 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/TestStringParser.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/TestStringParser.cs @@ -3,14 +3,14 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { /// /// Parses the TestString segment of the mod_rewrite condition. /// - public class TestStringParser + internal class TestStringParser { private const char Percent = '%'; private const char Dollar = '$'; diff --git a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Tokenizer.cs b/src/Middleware/Rewrite/src/ApacheModRewrite/Tokenizer.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Tokenizer.cs rename to src/Middleware/Rewrite/src/ApacheModRewrite/Tokenizer.cs index b9d19bd8c7..609e1b3e08 100644 --- a/src/Middleware/Rewrite/src/Internal/ApacheModRewrite/Tokenizer.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewrite/Tokenizer.cs @@ -5,12 +5,12 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite +namespace Microsoft.AspNetCore.Rewrite.ApacheModRewrite { /// /// Tokenizes a mod_rewrite rule, delimited by spaces. /// - public class Tokenizer + internal class Tokenizer { private const char Space = ' '; private const char Escape = '\\'; diff --git a/src/Middleware/Rewrite/src/ApacheModRewriteOptionsExtensions.cs b/src/Middleware/Rewrite/src/ApacheModRewriteOptionsExtensions.cs index b4779aece7..127de6647e 100644 --- a/src/Middleware/Rewrite/src/ApacheModRewriteOptionsExtensions.cs +++ b/src/Middleware/Rewrite/src/ApacheModRewriteOptionsExtensions.cs @@ -3,7 +3,7 @@ using System; using System.IO; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Microsoft.Extensions.FileProviders; namespace Microsoft.AspNetCore.Rewrite diff --git a/src/Middleware/Rewrite/src/Internal/BackReferenceCollection.cs b/src/Middleware/Rewrite/src/BackReferenceCollection.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/BackReferenceCollection.cs rename to src/Middleware/Rewrite/src/BackReferenceCollection.cs index 32b91a19ce..439946129b 100644 --- a/src/Middleware/Rewrite/src/Internal/BackReferenceCollection.cs +++ b/src/Middleware/Rewrite/src/BackReferenceCollection.cs @@ -5,9 +5,9 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class BackReferenceCollection + internal class BackReferenceCollection { private List _backReferences = new List(); diff --git a/src/Middleware/Rewrite/src/Internal/DelegateRule.cs b/src/Middleware/Rewrite/src/DelegateRule.cs similarity index 84% rename from src/Middleware/Rewrite/src/Internal/DelegateRule.cs rename to src/Middleware/Rewrite/src/DelegateRule.cs index ab8e75d1bf..7355ae5055 100644 --- a/src/Middleware/Rewrite/src/Internal/DelegateRule.cs +++ b/src/Middleware/Rewrite/src/DelegateRule.cs @@ -3,9 +3,9 @@ using System; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class DelegateRule : IRule + internal class DelegateRule : IRule { private readonly Action _onApplyRule; diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ActionType.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/ActionType.cs similarity index 75% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ActionType.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/ActionType.cs index 75bda6efa7..b38fd0e2a3 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ActionType.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/ActionType.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public enum ActionType + internal enum ActionType { None, Rewrite, diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/Condition.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/Condition.cs similarity index 87% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/Condition.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/Condition.cs index 18a24c1925..e453a1563a 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/Condition.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/Condition.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class Condition + internal class Condition { public Pattern Input { get; set; } public UrlMatch Match { get; set; } diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ConditionCollection.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/ConditionCollection.cs similarity index 93% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ConditionCollection.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/ConditionCollection.cs index 3aec4fe960..000eda85f6 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ConditionCollection.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/ConditionCollection.cs @@ -5,9 +5,9 @@ using System; using System.Collections; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class ConditionCollection : IEnumerable + internal class ConditionCollection : IEnumerable { private readonly List _conditions = new List(); diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ConditionEvaluator.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/ConditionEvaluator.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ConditionEvaluator.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/ConditionEvaluator.cs index 2d50739e78..c3d9f5e945 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ConditionEvaluator.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/ConditionEvaluator.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public static class ConditionEvaluator + internal static class ConditionEvaluator { public static MatchResults Evaluate(ConditionCollection conditions, RewriteContext context, BackReferenceCollection backReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISRewriteMap.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/IISRewriteMap.cs similarity index 92% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISRewriteMap.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/IISRewriteMap.cs index 0cd52338b9..05b54ace4a 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISRewriteMap.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/IISRewriteMap.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class IISRewriteMap + internal class IISRewriteMap { private readonly Dictionary _map = new Dictionary(); diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISRewriteMapCollection.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/IISRewriteMapCollection.cs similarity index 89% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISRewriteMapCollection.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/IISRewriteMapCollection.cs index 4f8a900623..b473a5295c 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISRewriteMapCollection.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/IISRewriteMapCollection.cs @@ -4,9 +4,9 @@ using System.Collections; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class IISRewriteMapCollection : IEnumerable + internal class IISRewriteMapCollection : IEnumerable { private readonly Dictionary _rewriteMaps = new Dictionary(); diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISUrlRewriteRule.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/IISUrlRewriteRule.cs similarity index 95% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISUrlRewriteRule.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/IISUrlRewriteRule.cs index d77f93d294..730477e06f 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/IISUrlRewriteRule.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/IISUrlRewriteRule.cs @@ -4,9 +4,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Rewrite.Logging; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class IISUrlRewriteRule : IRule + internal class IISUrlRewriteRule : IRule { public string Name { get; } public UrlMatch InitialMatch { get; } diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/InputParser.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/InputParser.cs similarity index 98% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/InputParser.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/InputParser.cs index a68ef08bd5..cb7672b5de 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/InputParser.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/InputParser.cs @@ -4,11 +4,11 @@ using System; using System.Collections.Generic; using System.Globalization; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class InputParser + internal class InputParser { private const char Colon = ':'; private const char OpenBrace = '{'; diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/InvalidUrlRewriteFormatException.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/InvalidUrlRewriteFormatException.cs similarity index 89% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/InvalidUrlRewriteFormatException.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/InvalidUrlRewriteFormatException.cs index 8e2bac3937..f7c74be2ac 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/InvalidUrlRewriteFormatException.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/InvalidUrlRewriteFormatException.cs @@ -5,9 +5,9 @@ using System; using System.Xml; using System.Xml.Linq; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class InvalidUrlRewriteFormatException : FormatException + internal class InvalidUrlRewriteFormatException : FormatException { public int LineNumber { get; } public int LinePosition { get; } diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/LogicalGrouping.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/LogicalGrouping.cs similarity index 70% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/LogicalGrouping.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/LogicalGrouping.cs index 85dc616e89..49b653de19 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/LogicalGrouping.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/LogicalGrouping.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public enum LogicalGrouping + internal enum LogicalGrouping { MatchAll, MatchAny diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/MatchType.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/MatchType.cs similarity index 73% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/MatchType.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/MatchType.cs index 4f02dc48ce..fb5ae7c4ba 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/MatchType.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/MatchType.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public enum MatchType + internal enum MatchType { Pattern, IsFile, diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/PatternSyntax.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/PatternSyntax.cs similarity index 72% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/PatternSyntax.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/PatternSyntax.cs index f27d2c7256..0d19cf46cf 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/PatternSyntax.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/PatternSyntax.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public enum PatternSyntax + internal enum PatternSyntax { ECMAScript, Wildcard, diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RedirectType.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/RedirectType.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RedirectType.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/RedirectType.cs index 012cc77ded..8a02b72bc3 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RedirectType.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/RedirectType.cs @@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public enum RedirectType + internal enum RedirectType { Permanent = StatusCodes.Status301MovedPermanently, Found = StatusCodes.Status302Found, diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RewriteMapParser.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/RewriteMapParser.cs similarity index 92% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RewriteMapParser.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/RewriteMapParser.cs index 4e9b21d800..c15105ca55 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RewriteMapParser.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/RewriteMapParser.cs @@ -5,9 +5,9 @@ using System; using System.Linq; using System.Xml.Linq; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public static class RewriteMapParser + internal static class RewriteMapParser { public static IISRewriteMapCollection Parse(XElement xmlRoot) { diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RewriteTags.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/RewriteTags.cs similarity index 95% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RewriteTags.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/RewriteTags.cs index d6d482bdd4..10d555625e 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/RewriteTags.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/RewriteTags.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public static class RewriteTags + internal static class RewriteTags { public const string Action = "action"; public const string Add = "add"; diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ServerVariables.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/ServerVariables.cs similarity index 96% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ServerVariables.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/ServerVariables.cs index cc991ca664..68185b6e68 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ServerVariables.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/ServerVariables.cs @@ -2,12 +2,12 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public static class ServerVariables + internal static class ServerVariables { /// /// Returns the matching for the given diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UriMatchCondition.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/UriMatchCondition.cs similarity index 84% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UriMatchCondition.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/UriMatchCondition.cs index c8378c6b77..0dd92a0b84 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UriMatchCondition.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/UriMatchCondition.cs @@ -3,11 +3,11 @@ using System; using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.UrlMatches; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class UriMatchCondition : Condition + internal class UriMatchCondition : Condition { private TimeSpan _regexTimeout = TimeSpan.FromSeconds(1); diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UriMatchPart.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/UriMatchPart.cs similarity index 69% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UriMatchPart.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/UriMatchPart.cs index 25da940689..fe3407343d 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UriMatchPart.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/UriMatchPart.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public enum UriMatchPart + internal enum UriMatchPart { Full, Path diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UrlRewriteFileParser.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/UrlRewriteFileParser.cs similarity index 98% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UrlRewriteFileParser.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/UrlRewriteFileParser.cs index 6cb1d824fb..7597752744 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UrlRewriteFileParser.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/UrlRewriteFileParser.cs @@ -7,12 +7,12 @@ using System.Globalization; using System.IO; using System.Linq; using System.Xml.Linq; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlMatches; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class UrlRewriteFileParser + internal class UrlRewriteFileParser { private InputParser _inputParser; diff --git a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UrlRewriteRuleBuilder.cs b/src/Middleware/Rewrite/src/IISUrlRewrite/UrlRewriteRuleBuilder.cs similarity index 95% rename from src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UrlRewriteRuleBuilder.cs rename to src/Middleware/Rewrite/src/IISUrlRewrite/UrlRewriteRuleBuilder.cs index 69ed962154..1e12bb0501 100644 --- a/src/Middleware/Rewrite/src/Internal/IISUrlRewrite/UrlRewriteRuleBuilder.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewrite/UrlRewriteRuleBuilder.cs @@ -4,11 +4,11 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.UrlMatches; -namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite +namespace Microsoft.AspNetCore.Rewrite.IISUrlRewrite { - public class UrlRewriteRuleBuilder + internal class UrlRewriteRuleBuilder { private readonly TimeSpan _regexTimeout = TimeSpan.FromSeconds(1); diff --git a/src/Middleware/Rewrite/src/IISUrlRewriteOptionsExtensions.cs b/src/Middleware/Rewrite/src/IISUrlRewriteOptionsExtensions.cs index 600a3c0656..50b32218ac 100644 --- a/src/Middleware/Rewrite/src/IISUrlRewriteOptionsExtensions.cs +++ b/src/Middleware/Rewrite/src/IISUrlRewriteOptionsExtensions.cs @@ -4,7 +4,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Microsoft.Extensions.FileProviders; namespace Microsoft.AspNetCore.Rewrite diff --git a/src/Middleware/Rewrite/src/Internal/MatchResults.cs b/src/Middleware/Rewrite/src/MatchResults.cs similarity index 87% rename from src/Middleware/Rewrite/src/Internal/MatchResults.cs rename to src/Middleware/Rewrite/src/MatchResults.cs index 13c505d8f0..9bb18cefa8 100644 --- a/src/Middleware/Rewrite/src/Internal/MatchResults.cs +++ b/src/Middleware/Rewrite/src/MatchResults.cs @@ -3,9 +3,9 @@ using System.Text.RegularExpressions; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class MatchResults + internal class MatchResults { public static readonly MatchResults EmptySuccess = new MatchResults { Success = true }; public static readonly MatchResults EmptyFailure = new MatchResults { Success = false }; diff --git a/src/Middleware/Rewrite/src/Internal/ParserContext.cs b/src/Middleware/Rewrite/src/ParserContext.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/ParserContext.cs rename to src/Middleware/Rewrite/src/ParserContext.cs index 50d0d3998a..624404ead0 100644 --- a/src/Middleware/Rewrite/src/Internal/ParserContext.cs +++ b/src/Middleware/Rewrite/src/ParserContext.cs @@ -1,12 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { /// /// Represents a string iterator, with captures. /// - public class ParserContext + internal class ParserContext { public readonly string Template; public int Index { get; set; } diff --git a/src/Middleware/Rewrite/src/Internal/Pattern.cs b/src/Middleware/Rewrite/src/Pattern.cs similarity index 92% rename from src/Middleware/Rewrite/src/Internal/Pattern.cs rename to src/Middleware/Rewrite/src/Pattern.cs index fe33dfa628..8d5d9bd4ac 100644 --- a/src/Middleware/Rewrite/src/Internal/Pattern.cs +++ b/src/Middleware/Rewrite/src/Pattern.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class Pattern + internal class Pattern { public IList PatternSegments { get; } public Pattern(IList patternSegments) diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegment.cs b/src/Middleware/Rewrite/src/PatternSegment.cs similarity index 79% rename from src/Middleware/Rewrite/src/Internal/PatternSegment.cs rename to src/Middleware/Rewrite/src/PatternSegment.cs index ef2b342065..9a06354513 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public abstract class PatternSegment + internal abstract class PatternSegment { public abstract string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences); } diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/ConditionMatchSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/ConditionMatchSegment.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/ConditionMatchSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/ConditionMatchSegment.cs index 6c131e2c1c..58e2c3be51 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/ConditionMatchSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/ConditionMatchSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class ConditionMatchSegment : PatternSegment + internal class ConditionMatchSegment : PatternSegment { private readonly int _index; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/DateTimeSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/DateTimeSegment.cs similarity index 96% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/DateTimeSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/DateTimeSegment.cs index 588a19de27..7205c120e1 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/DateTimeSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/DateTimeSegment.cs @@ -4,9 +4,9 @@ using System; using System.Globalization; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class DateTimeSegment : PatternSegment + internal class DateTimeSegment : PatternSegment { private readonly DateTimePortion _portion; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/HeaderSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/HeaderSegment.cs similarity index 83% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/HeaderSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/HeaderSegment.cs index 83bb5918e9..8e279e482a 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/HeaderSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/HeaderSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class HeaderSegment : PatternSegment + internal class HeaderSegment : PatternSegment { private readonly string _header; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/IISServerVariableSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/IISServerVariableSegment.cs similarity index 93% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/IISServerVariableSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/IISServerVariableSegment.cs index 8bc3f96cf8..a4ac6fee58 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/IISServerVariableSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/IISServerVariableSegment.cs @@ -4,7 +4,7 @@ using System; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { internal class IISServerVariableSegment : PatternSegment { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/IsHttpsModSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/IsHttpsModSegment.cs similarity index 83% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/IsHttpsModSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/IsHttpsModSegment.cs index ba42a8ce03..eee896614c 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/IsHttpsModSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/IsHttpsModSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class IsHttpsModSegment : PatternSegment + internal class IsHttpsModSegment : PatternSegment { // Note: Mod rewrite pattern matches on lower case "on" and "off" // while IIS looks for capitalized "ON" and "OFF" diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/IsHttpsUrlSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/IsHttpsUrlSegment.cs similarity index 83% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/IsHttpsUrlSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/IsHttpsUrlSegment.cs index 106bc089c7..dda5f5ca26 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/IsHttpsUrlSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/IsHttpsUrlSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class IsHttpsUrlSegment : PatternSegment + internal class IsHttpsUrlSegment : PatternSegment { // Note: Mod rewrite pattern matches on lower case "on" and "off" // while IIS looks for capitalized "ON" and "OFF" diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/IsIPV6Segment.cs b/src/Middleware/Rewrite/src/PatternSegments/IsIPV6Segment.cs similarity index 85% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/IsIPV6Segment.cs rename to src/Middleware/Rewrite/src/PatternSegments/IsIPV6Segment.cs index 858dd45c85..b788e2a272 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/IsIPV6Segment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/IsIPV6Segment.cs @@ -3,10 +3,9 @@ using System.Net.Sockets; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - - public class IsIPV6Segment : PatternSegment + internal class IsIPV6Segment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/LiteralSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/LiteralSegment.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/LiteralSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/LiteralSegment.cs index c89818c09b..b81ba13052 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/LiteralSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/LiteralSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class LiteralSegment : PatternSegment + internal class LiteralSegment : PatternSegment { private readonly string _literal; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/LocalAddressSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/LocalAddressSegment.cs similarity index 78% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/LocalAddressSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/LocalAddressSegment.cs index 5b6e0a2c66..f3242b6f67 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/LocalAddressSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/LocalAddressSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class LocalAddressSegment : PatternSegment + internal class LocalAddressSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/LocalPortSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/LocalPortSegment.cs similarity index 81% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/LocalPortSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/LocalPortSegment.cs index dc39080723..aab21a7b61 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/LocalPortSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/LocalPortSegment.cs @@ -3,9 +3,9 @@ using System.Globalization; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class LocalPortSegment : PatternSegment + internal class LocalPortSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/QueryStringSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/QueryStringSegment.cs similarity index 83% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/QueryStringSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/QueryStringSegment.cs index c2b2c56c39..2b2521ad35 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/QueryStringSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/QueryStringSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class QueryStringSegment : PatternSegment + internal class QueryStringSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackRefernces, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/RemoteAddressSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/RemoteAddressSegment.cs similarity index 78% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/RemoteAddressSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/RemoteAddressSegment.cs index acdb9f3a41..ae28e418f2 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/RemoteAddressSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/RemoteAddressSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class RemoteAddressSegment : PatternSegment + internal class RemoteAddressSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/RemotePortSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/RemotePortSegment.cs similarity index 80% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/RemotePortSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/RemotePortSegment.cs index 720e5493ca..236a402144 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/RemotePortSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/RemotePortSegment.cs @@ -3,9 +3,9 @@ using System.Globalization; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class RemotePortSegment : PatternSegment + internal class RemotePortSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/RequestFilenameSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/RequestFilenameSegment.cs similarity index 77% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/RequestFilenameSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/RequestFilenameSegment.cs index fb3615b9c0..06d2f985b8 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/RequestFilenameSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/RequestFilenameSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class RequestFileNameSegment : PatternSegment + internal class RequestFileNameSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/RequestMethodSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/RequestMethodSegment.cs similarity index 77% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/RequestMethodSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/RequestMethodSegment.cs index ffd106380c..d97ad872c1 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/RequestMethodSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/RequestMethodSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class RequestMethodSegment : PatternSegment + internal class RequestMethodSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/RewriteMapSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/RewriteMapSegment.cs similarity index 81% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/RewriteMapSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/RewriteMapSegment.cs index 3dd50c9fec..ec13b10ac3 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/RewriteMapSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/RewriteMapSegment.cs @@ -1,11 +1,11 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class RewriteMapSegment : PatternSegment + internal class RewriteMapSegment : PatternSegment { private readonly IISRewriteMap _rewriteMap; private readonly Pattern _pattern; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/RuleMatchSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/RuleMatchSegment.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/RuleMatchSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/RuleMatchSegment.cs index cdd4b38e24..1cdbdc68af 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/RuleMatchSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/RuleMatchSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class RuleMatchSegment : PatternSegment + internal class RuleMatchSegment : PatternSegment { private readonly int _index; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/SchemeSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/SchemeSegment.cs similarity index 78% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/SchemeSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/SchemeSegment.cs index bea7073308..1f215434a1 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/SchemeSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/SchemeSegment.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class SchemeSegment : PatternSegment + internal class SchemeSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/ServerProtocolSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/ServerProtocolSegment.cs similarity index 80% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/ServerProtocolSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/ServerProtocolSegment.cs index bf7f355194..38ea6c7446 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/ServerProtocolSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/ServerProtocolSegment.cs @@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Http.Features; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class ServerProtocolSegment : PatternSegment + internal class ServerProtocolSegment : PatternSegment { public override string Evaluate(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/ToLowerSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/ToLowerSegment.cs similarity index 89% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/ToLowerSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/ToLowerSegment.cs index dec2029658..b7863221cc 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/ToLowerSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/ToLowerSegment.cs @@ -3,9 +3,9 @@ using System.Text; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class ToLowerSegment : PatternSegment + internal class ToLowerSegment : PatternSegment { private readonly Pattern _pattern; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/UrlEncodeSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/UrlEncodeSegment.cs similarity index 90% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/UrlEncodeSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/UrlEncodeSegment.cs index dc99dd4d51..c3930165a0 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/UrlEncodeSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/UrlEncodeSegment.cs @@ -4,9 +4,9 @@ using System.Text; using System.Text.Encodings.Web; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class UrlEncodeSegment : PatternSegment + internal class UrlEncodeSegment : PatternSegment { private readonly Pattern _pattern; diff --git a/src/Middleware/Rewrite/src/Internal/PatternSegments/UrlSegment.cs b/src/Middleware/Rewrite/src/PatternSegments/UrlSegment.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/PatternSegments/UrlSegment.cs rename to src/Middleware/Rewrite/src/PatternSegments/UrlSegment.cs index 431d5cd5fb..74c16b6816 100644 --- a/src/Middleware/Rewrite/src/Internal/PatternSegments/UrlSegment.cs +++ b/src/Middleware/Rewrite/src/PatternSegments/UrlSegment.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http.Extensions; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; -namespace Microsoft.AspNetCore.Rewrite.Internal.PatternSegments +namespace Microsoft.AspNetCore.Rewrite.PatternSegments { - public class UrlSegment : PatternSegment + internal class UrlSegment : PatternSegment { private readonly UriMatchPart _uriMatchPart; diff --git a/src/Middleware/Rewrite/src/Internal/RedirectRule.cs b/src/Middleware/Rewrite/src/RedirectRule.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/RedirectRule.cs rename to src/Middleware/Rewrite/src/RedirectRule.cs index cf7ae0767c..3685fedad3 100644 --- a/src/Middleware/Rewrite/src/Internal/RedirectRule.cs +++ b/src/Middleware/Rewrite/src/RedirectRule.cs @@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.Net.Http.Headers; using Microsoft.AspNetCore.Rewrite.Logging; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class RedirectRule : IRule + internal class RedirectRule : IRule { private readonly TimeSpan _regexTimeout = TimeSpan.FromSeconds(1); public Regex InitialMatch { get; } diff --git a/src/Middleware/Rewrite/src/Internal/RedirectToHttpsRule.cs b/src/Middleware/Rewrite/src/RedirectToHttpsRule.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/RedirectToHttpsRule.cs rename to src/Middleware/Rewrite/src/RedirectToHttpsRule.cs index ae481c8824..4231a5bd94 100644 --- a/src/Middleware/Rewrite/src/Internal/RedirectToHttpsRule.cs +++ b/src/Middleware/Rewrite/src/RedirectToHttpsRule.cs @@ -6,9 +6,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Rewrite.Logging; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class RedirectToHttpsRule : IRule + internal class RedirectToHttpsRule : IRule { public int? SSLPort { get; set; } public int StatusCode { get; set; } diff --git a/src/Middleware/Rewrite/src/Internal/RedirectToWwwRule.cs b/src/Middleware/Rewrite/src/RedirectToWwwRule.cs similarity index 96% rename from src/Middleware/Rewrite/src/Internal/RedirectToWwwRule.cs rename to src/Middleware/Rewrite/src/RedirectToWwwRule.cs index d368d61446..fcf9735aef 100644 --- a/src/Middleware/Rewrite/src/Internal/RedirectToWwwRule.cs +++ b/src/Middleware/Rewrite/src/RedirectToWwwRule.cs @@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Rewrite.Logging; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class RedirectToWwwRule : IRule + internal class RedirectToWwwRule : IRule { public readonly int _statusCode; public readonly string[] _domains; diff --git a/src/Middleware/Rewrite/src/RewriteOptionsExtensions.cs b/src/Middleware/Rewrite/src/RewriteOptionsExtensions.cs index d1b69dbd34..88b6d783b4 100644 --- a/src/Middleware/Rewrite/src/RewriteOptionsExtensions.cs +++ b/src/Middleware/Rewrite/src/RewriteOptionsExtensions.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal; namespace Microsoft.AspNetCore.Rewrite { diff --git a/src/Middleware/Rewrite/src/Internal/RewriteRule.cs b/src/Middleware/Rewrite/src/RewriteRule.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/RewriteRule.cs rename to src/Middleware/Rewrite/src/RewriteRule.cs index 79416b548f..85835237eb 100644 --- a/src/Middleware/Rewrite/src/Internal/RewriteRule.cs +++ b/src/Middleware/Rewrite/src/RewriteRule.cs @@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Rewrite.Logging; -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public class RewriteRule : IRule + internal class RewriteRule : IRule { private readonly TimeSpan _regexTimeout = TimeSpan.FromSeconds(1); public Regex InitialMatch { get; } diff --git a/src/Middleware/Rewrite/src/Internal/UrlAction.cs b/src/Middleware/Rewrite/src/UrlAction.cs similarity index 82% rename from src/Middleware/Rewrite/src/Internal/UrlAction.cs rename to src/Middleware/Rewrite/src/UrlAction.cs index b01e0c1bd8..67cfe24eea 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlAction.cs +++ b/src/Middleware/Rewrite/src/UrlAction.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public abstract class UrlAction + internal abstract class UrlAction { protected Pattern Url { get; set; } public abstract void ApplyAction(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences); diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/AbortAction.cs b/src/Middleware/Rewrite/src/UrlActions/AbortAction.cs similarity index 86% rename from src/Middleware/Rewrite/src/Internal/UrlActions/AbortAction.cs rename to src/Middleware/Rewrite/src/UrlActions/AbortAction.cs index d5c3182fb1..850b2fa566 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/AbortAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/AbortAction.cs @@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Rewrite.Logging; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class AbortAction : UrlAction + internal class AbortAction : UrlAction { public override void ApplyAction(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/ChangeCookieAction.cs b/src/Middleware/Rewrite/src/UrlActions/ChangeCookieAction.cs similarity index 95% rename from src/Middleware/Rewrite/src/Internal/UrlActions/ChangeCookieAction.cs rename to src/Middleware/Rewrite/src/UrlActions/ChangeCookieAction.cs index c758111ca1..b3b6452ac4 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/ChangeCookieAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/ChangeCookieAction.cs @@ -4,9 +4,9 @@ using System; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class ChangeCookieAction : UrlAction + internal class ChangeCookieAction : UrlAction { private readonly Func _timeSource; private CookieOptions _cachedOptions; diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/CustomResponseAction.cs b/src/Middleware/Rewrite/src/UrlActions/CustomResponseAction.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/UrlActions/CustomResponseAction.cs rename to src/Middleware/Rewrite/src/UrlActions/CustomResponseAction.cs index 5fb4253b24..1b3fb4c2fb 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/CustomResponseAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/CustomResponseAction.cs @@ -6,9 +6,9 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Rewrite.Logging; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class CustomResponseAction : UrlAction + internal class CustomResponseAction : UrlAction { public int StatusCode { get; } public string StatusReason { get; set; } diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/ForbiddenAction.cs b/src/Middleware/Rewrite/src/UrlActions/ForbiddenAction.cs similarity index 83% rename from src/Middleware/Rewrite/src/Internal/UrlActions/ForbiddenAction.cs rename to src/Middleware/Rewrite/src/UrlActions/ForbiddenAction.cs index 3a1c14e75f..cfa007b3b8 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/ForbiddenAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/ForbiddenAction.cs @@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class ForbiddenAction : UrlAction + internal class ForbiddenAction : UrlAction { public override void ApplyAction(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/GoneAction.cs b/src/Middleware/Rewrite/src/UrlActions/GoneAction.cs similarity index 84% rename from src/Middleware/Rewrite/src/Internal/UrlActions/GoneAction.cs rename to src/Middleware/Rewrite/src/UrlActions/GoneAction.cs index f85cd22e3b..553d5ca923 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/GoneAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/GoneAction.cs @@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class GoneAction : UrlAction + internal class GoneAction : UrlAction { public override void ApplyAction(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences) { diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/NoneAction.cs b/src/Middleware/Rewrite/src/UrlActions/NoneAction.cs similarity index 85% rename from src/Middleware/Rewrite/src/Internal/UrlActions/NoneAction.cs rename to src/Middleware/Rewrite/src/UrlActions/NoneAction.cs index 4ba171bb5e..691f453412 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/NoneAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/NoneAction.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class NoneAction : UrlAction + internal class NoneAction : UrlAction { public RuleResult Result { get; } diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/RedirectAction.cs b/src/Middleware/Rewrite/src/UrlActions/RedirectAction.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/UrlActions/RedirectAction.cs rename to src/Middleware/Rewrite/src/UrlActions/RedirectAction.cs index f3ac9d3196..4c271cae4a 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/RedirectAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/RedirectAction.cs @@ -5,9 +5,9 @@ using System; using Microsoft.AspNetCore.Http; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class RedirectAction : UrlAction + internal class RedirectAction : UrlAction { public int StatusCode { get; } public bool QueryStringAppend { get; } diff --git a/src/Middleware/Rewrite/src/Internal/UrlActions/RewriteAction.cs b/src/Middleware/Rewrite/src/UrlActions/RewriteAction.cs similarity index 97% rename from src/Middleware/Rewrite/src/Internal/UrlActions/RewriteAction.cs rename to src/Middleware/Rewrite/src/UrlActions/RewriteAction.cs index 8f9c5818d3..4f1e147a32 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlActions/RewriteAction.cs +++ b/src/Middleware/Rewrite/src/UrlActions/RewriteAction.cs @@ -5,9 +5,9 @@ using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions +namespace Microsoft.AspNetCore.Rewrite.UrlActions { - public class RewriteAction : UrlAction + internal class RewriteAction : UrlAction { public RuleResult Result { get; } public bool QueryStringAppend { get; } diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatch.cs b/src/Middleware/Rewrite/src/UrlMatch.cs similarity index 79% rename from src/Middleware/Rewrite/src/Internal/UrlMatch.cs rename to src/Middleware/Rewrite/src/UrlMatch.cs index 9d78d63d67..14e0b9f2f3 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatch.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal +namespace Microsoft.AspNetCore.Rewrite { - public abstract class UrlMatch + internal abstract class UrlMatch { protected bool Negate { get; set; } public abstract MatchResults Evaluate(string input, RewriteContext context); diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/ExactMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/ExactMatch.cs similarity index 90% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/ExactMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/ExactMatch.cs index 23db120580..76e767a71d 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/ExactMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/ExactMatch.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class ExactMatch : UrlMatch + internal class ExactMatch : UrlMatch { private readonly bool _ignoreCase; private readonly string _stringMatch; diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/FileSizeMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/FileSizeMatch.cs similarity index 84% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/FileSizeMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/FileSizeMatch.cs index e798b0191c..8dd07f6fcd 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/FileSizeMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/FileSizeMatch.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class FileSizeMatch : UrlMatch + internal class FileSizeMatch : UrlMatch { public FileSizeMatch(bool negate) { diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/IntegerMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/IntegerMatch.cs similarity index 95% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/IntegerMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/IntegerMatch.cs index 73b814731f..e6dd7996c3 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/IntegerMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/IntegerMatch.cs @@ -5,9 +5,9 @@ using System; using System.Globalization; using Microsoft.AspNetCore.Rewrite; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class IntegerMatch : UrlMatch + internal class IntegerMatch : UrlMatch { private readonly int _value; private readonly IntegerOperationType _operation; diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/IntegerOperation.cs b/src/Middleware/Rewrite/src/UrlMatches/IntegerOperation.cs similarity index 75% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/IntegerOperation.cs rename to src/Middleware/Rewrite/src/UrlMatches/IntegerOperation.cs index fce53e3844..64253ff7b8 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/IntegerOperation.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/IntegerOperation.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public enum IntegerOperationType + internal enum IntegerOperationType { Equal, Greater, diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/IsDirectoryMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/IsDirectoryMatch.cs similarity index 83% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/IsDirectoryMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/IsDirectoryMatch.cs index b4361c5d31..f8745855b4 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/IsDirectoryMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/IsDirectoryMatch.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class IsDirectoryMatch : UrlMatch + internal class IsDirectoryMatch : UrlMatch { public IsDirectoryMatch(bool negate) { diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/IsFileMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/IsFileMatch.cs similarity index 84% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/IsFileMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/IsFileMatch.cs index e4d4816133..e951d6df4a 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/IsFileMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/IsFileMatch.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class IsFileMatch : UrlMatch + internal class IsFileMatch : UrlMatch { public IsFileMatch(bool negate) { diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/RegexMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/RegexMatch.cs similarity index 87% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/RegexMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/RegexMatch.cs index 131eea8f9d..e0d0319a52 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/RegexMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/RegexMatch.cs @@ -3,9 +3,9 @@ using System.Text.RegularExpressions; -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class RegexMatch : UrlMatch + internal class RegexMatch : UrlMatch { private readonly Regex _match; diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/StringMatch.cs b/src/Middleware/Rewrite/src/UrlMatches/StringMatch.cs similarity index 94% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/StringMatch.cs rename to src/Middleware/Rewrite/src/UrlMatches/StringMatch.cs index e991144f2d..38e0fdccd2 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/StringMatch.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/StringMatch.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public class StringMatch : UrlMatch + internal class StringMatch : UrlMatch { private readonly string _value; private readonly StringOperationType _operation; diff --git a/src/Middleware/Rewrite/src/Internal/UrlMatches/StringOperation.cs b/src/Middleware/Rewrite/src/UrlMatches/StringOperation.cs similarity index 74% rename from src/Middleware/Rewrite/src/Internal/UrlMatches/StringOperation.cs rename to src/Middleware/Rewrite/src/UrlMatches/StringOperation.cs index 15ff45d5f0..b45a56e86e 100644 --- a/src/Middleware/Rewrite/src/Internal/UrlMatches/StringOperation.cs +++ b/src/Middleware/Rewrite/src/UrlMatches/StringOperation.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Rewrite.Internal.UrlMatches +namespace Microsoft.AspNetCore.Rewrite.UrlMatches { - public enum StringOperationType + internal enum StringOperationType { Equal, Greater, diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/ConditionPatternParserTest.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/ConditionPatternParserTest.cs index d9dc2a5cf8..2bd799cb57 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/ConditionPatternParserTest.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/ConditionPatternParserTest.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite @@ -10,16 +10,16 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite public class ConditionPatternParserTest { [Theory] - [InlineData(">hey", OperationType.Greater, "hey", ConditionType.StringComp)] - [InlineData("=hey", OperationType.GreaterEqual, "hey", ConditionType.StringComp)] - [InlineData("<=hey", OperationType.LessEqual, "hey", ConditionType.StringComp)] - [InlineData("=hey", OperationType.Equal, "hey", ConditionType.StringComp)] - public void ConditionPatternParser_CheckStringComp(string condition, OperationType operation, string variable, ConditionType conditionType) + [InlineData(">hey", (int)OperationType.Greater, "hey", (int)ConditionType.StringComp)] + [InlineData("=hey", (int)OperationType.GreaterEqual, "hey", (int)ConditionType.StringComp)] + [InlineData("<=hey", (int)OperationType.LessEqual, "hey", (int)ConditionType.StringComp)] + [InlineData("=hey", (int)OperationType.Equal, "hey", (int)ConditionType.StringComp)] + public void ConditionPatternParser_CheckStringComp(string condition, int operation, string variable, int conditionType) { var results = new ConditionPatternParser().ParseActionCondition(condition); - var expected = new ParsedModRewriteInput { OperationType = operation, ConditionType = conditionType, Operand = variable, Invert = false }; + var expected = new ParsedModRewriteInput { OperationType = (OperationType)operation, ConditionType = (ConditionType)conditionType, Operand = variable, Invert = false }; Assert.True(CompareConditions(expected, results)); } @@ -34,53 +34,53 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite } [Theory] - [InlineData("-d", OperationType.Directory, ConditionType.PropertyTest)] - [InlineData("-f", OperationType.RegularFile, ConditionType.PropertyTest)] - [InlineData("-F", OperationType.ExistingFile, ConditionType.PropertyTest)] - [InlineData("-h", OperationType.SymbolicLink, ConditionType.PropertyTest)] - [InlineData("-L", OperationType.SymbolicLink, ConditionType.PropertyTest)] - [InlineData("-l", OperationType.SymbolicLink, ConditionType.PropertyTest)] - [InlineData("-s", OperationType.Size, ConditionType.PropertyTest)] - [InlineData("-U", OperationType.ExistingUrl, ConditionType.PropertyTest)] - [InlineData("-x", OperationType.Executable, ConditionType.PropertyTest)] - public void ConditionPatternParser_CheckFileOperations(string condition, OperationType operation, ConditionType cond) + [InlineData("-d", (int)OperationType.Directory, (int)ConditionType.PropertyTest)] + [InlineData("-f", (int)OperationType.RegularFile, (int)ConditionType.PropertyTest)] + [InlineData("-F", (int)OperationType.ExistingFile, (int)ConditionType.PropertyTest)] + [InlineData("-h", (int)OperationType.SymbolicLink, (int)ConditionType.PropertyTest)] + [InlineData("-L", (int)OperationType.SymbolicLink, (int)ConditionType.PropertyTest)] + [InlineData("-l", (int)OperationType.SymbolicLink, (int)ConditionType.PropertyTest)] + [InlineData("-s", (int)OperationType.Size, (int)ConditionType.PropertyTest)] + [InlineData("-U", (int)OperationType.ExistingUrl, (int)ConditionType.PropertyTest)] + [InlineData("-x", (int)OperationType.Executable, (int)ConditionType.PropertyTest)] + public void ConditionPatternParser_CheckFileOperations(string condition, int operation, int cond) { var results = new ConditionPatternParser().ParseActionCondition(condition); - var expected = new ParsedModRewriteInput { ConditionType = cond, OperationType = operation, Invert = false }; + var expected = new ParsedModRewriteInput { ConditionType = (ConditionType)cond, OperationType = (OperationType)operation, Invert = false }; Assert.True(CompareConditions(expected, results)); } [Theory] - [InlineData("!-d", OperationType.Directory, ConditionType.PropertyTest)] - [InlineData("!-f", OperationType.RegularFile, ConditionType.PropertyTest)] - [InlineData("!-F", OperationType.ExistingFile, ConditionType.PropertyTest)] - [InlineData("!-h", OperationType.SymbolicLink, ConditionType.PropertyTest)] - [InlineData("!-L", OperationType.SymbolicLink, ConditionType.PropertyTest)] - [InlineData("!-l", OperationType.SymbolicLink, ConditionType.PropertyTest)] - [InlineData("!-s", OperationType.Size, ConditionType.PropertyTest)] - [InlineData("!-U", OperationType.ExistingUrl, ConditionType.PropertyTest)] - [InlineData("!-x", OperationType.Executable, ConditionType.PropertyTest)] - public void ConditionPatternParser_CheckFileOperationsInverted(string condition, OperationType operation, ConditionType cond) + [InlineData("!-d", (int)OperationType.Directory, (int)ConditionType.PropertyTest)] + [InlineData("!-f", (int)OperationType.RegularFile, (int)ConditionType.PropertyTest)] + [InlineData("!-F", (int)OperationType.ExistingFile, (int)ConditionType.PropertyTest)] + [InlineData("!-h", (int)OperationType.SymbolicLink, (int)ConditionType.PropertyTest)] + [InlineData("!-L", (int)OperationType.SymbolicLink, (int)ConditionType.PropertyTest)] + [InlineData("!-l", (int)OperationType.SymbolicLink, (int)ConditionType.PropertyTest)] + [InlineData("!-s", (int)OperationType.Size, (int)ConditionType.PropertyTest)] + [InlineData("!-U", (int)OperationType.ExistingUrl, (int)ConditionType.PropertyTest)] + [InlineData("!-x", (int)OperationType.Executable, (int)ConditionType.PropertyTest)] + public void ConditionPatternParser_CheckFileOperationsInverted(string condition, int operation, int cond) { var results = new ConditionPatternParser().ParseActionCondition(condition); - var expected = new ParsedModRewriteInput { ConditionType = cond, OperationType = operation, Invert = true }; + var expected = new ParsedModRewriteInput { ConditionType = (ConditionType)cond, OperationType = (OperationType)operation, Invert = true }; Assert.True(CompareConditions(expected, results)); } [Theory] - [InlineData("-gt1", OperationType.Greater, "1", ConditionType.IntComp)] - [InlineData("-lt1", OperationType.Less, "1", ConditionType.IntComp)] - [InlineData("-ge1", OperationType.GreaterEqual, "1", ConditionType.IntComp)] - [InlineData("-le1", OperationType.LessEqual, "1", ConditionType.IntComp)] - [InlineData("-eq1", OperationType.Equal, "1", ConditionType.IntComp)] - [InlineData("-ne1", OperationType.NotEqual, "1", ConditionType.IntComp)] - public void ConditionPatternParser_CheckIntComp(string condition, OperationType operation, string variable, ConditionType cond) + [InlineData("-gt1", (int)OperationType.Greater, "1", (int)ConditionType.IntComp)] + [InlineData("-lt1", (int)OperationType.Less, "1", (int)ConditionType.IntComp)] + [InlineData("-ge1", (int)OperationType.GreaterEqual, "1", (int)ConditionType.IntComp)] + [InlineData("-le1", (int)OperationType.LessEqual, "1", (int)ConditionType.IntComp)] + [InlineData("-eq1", (int)OperationType.Equal, "1", (int)ConditionType.IntComp)] + [InlineData("-ne1", (int)OperationType.NotEqual, "1", (int)ConditionType.IntComp)] + public void ConditionPatternParser_CheckIntComp(string condition, int operation, string variable, int cond) { var results = new ConditionPatternParser().ParseActionCondition(condition); - var expected = new ParsedModRewriteInput { ConditionType = cond, OperationType = operation, Invert = false, Operand = variable }; + var expected = new ParsedModRewriteInput { ConditionType = (ConditionType)cond, OperationType = (OperationType)operation, Invert = false, Operand = variable }; Assert.True(CompareConditions(expected, results)); } diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/CookieActionFactoryTest.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/CookieActionFactoryTest.cs index d992eb7937..dd6501bf97 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/CookieActionFactoryTest.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/CookieActionFactoryTest.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Test diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/FlagParserTest.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/FlagParserTest.cs index bfb4c6420f..bad4b598b9 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/FlagParserTest.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/FlagParserTest.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/FormatExceptionTests.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/FormatExceptionTests.cs index 20db752b1f..44066bcfd1 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/FormatExceptionTests.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/FormatExceptionTests.cs @@ -3,7 +3,7 @@ using System; using System.IO; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/RewriteTokenizerTest.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/RewriteTokenizerTest.cs index 04a7071d7b..0d192e2fe5 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/RewriteTokenizerTest.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/RewriteTokenizerTest.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/RuleBuilderTest.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/RuleBuilderTest.cs index ec0b46803f..fe63d9afe6 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/RuleBuilderTest.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/RuleBuilderTest.cs @@ -4,9 +4,8 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.UrlActions; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/RuleRegexParserTest.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/RuleRegexParserTest.cs index 20f54abba5..9af8163bf2 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/RuleRegexParserTest.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/RuleRegexParserTest.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite diff --git a/src/Middleware/Rewrite/test/ApacheModRewrite/TestStringParserTests.cs b/src/Middleware/Rewrite/test/ApacheModRewrite/TestStringParserTests.cs index eafb814ab1..3968c9e403 100644 --- a/src/Middleware/Rewrite/test/ApacheModRewrite/TestStringParserTests.cs +++ b/src/Middleware/Rewrite/test/ApacheModRewrite/TestStringParserTests.cs @@ -3,9 +3,8 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.ApacheModRewrite; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/FileParserTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/FileParserTests.cs index f6ad788aca..1949e773c8 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/FileParserTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/FileParserTests.cs @@ -4,10 +4,9 @@ using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlMatches; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/FormatExceptionHandlingTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/FormatExceptionHandlingTests.cs index 20ad022d5a..17cd5900d5 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/FormatExceptionHandlingTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/FormatExceptionHandlingTests.cs @@ -3,7 +3,7 @@ using System; using System.IO; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/InputParserTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/InputParserTests.cs index 0439bc4fa0..a737da083f 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/InputParserTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/InputParserTests.cs @@ -5,9 +5,8 @@ using System; using System.Linq; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Microsoft.Extensions.Logging.Abstractions; using Xunit; diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/InvalidUrlRewriteFormatExceptionHandlingTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/InvalidUrlRewriteFormatExceptionHandlingTests.cs index 4f6e77d01b..3784e692c9 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/InvalidUrlRewriteFormatExceptionHandlingTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/InvalidUrlRewriteFormatExceptionHandlingTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs index ce146b1df1..35df2b5c56 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs @@ -11,10 +11,9 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlMatches; using Microsoft.AspNetCore.TestHost; using Microsoft.Net.Http.Headers; using Xunit; @@ -553,9 +552,9 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite } [Theory] - [InlineData(@"^http://localhost(/.*)", "http://localhost/foo/bar", UriMatchPart.Path)] - [InlineData(@"^http://localhost(/.*)", "http://www.test.com/foo/bar", UriMatchPart.Full)] - public async Task Invoke_GlobalRuleConditionMatchesAgainstFullUri_CodedRule(string conditionInputPattern, string expectedResult, UriMatchPart uriMatchPart) + [InlineData(@"^http://localhost(/.*)", "http://localhost/foo/bar", (int)UriMatchPart.Path)] + [InlineData(@"^http://localhost(/.*)", "http://www.test.com/foo/bar", (int)UriMatchPart.Full)] + public async Task Invoke_GlobalRuleConditionMatchesAgainstFullUri_CodedRule(string conditionInputPattern, string expectedResult, int uriMatchPart) { // arrange var inputParser = new InputParser(); @@ -571,7 +570,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite inputParser, "{REQUEST_URI}", conditionInputPattern, - uriMatchPart, + (UriMatchPart)uriMatchPart, ignoreCase: true, negate: false); ruleBuilder.ConfigureConditionBehavior(LogicalGrouping.MatchAll, trackAllCaptures: true); @@ -579,7 +578,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite var action = new RewriteAction( RuleResult.SkipRemainingRules, - inputParser.ParseInputString(@"http://www.test.com{C:1}", uriMatchPart), + inputParser.ParseInputString(@"http://www.test.com{C:1}", (UriMatchPart)uriMatchPart), queryStringAppend: false); ruleBuilder.AddUrlAction(action); diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/RewriteMapParserTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/RewriteMapParserTests.cs index a917e675f7..f100eea479 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/RewriteMapParserTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/RewriteMapParserTests.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Xml.Linq; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.IISUrlRewrite diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/ServerVariableTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/ServerVariableTests.cs index 274ef848e5..d4aedd866c 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/ServerVariableTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/ServerVariableTests.cs @@ -5,8 +5,8 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Microsoft.Net.Http.Headers; using Xunit; @@ -15,52 +15,52 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.IISUrlRewrite public class ServerVariableTests { [Theory] - [InlineData("CONTENT_LENGTH", "10", UriMatchPart.Path)] - [InlineData("CONTENT_TYPE", "json", UriMatchPart.Path)] - [InlineData("HTTP_ACCEPT", "accept", UriMatchPart.Path)] - [InlineData("HTTP_COOKIE", "cookie", UriMatchPart.Path)] - [InlineData("HTTP_HOST", "example.com", UriMatchPart.Path)] - [InlineData("HTTP_REFERER", "referer", UriMatchPart.Path)] - [InlineData("HTTP_USER_AGENT", "useragent", UriMatchPart.Path)] - [InlineData("HTTP_CONNECTION", "connection", UriMatchPart.Path)] - [InlineData("HTTP_URL", "/foo", UriMatchPart.Path)] - [InlineData("HTTP_URL", "http://example.com/foo?bar=1", UriMatchPart.Full)] - [InlineData("QUERY_STRING", "bar=1", UriMatchPart.Path)] - [InlineData("REQUEST_FILENAME", "/foo", UriMatchPart.Path)] - [InlineData("REQUEST_URI", "/foo", UriMatchPart.Path)] - [InlineData("REQUEST_URI", "http://example.com/foo?bar=1", UriMatchPart.Full)] - [InlineData("REQUEST_METHOD", "GET", UriMatchPart.Full)] - public void CheckServerVariableParsingAndApplication(string variable, string expected, UriMatchPart uriMatchPart) + [InlineData("CONTENT_LENGTH", "10", (int)UriMatchPart.Path)] + [InlineData("CONTENT_TYPE", "json", (int)UriMatchPart.Path)] + [InlineData("HTTP_ACCEPT", "accept", (int)UriMatchPart.Path)] + [InlineData("HTTP_COOKIE", "cookie", (int)UriMatchPart.Path)] + [InlineData("HTTP_HOST", "example.com", (int)UriMatchPart.Path)] + [InlineData("HTTP_REFERER", "referer", (int)UriMatchPart.Path)] + [InlineData("HTTP_USER_AGENT", "useragent", (int)UriMatchPart.Path)] + [InlineData("HTTP_CONNECTION", "connection", (int)UriMatchPart.Path)] + [InlineData("HTTP_URL", "/foo", (int)UriMatchPart.Path)] + [InlineData("HTTP_URL", "http://example.com/foo?bar=1", (int)UriMatchPart.Full)] + [InlineData("QUERY_STRING", "bar=1", (int)UriMatchPart.Path)] + [InlineData("REQUEST_FILENAME", "/foo", (int)UriMatchPart.Path)] + [InlineData("REQUEST_URI", "/foo", (int)UriMatchPart.Path)] + [InlineData("REQUEST_URI", "http://example.com/foo?bar=1", (int)UriMatchPart.Full)] + [InlineData("REQUEST_METHOD", "GET", (int)UriMatchPart.Full)] + public void CheckServerVariableParsingAndApplication(string variable, string expected, int uriMatchPart) { // Arrange and Act var testParserContext = new ParserContext("test"); - var serverVar = ServerVariables.FindServerVariable(variable, testParserContext, uriMatchPart, true); + var serverVar = ServerVariables.FindServerVariable(variable, testParserContext, (UriMatchPart)uriMatchPart, true); var lookup = serverVar.Evaluate(CreateTestRewriteContext(), CreateTestRuleMatch().BackReferences, CreateTestCondMatch().BackReferences); // Assert Assert.Equal(expected, lookup); } [Theory] - [InlineData("CONTENT_LENGTH", "20", UriMatchPart.Path)] - [InlineData("CONTENT_TYPE", "text/xml", UriMatchPart.Path)] - [InlineData("HTTP_ACCEPT", "other-accept", UriMatchPart.Path)] - [InlineData("HTTP_COOKIE", "other-cookie", UriMatchPart.Path)] - [InlineData("HTTP_HOST", "otherexample.com", UriMatchPart.Path)] - [InlineData("HTTP_REFERER", "other-referer", UriMatchPart.Path)] - [InlineData("HTTP_USER_AGENT", "other-useragent", UriMatchPart.Path)] - [InlineData("HTTP_CONNECTION", "other-connection", UriMatchPart.Path)] - [InlineData("HTTP_URL", "http://otherexample.com/other-foo?bar=2", UriMatchPart.Full)] - [InlineData("HTTP_URL", "http://otherexample.com/other-foo?bar=2", UriMatchPart.Path)] - [InlineData("QUERY_STRING", "bar=2", UriMatchPart.Path)] - [InlineData("REQUEST_FILENAME", "/other-foo", UriMatchPart.Path)] - [InlineData("REQUEST_URI", "/other-foo", UriMatchPart.Path)] - [InlineData("REQUEST_URI", "/other-foo", UriMatchPart.Full)] - [InlineData("REQUEST_METHOD", "POST", UriMatchPart.Full)] - public void CheckServerVariableFeatureHasPrecedenceWhenEnabled(string variable, string expected, UriMatchPart uriMatchPart) + [InlineData("CONTENT_LENGTH", "20", (int)UriMatchPart.Path)] + [InlineData("CONTENT_TYPE", "text/xml", (int)UriMatchPart.Path)] + [InlineData("HTTP_ACCEPT", "other-accept", (int)UriMatchPart.Path)] + [InlineData("HTTP_COOKIE", "other-cookie", (int)UriMatchPart.Path)] + [InlineData("HTTP_HOST", "otherexample.com", (int)UriMatchPart.Path)] + [InlineData("HTTP_REFERER", "other-referer", (int)UriMatchPart.Path)] + [InlineData("HTTP_USER_AGENT", "other-useragent", (int)UriMatchPart.Path)] + [InlineData("HTTP_CONNECTION", "other-connection", (int)UriMatchPart.Path)] + [InlineData("HTTP_URL", "http://otherexample.com/other-foo?bar=2", (int)UriMatchPart.Full)] + [InlineData("HTTP_URL", "http://otherexample.com/other-foo?bar=2", (int)UriMatchPart.Path)] + [InlineData("QUERY_STRING", "bar=2", (int)UriMatchPart.Path)] + [InlineData("REQUEST_FILENAME", "/other-foo", (int)UriMatchPart.Path)] + [InlineData("REQUEST_URI", "/other-foo", (int)UriMatchPart.Path)] + [InlineData("REQUEST_URI", "/other-foo", (int)UriMatchPart.Full)] + [InlineData("REQUEST_METHOD", "POST", (int)UriMatchPart.Full)] + public void CheckServerVariableFeatureHasPrecedenceWhenEnabled(string variable, string expected, int uriMatchPart) { // Arrange and Act var testParserContext = new ParserContext("test"); - var serverVar = ServerVariables.FindServerVariable(variable, testParserContext, uriMatchPart, false); + var serverVar = ServerVariables.FindServerVariable(variable, testParserContext, (UriMatchPart)uriMatchPart, false); var httpContext = CreateTestHttpContext(); httpContext.Features.Set(new TestServerVariablesFeature(new Dictionary { @@ -87,26 +87,26 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.IISUrlRewrite } [Theory] - [InlineData("CONTENT_LENGTH", "10", UriMatchPart.Path)] - [InlineData("CONTENT_TYPE", "json", UriMatchPart.Path)] - [InlineData("HTTP_ACCEPT", "accept", UriMatchPart.Path)] - [InlineData("HTTP_COOKIE", "cookie", UriMatchPart.Path)] - [InlineData("HTTP_HOST", "example.com", UriMatchPart.Path)] - [InlineData("HTTP_REFERER", "referer", UriMatchPart.Path)] - [InlineData("HTTP_USER_AGENT", "useragent", UriMatchPart.Path)] - [InlineData("HTTP_CONNECTION", "connection", UriMatchPart.Path)] - [InlineData("HTTP_URL", "/foo", UriMatchPart.Path)] - [InlineData("HTTP_URL", "http://example.com/foo?bar=1", UriMatchPart.Full)] - [InlineData("QUERY_STRING", "bar=1", UriMatchPart.Path)] - [InlineData("REQUEST_FILENAME", "/foo", UriMatchPart.Path)] - [InlineData("REQUEST_URI", "/foo", UriMatchPart.Path)] - [InlineData("REQUEST_URI", "http://example.com/foo?bar=1", UriMatchPart.Full)] - [InlineData("REQUEST_METHOD", "GET", UriMatchPart.Full)] - public void CheckServerVariableFeatureIsntUsedWhenDisabled(string variable, string expected, UriMatchPart uriMatchPart) + [InlineData("CONTENT_LENGTH", "10", (int)UriMatchPart.Path)] + [InlineData("CONTENT_TYPE", "json", (int)UriMatchPart.Path)] + [InlineData("HTTP_ACCEPT", "accept", (int)UriMatchPart.Path)] + [InlineData("HTTP_COOKIE", "cookie", (int)UriMatchPart.Path)] + [InlineData("HTTP_HOST", "example.com", (int)UriMatchPart.Path)] + [InlineData("HTTP_REFERER", "referer", (int)UriMatchPart.Path)] + [InlineData("HTTP_USER_AGENT", "useragent", (int)UriMatchPart.Path)] + [InlineData("HTTP_CONNECTION", "connection", (int)UriMatchPart.Path)] + [InlineData("HTTP_URL", "/foo", (int)UriMatchPart.Path)] + [InlineData("HTTP_URL", "http://example.com/foo?bar=1", (int)UriMatchPart.Full)] + [InlineData("QUERY_STRING", "bar=1", (int)UriMatchPart.Path)] + [InlineData("REQUEST_FILENAME", "/foo", (int)UriMatchPart.Path)] + [InlineData("REQUEST_URI", "/foo", (int)UriMatchPart.Path)] + [InlineData("REQUEST_URI", "http://example.com/foo?bar=1", (int)UriMatchPart.Full)] + [InlineData("REQUEST_METHOD", "GET", (int)UriMatchPart.Full)] + public void CheckServerVariableFeatureIsntUsedWhenDisabled(string variable, string expected, int uriMatchPart) { // Arrange and Act var testParserContext = new ParserContext("test"); - var serverVar = ServerVariables.FindServerVariable(variable, testParserContext, uriMatchPart, true); + var serverVar = ServerVariables.FindServerVariable(variable, testParserContext, (UriMatchPart)uriMatchPart, true); var httpContext = CreateTestHttpContext(); httpContext.Features.Set(new TestServerVariablesFeature(new Dictionary { diff --git a/src/Middleware/Rewrite/test/IISUrlRewrite/UrlRewriteApplicationTests.cs b/src/Middleware/Rewrite/test/IISUrlRewrite/UrlRewriteApplicationTests.cs index d1b9a83936..c78a4787e8 100644 --- a/src/Middleware/Rewrite/test/IISUrlRewrite/UrlRewriteApplicationTests.cs +++ b/src/Middleware/Rewrite/test/IISUrlRewrite/UrlRewriteApplicationTests.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite diff --git a/src/Middleware/Rewrite/test/PatternSegments/ConditionMatchSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/ConditionMatchSegmentTests.cs index a67113954f..e568636304 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/ConditionMatchSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/ConditionMatchSegmentTests.cs @@ -2,8 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/DateTimeSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/DateTimeSegmentTests.cs index 8f5ef184a8..2e142567a6 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/DateTimeSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/DateTimeSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/HeaderSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/HeaderSegmentTests.cs index b8472929b7..9f53cd5254 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/HeaderSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/HeaderSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/src/Middleware/Rewrite/test/PatternSegments/IsHttpsModSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/IsHttpsModSegmentTests.cs index b578b31bac..bd14c17372 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/IsHttpsModSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/IsHttpsModSegmentTests.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/IsHttpsSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/IsHttpsSegmentTests.cs index 789f94e670..2990ebe011 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/IsHttpsSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/IsHttpsSegmentTests.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/IsIPV6SegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/IsIPV6SegmentTests.cs index c787998e9c..3fe803be00 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/IsIPV6SegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/IsIPV6SegmentTests.cs @@ -4,7 +4,7 @@ using System.Net; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/LIteralSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/LIteralSegmentTests.cs index 1bf3e74fee..5269ab07de 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/LIteralSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/LIteralSegmentTests.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/LocalAddressSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/LocalAddressSegmentTests.cs index 07d7254574..a9f26d3373 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/LocalAddressSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/LocalAddressSegmentTests.cs @@ -4,7 +4,7 @@ using System.Net; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/LocalPortSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/LocalPortSegmentTests.cs index 1a3dad1896..7dae569646 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/LocalPortSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/LocalPortSegmentTests.cs @@ -4,7 +4,7 @@ using System.Globalization; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/QueryStringSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/QueryStringSegmentTests.cs index 3e7190ef9d..09ad2e4d69 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/QueryStringSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/QueryStringSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/RemoteAddressSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/RemoteAddressSegmentTests.cs index c7f5ede0dc..ec0316535a 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/RemoteAddressSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/RemoteAddressSegmentTests.cs @@ -3,7 +3,7 @@ using System.Net; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/RemotePortSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/RemotePortSegmentTests.cs index 6980e2379f..fd016fcd6e 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/RemotePortSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/RemotePortSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/RequestFilenameSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/RequestFilenameSegmentTests.cs index 16e051d7af..c4f90e5cae 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/RequestFilenameSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/RequestFilenameSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/RequestMethodSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/RequestMethodSegmentTests.cs index 0fa65a8182..c86ade7db9 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/RequestMethodSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/RequestMethodSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/RuleMatchSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/RuleMatchSegmentTests.cs index 56189c9bee..a7add81115 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/RuleMatchSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/RuleMatchSegmentTests.cs @@ -2,8 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/SchemeSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/SchemeSegmentTests.cs index 3caac305c6..c60463c5a0 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/SchemeSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/SchemeSegmentTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/ServerProtocolSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/ServerProtocolSegmentTests.cs index 9128ef6b32..c1ec80de68 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/ServerProtocolSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/ServerProtocolSegmentTests.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/ToLowerSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/ToLowerSegmentTests.cs index a6b434ff3d..be274a57d0 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/ToLowerSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/ToLowerSegmentTests.cs @@ -2,8 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/UrlEncodeSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/UrlEncodeSegmentTests.cs index 767876a9a5..cf3c65c5e8 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/UrlEncodeSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/UrlEncodeSegmentTests.cs @@ -2,8 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments diff --git a/src/Middleware/Rewrite/test/PatternSegments/UrlSegmentTests.cs b/src/Middleware/Rewrite/test/PatternSegments/UrlSegmentTests.cs index e85c5662b4..cf513624a1 100644 --- a/src/Middleware/Rewrite/test/PatternSegments/UrlSegmentTests.cs +++ b/src/Middleware/Rewrite/test/PatternSegments/UrlSegmentTests.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite; -using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; +using Microsoft.AspNetCore.Rewrite.IISUrlRewrite; +using Microsoft.AspNetCore.Rewrite.PatternSegments; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments @@ -11,19 +11,19 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments public class UrlSegmentTests { [Theory] - [InlineData("http", "localhost", 80, null, UriMatchPart.Path, "")] - [InlineData("http", "localhost", 80, "", UriMatchPart.Path, "")] - [InlineData("http", "localhost", 80, "/foo/bar", UriMatchPart.Path, "/foo/bar")] - [InlineData("http", "localhost", 80, "/foo:bar", UriMatchPart.Path, "/foo:bar")] - [InlineData("http", "localhost", 80, "/foo bar", UriMatchPart.Path, "/foo%20bar")] - [InlineData("http", "localhost", 80, null, UriMatchPart.Full, "http://localhost:80/")] - [InlineData("http", "localhost", 80, "", UriMatchPart.Full, "http://localhost:80/")] - [InlineData("http", "localhost", 80, "/foo:bar", UriMatchPart.Full, "http://localhost:80/foo:bar")] - [InlineData("http", "localhost", 80, "/foo bar", UriMatchPart.Full, "http://localhost:80/foo%20bar")] - [InlineData("http", "localhost", 80, "/foo/bar", UriMatchPart.Full, "http://localhost:80/foo/bar")] - [InlineData("http", "localhost", 81, "/foo/bar", UriMatchPart.Full, "http://localhost:81/foo/bar")] - [InlineData("https", "localhost", 443, "/foo/bar", UriMatchPart.Full, "https://localhost:443/foo/bar")] - public void AssertSegmentIsCorrect(string scheme, string host, int port, string path, UriMatchPart uriMatchPart, string expectedResult) + [InlineData("http", "localhost", 80, null, (int)UriMatchPart.Path, "")] + [InlineData("http", "localhost", 80, "", (int)UriMatchPart.Path, "")] + [InlineData("http", "localhost", 80, "/foo/bar", (int)UriMatchPart.Path, "/foo/bar")] + [InlineData("http", "localhost", 80, "/foo:bar", (int)UriMatchPart.Path, "/foo:bar")] + [InlineData("http", "localhost", 80, "/foo bar", (int)UriMatchPart.Path, "/foo%20bar")] + [InlineData("http", "localhost", 80, null, (int)UriMatchPart.Full, "http://localhost:80/")] + [InlineData("http", "localhost", 80, "", (int)UriMatchPart.Full, "http://localhost:80/")] + [InlineData("http", "localhost", 80, "/foo:bar", (int)UriMatchPart.Full, "http://localhost:80/foo:bar")] + [InlineData("http", "localhost", 80, "/foo bar", (int)UriMatchPart.Full, "http://localhost:80/foo%20bar")] + [InlineData("http", "localhost", 80, "/foo/bar", (int)UriMatchPart.Full, "http://localhost:80/foo/bar")] + [InlineData("http", "localhost", 81, "/foo/bar", (int)UriMatchPart.Full, "http://localhost:81/foo/bar")] + [InlineData("https", "localhost", 443, "/foo/bar", (int)UriMatchPart.Full, "https://localhost:443/foo/bar")] + public void AssertSegmentIsCorrect(string scheme, string host, int port, string path, int uriMatchPart, string expectedResult) { // Arrange var httpContext = new DefaultHttpContext(); @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.PatternSegments context.HttpContext = httpContext; // Act - var segment = new UrlSegment(uriMatchPart); + var segment = new UrlSegment((UriMatchPart)uriMatchPart); var results = segment.Evaluate(context, null, null); // Assert diff --git a/src/Middleware/Rewrite/test/UrlActions/AbortActionTests.cs b/src/Middleware/Rewrite/test/UrlActions/AbortActionTests.cs index e39e58fb84..654be9d3e5 100644 --- a/src/Middleware/Rewrite/test/UrlActions/AbortActionTests.cs +++ b/src/Middleware/Rewrite/test/UrlActions/AbortActionTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlActions; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlActions diff --git a/src/Middleware/Rewrite/test/UrlActions/ChangeCookieActionTests.cs b/src/Middleware/Rewrite/test/UrlActions/ChangeCookieActionTests.cs index 20096ef162..38365f7034 100644 --- a/src/Middleware/Rewrite/test/UrlActions/ChangeCookieActionTests.cs +++ b/src/Middleware/Rewrite/test/UrlActions/ChangeCookieActionTests.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlActions; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/src/Middleware/Rewrite/test/UrlActions/ForbiddenActionTests.cs b/src/Middleware/Rewrite/test/UrlActions/ForbiddenActionTests.cs index a9eac5a807..1dd8368792 100644 --- a/src/Middleware/Rewrite/test/UrlActions/ForbiddenActionTests.cs +++ b/src/Middleware/Rewrite/test/UrlActions/ForbiddenActionTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlActions; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlActions diff --git a/src/Middleware/Rewrite/test/UrlActions/GoneActionTests.cs b/src/Middleware/Rewrite/test/UrlActions/GoneActionTests.cs index 00720f85ef..b617332015 100644 --- a/src/Middleware/Rewrite/test/UrlActions/GoneActionTests.cs +++ b/src/Middleware/Rewrite/test/UrlActions/GoneActionTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlActions; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlActions diff --git a/src/Middleware/Rewrite/test/UrlMatches/ExactMatchTests.cs b/src/Middleware/Rewrite/test/UrlMatches/ExactMatchTests.cs index 7f7e82b9b2..94fb2f4aa3 100644 --- a/src/Middleware/Rewrite/test/UrlMatches/ExactMatchTests.cs +++ b/src/Middleware/Rewrite/test/UrlMatches/ExactMatchTests.cs @@ -2,9 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlMatches; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlMatches diff --git a/src/Middleware/Rewrite/test/UrlMatches/IntegerMatchTests.cs b/src/Middleware/Rewrite/test/UrlMatches/IntegerMatchTests.cs index 5dd87ca4ad..5979ed6835 100644 --- a/src/Middleware/Rewrite/test/UrlMatches/IntegerMatchTests.cs +++ b/src/Middleware/Rewrite/test/UrlMatches/IntegerMatchTests.cs @@ -4,9 +4,8 @@ using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Rewrite; -using Microsoft.AspNetCore.Rewrite.Internal; -using Microsoft.AspNetCore.Rewrite.Internal.UrlActions; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; +using Microsoft.AspNetCore.Rewrite.UrlActions; +using Microsoft.AspNetCore.Rewrite.UrlMatches; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlMatches @@ -21,19 +20,19 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlMatches } [Theory] - [InlineData(1,IntegerOperationType.Equal,"1",true)] - [InlineData(1, IntegerOperationType.NotEqual, "2", true)] - [InlineData(2, IntegerOperationType.Less, "1", true)] - [InlineData(1, IntegerOperationType.LessEqual, "2", false)] - [InlineData(1, IntegerOperationType.Greater, "2", true)] - [InlineData(2, IntegerOperationType.GreaterEqual, "1", false)] - [InlineData(1, IntegerOperationType.Equal, "Not an int", false)] - [InlineData(1, IntegerOperationType.Equal, "", false)] - [InlineData(1, IntegerOperationType.Equal, "2147483648", false)] - public void IntegerMatch_Evaluation_Cases_Tests(int value,IntegerOperationType operation, string input,bool expectedResult) + [InlineData(1, (int)IntegerOperationType.Equal,"1",true)] + [InlineData(1, (int)IntegerOperationType.NotEqual, "2", true)] + [InlineData(2, (int)IntegerOperationType.Less, "1", true)] + [InlineData(1, (int)IntegerOperationType.LessEqual, "2", false)] + [InlineData(1, (int)IntegerOperationType.Greater, "2", true)] + [InlineData(2, (int)IntegerOperationType.GreaterEqual, "1", false)] + [InlineData(1, (int)IntegerOperationType.Equal, "Not an int", false)] + [InlineData(1, (int)IntegerOperationType.Equal, "", false)] + [InlineData(1, (int)IntegerOperationType.Equal, "2147483648", false)] + public void IntegerMatch_Evaluation_Cases_Tests(int value, int operation, string input, bool expectedResult) { var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; - var integerMatch = new IntegerMatch(value, operation); + var integerMatch = new IntegerMatch(value, (IntegerOperationType)operation); var matchResult = integerMatch.Evaluate(input, context); Assert.Equal(expectedResult, matchResult.Success); } diff --git a/src/Middleware/Rewrite/test/UrlMatches/StringMatchTests.cs b/src/Middleware/Rewrite/test/UrlMatches/StringMatchTests.cs index a562fec6e2..857bdfc043 100644 --- a/src/Middleware/Rewrite/test/UrlMatches/StringMatchTests.cs +++ b/src/Middleware/Rewrite/test/UrlMatches/StringMatchTests.cs @@ -1,9 +1,9 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Rewrite.UrlMatches; using Xunit; namespace Microsoft.AspNetCore.Rewrite.Tests.UrlMatches @@ -11,17 +11,17 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlMatches public class StringMatchTests { [Theory] - [InlineData("hi", StringOperationType.Equal,true,"hi",true)] - [InlineData("a", StringOperationType.Greater, true, "b", true)] - [InlineData("a", StringOperationType.GreaterEqual, true, "b", true)] - [InlineData("b", StringOperationType.Less,true, "a", true)] - [InlineData("b", StringOperationType.LessEqual, true, "a", true)] - [InlineData("", StringOperationType.Equal, true, "", true)] - [InlineData(null, StringOperationType.Equal, true, null, true)] - public void StringMatch_Evaluation_Check_Cases(string value, StringOperationType operation, bool ignoreCase, string input, bool expectedResult) + [InlineData("hi", (int)StringOperationType.Equal,true,"hi",true)] + [InlineData("a", (int)StringOperationType.Greater, true, "b", true)] + [InlineData("a", (int)StringOperationType.GreaterEqual, true, "b", true)] + [InlineData("b", (int)StringOperationType.Less,true, "a", true)] + [InlineData("b", (int)StringOperationType.LessEqual, true, "a", true)] + [InlineData("", (int)StringOperationType.Equal, true, "", true)] + [InlineData(null, (int)StringOperationType.Equal, true, null, true)] + public void StringMatch_Evaluation_Check_Cases(string value, int operation, bool ignoreCase, string input, bool expectedResult) { var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; - var stringMatch = new StringMatch(value, operation, ignoreCase); + var stringMatch = new StringMatch(value, (StringOperationType)operation, ignoreCase); var matchResult = stringMatch.Evaluate(input, context); Assert.Equal(expectedResult, matchResult.Success); } diff --git a/src/Middleware/WebSockets/src/Internal/Constants.cs b/src/Middleware/WebSockets/src/Constants.cs similarity index 90% rename from src/Middleware/WebSockets/src/Internal/Constants.cs rename to src/Middleware/WebSockets/src/Constants.cs index 8fb17cf9c0..6208d4914a 100644 --- a/src/Middleware/WebSockets/src/Internal/Constants.cs +++ b/src/Middleware/WebSockets/src/Constants.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.WebSockets.Internal +namespace Microsoft.AspNetCore.WebSockets { internal static class Constants { diff --git a/src/Middleware/WebSockets/src/Internal/HandshakeHelpers.cs b/src/Middleware/WebSockets/src/HandshakeHelpers.cs similarity index 98% rename from src/Middleware/WebSockets/src/Internal/HandshakeHelpers.cs rename to src/Middleware/WebSockets/src/HandshakeHelpers.cs index 551ca879c9..0162751f16 100644 --- a/src/Middleware/WebSockets/src/Internal/HandshakeHelpers.cs +++ b/src/Middleware/WebSockets/src/HandshakeHelpers.cs @@ -8,7 +8,7 @@ using System.Text; using Microsoft.AspNetCore.Http; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.WebSockets.Internal +namespace Microsoft.AspNetCore.WebSockets { internal static class HandshakeHelpers { diff --git a/src/Middleware/WebSockets/src/WebSocketMiddleware.cs b/src/Middleware/WebSockets/src/WebSocketMiddleware.cs index 28f7f3a232..bff8a770d2 100644 --- a/src/Middleware/WebSockets/src/WebSocketMiddleware.cs +++ b/src/Middleware/WebSockets/src/WebSocketMiddleware.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.WebSockets.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; diff --git a/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs b/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs index 61b310f1b0..a997c88214 100644 --- a/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs +++ b/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs @@ -10,7 +10,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; -using Microsoft.AspNetCore.WebSockets.Internal; using Microsoft.Extensions.Logging.Testing; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/src/Middleware/WebSockets/test/UnitTests/WebSocketPair.cs b/src/Middleware/WebSockets/test/UnitTests/WebSocketPair.cs index d3050538a0..efb11af60c 100644 --- a/src/Middleware/WebSockets/test/UnitTests/WebSocketPair.cs +++ b/src/Middleware/WebSockets/test/UnitTests/WebSocketPair.cs @@ -1,6 +1,5 @@ using System; using System.Net.WebSockets; -using Microsoft.AspNetCore.WebSockets.Internal; namespace Microsoft.AspNetCore.WebSockets.Test { From 2a31739302c818e32444a0e4608b627acb179613 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 25 Jun 2019 13:32:21 -0700 Subject: [PATCH 08/21] Update doc comment for RazorInjectAttribute (#11554) * Update doc comment for RazorInjectAttribute --- src/Mvc/Mvc.Razor/src/Internal/RazorInjectAttribute.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Mvc/Mvc.Razor/src/Internal/RazorInjectAttribute.cs b/src/Mvc/Mvc.Razor/src/Internal/RazorInjectAttribute.cs index 72b1c31f49..a981e6eb66 100644 --- a/src/Mvc/Mvc.Razor/src/Internal/RazorInjectAttribute.cs +++ b/src/Mvc/Mvc.Razor/src/Internal/RazorInjectAttribute.cs @@ -5,8 +5,15 @@ using System; namespace Microsoft.AspNetCore.Mvc.Razor.Internal { + /// + /// Specifies that the attributed property should be bound using request services. + /// + /// This attribute is used as the backing attribute for the @inject + /// Razor directive. + /// + /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class RazorInjectAttribute : Attribute { } -} \ No newline at end of file +} From 0274aceaeef970bb19a04eb73cfe46e876ae99ee Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 25 Jun 2019 13:41:16 -0700 Subject: [PATCH 09/21] Generate .nupkg files that contain aspnetcore-runtime MSI for insertion into Visual Studio (#11345) --- eng/Signing.props | 2 ++ .../Windows/GenerateNugetPackageWithMsi.ps1 | 31 +++++++++++++++++++ .../SharedFramework/SharedFramework.wixproj | 19 ++++++++++++ .../SharedFrameworkPackage.nuspec | 19 ++++++++++++ .../TargetingPack/TargetingPack.wixproj | 18 +++++++++++ .../TargetingPack/TargetingPackPackage.nuspec | 18 +++++++++++ src/Installers/Windows/Wix.props | 1 + src/SiteExtensions/build.cmd | 2 +- 8 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 src/Installers/Windows/GenerateNugetPackageWithMsi.ps1 create mode 100644 src/Installers/Windows/SharedFramework/SharedFrameworkPackage.nuspec create mode 100644 src/Installers/Windows/TargetingPack/TargetingPackPackage.nuspec diff --git a/eng/Signing.props b/eng/Signing.props index 26491b99d1..0e8b87b4dd 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -24,6 +24,8 @@ + + + + + + $(InstallersOutputPath)$(PackageFileName) + + + diff --git a/src/Installers/Windows/TargetingPack/TargetingPackPackage.nuspec b/src/Installers/Windows/TargetingPack/TargetingPackPackage.nuspec new file mode 100644 index 0000000000..51f4a304e4 --- /dev/null +++ b/src/Installers/Windows/TargetingPack/TargetingPackPackage.nuspec @@ -0,0 +1,18 @@ + + + + VS.Redist.Common.AspNetCore.TargetingPack.$ARCH$.$MAJOR$.$MINOR$ + 1.0.0 + VS.Redist.Common.AspNetCore.TargetingPack.$ARCH$.$MAJOR$.$MINOR$ + Microsoft + Microsoft + https://www.microsoft.com/net/dotnet_library_license.htm + https://github.com/aspnet/aspnetcore + true + $MAJOR$.$MINOR$ ASP.NET Core TargetingPack ($ARCH$) Windows Installer MSI as a .nupkg for internal Visual Studio build consumption + © Microsoft Corporation. All rights reserved. + + + + + \ No newline at end of file diff --git a/src/Installers/Windows/Wix.props b/src/Installers/Windows/Wix.props index a76eaf631d..c9b7565fe8 100644 --- a/src/Installers/Windows/Wix.props +++ b/src/Installers/Windows/Wix.props @@ -25,6 +25,7 @@ $(DefineConstants);files=$(MSBuildThisFileDirectory)files $(DefineConstants);Culture=$(Cultures) + $(RepoRoot)\src\Installers\Windows\GenerateNugetPackageWithMsi.ps1 diff --git a/src/SiteExtensions/build.cmd b/src/SiteExtensions/build.cmd index 8535c444d2..b8b980af6f 100644 --- a/src/SiteExtensions/build.cmd +++ b/src/SiteExtensions/build.cmd @@ -24,4 +24,4 @@ IF %ERRORLEVEL% NEQ 0 ( EXIT /b %ErrorLevel% ) -ECHO SiteExtensions successly built! \ No newline at end of file +ECHO SiteExtensions successly built! From 7003fb53d542de6f4bf999f2edaa91c6951e1be0 Mon Sep 17 00:00:00 2001 From: Kristian Hellang Date: Wed, 26 Jun 2019 00:07:35 +0200 Subject: [PATCH 10/21] Add explicit content types to 'no formatter' logging (#11213) * Add explicit content types to 'no formatter' logging * Remove dead code --- .../DefaultOutputFormatterSelector.cs | 7 ++-- .../Infrastructure/ObjectResultExecutor.cs | 2 +- .../Mvc.Core/src/MvcCoreLoggerExtensions.cs | 21 +++++++----- .../test/MvcCoreLoggerExtensionsTest.cs | 33 +++++++++++++++++++ 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/DefaultOutputFormatterSelector.cs b/src/Mvc/Mvc.Core/src/Infrastructure/DefaultOutputFormatterSelector.cs index bafe6d239d..d26d7decb4 100644 --- a/src/Mvc/Mvc.Core/src/Infrastructure/DefaultOutputFormatterSelector.cs +++ b/src/Mvc/Mvc.Core/src/Infrastructure/DefaultOutputFormatterSelector.cs @@ -147,14 +147,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure } } - if (selectedFormatter == null) + if (selectedFormatter != null) { - // No formatter supports this. - _logger.NoFormatter(context); - return null; + _logger.FormatterSelected(selectedFormatter, context); } - _logger.FormatterSelected(selectedFormatter, context); return selectedFormatter; } diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs b/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs index 3dd2ddc845..8f2a40bbfc 100644 --- a/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs +++ b/src/Mvc/Mvc.Core/src/Infrastructure/ObjectResultExecutor.cs @@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure if (selectedFormatter == null) { // No formatter supports this. - Logger.NoFormatter(formatterContext); + Logger.NoFormatter(formatterContext, result.ContentTypes); context.HttpContext.Response.StatusCode = StatusCodes.Status406NotAcceptable; return Task.CompletedTask; diff --git a/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs b/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs index 26534c1712..17a94f3edf 100644 --- a/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs +++ b/src/Mvc/Mvc.Core/src/MvcCoreLoggerExtensions.cs @@ -4,7 +4,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Reflection; using System.Security.Claims; @@ -28,8 +27,6 @@ namespace Microsoft.AspNetCore.Mvc public const string ActionFilter = "Action Filter"; private static readonly string[] _noFilters = new[] { "None" }; - private static readonly double TimestampToTicks = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency; - private static readonly Action _actionExecuting; private static readonly Action _controllerActionExecuting; private static readonly Action _actionExecuted; @@ -73,7 +70,7 @@ namespace Microsoft.AspNetCore.Mvc private static readonly Action _localRedirectResultExecuting; private static readonly Action _objectResultExecuting; - private static readonly Action _noFormatter; + private static readonly Action, Exception> _noFormatter; private static readonly Action _formatterSelected; private static readonly Action _skippedContentNegotiation; private static readonly Action _noAcceptForNegotiation; @@ -300,10 +297,10 @@ namespace Microsoft.AspNetCore.Mvc new EventId(1, "LocalRedirectResultExecuting"), "Executing LocalRedirectResult, redirecting to {Destination}."); - _noFormatter = LoggerMessage.Define( + _noFormatter = LoggerMessage.Define>( LogLevel.Warning, new EventId(1, "NoFormatter"), - "No output formatter was found for content type '{ContentType}' to write the response."); + "No output formatter was found for content types '{ContentTypes}' to write the response."); _objectResultExecuting = LoggerMessage.Define( LogLevel.Information, @@ -1017,11 +1014,19 @@ namespace Microsoft.AspNetCore.Mvc public static void NoFormatter( this ILogger logger, - OutputFormatterCanWriteContext formatterContext) + OutputFormatterCanWriteContext context, + MediaTypeCollection contentTypes) { if (logger.IsEnabled(LogLevel.Warning)) { - _noFormatter(logger, Convert.ToString(formatterContext.ContentType), null); + var considered = new List(contentTypes); + + if (context.ContentType.HasValue) + { + considered.Add(Convert.ToString(context.ContentType)); + } + + _noFormatter(logger, considered, null); } } diff --git a/src/Mvc/Mvc.Core/test/MvcCoreLoggerExtensionsTest.cs b/src/Mvc/Mvc.Core/test/MvcCoreLoggerExtensionsTest.cs index ae6987a4c4..37688c2107 100644 --- a/src/Mvc/Mvc.Core/test/MvcCoreLoggerExtensionsTest.cs +++ b/src/Mvc/Mvc.Core/test/MvcCoreLoggerExtensionsTest.cs @@ -1,7 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Extensions.Logging.Testing; using Moq; using Xunit; @@ -282,6 +284,37 @@ namespace Microsoft.AspNetCore.Mvc write.State.ToString()); } + [Fact] + public void NoFormatter_LogsListOfContentTypes() + { + // Arrange + var testSink = new TestSink(); + var loggerFactory = new TestLoggerFactory(testSink, enabled: true); + var logger = loggerFactory.CreateLogger("test"); + + var mediaTypes = new MediaTypeCollection + { + "application/problem+json", + "application/problem+xml", + }; + + var httpContext = Mock.Of(); + var context = new Mock(httpContext); + + context.SetupGet(x => x.ContentType).Returns("application/json"); + + // Act + logger.NoFormatter(context.Object, mediaTypes); + + // Assert + var write = Assert.Single(testSink.Writes); + Assert.Equal( + "No output formatter was found for content types " + + "'application/problem+json, application/problem+xml, application/json'" + + " to write the response.", + write.State.ToString()); + } + public interface IOrderedAuthorizeFilter : IAuthorizationFilter, IAsyncAuthorizationFilter, IOrderedFilter { } public interface IOrderedResourceFilter : IResourceFilter, IAsyncResourceFilter, IOrderedFilter { } From 73a2603aa68a0e039ce6826db9e392e620a199d1 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 25 Jun 2019 15:34:08 -0700 Subject: [PATCH 11/21] Fix Complete in Message Bodies (#11066) --- .../Http/Http1ChunkedEncodingMessageBody.cs | 17 +++++- .../Http/Http1ContentLengthMessageBody.cs | 19 +++---- .../src/Internal/Http/Http1MessageBody.cs | 18 +++++- .../Internal/Http/Http1UpgradeMessageBody.cs | 11 +++- .../Kestrel/Core/test/MessageBodyTests.cs | 49 +++++++++++++++- .../ChunkedRequestTests.cs | 57 +++++++++++++++++++ .../InMemory.FunctionalTests/RequestTests.cs | 42 ++++++++++++++ 7 files changed, 197 insertions(+), 16 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs index db9e78aa2f..fabf8950a4 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs @@ -50,6 +50,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } public override bool TryRead(out ReadResult readResult) + { + ThrowIfCompleted(); + + return TryReadInternal(out readResult); + } + + public override bool TryReadInternal(out ReadResult readResult) { TryStart(); @@ -65,7 +72,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return boolResult; } - public override async ValueTask ReadAsync(CancellationToken cancellationToken = default) + public override ValueTask ReadAsync(CancellationToken cancellationToken = default) + { + ThrowIfCompleted(); + return ReadAsyncInternal(cancellationToken); + } + + public override async ValueTask ReadAsyncInternal(CancellationToken cancellationToken = default) { TryStart(); @@ -92,7 +105,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http public override void Complete(Exception exception) { - _requestBodyPipe.Reader.Complete(); + _completed = true; _context.ReportApplicationError(exception); } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs index 2d13e68680..7b4875aaa0 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs @@ -15,7 +15,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http private readonly long _contentLength; private long _inputLength; private bool _readCompleted; - private bool _completed; private bool _isReading; private int _userCanceled; private long _totalExaminedInPreviousReadResult; @@ -29,10 +28,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http _inputLength = _contentLength; } - public override async ValueTask ReadAsync(CancellationToken cancellationToken = default) + public override ValueTask ReadAsync(CancellationToken cancellationToken = default) { ThrowIfCompleted(); + return ReadAsyncInternal(cancellationToken); + } + public override async ValueTask ReadAsyncInternal(CancellationToken cancellationToken = default) + { if (_isReading) { throw new InvalidOperationException("Reading is already in progress."); @@ -112,7 +115,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http public override bool TryRead(out ReadResult readResult) { ThrowIfCompleted(); + return TryReadInternal(out readResult); + } + public override bool TryReadInternal(out ReadResult readResult) + { if (_isReading) { throw new InvalidOperationException("Reading is already in progress."); @@ -164,14 +171,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return OnConsumeAsync(); } - - private void ThrowIfCompleted() - { - if (_completed) - { - throw new InvalidOperationException("Reading is not allowed after the reader was completed."); - } - } private void CreateReadResultFromConnectionReadResult() { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs index 0691c842d7..f2f8ae6434 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs @@ -3,6 +3,7 @@ using System; using System.IO.Pipelines; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; @@ -12,6 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http internal abstract class Http1MessageBody : MessageBody { protected readonly Http1Connection _context; + protected bool _completed; protected Http1MessageBody(Http1Connection context) : base(context) @@ -34,11 +36,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } } + public abstract bool TryReadInternal(out ReadResult readResult); + + public abstract ValueTask ReadAsyncInternal(CancellationToken cancellationToken = default); + protected override Task OnConsumeAsync() { try { - if (TryRead(out var readResult)) + while (TryReadInternal(out var readResult)) { AdvanceTo(readResult.Buffer.End); @@ -79,7 +85,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http ReadResult result; do { - result = await ReadAsync(); + result = await ReadAsyncInternal(); AdvanceTo(result.Buffer.End); } while (!result.IsCompleted); } @@ -177,5 +183,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http context.OnTrailersComplete(); // No trailers for these. return keepAlive ? MessageBody.ZeroContentLengthKeepAlive : MessageBody.ZeroContentLengthClose; } + + protected void ThrowIfCompleted() + { + if (_completed) + { + throw new InvalidOperationException("Reading is not allowed after the reader was completed."); + } + } } } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs index 3958fad0ba..8d01c9232f 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs @@ -14,7 +14,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http /// internal sealed class Http1UpgradeMessageBody : Http1MessageBody { - public bool _completed; public Http1UpgradeMessageBody(Http1Connection context) : base(context) { @@ -78,5 +77,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { return Task.CompletedTask; } + + public override bool TryReadInternal(out ReadResult readResult) + { + return _context.Input.TryRead(out readResult); + } + + public override ValueTask ReadAsyncInternal(CancellationToken cancellationToken = default) + { + return _context.Input.ReadAsync(cancellationToken); + } } } diff --git a/src/Servers/Kestrel/Core/test/MessageBodyTests.cs b/src/Servers/Kestrel/Core/test/MessageBodyTests.cs index 94d4ff0b74..a361e2d1c4 100644 --- a/src/Servers/Kestrel/Core/test/MessageBodyTests.cs +++ b/src/Servers/Kestrel/Core/test/MessageBodyTests.cs @@ -1235,6 +1235,30 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } } + [Fact] + public async Task CompleteForContentLengthAllowsConsumeToWork() + { + using (var input = new TestInput()) + { + var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); + var reader = new HttpRequestPipeReader(); + reader.StartAcceptingReads(body); + + input.Add("a"); + + Assert.True(reader.TryRead(out var readResult)); + + Assert.False(readResult.IsCompleted); + + input.Add("asdf"); + + reader.AdvanceTo(readResult.Buffer.End); + reader.Complete(); + + await body.ConsumeAsync(); + } + } + [Fact] public async Task CompleteForContentLengthDoesNotCompleteConnectionPipeMakesReadReturnThrow() { @@ -1261,6 +1285,30 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } } + [Fact] + public async Task CompleteForChunkedAllowsConsumeToWork() + { + using (var input = new TestInput()) + { + var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); + var reader = new HttpRequestPipeReader(); + reader.StartAcceptingReads(body); + + input.Add("5\r\nHello\r\n"); + + Assert.True(reader.TryRead(out var readResult)); + + Assert.False(readResult.IsCompleted); + reader.AdvanceTo(readResult.Buffer.End); + + input.Add("1\r\nH\r\n0\r\n\r\n"); + + reader.Complete(); + + await body.ConsumeAsync(); + } + } + [Fact] public async Task CompleteForChunkedDoesNotCompleteConnectionPipeMakesReadThrow() { @@ -1313,7 +1361,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } } - [Fact] public async Task CompleteForZeroByteBodyDoesNotCompleteConnectionPipeNoopsReads() { diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/ChunkedRequestTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/ChunkedRequestTests.cs index 12ac5791ff..72d7c2cc7c 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/ChunkedRequestTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/ChunkedRequestTests.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport; using Microsoft.AspNetCore.Testing; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Xunit; @@ -991,6 +992,62 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests } } + [Fact] + public async Task ChunkedRequestCallCompleteDoesNotCauseException() + { + var testContext = new TestServiceContext(LoggerFactory); + + await using (var server = new TestServer(async httpContext => + { + var request = httpContext.Request; + + // This read may receive all data, but what we care about + // is that ConsumeAsync is called and doesn't error. Calling + // TryRead before would always fail. + var readResult = await request.BodyReader.ReadAsync(); + request.BodyReader.AdvanceTo(readResult.Buffer.End); + + request.BodyReader.Complete(); + + }, testContext)) + { + using (var connection = server.CreateConnection()) + { + await connection.Send( + "POST / HTTP/1.1", + "Host:", + "Transfer-Encoding: chunked", + "", + "1", + "H", + "4", + "ello", + "0", + "", + ""); + + await connection.Receive( + "HTTP/1.1 200 OK", + $"Date: {testContext.DateHeaderValue}", + "Content-Length: 0", + "", + ""); + + // start another request to make sure OnComsumeAsync is hit + await connection.Send( + "POST / HTTP/1.1", + "Host:", + "Transfer-Encoding: chunked", + "", + "0", + "", + ""); + } + } + + Assert.All(TestSink.Writes, w => Assert.InRange(w.LogLevel, LogLevel.Trace, LogLevel.Information)); + } + [Fact] public async Task ChunkedRequestCallCompleteWithExceptionCauses500() { diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs index 7ed5fb5934..8e9414f519 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs @@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Xunit; @@ -1535,6 +1536,47 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests } } + [Fact] + public async Task ContentLengthRequestCallCompleteDoesNotCauseException() + { + var testContext = new TestServiceContext(LoggerFactory); + + var tcs = new TaskCompletionSource(); + await using (var server = new TestServer(async httpContext => + { + var request = httpContext.Request; + + var readResult = await request.BodyReader.ReadAsync(); + request.BodyReader.AdvanceTo(readResult.Buffer.End); + + httpContext.Request.BodyReader.Complete(); + + tcs.SetResult(null); + + }, testContext)) + { + using (var connection = server.CreateConnection()) + { + await connection.Send( + "POST / HTTP/1.1", + "Host:", + "Content-Length: 5", + "", + "He"); + await tcs.Task; + await connection.Send("llo"); + await connection.Receive( + "HTTP/1.1 200 OK", + $"Date: {testContext.DateHeaderValue}", + "Content-Length: 0", + "", + ""); + } + } + + Assert.All(TestSink.Writes, w => Assert.InRange(w.LogLevel, LogLevel.Trace, LogLevel.Information)); + } + [Fact] public async Task ContentLengthCallCompleteWithExceptionCauses500() { From f40bfde9ff3e2dc48ab5165cbc618c0c1a09c2ab Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Tue, 25 Jun 2019 15:51:20 -0700 Subject: [PATCH 12/21] Make Razor file encoding consistent (#11530) * Make Razor file encoding consistent * feedback --- .../content/RazorComponent/Component1.razor | 2 +- .../Identity/Pages/Account/LogOut.cshtml | 2 +- .../Pages/Shared/_LoginPartial.cshtml | 2 +- .../Pages/Counter.razor | 2 +- .../Pages/FetchData.razor | 2 +- .../Pages/_Host.cshtml | 2 +- .../LoginDisplay.IndividualB2CAuth.razor | 2 +- .../LoginDisplay.IndividualLocalAuth.razor | 2 +- .../LoginDisplay.OrganizationalAuth.razor | 2 +- .../Shared/LoginDisplay.WindowsAuth.razor | 2 +- .../Shared/NavMenu.razor | 2 +- .../RazorComponentsWeb-CSharp/_Imports.razor | 2 +- .../Shared/_LoginPartial.Identity.cshtml | 2 +- .../Pages/Shared/_LoginPartial.OrgAuth.cshtml | 2 +- .../Shared/_ValidationScriptsPartial.cshtml | 2 +- .../Pages/_ViewImports.cshtml | 2 +- .../Shared/_LoginPartial.Identity.cshtml | 2 +- .../Views/Shared/_LoginPartial.OrgAuth.cshtml | 2 +- .../Shared/_ValidationScriptsPartial.cshtml | 2 +- .../test/ByteOrderMarkTest.cs | 37 +++++++++++++++++-- 20 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/ProjectTemplates/Web.ItemTemplates/content/RazorComponent/Component1.razor b/src/ProjectTemplates/Web.ItemTemplates/content/RazorComponent/Component1.razor index bc0a14eec4..ec18562296 100644 --- a/src/ProjectTemplates/Web.ItemTemplates/content/RazorComponent/Component1.razor +++ b/src/ProjectTemplates/Web.ItemTemplates/content/RazorComponent/Component1.razor @@ -1,4 +1,4 @@ -

Component1

+

Component1

@code { diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Account/LogOut.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Account/LogOut.cshtml index 4ea81fc052..c6da14beca 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Account/LogOut.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Account/LogOut.cshtml @@ -1,4 +1,4 @@ -@page +@page @using Microsoft.AspNetCore.Identity @inject SignInManager SignInManager @functions { diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Shared/_LoginPartial.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Shared/_LoginPartial.cshtml index e55bafe6a7..e35168507a 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Shared/_LoginPartial.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Areas/Identity/Pages/Shared/_LoginPartial.cshtml @@ -1,4 +1,4 @@ -@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.Identity @inject SignInManager SignInManager @inject UserManager UserManager @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/Counter.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/Counter.razor index ea87f6be2d..1360f9eb12 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/Counter.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/Counter.razor @@ -1,4 +1,4 @@ -@page "/counter" +@page "/counter"

Counter

diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/FetchData.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/FetchData.razor index 25e30159f4..896e045212 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/FetchData.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/FetchData.razor @@ -1,4 +1,4 @@ -@page "/fetchdata" +@page "/fetchdata" @using RazorComponentsWeb_CSharp.Data @inject WeatherForecastService ForecastService diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/_Host.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/_Host.cshtml index 4eff49f3b4..9bf4baa567 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/_Host.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Pages/_Host.cshtml @@ -1,4 +1,4 @@ -@page "/" +@page "/" @namespace RazorComponentsWeb_CSharp.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualB2CAuth.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualB2CAuth.razor index d971d6206e..c8891a3360 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualB2CAuth.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualB2CAuth.razor @@ -1,4 +1,4 @@ -@using Microsoft.AspNetCore.Authentication.AzureADB2C.UI +@using Microsoft.AspNetCore.Authentication.AzureADB2C.UI @using Microsoft.Extensions.Options @inject IOptionsMonitor AzureADB2COptions diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualLocalAuth.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualLocalAuth.razor index efe5d380ee..9c976507b7 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualLocalAuth.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.IndividualLocalAuth.razor @@ -1,4 +1,4 @@ - + Hello, @context.User.Identity.Name! Log out diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.OrganizationalAuth.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.OrganizationalAuth.razor index fd7d5a95e7..fc4422a056 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.OrganizationalAuth.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.OrganizationalAuth.razor @@ -1,4 +1,4 @@ - + Hello, @context.User.Identity.Name! Log out diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.WindowsAuth.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.WindowsAuth.razor index 77d7fb78f2..bf579153e2 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.WindowsAuth.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/LoginDisplay.WindowsAuth.razor @@ -1,3 +1,3 @@ - + Hello, @context.User.Identity.Name! diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/NavMenu.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/NavMenu.razor index e64d6b2c21..e2bcf2c748 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/NavMenu.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorComponentsWeb-CSharp/Shared/NavMenu.razor @@ -1,4 +1,4 @@ -