Restructure shared http code (#18967)

* Restructure shared runtime code

* More qpack

* Header field

* HttpSys tests

* Casing
This commit is contained in:
Chris Ross 2020-02-12 10:07:32 -08:00 committed by GitHub
parent 1bd2b5f19e
commit e9e6b53526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 44 additions and 140 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
@ -7,7 +7,9 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="$(SharedSourceRoot)Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpHeadersHandler.cs" LinkBase="Shared\IHttpHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" />
<Compile Include="$(SharedSourceRoot)TaskToApm.cs" Link="Shared\TaskToApm.cs" />
@ -36,7 +38,7 @@
<ManifestResourceName>Microsoft.AspNetCore.Server.SharedStrings</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(SharedSourceRoot)Http2\SR.resx" Link="Shared\Http2\SR.resx">
<EmbeddedResource Include="$(SharedSourceRoot)runtime\SR.resx" Link="Shared\runtime\SR.resx">
<ManifestResourceName>System.Net.Http.SR</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>

View File

@ -16,8 +16,7 @@
<Compile Include="$(SharedSourceRoot)CertificateGeneration\**\*.cs" />
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" />
<Compile Include="$(SharedSourceRoot)UrlDecoder\**\*.cs" />
<Compile Include="$(SharedSourceRoot)Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)Http3\**\*.cs" LinkBase="Shared\Http3\" />
<Compile Include="$(SharedSourceRoot)runtime\**\*.cs" LinkBase="Shared\runtime\" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" />
<Compile Include="$(RepoRoot)src\Shared\TaskToApm.cs" Link="Internal\TaskToApm.cs" />
</ItemGroup>
@ -42,7 +41,7 @@
<ManifestResourceName>Microsoft.AspNetCore.Server.SharedStrings</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(SharedSourceRoot)Http2\SR.resx" Link="Shared\Http2\SR.resx">
<EmbeddedResource Include="$(SharedSourceRoot)runtime\SR.resx" Link="Shared\runtime\SR.resx">
<ManifestResourceName>System.Net.Http.SR</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
@ -15,7 +15,7 @@
<Content Include="$(KestrelSharedSourceRoot)test\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
<Compile Include="$(RepoRoot)src\Shared\Buffers.MemoryPool\*.cs" LinkBase="MemoryPool" />
<Compile Include="$(KestrelSharedSourceRoot)\CorrelationIdGenerator.cs" Link="Internal\CorrelationIdGenerator.cs" />
<Compile Include="$(SharedSourceRoot)test\Shared.Tests\Http2\**\*.cs" Link="Shared\Http2\%(Filename)%(Extension)" />
<Compile Include="$(SharedSourceRoot)test\Shared.Tests\runtime\**\*.cs" Link="Shared\runtime\%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@ -7,7 +7,9 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="$(SharedSourceRoot)Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpHeadersHandler.cs" LinkBase="Shared\IHttpHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" />
<Compile Include="$(SharedSourceRoot)TaskToApm.cs" Link="Shared\TaskToApm.cs" />
@ -25,7 +27,7 @@
<ManifestResourceName>Microsoft.AspNetCore.Server.SharedStrings</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(SharedSourceRoot)Http2\SR.resx" Link="Shared\Http2\SR.resx">
<EmbeddedResource Include="$(SharedSourceRoot)runtime\SR.resx" Link="Shared\runtime\SR.resx">
<ManifestResourceName>System.Net.Http.SR</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
if [[ -n "$1" ]]; then
remote_repo="$1"
else
remote_repo="$ASPNETCORE_REPO"
fi
if [[ -z "$remote_repo" ]]; then
echo The 'ASPNETCORE_REPO' environment variable or command line parameter is not set, aborting.
exit 1
fi
cd "$(dirname "$0")" || exit 1
echo "ASPNETCORE_REPO: $remote_repo"
rsync -av --delete ./ "$remote_repo"/src/Shared/Http2
rsync -av --delete ./../../../../../tests/Tests/System/Net/Http2/ "$remote_repo"/src/Shared/test/Shared.Tests/Http2

View File

@ -1,14 +0,0 @@
@ECHO OFF
SETLOCAL
if not [%1] == [] (set remote_repo=%1) else (set remote_repo=%RUNTIME_REPO%)
IF [%remote_repo%] == [] (
echo The 'RUNTIME_REPO' environment variable or command line parameter is not set, aborting.
exit /b 1
)
echo RUNTIME_REPO: %remote_repo%
robocopy . %remote_repo%\src\libraries\Common\src\System\Net\Http\Http2 /MIR
robocopy .\..\test\Shared.Tests\Http2 %remote_repo%\src\libraries\Common\tests\Tests\System\Net\Http2 /MIR

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
if [[ -n "$1" ]]; then
remote_repo="$1"
else
remote_repo="$RUNTIME_REPO"
fi
if [[ -z "$remote_repo" ]]; then
echo The 'RUNTIME_REPO' environment variable or command line parameter is not set, aborting.
exit 1
fi
cd "$(dirname "$0")" || exit 1
echo "RUNTIME_REPO: $remote_repo"
rsync -av --delete ./ "$remote_repo"/src/libraries/Common/src/System/Net/Http/Http2
rsync -av --delete ./../test/Shared.Tests/Http2/ "$remote_repo"/src/libraries/Common/tests/Tests/System/Net/Http2

View File

@ -1,14 +0,0 @@
@ECHO OFF
SETLOCAL
if not [%1] == [] (set remote_repo=%1) else (set remote_repo=%ASPNETCORE_REPO%)
IF [%remote_repo%] == [] (
echo The 'ASPNETCORE_REPO' environment variable or command line parameter is not set, aborting.
exit /b 1
)
echo ASPNETCORE_REPO: %remote_repo%
robocopy . %remote_repo%\src\Shared\Http3 /MIR
robocopy .\..\..\..\..\..\tests\Tests\System\Net\Http3\ %remote_repo%\src\Shared\test\Shared.Tests\Http3 /MIR

View File

@ -1,36 +0,0 @@
The code in this directory is shared between dotnet/runtime and aspnet/AspNetCore. This contains HTTP/3 protocol infrastructure such as a QPACK implementation. Any changes to this dir need to be checked into both repositories.
dotnet/runtime code paths:
- runtime\src\libraries\Common\src\System\Net\Http\Http3
- runtime\src\libraries\Common\tests\Tests\System\Net\Http3
aspnet/AspNetCore code paths:
- AspNetCore\src\Shared\Http3
- AspNetCore\src\Shared\test\Shared.Tests\Http3
## Copying code
To copy code from dotnet/runtime to aspnet/AspNetCore, set ASPNETCORE_REPO to the AspNetCore repo root and then run CopyToAspNetCore.cmd.
To copy code from aspnet/AspNetCore to dotnet/runtime, set RUNTIME_REPO to the runtime repo root and then run CopyToRuntime.cmd.
## Building dotnet/runtime code:
- https://github.com/dotnet/runtime/blob/master/docs/libraries/building/windows-instructions.md
- https://github.com/dotnet/runtime/blob/master/docs/libraries/project-docs/developer-guide.md
- Run *build.cmd* from the root once: `PS D:\github\runtime> .\build.cmd -subsetCategory libraries`
- Build the individual projects:
- `PS D:\github\dotnet\src\libraries\Common\tests> dotnet msbuild /t:rebuild`
- `PS D:\github\dotnet\src\libraries\System.Net.Http\src> dotnet msbuild /t:rebuild`
### Running dotnet/runtime tests:
- `PS D:\github\runtime\src\libraries\Common\tests> dotnet msbuild /t:rebuildandtest`
- `PS D:\github\runtime\src\libraries\System.Net.Http\tests\UnitTests> dotnet msbuild /t:rebuildandtest`
## Building aspnet/AspNetCore code:
- https://github.com/aspnet/AspNetCore/blob/master/docs/BuildFromSource.md
- Run restore in the root once: `PS D:\github\AspNetCore> .\restore.cmd`
- Activate to use the repo local runtime: `PS D:\github\AspNetCore> . .\activate.ps1`
- Build the individual projects:
- `(AspNetCore) PS D:\github\AspNetCore\src\Shared\test\Shared.Tests> dotnet msbuild`
- `(AspNetCore) PS D:\github\AspNetCore\src\servers\Kestrel\core\src> dotnet msbuild`
### Running aspnet/AspNetCore tests:
- `(AspNetCore) PS D:\github\AspNetCore\src\Shared\test\Shared.Tests> dotnet test`
- `(AspNetCore) PS D:\github\AspNetCore\src\servers\Kestrel\core\test> dotnet test`

View File

@ -10,5 +10,5 @@ IF [%remote_repo%] == [] (
echo ASPNETCORE_REPO: %remote_repo%
robocopy . %remote_repo%\src\Shared\Http2 /MIR
robocopy .\..\..\..\..\..\tests\Tests\System\Net\Http2\ %remote_repo%\src\Shared\test\Shared.Tests\Http2 /MIR
robocopy . %remote_repo%\src\Shared\runtime /MIR
robocopy .\..\..\..\..\..\tests\Tests\System\Net\aspnetcore\ %remote_repo%\src\Shared\test\Shared.Tests\runtime /MIR

View File

@ -15,5 +15,5 @@ cd "$(dirname "$0")" || exit 1
echo "ASPNETCORE_REPO: $remote_repo"
rsync -av --delete ./ "$remote_repo"/src/Shared/Http3
rsync -av --delete ./../../../../../tests/Tests/System/Net/Http3/ "$remote_repo"/src/Shared/test/Shared.Tests/Http3
rsync -av --delete ./ "$remote_repo"/src/Shared/runtime
rsync -av --delete ./../../../../../tests/Tests/System/Net/aspnetcore/ "$remote_repo"/src/Shared/test/Shared.Tests/runtime

View File

@ -10,5 +10,5 @@ IF [%remote_repo%] == [] (
echo RUNTIME_REPO: %remote_repo%
robocopy . %remote_repo%\src\libraries\Common\src\System\Net\Http\Http3 /MIR
robocopy .\..\test\Shared.Tests\Http3 %remote_repo%\src\libraries\Common\tests\Tests\System\Net\Http3 /MIR
robocopy . %remote_repo%\src\libraries\Common\src\System\Net\Http\aspnetcore /MIR
robocopy .\..\test\Shared.Tests\runtime %remote_repo%\src\libraries\Common\tests\Tests\System\Net\aspnetcore /MIR

View File

@ -15,5 +15,5 @@ cd "$(dirname "$0")" || exit 1
echo "RUNTIME_REPO: $remote_repo"
rsync -av --delete ./ "$remote_repo"/src/libraries/Common/src/System/Net/Http/Http3
rsync -av --delete ./../test/Shared.Tests/Http3/ "$remote_repo"/src/libraries/Common/tests/Tests/System/Net/Http3
rsync -av --delete ./ "$remote_repo"/src/libraries/Common/src/System/Net/Http/aspnetcore
rsync -av --delete ./../test/Shared.Tests/runtime/ "$remote_repo"/src/libraries/Common/tests/Tests/System/Net/aspnetcore

View File

@ -506,7 +506,7 @@ namespace System.Net.Http.QPack
private static void ThrowDynamicTableNotSupported()
{
throw new QPackDecodingException("No dynamic table support");
throw new QPackDecodingException(SR.net_http_qpack_no_dynamic_table);
}
}
}

View File

@ -1,16 +1,16 @@
The code in this directory is shared between dotnet/runtime and aspnet/AspNetCore. This contains HTTP/2 protocol infrastructure such as an HPACK implementation. Any changes to this dir need to be checked into both repositories.
The code in this directory is shared between dotnet/runtime and dotnet/AspNetCore. This contains HTTP/2 and HTTP/3 protocol infrastructure such as an HPACK implementation. Any changes to this dir need to be checked into both repositories.
dotnet/runtime code paths:
- runtime\src\libraries\Common\src\System\Net\Http\Http2
- runtime\src\libraries\Common\tests\Tests\System\Net\Http2
- runtime\src\libraries\Common\src\System\Net\Http\aspnetcore
- runtime\src\libraries\Common\tests\Tests\System\Net\aspnetcore
aspnet/AspNetCore code paths:
- AspNetCore\src\Shared\Http2
- AspNetCore\src\Shared\test\Shared.Tests\Http2
dotnet/AspNetCore code paths:
- AspNetCore\src\Shared\runtime
- AspNetCore\src\Shared\test\Shared.Tests\runtime
## Copying code
- To copy code from dotnet/runtime to aspnet/AspNetCore, set ASPNETCORE_REPO to the AspNetCore repo root and then run CopyToAspNetCore.cmd.
- To copy code from aspnet/AspNetCore to dotnet/runtime, set RUNTIME_REPO to the runtime repo root and then run CopyToRuntime.cmd.
- To copy code from dotnet/runtime to dotnet/AspNetCore, set ASPNETCORE_REPO to the AspNetCore repo root and then run CopyToAspNetCore.cmd.
- To copy code from dotnet/AspNetCore to dotnet/runtime, set RUNTIME_REPO to the runtime repo root and then run CopyToRuntime.cmd.
## Building dotnet/runtime code:
- https://github.com/dotnet/runtime/tree/master/docs/workflow
@ -23,14 +23,14 @@ aspnet/AspNetCore code paths:
- `PS D:\github\runtime\src\libraries\Common\tests> dotnet msbuild /t:rebuildandtest`
- `PS D:\github\runtime\src\libraries\System.Net.Http\tests\UnitTests> dotnet msbuild /t:rebuildandtest`
## Building aspnet/AspNetCore code:
- https://github.com/aspnet/AspNetCore/blob/master/docs/BuildFromSource.md
## Building dotnet/AspNetCore code:
- https://github.com/dotnet/AspNetCore/blob/master/docs/BuildFromSource.md
- Run restore in the root once: `PS D:\github\AspNetCore> .\restore.cmd`
- Activate to use the repo local runtime: `PS D:\github\AspNetCore> . .\activate.ps1`
- Build the individual projects:
- `(AspNetCore) PS D:\github\AspNetCore\src\Shared\test\Shared.Tests> dotnet msbuild`
- `(AspNetCore) PS D:\github\AspNetCore\src\servers\Kestrel\core\src> dotnet msbuild`
### Running aspnet/AspNetCore tests:
### Running dotnet/AspNetCore tests:
- `(AspNetCore) PS D:\github\AspNetCore\src\Shared\test\Shared.Tests> dotnet test`
- `(AspNetCore) PS D:\github\AspNetCore\src\servers\Kestrel\core\test> dotnet test`

View File

@ -150,6 +150,9 @@
<data name="net_http_invalid_header_name" xml:space="preserve">
<value>Received an invalid header name: '{0}'.</value>
</data>
<data name="net_http_qpack_no_dynamic_table" xml:space="preserve">
<value>No dynamic table support</value>
</data>
<data name="net_http_request_invalid_char_encoding" xml:space="preserve">
<value>Request headers must contain only ASCII characters.</value>
</data>

View File

@ -1,5 +0,0 @@
The code in this directory is shared between the runtime libraries and AspNetCore. This contains tests for HTTP/2 protocol infrastructure such as HPACK. Any changes to this dir need to be checked into both repositories.
For additional details see:
- runtime/src/libraries/Common/src/System/Net/Http/Http2/ReadMe.SharedCode.md
- AspNetCore/src/Shared/Http2/ReadMe.SharedCode.md

View File

@ -10,7 +10,7 @@
<ItemGroup>
<Compile Include="$(SharedSourceRoot)ClosedGenericMatcher\*.cs" Link="Shared\ClosedGenericMatcher\%(Filename)%(Extension)"/>
<Compile Include="$(SharedSourceRoot)CopyOnWriteDictionary\*.cs" Link="Shared\CopyOnWriteDictionary\%(Filename)%(Extension)"/>
<Compile Include="$(SharedSourceRoot)Http2\**\*.cs" Link="Shared\Http2\%(Filename)%(Extension)"/>
<Compile Include="$(SharedSourceRoot)runtime\**\*.cs" Link="Shared\runtime\%(Filename)%(Extension)"/>
<Compile Include="$(SharedSourceRoot)HttpSys\**\*.cs" Link="Shared\HttpSys\%(Filename)%(Extension)"/>
<Compile Include="$(SharedSourceRoot)ObjectMethodExecutor\*.cs" Link="Shared\ObjectMethodExecutor\%(Filename)%(Extension)"/>
<Compile Include="$(SharedSourceRoot)PropertyActivator\*.cs" Link="Shared\PropertyActivator\%(Filename)%(Extension)"/>
@ -32,7 +32,7 @@
<ItemGroup>
<ProjectReference Include="..\testassets\ThrowingLibrary\ThrowingLibrary.csproj" />
<EmbeddedResource Include="$(SharedSourceRoot)Http2\SR.resx" Link="Shared\Http2\SR.resx">
<EmbeddedResource Include="$(SharedSourceRoot)runtime\SR.resx" Link="Shared\runtime\SR.resx">
<ManifestResourceName>System.Net.Http.SR</ManifestResourceName>
<Generator></Generator>
</EmbeddedResource>

View File

@ -0,0 +1,5 @@
The code in this directory is shared between the runtime libraries and AspNetCore. This contains tests for HTTP/2 and HTTP/3 protocol infrastructure such as HPACK. Any changes to this dir need to be checked into both repositories.
For additional details see:
- runtime/src/libraries/Common/src/System/Net/Http/aspnetcore/ReadMe.SharedCode.md
- AspNetCore/src/Shared/runtime/ReadMe.SharedCode.md