Update shared code for HTTP/2 and HTTP/3 (#18958)
This commit is contained in:
parent
493da142f1
commit
9733704aea
|
|
@ -13,6 +13,7 @@ using System.Runtime.CompilerServices;
|
||||||
using System.Security.Authentication;
|
using System.Security.Authentication;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Net.Http;
|
||||||
using Microsoft.AspNetCore.Connections;
|
using Microsoft.AspNetCore.Connections;
|
||||||
using Microsoft.AspNetCore.Connections.Features;
|
using Microsoft.AspNetCore.Connections.Features;
|
||||||
using Microsoft.AspNetCore.Hosting.Server;
|
using Microsoft.AspNetCore.Hosting.Server;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// 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
|
#if KESTREL
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ aspnet/AspNetCore code paths:
|
||||||
|
|
||||||
## Building dotnet/runtime code:
|
## Building dotnet/runtime code:
|
||||||
- https://github.com/dotnet/runtime/tree/master/docs/workflow
|
- 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:
|
- Build the individual projects:
|
||||||
- `PS D:\github\dotnet\src\libraries\Common\tests> dotnet msbuild /t:rebuild`
|
- `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`
|
- `PS D:\github\dotnet\src\libraries\System.Net.Http\src> dotnet msbuild /t:rebuild`
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ using System.Buffers;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Http.HPack;
|
using System.Net.Http.HPack;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
|
#if KESTREL
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace System.Net.Http.QPack
|
namespace System.Net.Http.QPack
|
||||||
{
|
{
|
||||||
|
|
@ -221,9 +224,9 @@ namespace System.Net.Http.QPack
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case State.CompressedHeaders:
|
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;
|
prefixInt = IndexedHeaderFieldPrefixMask & b;
|
||||||
|
|
||||||
bool useStaticTable = (b & IndexedHeaderStaticMask) == IndexedHeaderStaticRepresentation;
|
bool useStaticTable = (b & IndexedHeaderStaticMask) == IndexedHeaderStaticRepresentation;
|
||||||
|
|
@ -242,7 +245,7 @@ namespace System.Net.Http.QPack
|
||||||
_state = State.HeaderFieldIndex;
|
_state = State.HeaderFieldIndex;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 25: // Literal Header Field With Name Reference
|
case 1: // Literal Header Field With Name Reference
|
||||||
useStaticTable = (LiteralHeaderFieldStaticMask & b) == LiteralHeaderFieldStaticMask;
|
useStaticTable = (LiteralHeaderFieldStaticMask & b) == LiteralHeaderFieldStaticMask;
|
||||||
|
|
||||||
if (!useStaticTable)
|
if (!useStaticTable)
|
||||||
|
|
@ -260,7 +263,7 @@ namespace System.Net.Http.QPack
|
||||||
_state = State.HeaderNameIndex;
|
_state = State.HeaderNameIndex;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 26: // Literal Header Field Without Name Reference
|
case 2: // Literal Header Field Without Name Reference
|
||||||
_huffman = (b & LiteralHeaderFieldWithoutNameReferenceHuffmanMask) != 0;
|
_huffman = (b & LiteralHeaderFieldWithoutNameReferenceHuffmanMask) != 0;
|
||||||
prefixInt = b & LiteralHeaderFieldWithoutNameReferencePrefixMask;
|
prefixInt = b & LiteralHeaderFieldWithoutNameReferencePrefixMask;
|
||||||
|
|
||||||
|
|
@ -273,7 +276,7 @@ namespace System.Net.Http.QPack
|
||||||
_state = State.HeaderNameLength;
|
_state = State.HeaderNameLength;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 27: // Indexed Header Field With Post-Base Index
|
case 3: // Indexed Header Field With Post-Base Index
|
||||||
prefixInt = ~PostBaseIndexMask & b;
|
prefixInt = ~PostBaseIndexMask & b;
|
||||||
if (_integerDecoder.BeginTryDecode((byte)prefixInt, PostBaseIndexPrefix, out intResult))
|
if (_integerDecoder.BeginTryDecode((byte)prefixInt, PostBaseIndexPrefix, out intResult))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ To copy code from aspnet/AspNetCore to dotnet/runtime, set RUNTIME_REPO to the r
|
||||||
## Building dotnet/runtime code:
|
## 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/building/windows-instructions.md
|
||||||
- https://github.com/dotnet/runtime/blob/master/docs/libraries/project-docs/developer-guide.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:
|
- Build the individual projects:
|
||||||
- `PS D:\github\dotnet\src\libraries\Common\tests> dotnet msbuild /t:rebuild`
|
- `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`
|
- `PS D:\github\dotnet\src\libraries\System.Net.Http\src> dotnet msbuild /t:rebuild`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue