diff --git a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs index 1ca1f57fc5..494b91c540 100644 --- a/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs +++ b/src/Antiforgery/test/DefaultAntiforgeryTokenStoreTest.cs @@ -5,8 +5,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Primitives; +using Microsoft.Net.Http.Headers; using Moq; using Xunit; @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Antiforgery.Internal public void GetCookieToken_CookieDoesNotExist_ReturnsNull() { // Arrange - var httpContext = GetHttpContext(new RequestCookieCollection()); + var httpContext = GetHttpContext(); var options = new AntiforgeryOptions { Cookie = { Name = _cookieName } @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Antiforgery.Internal public async Task GetRequestTokens_CookieIsEmpty_ReturnsNullTokens() { // Arrange - var httpContext = GetHttpContext(new RequestCookieCollection()); + var httpContext = GetHttpContext(); httpContext.Request.Form = FormCollection.Empty; var options = new AntiforgeryOptions @@ -407,18 +407,14 @@ namespace Microsoft.AspNetCore.Antiforgery.Internal private HttpContext GetHttpContext(string cookieName, string cookieValue) { - var cookies = new RequestCookieCollection(new Dictionary - { - { cookieName, cookieValue }, - }); - - return GetHttpContext(cookies); + var context = GetHttpContext(); + context.Request.Headers[HeaderNames.Cookie] = $"{cookieName}={cookieValue}"; + return context; } - private HttpContext GetHttpContext(IRequestCookieCollection cookies) + private HttpContext GetHttpContext() { var httpContext = new DefaultHttpContext(); - httpContext.Request.Cookies = cookies; return httpContext; } diff --git a/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs b/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs index 817ec5474d..ac56285eef 100644 --- a/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs +++ b/src/Components/Server/test/ComponentEndpointRouteBuilderExtensionsTest.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; diff --git a/src/Hosting/Hosting/src/Builder/ApplicationBuilderFactory.cs b/src/Hosting/Hosting/src/Builder/ApplicationBuilderFactory.cs index e188c0b7fd..e9c410370c 100644 --- a/src/Hosting/Hosting/src/Builder/ApplicationBuilderFactory.cs +++ b/src/Hosting/Hosting/src/Builder/ApplicationBuilderFactory.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Hosting.Builder diff --git a/src/Hosting/Hosting/test/ConfigureBuilderTests.cs b/src/Hosting/Hosting/test/ConfigureBuilderTests.cs index cea4235c8c..e7928b702e 100644 --- a/src/Hosting/Hosting/test/ConfigureBuilderTests.cs +++ b/src/Hosting/Hosting/test/ConfigureBuilderTests.cs @@ -4,7 +4,6 @@ using System; using System.Reflection; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.Extensions.DependencyInjection; using Xunit; @@ -52,4 +51,4 @@ namespace Microsoft.AspNetCore.Hosting.Tests } } } -} \ No newline at end of file +} diff --git a/src/Hosting/Hosting/test/StartupManagerTests.cs b/src/Hosting/Hosting/test/StartupManagerTests.cs index f336b3cc8d..3134b16731 100644 --- a/src/Hosting/Hosting/test/StartupManagerTests.cs +++ b/src/Hosting/Hosting/test/StartupManagerTests.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Reflection; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Hosting.Fakes; using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.AspNetCore.Hosting.Tests.Internal; diff --git a/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp3.0.cs b/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp3.0.cs index 819234838c..c7d040dd3e 100644 --- a/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp3.0.cs +++ b/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp3.0.cs @@ -474,58 +474,6 @@ namespace Microsoft.AspNetCore.Http.Features Microsoft.AspNetCore.Routing.RouteValueDictionary RouteValues { get; set; } } } -namespace Microsoft.AspNetCore.Http.Internal -{ - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct HeaderSegment : System.IEquatable - { - private readonly object _dummy; - public HeaderSegment(Microsoft.Extensions.Primitives.StringSegment formatting, Microsoft.Extensions.Primitives.StringSegment data) { throw null; } - public Microsoft.Extensions.Primitives.StringSegment Data { get { throw null; } } - public Microsoft.Extensions.Primitives.StringSegment Formatting { get { throw null; } } - public bool Equals(Microsoft.AspNetCore.Http.Internal.HeaderSegment other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(Microsoft.AspNetCore.Http.Internal.HeaderSegment left, Microsoft.AspNetCore.Http.Internal.HeaderSegment right) { throw null; } - public static bool operator !=(Microsoft.AspNetCore.Http.Internal.HeaderSegment left, Microsoft.AspNetCore.Http.Internal.HeaderSegment right) { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct HeaderSegmentCollection : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IEquatable - { - private readonly object _dummy; - public HeaderSegmentCollection(Microsoft.Extensions.Primitives.StringValues headers) { throw null; } - public bool Equals(Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection other) { throw null; } - public override bool Equals(object obj) { throw null; } - public Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection.Enumerator GetEnumerator() { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection left, Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection right) { throw null; } - public static bool operator !=(Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection left, Microsoft.AspNetCore.Http.Internal.HeaderSegmentCollection right) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct Enumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable - { - private object _dummy; - private int _dummyPrimitive; - public Enumerator(Microsoft.Extensions.Primitives.StringValues headers) { throw null; } - public Microsoft.AspNetCore.Http.Internal.HeaderSegment Current { get { throw null; } } - object System.Collections.IEnumerator.Current { get { throw null; } } - public void Dispose() { } - public bool MoveNext() { throw null; } - public void Reset() { } - } - } - public static partial class ParsingHelpers - { - public static void AppendHeaderJoined(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, params string[] values) { } - public static void AppendHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues values) { } - public static Microsoft.Extensions.Primitives.StringValues GetHeader(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; } - public static Microsoft.Extensions.Primitives.StringValues GetHeaderSplit(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; } - public static Microsoft.Extensions.Primitives.StringValues GetHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; } - public static void SetHeaderJoined(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues value) { } - public static void SetHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues? values) { } - } -} namespace Microsoft.AspNetCore.Routing { public partial class RouteValueDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyDictionary, System.Collections.IEnumerable diff --git a/src/Http/Http.Abstractions/src/Extensions/HeaderDictionaryExtensions.cs b/src/Http/Http.Abstractions/src/Extensions/HeaderDictionaryExtensions.cs index 5cc06484a2..e942b1b1e9 100644 --- a/src/Http/Http.Abstractions/src/Extensions/HeaderDictionaryExtensions.cs +++ b/src/Http/Http.Abstractions/src/Extensions/HeaderDictionaryExtensions.cs @@ -1,7 +1,6 @@ // 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.Internal; using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Http diff --git a/src/Http/Http.Abstractions/src/HostString.cs b/src/Http/Http.Abstractions/src/HostString.cs index 15e0071a27..0e3da28c41 100644 --- a/src/Http/Http.Abstractions/src/HostString.cs +++ b/src/Http/Http.Abstractions/src/HostString.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Globalization; using Microsoft.AspNetCore.Http.Abstractions; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Http diff --git a/src/Http/Http.Abstractions/src/Internal/HeaderSegment.cs b/src/Http/Http.Abstractions/src/Internal/HeaderSegment.cs index d2a64a53ac..f86ea7db07 100644 --- a/src/Http/Http.Abstractions/src/Internal/HeaderSegment.cs +++ b/src/Http/Http.Abstractions/src/Internal/HeaderSegment.cs @@ -4,9 +4,9 @@ using System; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public readonly struct HeaderSegment : IEquatable + internal readonly struct HeaderSegment : IEquatable { private readonly StringSegment _formatting; private readonly StringSegment _data; diff --git a/src/Http/Http.Abstractions/src/Internal/HeaderSegmentCollection.cs b/src/Http/Http.Abstractions/src/Internal/HeaderSegmentCollection.cs index 12e241eded..70d6b45109 100644 --- a/src/Http/Http.Abstractions/src/Internal/HeaderSegmentCollection.cs +++ b/src/Http/Http.Abstractions/src/Internal/HeaderSegmentCollection.cs @@ -6,9 +6,9 @@ using System.Collections; using System.Collections.Generic; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public readonly struct HeaderSegmentCollection : IEnumerable, IEquatable + internal readonly struct HeaderSegmentCollection : IEnumerable, IEquatable { private readonly StringValues _headers; diff --git a/src/Http/Http.Abstractions/src/Internal/HostStringHelper.cs b/src/Http/Http.Abstractions/src/Internal/HostStringHelper.cs index f4cfac52af..7644b1a06c 100644 --- a/src/Http/Http.Abstractions/src/Internal/HostStringHelper.cs +++ b/src/Http/Http.Abstractions/src/Internal/HostStringHelper.cs @@ -1,7 +1,7 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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.Http.Internal +namespace Microsoft.AspNetCore.Http { internal class HostStringHelper { diff --git a/src/Http/Http.Abstractions/src/Internal/ParsingHelpers.cs b/src/Http/Http.Abstractions/src/Internal/ParsingHelpers.cs index 60c3197e3c..f5254acb7a 100644 --- a/src/Http/Http.Abstractions/src/Internal/ParsingHelpers.cs +++ b/src/Http/Http.Abstractions/src/Internal/ParsingHelpers.cs @@ -2,13 +2,12 @@ // 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 Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public static class ParsingHelpers + internal static class ParsingHelpers { public static StringValues GetHeader(IHeaderDictionary headers, string key) { diff --git a/src/Http/Http.Abstractions/src/Internal/PathStringHelper.cs b/src/Http/Http.Abstractions/src/Internal/PathStringHelper.cs index 39a077f912..64a0e45c19 100644 --- a/src/Http/Http.Abstractions/src/Internal/PathStringHelper.cs +++ b/src/Http/Http.Abstractions/src/Internal/PathStringHelper.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Runtime.CompilerServices; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { internal static class PathStringHelper { diff --git a/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj b/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj index 65d9ae48dd..e328afbfac 100644 --- a/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj +++ b/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj @@ -25,4 +25,8 @@ Microsoft.AspNetCore.Http.HttpResponse + + + + diff --git a/src/Http/Http.Abstractions/src/PathString.cs b/src/Http/Http.Abstractions/src/PathString.cs index 8eba3914ca..40fe610a82 100644 --- a/src/Http/Http.Abstractions/src/PathString.cs +++ b/src/Http/Http.Abstractions/src/PathString.cs @@ -6,7 +6,6 @@ using System.ComponentModel; using System.Globalization; using System.Text; using Microsoft.AspNetCore.Http.Abstractions; -using Microsoft.AspNetCore.Http.Internal; namespace Microsoft.AspNetCore.Http { diff --git a/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp3.0.cs b/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp3.0.cs index d3c88f791f..3848153a9f 100644 --- a/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp3.0.cs +++ b/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp3.0.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.Builder.Internal +namespace Microsoft.AspNetCore.Builder { public partial class ApplicationBuilder : Microsoft.AspNetCore.Builder.IApplicationBuilder { @@ -17,6 +17,20 @@ namespace Microsoft.AspNetCore.Builder.Internal } namespace Microsoft.AspNetCore.Http { + public partial class BindingAddress + { + public BindingAddress() { } + public string Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool IsUnixPipe { get { throw null; } } + public string PathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int Port { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string UnixPipePath { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static Microsoft.AspNetCore.Http.BindingAddress Parse(string address) { throw null; } + public override string ToString() { throw null; } + } public sealed partial class DefaultHttpContext : Microsoft.AspNetCore.Http.HttpContext { public DefaultHttpContext() { } @@ -71,6 +85,27 @@ namespace Microsoft.AspNetCore.Http void System.Collections.IEnumerator.Reset() { } } } + public partial class FormFile : Microsoft.AspNetCore.Http.IFormFile + { + public FormFile(System.IO.Stream baseStream, long baseStreamOffset, long length, string name, string fileName) { } + public string ContentDisposition { get { throw null; } set { } } + public string ContentType { get { throw null; } set { } } + public string FileName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public long Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public void CopyTo(System.IO.Stream target) { } + [System.Diagnostics.DebuggerStepThroughAttribute] + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.IO.Stream OpenReadStream() { throw null; } + } + public partial class FormFileCollection : System.Collections.Generic.List, Microsoft.AspNetCore.Http.IFormFileCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable + { + public FormFileCollection() { } + public Microsoft.AspNetCore.Http.IFormFile this[string name] { get { throw null; } } + public Microsoft.AspNetCore.Http.IFormFile GetFile(string name) { throw null; } + public System.Collections.Generic.IReadOnlyList GetFiles(string name) { throw null; } + } public partial class HeaderDictionary : Microsoft.AspNetCore.Http.IHeaderDictionary, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable { public HeaderDictionary() { } @@ -139,6 +174,33 @@ namespace Microsoft.AspNetCore.Http public Microsoft.AspNetCore.Http.IMiddleware Create(System.Type middlewareType) { throw null; } public void Release(Microsoft.AspNetCore.Http.IMiddleware middleware) { } } + public partial class QueryCollection : Microsoft.AspNetCore.Http.IQueryCollection, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + { + public static readonly Microsoft.AspNetCore.Http.QueryCollection Empty; + public QueryCollection() { } + public QueryCollection(Microsoft.AspNetCore.Http.QueryCollection store) { } + public QueryCollection(System.Collections.Generic.Dictionary store) { } + public QueryCollection(int capacity) { } + public int Count { get { throw null; } } + public Microsoft.Extensions.Primitives.StringValues this[string key] { get { throw null; } } + public System.Collections.Generic.ICollection Keys { get { throw null; } } + public bool ContainsKey(string key) { throw null; } + public Microsoft.AspNetCore.Http.QueryCollection.Enumerator GetEnumerator() { throw null; } + System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string key, out Microsoft.Extensions.Primitives.StringValues value) { throw null; } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Enumerator : System.Collections.Generic.IEnumerator>, System.Collections.IEnumerator, System.IDisposable + { + private object _dummy; + private int _dummyPrimitive; + public System.Collections.Generic.KeyValuePair Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public void Dispose() { } + public bool MoveNext() { throw null; } + void System.Collections.IEnumerator.Reset() { } + } + } public static partial class RequestFormReaderExtensions { public static System.Threading.Tasks.Task ReadFormAsync(this Microsoft.AspNetCore.Http.HttpRequest request, Microsoft.AspNetCore.Http.Features.FormOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -289,204 +351,6 @@ namespace Microsoft.AspNetCore.Http.Features.Authentication public System.Security.Claims.ClaimsPrincipal User { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } } -namespace Microsoft.AspNetCore.Http.Internal -{ - public partial class BindingAddress - { - public BindingAddress() { } - public string Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool IsUnixPipe { get { throw null; } } - public string PathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public int Port { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string UnixPipePath { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static Microsoft.AspNetCore.Http.Internal.BindingAddress Parse(string address) { throw null; } - public override string ToString() { throw null; } - } - public static partial class BufferingHelper - { - public static Microsoft.AspNetCore.Http.HttpRequest EnableRewind(this Microsoft.AspNetCore.Http.HttpRequest request, int bufferThreshold = 30720, long? bufferLimit = default(long?)) { throw null; } - public static Microsoft.AspNetCore.WebUtilities.MultipartSection EnableRewind(this Microsoft.AspNetCore.WebUtilities.MultipartSection section, System.Action registerForDispose, int bufferThreshold = 30720, long? bufferLimit = default(long?)) { throw null; } - } - public sealed partial class DefaultConnectionInfo : Microsoft.AspNetCore.Http.ConnectionInfo - { - public DefaultConnectionInfo(Microsoft.AspNetCore.Http.Features.IFeatureCollection features) { } - public override System.Security.Cryptography.X509Certificates.X509Certificate2 ClientCertificate { get { throw null; } set { } } - public override string Id { get { throw null; } set { } } - public override System.Net.IPAddress LocalIpAddress { get { throw null; } set { } } - public override int LocalPort { get { throw null; } set { } } - public override System.Net.IPAddress RemoteIpAddress { get { throw null; } set { } } - public override int RemotePort { get { throw null; } set { } } - public override System.Threading.Tasks.Task GetClientCertificateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public void Initialize(Microsoft.AspNetCore.Http.Features.IFeatureCollection features) { } - public void Initialize(Microsoft.AspNetCore.Http.Features.IFeatureCollection features, int revision) { } - public void Uninitialize() { } - } - public sealed partial class DefaultHttpRequest : Microsoft.AspNetCore.Http.HttpRequest - { - public DefaultHttpRequest(Microsoft.AspNetCore.Http.DefaultHttpContext context) { } - public override System.IO.Stream Body { get { throw null; } set { } } - public override System.IO.Pipelines.PipeReader BodyReader { get { throw null; } } - public override long? ContentLength { get { throw null; } set { } } - public override string ContentType { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.IRequestCookieCollection Cookies { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.IFormCollection Form { get { throw null; } set { } } - public override bool HasFormContentType { get { throw null; } } - public override Microsoft.AspNetCore.Http.IHeaderDictionary Headers { get { throw null; } } - public override Microsoft.AspNetCore.Http.HostString Host { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.HttpContext HttpContext { get { throw null; } } - public override bool IsHttps { get { throw null; } set { } } - public override string Method { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.PathString Path { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.PathString PathBase { get { throw null; } set { } } - public override string Protocol { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.IQueryCollection Query { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.QueryString QueryString { get { throw null; } set { } } - public override Microsoft.AspNetCore.Routing.RouteValueDictionary RouteValues { get { throw null; } set { } } - public override string Scheme { get { throw null; } set { } } - public void Initialize() { } - public void Initialize(int revision) { } - public override System.Threading.Tasks.Task ReadFormAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - public void Uninitialize() { } - } - public sealed partial class DefaultHttpResponse : Microsoft.AspNetCore.Http.HttpResponse - { - public DefaultHttpResponse(Microsoft.AspNetCore.Http.DefaultHttpContext context) { } - public override System.IO.Stream Body { get { throw null; } set { } } - public override System.IO.Pipelines.PipeWriter BodyWriter { get { throw null; } } - public override long? ContentLength { get { throw null; } set { } } - public override string ContentType { get { throw null; } set { } } - public override Microsoft.AspNetCore.Http.IResponseCookies Cookies { get { throw null; } } - public override bool HasStarted { get { throw null; } } - public override Microsoft.AspNetCore.Http.IHeaderDictionary Headers { get { throw null; } } - public override Microsoft.AspNetCore.Http.HttpContext HttpContext { get { throw null; } } - public override int StatusCode { get { throw null; } set { } } - public void Initialize() { } - public void Initialize(int revision) { } - public override void OnCompleted(System.Func callback, object state) { } - public override void OnStarting(System.Func callback, object state) { } - public override void Redirect(string location, bool permanent) { } - public override System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public void Uninitialize() { } - } - public sealed partial class DefaultWebSocketManager : Microsoft.AspNetCore.Http.WebSocketManager - { - public DefaultWebSocketManager(Microsoft.AspNetCore.Http.Features.IFeatureCollection features) { } - public override bool IsWebSocketRequest { get { throw null; } } - public override System.Collections.Generic.IList WebSocketRequestedProtocols { get { throw null; } } - public override System.Threading.Tasks.Task AcceptWebSocketAsync(string subProtocol) { throw null; } - public void Initialize(Microsoft.AspNetCore.Http.Features.IFeatureCollection features) { } - public void Initialize(Microsoft.AspNetCore.Http.Features.IFeatureCollection features, int revision) { } - public void Uninitialize() { } - } - public partial class FormFile : Microsoft.AspNetCore.Http.IFormFile - { - public FormFile(System.IO.Stream baseStream, long baseStreamOffset, long length, string name, string fileName) { } - public string ContentDisposition { get { throw null; } set { } } - public string ContentType { get { throw null; } set { } } - public string FileName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public long Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void CopyTo(System.IO.Stream target) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public System.IO.Stream OpenReadStream() { throw null; } - } - public partial class FormFileCollection : System.Collections.Generic.List, Microsoft.AspNetCore.Http.IFormFileCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable - { - public FormFileCollection() { } - public Microsoft.AspNetCore.Http.IFormFile this[string name] { get { throw null; } } - public Microsoft.AspNetCore.Http.IFormFile GetFile(string name) { throw null; } - public System.Collections.Generic.IReadOnlyList GetFiles(string name) { throw null; } - } - public partial class ItemsDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ItemsDictionary() { } - public ItemsDictionary(System.Collections.Generic.IDictionary items) { } - public System.Collections.Generic.IDictionary Items { get { throw null; } } - int System.Collections.Generic.ICollection>.Count { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - object System.Collections.Generic.IDictionary.this[object key] { get { throw null; } set { } } - System.Collections.Generic.ICollection System.Collections.Generic.IDictionary.Keys { get { throw null; } } - System.Collections.Generic.ICollection System.Collections.Generic.IDictionary.Values { get { throw null; } } - void System.Collections.Generic.ICollection>.Add(System.Collections.Generic.KeyValuePair item) { } - void System.Collections.Generic.ICollection>.Clear() { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - void System.Collections.Generic.ICollection>.CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - void System.Collections.Generic.IDictionary.Add(object key, object value) { } - bool System.Collections.Generic.IDictionary.ContainsKey(object key) { throw null; } - bool System.Collections.Generic.IDictionary.Remove(object key) { throw null; } - bool System.Collections.Generic.IDictionary.TryGetValue(object key, out object value) { throw null; } - System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class QueryCollection : Microsoft.AspNetCore.Http.IQueryCollection, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public static readonly Microsoft.AspNetCore.Http.Internal.QueryCollection Empty; - public QueryCollection() { } - public QueryCollection(Microsoft.AspNetCore.Http.Internal.QueryCollection store) { } - public QueryCollection(System.Collections.Generic.Dictionary store) { } - public QueryCollection(int capacity) { } - public int Count { get { throw null; } } - public Microsoft.Extensions.Primitives.StringValues this[string key] { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public bool ContainsKey(string key) { throw null; } - public Microsoft.AspNetCore.Http.Internal.QueryCollection.Enumerator GetEnumerator() { throw null; } - System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out Microsoft.Extensions.Primitives.StringValues value) { throw null; } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct Enumerator : System.Collections.Generic.IEnumerator>, System.Collections.IEnumerator, System.IDisposable - { - private object _dummy; - private int _dummyPrimitive; - public System.Collections.Generic.KeyValuePair Current { get { throw null; } } - object System.Collections.IEnumerator.Current { get { throw null; } } - public void Dispose() { } - public bool MoveNext() { throw null; } - void System.Collections.IEnumerator.Reset() { } - } - } - public partial class RequestCookieCollection : Microsoft.AspNetCore.Http.IRequestCookieCollection, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public static readonly Microsoft.AspNetCore.Http.Internal.RequestCookieCollection Empty; - public RequestCookieCollection() { } - public RequestCookieCollection(System.Collections.Generic.Dictionary store) { } - public RequestCookieCollection(int capacity) { } - public int Count { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public bool ContainsKey(string key) { throw null; } - public Microsoft.AspNetCore.Http.Internal.RequestCookieCollection.Enumerator GetEnumerator() { throw null; } - public static Microsoft.AspNetCore.Http.Internal.RequestCookieCollection Parse(System.Collections.Generic.IList values) { throw null; } - System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out string value) { throw null; } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct Enumerator : System.Collections.Generic.IEnumerator>, System.Collections.IEnumerator, System.IDisposable - { - private object _dummy; - private int _dummyPrimitive; - public System.Collections.Generic.KeyValuePair Current { get { throw null; } } - object System.Collections.IEnumerator.Current { get { throw null; } } - public void Dispose() { } - public bool MoveNext() { throw null; } - public void Reset() { } - } - } - public partial class ResponseCookies : Microsoft.AspNetCore.Http.IResponseCookies - { - public ResponseCookies(Microsoft.AspNetCore.Http.IHeaderDictionary headers, Microsoft.Extensions.ObjectPool.ObjectPool builderPool) { } - public void Append(string key, string value) { } - public void Append(string key, string value, Microsoft.AspNetCore.Http.CookieOptions options) { } - public void Delete(string key) { } - public void Delete(string key, Microsoft.AspNetCore.Http.CookieOptions options) { } - } -} namespace Microsoft.Extensions.DependencyInjection { public static partial class HttpServiceCollectionExtensions diff --git a/src/Http/Http/src/Internal/BindingAddress.cs b/src/Http/Http/src/BindingAddress.cs similarity index 91% rename from src/Http/Http/src/Internal/BindingAddress.cs rename to src/Http/Http/src/BindingAddress.cs index b5f008b091..67a62e0c42 100644 --- a/src/Http/Http/src/Internal/BindingAddress.cs +++ b/src/Http/Http/src/BindingAddress.cs @@ -2,13 +2,14 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Diagnostics; using System.Globalization; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { public class BindingAddress { + private const string UnixPipeHostPrefix = "unix:/"; + public string Host { get; private set; } public string PathBase { get; private set; } public int Port { get; internal set; } @@ -18,7 +19,7 @@ namespace Microsoft.AspNetCore.Http.Internal { get { - return Host.StartsWith(Constants.UnixPipeHostPrefix, StringComparison.Ordinal); + return Host.StartsWith(UnixPipeHostPrefix, StringComparison.Ordinal); } } @@ -31,7 +32,7 @@ namespace Microsoft.AspNetCore.Http.Internal throw new InvalidOperationException("Binding address is not a unix pipe."); } - return Host.Substring(Constants.UnixPipeHostPrefix.Length - 1); + return Host.Substring(UnixPipeHostPrefix.Length - 1); } } @@ -76,7 +77,7 @@ namespace Microsoft.AspNetCore.Http.Internal } int schemeDelimiterEnd = schemeDelimiterStart + "://".Length; - var isUnixPipe = address.IndexOf(Constants.UnixPipeHostPrefix, schemeDelimiterEnd, StringComparison.Ordinal) == schemeDelimiterEnd; + var isUnixPipe = address.IndexOf(UnixPipeHostPrefix, schemeDelimiterEnd, StringComparison.Ordinal) == schemeDelimiterEnd; int pathDelimiterStart; int pathDelimiterEnd; @@ -87,7 +88,7 @@ namespace Microsoft.AspNetCore.Http.Internal } else { - pathDelimiterStart = address.IndexOf(":", schemeDelimiterEnd + Constants.UnixPipeHostPrefix.Length, StringComparison.Ordinal); + pathDelimiterStart = address.IndexOf(":", schemeDelimiterEnd + UnixPipeHostPrefix.Length, StringComparison.Ordinal); pathDelimiterEnd = pathDelimiterStart + ":".Length; } @@ -152,4 +153,4 @@ namespace Microsoft.AspNetCore.Http.Internal return serverAddress; } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Internal/ApplicationBuilder.cs b/src/Http/Http/src/Builder/ApplicationBuilder.cs similarity index 87% rename from src/Http/Http/src/Internal/ApplicationBuilder.cs rename to src/Http/Http/src/Builder/ApplicationBuilder.cs index 483dbee1e6..1a08127d08 100644 --- a/src/Http/Http/src/Internal/ApplicationBuilder.cs +++ b/src/Http/Http/src/Builder/ApplicationBuilder.cs @@ -7,13 +7,15 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Internal; -namespace Microsoft.AspNetCore.Builder.Internal +namespace Microsoft.AspNetCore.Builder { public class ApplicationBuilder : IApplicationBuilder { + private const string ServerFeaturesKey = "server.Features"; + private const string ApplicationServicesKey = "application.Services"; + private readonly IList> _components = new List>(); public ApplicationBuilder(IServiceProvider serviceProvider) @@ -25,7 +27,7 @@ namespace Microsoft.AspNetCore.Builder.Internal public ApplicationBuilder(IServiceProvider serviceProvider, object server) : this(serviceProvider) { - SetProperty(Constants.BuilderProperties.ServerFeatures, server); + SetProperty(ServerFeaturesKey, server); } private ApplicationBuilder(ApplicationBuilder builder) @@ -37,11 +39,11 @@ namespace Microsoft.AspNetCore.Builder.Internal { get { - return GetProperty(Constants.BuilderProperties.ApplicationServices); + return GetProperty(ApplicationServicesKey); } set { - SetProperty(Constants.BuilderProperties.ApplicationServices, value); + SetProperty(ApplicationServicesKey, value); } } @@ -49,7 +51,7 @@ namespace Microsoft.AspNetCore.Builder.Internal { get { - return GetProperty(Constants.BuilderProperties.ServerFeatures); + return GetProperty(ServerFeaturesKey); } } diff --git a/src/Http/Http/src/DefaultHttpContext.cs b/src/Http/Http/src/DefaultHttpContext.cs index 8ab60e9776..cbc2449058 100644 --- a/src/Http/Http/src/DefaultHttpContext.cs +++ b/src/Http/Http/src/DefaultHttpContext.cs @@ -8,7 +8,6 @@ using System.Security.Claims; using System.Threading; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features.Authentication; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Http diff --git a/src/Http/Http/src/Extensions/HttpRequestRewindExtensions.cs b/src/Http/Http/src/Extensions/HttpRequestRewindExtensions.cs index 557ee42155..e26a820dd1 100644 --- a/src/Http/Http/src/Extensions/HttpRequestRewindExtensions.cs +++ b/src/Http/Http/src/Extensions/HttpRequestRewindExtensions.cs @@ -1,8 +1,6 @@ // 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.Internal; - namespace Microsoft.AspNetCore.Http { /// diff --git a/src/Http/Http/src/Features/FormFeature.cs b/src/Http/Http/src/Features/FormFeature.cs index 5881b25ce4..e4a8498851 100644 --- a/src/Http/Http/src/Features/FormFeature.cs +++ b/src/Http/Http/src/Features/FormFeature.cs @@ -6,7 +6,6 @@ using System.IO; using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; diff --git a/src/Http/Http/src/Features/ItemsFeature.cs b/src/Http/Http/src/Features/ItemsFeature.cs index 6bf0669b45..6e8cdb982e 100644 --- a/src/Http/Http/src/Features/ItemsFeature.cs +++ b/src/Http/Http/src/Features/ItemsFeature.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.Collections.Generic; -using Microsoft.AspNetCore.Http.Internal; namespace Microsoft.AspNetCore.Http.Features { @@ -15,4 +14,4 @@ namespace Microsoft.AspNetCore.Http.Features public IDictionary Items { get; set; } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Features/QueryFeature.cs b/src/Http/Http/src/Features/QueryFeature.cs index 28af551594..985aceb6a5 100644 --- a/src/Http/Http/src/Features/QueryFeature.cs +++ b/src/Http/Http/src/Features/QueryFeature.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; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.WebUtilities; namespace Microsoft.AspNetCore.Http.Features @@ -90,4 +89,4 @@ namespace Microsoft.AspNetCore.Http.Features } } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Features/RequestCookiesFeature.cs b/src/Http/Http/src/Features/RequestCookiesFeature.cs index c657a663d4..cde35893f0 100644 --- a/src/Http/Http/src/Features/RequestCookiesFeature.cs +++ b/src/Http/Http/src/Features/RequestCookiesFeature.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; @@ -93,4 +92,4 @@ namespace Microsoft.AspNetCore.Http.Features } } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Features/ResponseCookiesFeature.cs b/src/Http/Http/src/Features/ResponseCookiesFeature.cs index 66cb8e86c7..64a11645b6 100644 --- a/src/Http/Http/src/Features/ResponseCookiesFeature.cs +++ b/src/Http/Http/src/Features/ResponseCookiesFeature.cs @@ -3,7 +3,6 @@ using System; using System.Text; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.ObjectPool; namespace Microsoft.AspNetCore.Http.Features @@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Http.Features } } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/FormCollection.cs b/src/Http/Http/src/FormCollection.cs index 23709b2bb0..b0e8c8e51d 100644 --- a/src/Http/Http/src/FormCollection.cs +++ b/src/Http/Http/src/FormCollection.cs @@ -4,7 +4,6 @@ using System; using System.Collections; using System.Collections.Generic; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Http diff --git a/src/Http/Http/src/Internal/FormFile.cs b/src/Http/Http/src/FormFile.cs similarity index 96% rename from src/Http/Http/src/Internal/FormFile.cs rename to src/Http/Http/src/FormFile.cs index fe541ae857..c861962919 100644 --- a/src/Http/Http/src/Internal/FormFile.cs +++ b/src/Http/Http/src/FormFile.cs @@ -7,8 +7,11 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { + /// + /// Default implementation of . + /// public class FormFile : IFormFile { // Stream.CopyTo method uses 80KB as the default buffer size. diff --git a/src/Http/Http/src/Internal/FormFileCollection.cs b/src/Http/Http/src/FormFileCollection.cs similarity index 96% rename from src/Http/Http/src/Internal/FormFileCollection.cs rename to src/Http/Http/src/FormFileCollection.cs index bb13e121b2..4672567a17 100644 --- a/src/Http/Http/src/Internal/FormFileCollection.cs +++ b/src/Http/Http/src/FormFileCollection.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { /// /// Default implementation of . @@ -44,4 +44,4 @@ namespace Microsoft.AspNetCore.Http.Internal return files; } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Internal/BufferingHelper.cs b/src/Http/Http/src/Internal/BufferingHelper.cs index d3ae6e42c8..31414d3940 100644 --- a/src/Http/Http/src/Internal/BufferingHelper.cs +++ b/src/Http/Http/src/Internal/BufferingHelper.cs @@ -5,9 +5,9 @@ using System; using Microsoft.AspNetCore.Internal; using Microsoft.AspNetCore.WebUtilities; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public static class BufferingHelper + internal static class BufferingHelper { internal const int DefaultBufferThreshold = 1024 * 30; diff --git a/src/Http/Http/src/Internal/Constants.cs b/src/Http/Http/src/Internal/Constants.cs deleted file mode 100644 index 280011b3e0..0000000000 --- a/src/Http/Http/src/Internal/Constants.cs +++ /dev/null @@ -1,18 +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. - -namespace Microsoft.AspNetCore.Http.Internal -{ - internal static class Constants - { - internal const string Http = "http"; - internal const string Https = "https"; - internal const string UnixPipeHostPrefix = "unix:/"; - - internal static class BuilderProperties - { - internal static string ServerFeatures = "server.Features"; - internal static string ApplicationServices = "application.Services"; - } - } -} diff --git a/src/Http/Http/src/Internal/DefaultConnectionInfo.cs b/src/Http/Http/src/Internal/DefaultConnectionInfo.cs index b2146e36c4..2c1dcfd114 100644 --- a/src/Http/Http/src/Internal/DefaultConnectionInfo.cs +++ b/src/Http/Http/src/Internal/DefaultConnectionInfo.cs @@ -8,9 +8,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public sealed class DefaultConnectionInfo : ConnectionInfo + internal sealed class DefaultConnectionInfo : ConnectionInfo { // Lambdas hoisted to static readonly fields to improve inlining https://github.com/dotnet/roslyn/issues/13624 private readonly static Func _newHttpConnectionFeature = f => new HttpConnectionFeature(); diff --git a/src/Http/Http/src/Internal/DefaultHttpRequest.cs b/src/Http/Http/src/Internal/DefaultHttpRequest.cs index bc0a4c42dc..29312a5616 100644 --- a/src/Http/Http/src/Internal/DefaultHttpRequest.cs +++ b/src/Http/Http/src/Internal/DefaultHttpRequest.cs @@ -10,10 +10,13 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Routing; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public sealed class DefaultHttpRequest : HttpRequest + internal sealed class DefaultHttpRequest : HttpRequest { + private const string Http = "http"; + private const string Https = "https"; + // Lambdas hoisted to static readonly fields to improve inlining https://github.com/dotnet/roslyn/issues/13624 private readonly static Func _nullRequestFeature = f => null; private readonly static Func _newQueryFeature = f => new QueryFeature(f); @@ -110,8 +113,8 @@ namespace Microsoft.AspNetCore.Http.Internal public override bool IsHttps { - get { return string.Equals(Constants.Https, Scheme, StringComparison.OrdinalIgnoreCase); } - set { Scheme = value ? Constants.Https : Constants.Http; } + get { return string.Equals(Https, Scheme, StringComparison.OrdinalIgnoreCase); } + set { Scheme = value ? Https : Http; } } public override HostString Host diff --git a/src/Http/Http/src/Internal/DefaultHttpResponse.cs b/src/Http/Http/src/Internal/DefaultHttpResponse.cs index 19e75c3aa0..d6502e494d 100644 --- a/src/Http/Http/src/Internal/DefaultHttpResponse.cs +++ b/src/Http/Http/src/Internal/DefaultHttpResponse.cs @@ -9,9 +9,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public sealed class DefaultHttpResponse : HttpResponse + internal sealed class DefaultHttpResponse : HttpResponse { // Lambdas hoisted to static readonly fields to improve inlining https://github.com/dotnet/roslyn/issues/13624 private readonly static Func _nullResponseFeature = f => null; diff --git a/src/Http/Http/src/Internal/DefaultWebSocketManager.cs b/src/Http/Http/src/Internal/DefaultWebSocketManager.cs index 34de127724..8b03dfd753 100644 --- a/src/Http/Http/src/Internal/DefaultWebSocketManager.cs +++ b/src/Http/Http/src/Internal/DefaultWebSocketManager.cs @@ -8,9 +8,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public sealed class DefaultWebSocketManager : WebSocketManager + internal sealed class DefaultWebSocketManager : WebSocketManager { // Lambdas hoisted to static readonly fields to improve inlining https://github.com/dotnet/roslyn/issues/13624 private readonly static Func _nullRequestFeature = f => null; @@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Http.Internal { get { - return ParsingHelpers.GetHeaderSplit(HttpRequestFeature.Headers, HeaderNames.WebSocketSubProtocols); + return HttpRequestFeature.Headers.GetCommaSeparatedValues(HeaderNames.WebSocketSubProtocols); } } diff --git a/src/Http/Http/src/Internal/ItemsDictionary.cs b/src/Http/Http/src/Internal/ItemsDictionary.cs index 7f5f458ba1..5dd44f6887 100644 --- a/src/Http/Http/src/Internal/ItemsDictionary.cs +++ b/src/Http/Http/src/Internal/ItemsDictionary.cs @@ -4,9 +4,9 @@ using System.Collections; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public class ItemsDictionary : IDictionary + internal class ItemsDictionary : IDictionary { private IDictionary _items; @@ -159,4 +159,4 @@ namespace Microsoft.AspNetCore.Http.Internal public static ICollection> Collection => Dictionary; } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Internal/ReferenceReadStream.cs b/src/Http/Http/src/Internal/ReferenceReadStream.cs index 2d14cc4311..e7160407d9 100644 --- a/src/Http/Http/src/Internal/ReferenceReadStream.cs +++ b/src/Http/Http/src/Internal/ReferenceReadStream.cs @@ -6,7 +6,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { /// /// A Stream that wraps another stream starting at a certain offset and reading for the given length. diff --git a/src/Http/Http/src/Internal/RequestCookieCollection.cs b/src/Http/Http/src/Internal/RequestCookieCollection.cs index 4af0a65246..2fb738b51b 100644 --- a/src/Http/Http/src/Internal/RequestCookieCollection.cs +++ b/src/Http/Http/src/Internal/RequestCookieCollection.cs @@ -6,9 +6,9 @@ using System.Collections; using System.Collections.Generic; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { - public class RequestCookieCollection : IRequestCookieCollection + internal class RequestCookieCollection : IRequestCookieCollection { public static readonly RequestCookieCollection Empty = new RequestCookieCollection(); private static readonly string[] EmptyKeys = Array.Empty(); @@ -229,4 +229,4 @@ namespace Microsoft.AspNetCore.Http.Internal } } } -} \ No newline at end of file +} diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index 7c6e3e033b..a8ed7dd66f 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -8,12 +8,12 @@ using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { /// /// A wrapper for the response Set-Cookie header. /// - public class ResponseCookies : IResponseCookies + internal class ResponseCookies : IResponseCookies { /// /// Create a new wrapper. diff --git a/src/Http/Http/src/Internal/QueryCollection.cs b/src/Http/Http/src/QueryCollection.cs similarity index 99% rename from src/Http/Http/src/Internal/QueryCollection.cs rename to src/Http/Http/src/QueryCollection.cs index 620de44a92..c1df1e59aa 100644 --- a/src/Http/Http/src/Internal/QueryCollection.cs +++ b/src/Http/Http/src/QueryCollection.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { /// /// The HttpRequest query string collection diff --git a/src/Http/Http/test/Internal/ApplicationBuilderTests.cs b/src/Http/Http/test/ApplicationBuilderTests.cs similarity index 100% rename from src/Http/Http/test/Internal/ApplicationBuilderTests.cs rename to src/Http/Http/test/ApplicationBuilderTests.cs diff --git a/src/Http/Http/test/Internal/BindingAddressTests.cs b/src/Http/Http/test/BindingAddressTests.cs similarity index 97% rename from src/Http/Http/test/Internal/BindingAddressTests.cs rename to src/Http/Http/test/BindingAddressTests.cs index 3bca310e82..3e56f5a993 100644 --- a/src/Http/Http/test/Internal/BindingAddressTests.cs +++ b/src/Http/Http/test/BindingAddressTests.cs @@ -1,11 +1,11 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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.Text; using Xunit; -namespace Microsoft.AspNetCore.Http.Internal.Tests +namespace Microsoft.AspNetCore.Http.Tests { public class BindingAddressTests { diff --git a/src/Http/Http/test/Internal/DefaultHttpRequestTests.cs b/src/Http/Http/test/Internal/DefaultHttpRequestTests.cs index ead7012fac..da9a846277 100644 --- a/src/Http/Http/test/Internal/DefaultHttpRequestTests.cs +++ b/src/Http/Http/test/Internal/DefaultHttpRequestTests.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Primitives; using Xunit; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { public class DefaultHttpRequestTests { diff --git a/src/Http/Http/test/Internal/DefaultHttpResponseTests.cs b/src/Http/Http/test/Internal/DefaultHttpResponseTests.cs index ccc4540587..e16d34eb87 100644 --- a/src/Http/Http/test/Internal/DefaultHttpResponseTests.cs +++ b/src/Http/Http/test/Internal/DefaultHttpResponseTests.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.Primitives; using Moq; using Xunit; -namespace Microsoft.AspNetCore.Http.Internal +namespace Microsoft.AspNetCore.Http { public class DefaultHttpResponseTests { diff --git a/src/Http/Http/test/RequestCookiesCollectionTests.cs b/src/Http/Http/test/RequestCookiesCollectionTests.cs index 70106df027..0d3cf069ad 100644 --- a/src/Http/Http/test/RequestCookiesCollectionTests.cs +++ b/src/Http/Http/test/RequestCookiesCollectionTests.cs @@ -1,8 +1,7 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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.Linq; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Primitives; using Xunit; diff --git a/src/Http/Http/test/ResponseCookiesTest.cs b/src/Http/Http/test/ResponseCookiesTest.cs index a6aa2de5ba..52bf95c49d 100644 --- a/src/Http/Http/test/ResponseCookiesTest.cs +++ b/src/Http/Http/test/ResponseCookiesTest.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; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Net.Http.Headers; using Xunit; diff --git a/src/Http/Owin/src/OwinExtensions.cs b/src/Http/Owin/src/OwinExtensions.cs index b7fcf15d04..b0c804027a 100644 --- a/src/Http/Owin/src/OwinExtensions.cs +++ b/src/Http/Owin/src/OwinExtensions.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Owin; diff --git a/src/Http/Owin/test/OwinExtensionTests.cs b/src/Http/Owin/test/OwinExtensionTests.cs index c4c51fba0a..be541ef44c 100644 --- a/src/Http/Owin/test/OwinExtensionTests.cs +++ b/src/Http/Owin/test/OwinExtensionTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Xunit; diff --git a/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs b/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs index 9a6f3df066..c9dbbd4032 100644 --- a/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs +++ b/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Routing; diff --git a/src/Http/Routing/test/UnitTests/Builder/RoutingBuilderExtensionsTest.cs b/src/Http/Routing/test/UnitTests/Builder/RoutingBuilderExtensionsTest.cs index 136950cfce..ed90d42783 100644 --- a/src/Http/Routing/test/UnitTests/Builder/RoutingBuilderExtensionsTest.cs +++ b/src/Http/Routing/test/UnitTests/Builder/RoutingBuilderExtensionsTest.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/perf/Microbenchmarks/GetHeaderSplitBenchmark.cs b/src/Http/perf/Microbenchmarks/GetHeaderSplitBenchmark.cs index 9105b5c448..54f3beb6d9 100644 --- a/src/Http/perf/Microbenchmarks/GetHeaderSplitBenchmark.cs +++ b/src/Http/perf/Microbenchmarks/GetHeaderSplitBenchmark.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs index 006a9294d4..ee8f1334eb 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs @@ -12,7 +12,6 @@ using IdentityServer4.Services; using IdentityServer4.Validation; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs b/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs index f6852e079f..d0aa5dbcb0 100644 --- a/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs +++ b/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.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.Threading.Tasks; -using Microsoft.AspNetCore.Builder.Internal; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity.Test; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.EntityFrameworkCore; diff --git a/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs b/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs index 8b9bef2469..3a8a8b38a4 100644 --- a/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs +++ b/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.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.Builder.Internal; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; diff --git a/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyCustomContextTest.cs b/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyCustomContextTest.cs index 1ef282f03d..28ab8e21c1 100644 --- a/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyCustomContextTest.cs +++ b/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyCustomContextTest.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.Threading.Tasks; -using Microsoft.AspNetCore.Builder.Internal; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity.Test; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.EntityFrameworkCore; diff --git a/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs b/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs index c17c6ad53e..364226f665 100644 --- a/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs +++ b/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs @@ -3,7 +3,7 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder.Internal; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity.Test; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.EntityFrameworkCore; diff --git a/src/Identity/test/InMemory.Test/ControllerTest.cs b/src/Identity/test/InMemory.Test/ControllerTest.cs index 3cb5c49f4e..302abbbad9 100644 --- a/src/Identity/test/InMemory.Test/ControllerTest.cs +++ b/src/Identity/test/InMemory.Test/ControllerTest.cs @@ -4,7 +4,7 @@ using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Builder.Internal; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity.Test; using Microsoft.Extensions.Configuration; diff --git a/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs b/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs index 192845f7db..72b63f578f 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.Http.Internal; using Microsoft.AspNetCore.HttpsPolicy.Internal; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; diff --git a/src/MusicStore/samples/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs b/src/MusicStore/samples/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs index 3982964372..b0978cfe47 100644 --- a/src/MusicStore/samples/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs +++ b/src/MusicStore/samples/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs @@ -4,7 +4,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.WebUtilities; using MusicStore.Mocks.Common; diff --git a/src/MusicStore/test/MusicStore.E2ETests/Implementation/FacebookLoginScenarios.cs b/src/MusicStore/test/MusicStore.E2ETests/Implementation/FacebookLoginScenarios.cs index e98b2985ef..eafc6f1c43 100644 --- a/src/MusicStore/test/MusicStore.E2ETests/Implementation/FacebookLoginScenarios.cs +++ b/src/MusicStore/test/MusicStore.E2ETests/Implementation/FacebookLoginScenarios.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; diff --git a/src/MusicStore/test/MusicStore.E2ETests/Implementation/GoogleLoginScenarios.cs b/src/MusicStore/test/MusicStore.E2ETests/Implementation/GoogleLoginScenarios.cs index 35a1eeac11..23861f47f4 100644 --- a/src/MusicStore/test/MusicStore.E2ETests/Implementation/GoogleLoginScenarios.cs +++ b/src/MusicStore/test/MusicStore.E2ETests/Implementation/GoogleLoginScenarios.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; diff --git a/src/MusicStore/test/MusicStore.E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs b/src/MusicStore/test/MusicStore.E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs index bfca72d5d2..bfa754204f 100644 --- a/src/MusicStore/test/MusicStore.E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs +++ b/src/MusicStore/test/MusicStore.E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; @@ -95,4 +95,4 @@ namespace E2ETests _logger.LogInformation("Middleware events were fired successfully"); } } -} \ No newline at end of file +} diff --git a/src/MusicStore/test/MusicStore.E2ETests/Implementation/OpenIdConnectLoginScenarios.cs b/src/MusicStore/test/MusicStore.E2ETests/Implementation/OpenIdConnectLoginScenarios.cs index 6f75115626..48092a4f6c 100644 --- a/src/MusicStore/test/MusicStore.E2ETests/Implementation/OpenIdConnectLoginScenarios.cs +++ b/src/MusicStore/test/MusicStore.E2ETests/Implementation/OpenIdConnectLoginScenarios.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; diff --git a/src/MusicStore/test/MusicStore.E2ETests/Implementation/TwitterLoginScenarios.cs b/src/MusicStore/test/MusicStore.E2ETests/Implementation/TwitterLoginScenarios.cs index 2b9b7849ab..db83f98a3a 100644 --- a/src/MusicStore/test/MusicStore.E2ETests/Implementation/TwitterLoginScenarios.cs +++ b/src/MusicStore/test/MusicStore.E2ETests/Implementation/TwitterLoginScenarios.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging; using Xunit; @@ -92,4 +92,4 @@ namespace E2ETests _logger.LogInformation("Middleware events were fired successfully"); } } -} \ No newline at end of file +} diff --git a/src/Mvc/Mvc.Core/test/Builder/MvcApplicationBuilderExtensionsTest.cs b/src/Mvc/Mvc.Core/test/Builder/MvcApplicationBuilderExtensionsTest.cs index fd9c38a8a0..e3d0b9381c 100644 --- a/src/Mvc/Mvc.Core/test/Builder/MvcApplicationBuilderExtensionsTest.cs +++ b/src/Mvc/Mvc.Core/test/Builder/MvcApplicationBuilderExtensionsTest.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterAttributeTest.cs b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterAttributeTest.cs index 801bcb3a8b..e6912b1ff9 100644 --- a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterAttributeTest.cs +++ b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterAttributeTest.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.Extensions.DependencyInjection; using Xunit; diff --git a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterBuilderTest.cs b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterBuilderTest.cs index 2802d65512..2d6a4fa11c 100644 --- a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterBuilderTest.cs +++ b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterBuilderTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Runtime.ExceptionServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.Abstractions; diff --git a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs index 414d4f0135..d054f8590a 100644 --- a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs +++ b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Controllers; diff --git a/src/Mvc/Mvc.Core/test/LocalRedirectResultTest.cs b/src/Mvc/Mvc.Core/test/LocalRedirectResultTest.cs index 6e78d6f840..0c6bb21381 100644 --- a/src/Mvc/Mvc.Core/test/LocalRedirectResultTest.cs +++ b/src/Mvc/Mvc.Core/test/LocalRedirectResultTest.cs @@ -5,13 +5,13 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Net.Http.Headers; using Moq; using Xunit; @@ -71,11 +71,8 @@ namespace Microsoft.AspNetCore.Mvc var appRoot = "/"; var contentPath = "~/Home/About"; var expectedPath = "/Home/About"; - var httpResponse = new Mock(); - httpResponse.Setup(o => o.Redirect(expectedPath, false)) - .Verifiable(); - var httpContext = GetHttpContext(appRoot, contentPath, expectedPath, httpResponse.Object); + var httpContext = GetHttpContext(appRoot); var actionContext = GetActionContext(httpContext); var result = new LocalRedirectResult(contentPath); @@ -83,27 +80,23 @@ namespace Microsoft.AspNetCore.Mvc await result.ExecuteResultAsync(actionContext); // Assert - httpResponse.Verify(); + Assert.Equal(expectedPath, httpContext.Response.Headers[HeaderNames.Location].ToString()); + Assert.Equal(StatusCodes.Status302Found, httpContext.Response.StatusCode); } [Theory] - [InlineData("", "//", "/test")] - [InlineData("", "/\\", "/test")] - [InlineData("", "//foo", "/test")] - [InlineData("", "/\\foo", "/test")] - [InlineData("", "Home/About", "/Home/About")] - [InlineData("/myapproot", "http://www.example.com", "/test")] + [InlineData("", "//")] + [InlineData("", "/\\")] + [InlineData("", "//foo")] + [InlineData("", "/\\foo")] + [InlineData("", "Home/About")] + [InlineData("/myapproot", "http://www.example.com")] public async Task Execute_Throws_ForNonLocalUrl( string appRoot, - string contentPath, - string expectedPath) + string contentPath) { // Arrange - var httpResponse = new Mock(); - httpResponse.Setup(o => o.Redirect(expectedPath, false)) - .Verifiable(); - - var httpContext = GetHttpContext(appRoot, contentPath, expectedPath, httpResponse.Object); + var httpContext = GetHttpContext(appRoot); var actionContext = GetActionContext(httpContext); var result = new LocalRedirectResult(contentPath); @@ -116,21 +109,16 @@ namespace Microsoft.AspNetCore.Mvc } [Theory] - [InlineData("", "~//", "//")] - [InlineData("", "~/\\", "/\\")] - [InlineData("", "~//foo", "//foo")] - [InlineData("", "~/\\foo", "/\\foo")] + [InlineData("", "~//")] + [InlineData("", "~/\\")] + [InlineData("", "~//foo")] + [InlineData("", "~/\\foo")] public async Task Execute_Throws_ForNonLocalUrlTilde( string appRoot, - string contentPath, - string expectedPath) + string contentPath) { // Arrange - var httpResponse = new Mock(); - httpResponse.Setup(o => o.Redirect(expectedPath, false)) - .Verifiable(); - - var httpContext = GetHttpContext(appRoot, contentPath, expectedPath, httpResponse.Object); + var httpContext = GetHttpContext(appRoot); var actionContext = GetActionContext(httpContext); var result = new LocalRedirectResult(contentPath); @@ -160,26 +148,12 @@ namespace Microsoft.AspNetCore.Mvc } private static HttpContext GetHttpContext( - string appRoot, - string contentPath, - string expectedPath, - HttpResponse response) + string appRoot) { - var httpContext = new Mock(); - var serviceProvider = GetServiceProvider(); - - httpContext.Setup(o => o.Response) - .Returns(response); - httpContext.SetupGet(o => o.RequestServices) - .Returns(serviceProvider); - httpContext.SetupGet(o => o.Items) - .Returns(new ItemsDictionary()); - httpContext.Setup(o => o.Request.PathBase) - .Returns(new PathString(appRoot)); - httpContext.SetupGet(h => h.Features) - .Returns(new FeatureCollection()); - - return httpContext.Object; + var httpContext = new DefaultHttpContext(); + httpContext.RequestServices = GetServiceProvider(); + httpContext.Request.PathBase = new PathString(appRoot); + return httpContext; } } } \ No newline at end of file diff --git a/src/Mvc/Mvc.Core/test/ModelBinding/Binders/FormFileModelBinderTest.cs b/src/Mvc/Mvc.Core/test/ModelBinding/Binders/FormFileModelBinderTest.cs index 40f025b53d..b1e3c35817 100644 --- a/src/Mvc/Mvc.Core/test/ModelBinding/Binders/FormFileModelBinderTest.cs +++ b/src/Mvc/Mvc.Core/test/ModelBinding/Binders/FormFileModelBinderTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.Extensions.Logging.Abstractions; using Moq; diff --git a/src/Mvc/Mvc.Core/test/ModelBinding/CompositeValueProviderTest.cs b/src/Mvc/Mvc.Core/test/ModelBinding/CompositeValueProviderTest.cs index 66d87b5f06..43b49ce16c 100644 --- a/src/Mvc/Mvc.Core/test/ModelBinding/CompositeValueProviderTest.cs +++ b/src/Mvc/Mvc.Core/test/ModelBinding/CompositeValueProviderTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.Extensions.Primitives; using Moq; using Xunit; diff --git a/src/Mvc/Mvc.Core/test/ModelBinding/DefaultModelBindingContextTest.cs b/src/Mvc/Mvc.Core/test/ModelBinding/DefaultModelBindingContextTest.cs index 98b2825970..6fc7d49237 100644 --- a/src/Mvc/Mvc.Core/test/ModelBinding/DefaultModelBindingContextTest.cs +++ b/src/Mvc/Mvc.Core/test/ModelBinding/DefaultModelBindingContextTest.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/src/Mvc/Mvc.Core/test/ModelBinding/JQueryQueryStringValueProviderFactoryTest.cs b/src/Mvc/Mvc.Core/test/ModelBinding/JQueryQueryStringValueProviderFactoryTest.cs index fe6a060d92..95f1a50dcb 100644 --- a/src/Mvc/Mvc.Core/test/ModelBinding/JQueryQueryStringValueProviderFactoryTest.cs +++ b/src/Mvc/Mvc.Core/test/ModelBinding/JQueryQueryStringValueProviderFactoryTest.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Primitives; diff --git a/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderFactoryTest.cs b/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderFactoryTest.cs index 40dbfb0d3c..fbf2605ad5 100644 --- a/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderFactoryTest.cs +++ b/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderFactoryTest.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Primitives; diff --git a/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderTest.cs b/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderTest.cs index bab0e56679..273586b1eb 100644 --- a/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderTest.cs +++ b/src/Mvc/Mvc.Core/test/ModelBinding/QueryStringValueProviderTest.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Globalization; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Mvc.ModelBinding diff --git a/src/Mvc/Mvc.Core/test/RedirectResultTest.cs b/src/Mvc/Mvc.Core/test/RedirectResultTest.cs index 61d583b998..46ecfda35e 100644 --- a/src/Mvc/Mvc.Core/test/RedirectResultTest.cs +++ b/src/Mvc/Mvc.Core/test/RedirectResultTest.cs @@ -5,13 +5,13 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Net.Http.Headers; using Moq; using Xunit; @@ -73,11 +73,7 @@ namespace Microsoft.AspNetCore.Mvc string expectedPath) { // Arrange - var httpResponse = new Mock(); - httpResponse.Setup(o => o.Redirect(expectedPath, false)) - .Verifiable(); - - var httpContext = GetHttpContext(appRoot, contentPath, expectedPath, httpResponse.Object); + var httpContext = GetHttpContext(appRoot); var actionContext = GetActionContext(httpContext); var result = new RedirectResult(contentPath); @@ -86,7 +82,8 @@ namespace Microsoft.AspNetCore.Mvc // Assert // Verifying if Redirect was called with the specific Url and parameter flag. - httpResponse.Verify(); + Assert.Equal(expectedPath, httpContext.Response.Headers[HeaderNames.Location].ToString()); + Assert.Equal(StatusCodes.Status302Found, httpContext.Response.StatusCode); } [Theory] @@ -101,11 +98,7 @@ namespace Microsoft.AspNetCore.Mvc string expectedPath) { // Arrange - var httpResponse = new Mock(); - httpResponse.Setup(o => o.Redirect(expectedPath, false)) - .Verifiable(); - - var httpContext = GetHttpContext(appRoot, contentPath, expectedPath, httpResponse.Object); + var httpContext = GetHttpContext(appRoot); var actionContext = GetActionContext(httpContext); var result = new RedirectResult(contentPath); @@ -114,7 +107,8 @@ namespace Microsoft.AspNetCore.Mvc // Assert // Verifying if Redirect was called with the specific Url and parameter flag. - httpResponse.Verify(); + Assert.Equal(expectedPath, httpContext.Response.Headers[HeaderNames.Location].ToString()); + Assert.Equal(StatusCodes.Status302Found, httpContext.Response.StatusCode); } private static ActionContext GetActionContext(HttpContext httpContext) @@ -137,26 +131,12 @@ namespace Microsoft.AspNetCore.Mvc } private static HttpContext GetHttpContext( - string appRoot, - string contentPath, - string expectedPath, - HttpResponse response) + string appRoot) { - var httpContext = new Mock(); - var serviceProvider = GetServiceProvider(); - - httpContext.Setup(o => o.Response) - .Returns(response); - httpContext.SetupGet(o => o.RequestServices) - .Returns(serviceProvider); - httpContext.SetupGet(o => o.Items) - .Returns(new ItemsDictionary()); - httpContext.Setup(o => o.Request.PathBase) - .Returns(new PathString(appRoot)); - httpContext.SetupGet(h => h.Features) - .Returns(new FeatureCollection()); - - return httpContext.Object; + var httpContext = new DefaultHttpContext(); + httpContext.RequestServices = GetServiceProvider(); + httpContext.Request.PathBase = new PathString(appRoot); + return httpContext; } } } \ No newline at end of file diff --git a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs index 302082bf5e..892c6f1146 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/CookieTempDataProviderTest.cs @@ -4,10 +4,10 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using System.Text; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.ViewFeatures.Infrastructure; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging.Abstractions; @@ -86,10 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures var base64AndUrlEncodedDataInCookie = WebEncoders.Base64UrlEncode(expectedDataToUnprotect); var context = new DefaultHttpContext(); - context.Request.Cookies = new RequestCookieCollection(new Dictionary() - { - { CookieTempDataProvider.CookieName, base64AndUrlEncodedDataInCookie } - }); + context.Request.Headers[HeaderNames.Cookie] = $"{CookieTempDataProvider.CookieName}={base64AndUrlEncodedDataInCookie}"; // Act var tempDataDictionary = tempDataProvider.LoadTempData(context); @@ -110,17 +107,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures var base64AndUrlEncodedDataInCookie = WebEncoders.Base64UrlEncode(expectedDataToUnprotect); var dataProtector = new PassThroughDataProtector(); var tempDataProvider = GetProvider(dataProtector); - var requestCookies = new RequestCookieCollection(new Dictionary() - { - { CookieTempDataProvider.CookieName, base64AndUrlEncodedDataInCookie } - }); - var httpContext = new Mock(); - httpContext - .Setup(hc => hc.Request.Cookies) - .Returns(requestCookies); + var httpContext = new DefaultHttpContext(); + httpContext.Request.Headers[HeaderNames.Cookie] = $"{CookieTempDataProvider.CookieName}={base64AndUrlEncodedDataInCookie}"; // Act - var actualValues = tempDataProvider.LoadTempData(httpContext.Object); + var actualValues = tempDataProvider.LoadTempData(httpContext); // Assert Assert.Equal(expectedDataToUnprotect, dataProtector.DataToUnprotect); @@ -311,35 +302,23 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures var base64AndUrlEncodedData = WebEncoders.Base64UrlEncode(serializedData); var dataProtector = new PassThroughDataProtector(); var tempDataProvider = GetProvider(dataProtector); - var requestCookies = new RequestCookieCollection(new Dictionary() - { - { CookieTempDataProvider.CookieName, base64AndUrlEncodedData } - }); - var responseCookies = new MockResponseCookieCollection(); - var httpContext = new Mock(); - httpContext - .SetupGet(hc => hc.Request.PathBase) - .Returns("/"); - httpContext - .Setup(hc => hc.Request.Cookies) - .Returns(requestCookies); - httpContext - .Setup(hc => hc.Response.Cookies) - .Returns(responseCookies); - httpContext - .Setup(hc => hc.Response.Headers) - .Returns(new HeaderDictionary()); + var requestCookies = $"{CookieTempDataProvider.CookieName}={base64AndUrlEncodedData}"; + var httpContext = new DefaultHttpContext(); + httpContext.Request.PathBase = "/"; + httpContext.Request.Headers[HeaderNames.Cookie] = requestCookies; // Act - tempDataProvider.SaveTempData(httpContext.Object, new Dictionary()); + tempDataProvider.SaveTempData(httpContext, new Dictionary()); // Assert - Assert.Equal(1, responseCookies.Count); - var cookie = responseCookies[CookieTempDataProvider.CookieName]; + var responseCookies = httpContext.Response.GetTypedHeaders().SetCookie; + Assert.Single(responseCookies); + var cookie = responseCookies.Single(); Assert.NotNull(cookie); + Assert.Equal(CookieTempDataProvider.CookieName, cookie.Name); Assert.Equal(string.Empty, cookie.Value); - Assert.NotNull(cookie.Options.Expires); - Assert.True(cookie.Options.Expires.Value < DateTimeOffset.Now); // expired cookie + Assert.NotNull(cookie.Expires); + Assert.True(cookie.Expires.Value < DateTimeOffset.Now); // expired cookie } [Fact] @@ -364,30 +343,28 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures private static HttpContext GetHttpContext() { - var context = new Mock(); - context - .SetupGet(hc => hc.Request.PathBase) - .Returns("/"); - context - .SetupGet(hc => hc.Response.Cookies) - .Returns(new MockResponseCookieCollection()); - return context.Object; + var context = new DefaultHttpContext(); + context.Request.PathBase = "/"; + return context; } private void UpdateRequestWithCookies(HttpContext httpContext) { - var responseCookies = (MockResponseCookieCollection)httpContext.Response.Cookies; + var responseCookies = httpContext.Response.GetTypedHeaders().SetCookie; - var values = new Dictionary(); - foreach (var responseCookie in responseCookies) + if (responseCookies.Count > 0) { - values.Add(responseCookie.Key, responseCookie.Value); - } + var stringBuilder = new StringBuilder(); + foreach (var cookie in responseCookies) + { + stringBuilder.Append(cookie.Name.AsSpan()); + stringBuilder.Append("="); + stringBuilder.Append(cookie.Value.AsSpan()); + stringBuilder.Append(";"); + } - if (values.Count > 0) - { - httpContext.Request.Cookies = new RequestCookieCollection(values); + httpContext.Request.Headers[HeaderNames.Cookie] = stringBuilder.ToString(); } } diff --git a/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs b/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs index b6468f36db..ecd4b74904 100644 --- a/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs +++ b/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Net; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; using Xunit; diff --git a/src/Mvc/test/Mvc.IntegrationTests/BindingSourceMetadataProviderIntegrationTest.cs b/src/Mvc/test/Mvc.IntegrationTests/BindingSourceMetadataProviderIntegrationTest.cs index e41452e0bb..200da5cce7 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/BindingSourceMetadataProviderIntegrationTest.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/BindingSourceMetadataProviderIntegrationTest.cs @@ -7,7 +7,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; diff --git a/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeModelBinderIntegrationTest.cs b/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeModelBinderIntegrationTest.cs index 19d65e864c..0c45eb05cd 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeModelBinderIntegrationTest.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeModelBinderIntegrationTest.cs @@ -8,7 +8,6 @@ using System.IO; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; diff --git a/src/Mvc/test/Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs b/src/Mvc/test/Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs index 330da2bc38..1b7ce7e335 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs @@ -6,7 +6,6 @@ using System.IO; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Primitives; diff --git a/src/Mvc/test/Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs b/src/Mvc/test/Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs index 34e2a2a20f..a7ff6eeba3 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs @@ -6,7 +6,6 @@ using System.IO; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Primitives; diff --git a/src/Mvc/test/Mvc.IntegrationTests/NullableReferenceTypeIntegrationTest.cs b/src/Mvc/test/Mvc.IntegrationTests/NullableReferenceTypeIntegrationTest.cs index 5fd7a89e89..6e61419fe3 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/NullableReferenceTypeIntegrationTest.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/NullableReferenceTypeIntegrationTest.cs @@ -9,7 +9,6 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Primitives; diff --git a/src/Mvc/test/Mvc.IntegrationTests/TryUpdateModelIntegrationTest.cs b/src/Mvc/test/Mvc.IntegrationTests/TryUpdateModelIntegrationTest.cs index d536e0190d..eb0a6d7cd9 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/TryUpdateModelIntegrationTest.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/TryUpdateModelIntegrationTest.cs @@ -7,7 +7,6 @@ using System.IO; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Primitives; using Xunit; diff --git a/src/Mvc/test/WebSites/HtmlGenerationWebSite/Models/Folder.cs b/src/Mvc/test/WebSites/HtmlGenerationWebSite/Models/Folder.cs index 73e14df392..5913299e3b 100644 --- a/src/Mvc/test/WebSites/HtmlGenerationWebSite/Models/Folder.cs +++ b/src/Mvc/test/WebSites/HtmlGenerationWebSite/Models/Folder.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Internal; namespace HtmlGenerationWebSite.Models { diff --git a/src/Security/Authorization/test/AuthorizationAppBuilderExtensionsTests.cs b/src/Security/Authorization/test/AuthorizationAppBuilderExtensionsTests.cs index aa888daf80..be67ab6e41 100644 --- a/src/Security/Authorization/test/AuthorizationAppBuilderExtensionsTests.cs +++ b/src/Security/Authorization/test/AuthorizationAppBuilderExtensionsTests.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization.Test.TestObjects; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Servers/IIS/IIS/test/testassets/shared/WebSockets/TestStartup.cs b/src/Servers/IIS/IIS/test/testassets/shared/WebSockets/TestStartup.cs index f35b9db813..adca16b3c4 100644 --- a/src/Servers/IIS/IIS/test/testassets/shared/WebSockets/TestStartup.cs +++ b/src/Servers/IIS/IIS/test/testassets/shared/WebSockets/TestStartup.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.IISIntegration.FunctionalTests diff --git a/src/Servers/Kestrel/Core/src/Internal/AddressBinder.cs b/src/Servers/Kestrel/Core/src/Internal/AddressBinder.cs index 70a306c3ad..c87b0653bd 100644 --- a/src/Servers/Kestrel/Core/src/Internal/AddressBinder.cs +++ b/src/Servers/Kestrel/Core/src/Internal/AddressBinder.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.Extensions.Logging; diff --git a/src/Servers/Kestrel/Core/test/AddressBinderTests.cs b/src/Servers/Kestrel/Core/test/AddressBinderTests.cs index 76d5172207..826cc0027c 100644 --- a/src/Servers/Kestrel/Core/test/AddressBinderTests.cs +++ b/src/Servers/Kestrel/Core/test/AddressBinderTests.cs @@ -7,7 +7,7 @@ using System.Net; using System.Net.Sockets; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; -using Microsoft.AspNetCore.Http.Internal; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; diff --git a/src/Servers/Kestrel/perf/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs b/src/Servers/Kestrel/perf/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs index 8430ed5900..a128cd8702 100644 --- a/src/Servers/Kestrel/perf/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs +++ b/src/Servers/Kestrel/perf/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs @@ -9,7 +9,6 @@ using System.Text; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; @@ -197,7 +196,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance _responseHeadersDirect = (HttpResponseHeaders)http1Connection.ResponseHeaders; var context = new DefaultHttpContext(http1Connection); - _response = new DefaultHttpResponse(context); + _response = context.Response; switch (Type) { diff --git a/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs b/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs index d577a6a920..44e24a23ad 100644 --- a/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs +++ b/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs @@ -19,7 +19,6 @@ using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Http.Connections.Internal; using Microsoft.AspNetCore.Http.Connections.Internal.Transports; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Internal; using Microsoft.AspNetCore.SignalR.Tests; using Microsoft.AspNetCore.Testing;