Update shared code for HTTP/2 and HTTP/3 (#18958)

This commit is contained in:
Justin Kotalik 2020-02-11 14:25:46 -08:00 committed by GitHub
parent 493da142f1
commit 9733704aea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 7 deletions

View File

@ -13,6 +13,7 @@ using System.Runtime.CompilerServices;
using System.Security.Authentication;
using System.Threading;
using System.Threading.Tasks;
using System.Net.Http;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Hosting.Server;

View File

@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// Don't ever change this unless we are explicitly trying to remove IHttpHeadersHandler as public API.
#if KESTREL
using System;

View File

@ -14,7 +14,7 @@ aspnet/AspNetCore code paths:
## Building dotnet/runtime code:
- https://github.com/dotnet/runtime/tree/master/docs/workflow
- Run libraries.cmd from the root once: `PS D:\github\runtime> .\libraries.cmd`
- 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`

View File

@ -6,7 +6,10 @@ using System.Buffers;
using System.Diagnostics;
using System.Net.Http.HPack;
using System.Numerics;
#if KESTREL
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
#endif
namespace System.Net.Http.QPack
{
@ -221,9 +224,9 @@ namespace System.Net.Http.QPack
}
break;
case State.CompressedHeaders:
switch (BitOperations.LeadingZeroCount(b))
switch (BitOperations.LeadingZeroCount(b) - 24)
{
case 24: // Indexed Header Field
case 0: // Indexed Header Field
prefixInt = IndexedHeaderFieldPrefixMask & b;
bool useStaticTable = (b & IndexedHeaderStaticMask) == IndexedHeaderStaticRepresentation;
@ -242,7 +245,7 @@ namespace System.Net.Http.QPack
_state = State.HeaderFieldIndex;
}
break;
case 25: // Literal Header Field With Name Reference
case 1: // Literal Header Field With Name Reference
useStaticTable = (LiteralHeaderFieldStaticMask & b) == LiteralHeaderFieldStaticMask;
if (!useStaticTable)
@ -260,7 +263,7 @@ namespace System.Net.Http.QPack
_state = State.HeaderNameIndex;
}
break;
case 26: // Literal Header Field Without Name Reference
case 2: // Literal Header Field Without Name Reference
_huffman = (b & LiteralHeaderFieldWithoutNameReferenceHuffmanMask) != 0;
prefixInt = b & LiteralHeaderFieldWithoutNameReferencePrefixMask;
@ -273,7 +276,7 @@ namespace System.Net.Http.QPack
_state = State.HeaderNameLength;
}
break;
case 27: // Indexed Header Field With Post-Base Index
case 3: // Indexed Header Field With Post-Base Index
prefixInt = ~PostBaseIndexMask & b;
if (_integerDecoder.BeginTryDecode((byte)prefixInt, PostBaseIndexPrefix, out intResult))
{

View File

@ -14,7 +14,7 @@ To copy code from aspnet/AspNetCore to dotnet/runtime, set RUNTIME_REPO to the r
## 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 libraries.cmd from the root once: `PS D:\github\runtime> .\libraries.cmd`
- 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`