diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..af6855653f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "corefxlab"] + path = corefxlab + url = https://github.com/dotnet/corefxlab diff --git a/KestrelHttpServer.sln b/KestrelHttpServer.sln index 24a8e79020..820b9e6e27 100644 --- a/KestrelHttpServer.sln +++ b/KestrelHttpServer.sln @@ -65,6 +65,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel", "src\Microsoft.AspNetCore.Server.Kestrel\Microsoft.AspNetCore.Server.Kestrel.csproj", "{56139957-5C29-4E7D-89BD-7D20598B4EAF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Internalizer", "tools\Internalizer\Internalizer.csproj", "{6B04EAAA-08DE-464B-92DB-1D32BB86892C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -195,6 +197,18 @@ Global {56139957-5C29-4E7D-89BD-7D20598B4EAF}.Release|x64.Build.0 = Release|Any CPU {56139957-5C29-4E7D-89BD-7D20598B4EAF}.Release|x86.ActiveCfg = Release|Any CPU {56139957-5C29-4E7D-89BD-7D20598B4EAF}.Release|x86.Build.0 = Release|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Debug|x64.ActiveCfg = Debug|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Debug|x64.Build.0 = Debug|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Debug|x86.ActiveCfg = Debug|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Debug|x86.Build.0 = Debug|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Release|Any CPU.Build.0 = Release|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Release|x64.ActiveCfg = Release|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Release|x64.Build.0 = Release|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Release|x86.ActiveCfg = Release|Any CPU + {6B04EAAA-08DE-464B-92DB-1D32BB86892C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -212,5 +226,6 @@ Global {2822C132-BFFB-4D53-AC5B-E7E47DD81A6E} = {0EF2ACDF-012F-4472-A13A-4272419E2903} {A76B8C8C-0DC5-4DD3-9B1F-02E51A0915F4} = {2D5D5227-4DBD-499A-96B1-76A36B03B750} {56139957-5C29-4E7D-89BD-7D20598B4EAF} = {2D5D5227-4DBD-499A-96B1-76A36B03B750} + {6B04EAAA-08DE-464B-92DB-1D32BB86892C} = {327F7880-D9AF-46BD-B45C-3B7E34A01DFD} EndGlobalSection EndGlobal diff --git a/build/corefxlab.props b/build/corefxlab.props new file mode 100644 index 0000000000..f44b11a994 --- /dev/null +++ b/build/corefxlab.props @@ -0,0 +1,14 @@ + + + + $(MSBuildThisFileDirectory)..\corefxlab\ + + + + + + + + + + diff --git a/build/dependencies.props b/build/dependencies.props index ac2690b701..9601cfeacf 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,6 +4,7 @@ 0.1.0-* 0.1.0-* 4.3.0 + 4.4.0-* 2.0.0-* 1.10.0-* 9.0.1 diff --git a/build/repo.targets b/build/repo.targets index d05edf3572..81a19d46b8 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -1,5 +1,24 @@ + + Internalize;$(CompileDependsOn) + + + + + + + + + + + + $(MSBuildThisFileDirectory)..\artifacts\corefxlabfiles.txt + + + + + diff --git a/corefxlab b/corefxlab new file mode 160000 index 0000000000..5afdb0ea1f --- /dev/null +++ b/corefxlab @@ -0,0 +1 @@ +Subproject commit 5afdb0ea1fb6842ef9662ed8ab9890a0e1d3c3b9 diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs index 54674ae5d4..4a1087976a 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs @@ -3,9 +3,9 @@ using System; using System.IO; -using System.IO.Pipelines; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/RawStream.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/RawStream.cs index 6e21958576..c47e0a9369 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/RawStream.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/RawStream.cs @@ -3,10 +3,10 @@ using System; using System.IO; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/StreamSocketOutput.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/StreamSocketOutput.cs index 11da4bc24b..7ec74cc6b7 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/StreamSocketOutput.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Adapter/Internal/StreamSocketOutput.cs @@ -3,10 +3,10 @@ using System; using System.IO; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/ConnectionHandler.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/ConnectionHandler.cs index 933e04b8ab..265b7d7c33 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/ConnectionHandler.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/ConnectionHandler.cs @@ -1,10 +1,10 @@ // 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.IO.Pipelines; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; namespace Microsoft.AspNetCore.Server.Kestrel.Internal diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs index af5454f581..fb5cb169c1 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs @@ -4,12 +4,12 @@ using System; using System.Collections.Generic; using System.IO; -using System.IO.Pipelines; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Adapter; using Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnectionContext.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnectionContext.cs index 271c009385..a2dc0a1ec9 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnectionContext.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnectionContext.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Adapter; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ChunkWriter.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ChunkWriter.cs index 6ffbc577b9..80bd99a610 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ChunkWriter.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ChunkWriter.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Text; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ConnectionLifetimeControl.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ConnectionLifetimeControl.cs index ae7d98ba3f..7b794a5d3a 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ConnectionLifetimeControl.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ConnectionLifetimeControl.cs @@ -1,8 +1,8 @@ // 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.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/Frame.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/Frame.cs index e5b10948e2..9c26aadb11 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/Frame.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/Frame.cs @@ -5,17 +5,17 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.IO.Pipelines; using System.Linq; using System.Net; using System.Runtime.CompilerServices; using System.Text; -using System.Text.Encodings.Web.Utf8; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.Kestrel.Adapter; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.Text.Encodings.Web.Utf8; using Microsoft.AspNetCore.Server.Kestrel.Transport; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; @@ -987,7 +987,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http responseHeaders.SetRawDate(dateHeaderValues.String, dateHeaderValues.Bytes); } - Output.Write(_writeHeaders, this); + Output.Write(_writeHeaders, this); } private static void WriteResponseHeaders(WritableBuffer writableBuffer, Frame frame) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameHeaders.Generated.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameHeaders.Generated.cs index 8cc1ad75bd..10d7f2b9a5 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameHeaders.Generated.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameHeaders.Generated.cs @@ -3,8 +3,7 @@ using System; using System.Collections.Generic; -using System.IO.Pipelines; -using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameResponseHeaders.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameResponseHeaders.cs index 9fc752f6cd..ca69a0e26c 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameResponseHeaders.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/FrameResponseHeaders.cs @@ -4,8 +4,8 @@ using System; using System.Collections; using System.Collections.Generic; -using System.IO.Pipelines; using System.Runtime.CompilerServices; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/IHttpParser.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/IHttpParser.cs index ee888bea1f..a76ff2ed4b 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/IHttpParser.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/IHttpParser.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 System.IO.Pipelines; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ISocketOutput.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ISocketOutput.cs index 379dd52318..c5fe3ef28c 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ISocketOutput.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/ISocketOutput.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/KestrelHttpParser.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/KestrelHttpParser.cs index b78d04b69c..d677d35697 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/KestrelHttpParser.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/KestrelHttpParser.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Numerics; using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/MessageBody.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/MessageBody.cs index 03130d7628..5af47e057e 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/MessageBody.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/MessageBody.cs @@ -3,10 +3,10 @@ using System; using System.IO; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs index 4109119da9..2a02ce766c 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Buffers; -using System.IO.Pipelines; using System.Runtime.CompilerServices; using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.Buffers; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/SocketOutputProducer.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/SocketOutputProducer.cs index 956fd5a336..c415985677 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/SocketOutputProducer.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/SocketOutputProducer.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Infrastructure/IThreadPool.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Infrastructure/IThreadPool.cs index 48db68ff10..db15d24ea3 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Infrastructure/IThreadPool.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Infrastructure/IThreadPool.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Microsoft.AspNetCore.Server.Kestrel.Core.csproj b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Microsoft.AspNetCore.Server.Kestrel.Core.csproj index 931898c08b..95bfdb9012 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Microsoft.AspNetCore.Server.Kestrel.Core.csproj +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Microsoft.AspNetCore.Server.Kestrel.Core.csproj @@ -1,6 +1,7 @@  + Core components of ASP.NET Core Kestrel cross-platform web server. @@ -8,7 +9,7 @@ true aspnetcore;kestrel true - CS1591;$(NoWarn) + CS1570;CS1571;CS1572;CS1573;CS1574;CS1591;$(NoWarn) false @@ -19,10 +20,9 @@ + - - @@ -31,4 +31,9 @@ + + + + + diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionContext.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionContext.cs index 1ef633d445..3dd426fc67 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionContext.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionContext.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Transport { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionInformation.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionInformation.cs index 911b83a0df..763c59e6c3 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionInformation.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Transport/IConnectionInformation.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO.Pipelines; using System.Net; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Transport { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/Connection.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/Connection.cs index bff2e1021a..e7911c6ed5 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/Connection.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/Connection.cs @@ -4,11 +4,11 @@ using System; using System.Diagnostics; using System.IO; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Internal.Networking; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; using Microsoft.AspNetCore.Server.Kestrel.Transport.Exceptions; using Microsoft.Extensions.Logging; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/ConnectionContext.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/ConnectionContext.cs index 869935033e..60376b6605 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/ConnectionContext.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/ConnectionContext.cs @@ -1,8 +1,8 @@ // 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.IO.Pipelines; using System.Net; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/SocketOutputConsumer.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/SocketOutputConsumer.cs index 6ff5c69ebb..5705fe623d 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/SocketOutputConsumer.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Http/SocketOutputConsumer.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Internal.Networking; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http { diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Infrastructure/KestrelThread.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Infrastructure/KestrelThread.cs index 5978ce4f9a..3cca5302ad 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Infrastructure/KestrelThread.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Infrastructure/KestrelThread.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.IO.Pipelines; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Threading; @@ -12,6 +11,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Internal.Networking; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.Kestrel.Internal diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs index 5462d2a2d4..8b4d84ed7b 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv/Internal/Networking/UvWriteReq.cs @@ -4,9 +4,10 @@ using System; using System.Buffers; using System.Collections.Generic; -using System.IO.Pipelines; using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.Buffers; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/DotSegmentRemovalBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/DotSegmentRemovalBenchmark.cs index 64482a568c..eb626280d1 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/DotSegmentRemovalBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/DotSegmentRemovalBenchmark.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance [Benchmark(Baseline = true)] public unsafe int NoDotSegments() { - _noDotSegmentsAscii.CopyTo(_noDotSegmentsBytes); + _noDotSegmentsAscii.CopyTo(_noDotSegmentsBytes, 0); fixed (byte* start = _noDotSegmentsBytes) { @@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance [Benchmark] public unsafe int SingleDotSegments() { - _singleDotSegmentsAscii.CopyTo(_singleDotSegmentsBytes); + _singleDotSegmentsAscii.CopyTo(_singleDotSegmentsBytes, 0); fixed (byte* start = _singleDotSegmentsBytes) { @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance [Benchmark] public unsafe int DoubleDotSegments() { - _doubleDotSegmentsAscii.CopyTo(_doubleDotSegmentsBytes); + _doubleDotSegmentsAscii.CopyTo(_doubleDotSegmentsBytes, 0); fixed (byte* start = _doubleDotSegmentsBytes) { diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameParsingOverheadBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameParsingOverheadBenchmark.cs index a3d0092638..81b219f127 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameParsingOverheadBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameParsingOverheadBenchmark.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Text; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameWritingBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameWritingBenchmark.cs index ae41da1959..40053dc333 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameWritingBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/FrameWritingBenchmark.cs @@ -2,12 +2,12 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Testing; namespace Microsoft.AspNetCore.Server.Kestrel.Performance diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/KestrelHttpParserBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/KestrelHttpParserBenchmark.cs index 0a06b448d0..7c4a3eb6d3 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/KestrelHttpParserBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/KestrelHttpParserBenchmark.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Mocks/MockConnectionInformation.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Mocks/MockConnectionInformation.cs index 9faa8d2f63..62d57f3d75 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Mocks/MockConnectionInformation.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Mocks/MockConnectionInformation.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO.Pipelines; using System.Net; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; namespace Microsoft.AspNetCore.Server.Kestrel.Performance diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/PipeThroughputBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/PipeThroughputBenchmark.cs index 957a66b19c..152f8af1ef 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/PipeThroughputBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/PipeThroughputBenchmark.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO.Pipelines; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsingBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsingBenchmark.cs index 68da390b7a..1ebf04ddb5 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsingBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsingBenchmark.cs @@ -1,10 +1,10 @@ // 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.IO.Pipelines; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/ResponseHeadersWritingBenchmark.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/ResponseHeadersWritingBenchmark.cs index ce2f941c41..b0c739e641 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/ResponseHeadersWritingBenchmark.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/ResponseHeadersWritingBenchmark.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using System.IO.Pipelines; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -11,6 +10,7 @@ using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Testing; namespace Microsoft.AspNetCore.Server.Kestrel.Performance diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/FrameResponseHeadersTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/FrameResponseHeadersTests.cs index d626512420..c89e23c8c7 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/FrameResponseHeadersTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/FrameResponseHeadersTests.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO.Pipelines; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Primitives; using Xunit; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/FrameTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/FrameTests.cs index 70f63f8a72..97bf5451e5 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/FrameTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/FrameTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.IO.Pipelines; using System.Net; using System.Text; using System.Threading; @@ -16,6 +15,7 @@ using Microsoft.AspNetCore.Server.Kestrel; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Internal; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/HttpParserTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/HttpParserTests.cs index 99daa1a53d..cc542df620 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/HttpParserTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/HttpParserTests.cs @@ -3,14 +3,14 @@ using System; using System.Collections.Generic; -using System.IO.Pipelines; -using System.IO.Pipelines.Testing; using System.Linq; using System.Text; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.Kestrel; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Testing; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; using Moq; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/MultipleLoopTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/MultipleLoopTests.cs index e95605a33f..40c3dde7a6 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/MultipleLoopTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/MultipleLoopTests.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 System.IO.Pipelines; using System.Net; using System.Net.Sockets; using System.Runtime.InteropServices; @@ -10,6 +9,7 @@ using System.Threading; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Internal.Networking; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.KestrelTests.TestHelpers; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/NetworkingTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/NetworkingTests.cs index 4799438634..f224da0e8d 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/NetworkingTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/NetworkingTests.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 System.IO.Pipelines; using System.Net; using System.Net.Sockets; using System.Runtime.InteropServices; @@ -10,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Internal.Networking; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/PipeOptionsTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/PipeOptionsTests.cs index 924a4200e5..b418619615 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/PipeOptionsTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/PipeOptionsTests.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Testing; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/PipelineExtensionTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/PipelineExtensionTests.cs index e5227dd63e..76496ec1ad 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/PipelineExtensionTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/PipelineExtensionTests.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Xunit; namespace Microsoft.AspNetCore.Server.KestrelTests diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/SocketOutputTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/SocketOutputTests.cs index 351886a3ce..428f4f1363 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/SocketOutputTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/SocketOutputTests.cs @@ -3,12 +3,12 @@ using System; using System.Collections.Concurrent; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.KestrelTests.TestHelpers; using Microsoft.AspNetCore.Testing; using Xunit; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/StreamSocketOutputTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/StreamSocketOutputTests.cs index 1dab5016f8..c122e4e658 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/StreamSocketOutputTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/StreamSocketOutputTests.cs @@ -3,8 +3,8 @@ using System; using System.IO; -using System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Xunit; namespace Microsoft.AspNetCore.Server.KestrelTests diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnectionHandler.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnectionHandler.cs index f50f3572c6..0fb74487f9 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnectionHandler.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnectionHandler.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Server.Kestrel.Transport; using Xunit; diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/TestInput.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/TestInput.cs index cfa87eb55e..0b2fba1078 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/TestInput.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/TestInput.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Internal; diff --git a/test/shared/MockSocketOutput.cs b/test/shared/MockSocketOutput.cs index c5cdc32cb2..31819dd1fa 100644 --- a/test/shared/MockSocketOutput.cs +++ b/test/shared/MockSocketOutput.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Testing diff --git a/tools/CodeGenerator/KnownHeaders.cs b/tools/CodeGenerator/KnownHeaders.cs index 6f8ef86303..5d4f4eb717 100644 --- a/tools/CodeGenerator/KnownHeaders.cs +++ b/tools/CodeGenerator/KnownHeaders.cs @@ -291,8 +291,7 @@ namespace CodeGenerator using System; using System.Collections.Generic; -using System.IO.Pipelines; -using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; diff --git a/tools/Internalizer/Internalizer.csproj b/tools/Internalizer/Internalizer.csproj new file mode 100644 index 0000000000..b4ab265a95 --- /dev/null +++ b/tools/Internalizer/Internalizer.csproj @@ -0,0 +1,7 @@ + + + netcoreapp1.1 + Exe + false + + diff --git a/tools/Internalizer/Program.cs b/tools/Internalizer/Program.cs new file mode 100644 index 0000000000..4ba2bf1efd --- /dev/null +++ b/tools/Internalizer/Program.cs @@ -0,0 +1,108 @@ +// 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.Concurrent; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace Internalizer +{ + public class Program + { + private const string MicrosoftAspnetcoreServerKestrelInternal = "Microsoft.AspNetCore.Server.Kestrel.Internal"; + private const string DefaultUsings = +@"// This file was processed with Internalizer tool and should not be edited manually + +using System; +using System.Runtime; +using System.Buffers; + +"; + private static readonly UTF8Encoding _utf8Encoding = new UTF8Encoding(false); + private static readonly Regex _usingRegex = new Regex("using\\s+([\\w.]+)\\s*;", RegexOptions.Compiled); + private static readonly Regex _namespaceRegex = new Regex("namespace\\s+([\\w.]+)", RegexOptions.Compiled); + + public static int Main(string[] args) + { + if (args.Length < 1) + { + Console.Error.WriteLine("Missing path to file list"); + return 1; + } + Run(args[0]); + + return 0; + } + + public static void Run(string csFileList) + { + var files = File.ReadAllLines(csFileList); + var namespaces = new ConcurrentDictionary(); + + var fileContents = files.AsParallel().Select(file => + { + var text = File.ReadAllText(file); + return new FileEntry(path: file, oldText : text, newText : text); + }).ToArray(); + + Parallel.ForEach(fileContents, fileEntry => + { + fileEntry.NewText = ProcessNamespaces(fileEntry.NewText, namespaces); + }); + + Parallel.ForEach(fileContents, fileEntry => + { + fileEntry.NewText = ProcessUsings(fileEntry.NewText, namespaces); + if (fileEntry.NewText != fileEntry.OldText) + { + File.WriteAllText(fileEntry.Path, fileEntry.NewText, _utf8Encoding); + } + }); + + Console.WriteLine($"Successfully internalized {files.Length} file(s)."); + } + + private static string ProcessNamespaces(string contents, ConcurrentDictionary namespaces) + { + return _namespaceRegex.Replace(contents, match => + { + var ns = match.Groups[1].Value; + var newNamespace = $"{MicrosoftAspnetcoreServerKestrelInternal}.{ns}"; + + namespaces.AddOrUpdate(ns, newNamespace, (s, s1) => s1); + return $"namespace {newNamespace}"; + }); + } + + private static string ProcessUsings(string contents, ConcurrentDictionary namespaces) + { + return DefaultUsings + _usingRegex.Replace(contents, match => + { + var ns = match.Groups[1].Value; + if (namespaces.TryGetValue(ns, out var newNamespace)) + { + return $"using {newNamespace};"; + } + return match.Value; + }); + } + } + + public class FileEntry + { + public string Path { get; set; } + public string OldText { get; set; } + public string NewText { get; set; } + + public FileEntry(string path, string oldText, string newText) + { + Path = path; + OldText = oldText; + NewText = newText; + } + } +}