HPACK fixes and tests (dotnet/corefx#38324)
authorCory Nelson <phrosty@gmail.com>
Wed, 12 Jun 2019 16:46:28 +0000 (09:46 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Jun 2019 16:46:28 +0000 (09:46 -0700)
commitae79b2383f1e968fd1442637911ca8834ff73caa
treecb5bd28c1928b3fc3c6bb4ecf66328b499f75a79
parentc1a10c7c475cd2b8db53b9593aab3d136a4011f1
HPACK fixes and tests (dotnet/corefx#38324)

* HPACK correctness tests/updates. Resolves dotnet/corefx#31316.

Fixes:
- Fix check allowing out-of-bounds write in IntegerEncoder when an integer requires more than one byte and there is not enough buffer space.
- Encode Content-Type with a "Literal Header Without Indexing -- Indexed Name" rather than with a literal name.

Updates: (ported from ASP.NET HPACK code)
- Dynamic table size update must be the first instruction in the header block. Throw an exception when not the case.
- Throw an exception when we've reached the end of header data and we are still mid-parse.

New:
- Asserts, documentation, and tests for IntegerEncoder and IntegerDecoder.
- Tests to verify HttpClient is correctly encoding the different variants of headers.
- HPackDecoder tests (ported from ASP.NET)

* Address review feedback and fix CI.

* Address review feedback.

* Fix licensing to use ASP.NET's licensing. Add a TPN.

Commit migrated from https://github.com/dotnet/corefx/commit/ed526597f3f0d4653588ba0129fcaf18e2e5a4ef
20 files changed:
src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs
src/libraries/Common/tests/System/Net/Http/Http2LoopbackServer.cs
src/libraries/System.Net.Http/src/Resources/Strings.resx
src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/DynamicTable.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/HPackDecoder.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/HPackDecodingException.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/HPackEncoder.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/HeaderField.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/Huffman.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/HuffmanDecodingException.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/IntegerDecoder.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/IntegerEncoder.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HPack/StaticTable.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HPackTest.cs [new file with mode: 0644]
src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj
src/libraries/System.Net.Http/tests/UnitTests/HPack/HPackDecoderTest.cs [new file with mode: 0644]
src/libraries/System.Net.Http/tests/UnitTests/HPack/HPackIntegerTest.cs [new file with mode: 0644]
src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj