Skip to content

Fix incorrect HTTP/2 method header decoding #40412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Feb 25, 2022

Fixes #40301

@adityamandaleeka It's my Saturday tomorrow so I just went ahead and created a PR. The only fix required was _hpackDecoder.Decode after the first stream.

With HPACK, the response headers from the first stream tell the decoder that the headers should be added to the dynamic table. They are now available for the second stream which sends back response headers that use dynamic table indexes. Example: https://datatracker.ietf.org/doc/html/rfc7541#appendix-C.5

If you've ever wondered why HPACK was replaced by QPACK in HTTP/3, it's because HTTP/2 guarantees the order of delivery. With HTTP/2 the server knows exactly what is the client's dynamic table based on what it has sent. That means it can safely send a header identified with a dynamic header index. HTTP/3 doesn't guarantee the order of delivery (e.g. stream 3 response headers are received before stream 1 response headers) so a new header compression spec is required.

@JamesNK JamesNK changed the title WIP - Fix incorrect h2 header decoding. Fix incorrect h2 header decoding. Feb 25, 2022
@JamesNK JamesNK force-pushed the jamesnk/header_compression_issue40301 branch from e6e9ebb to d49e46f Compare March 1, 2022 00:38
@JamesNK JamesNK changed the title Fix incorrect h2 header decoding. Fix incorrect HTTP/2 method header decoding Mar 1, 2022
@JamesNK JamesNK enabled auto-merge (squash) March 1, 2022 01:25
@JamesNK JamesNK merged commit 6a43d05 into main Mar 1, 2022
@JamesNK JamesNK deleted the jamesnk/header_compression_issue40301 branch March 1, 2022 01:52
@ghost ghost added this to the 7.0-preview3 milestone Mar 1, 2022
@halter73
Copy link
Member

halter73 commented Mar 1, 2022

😆

@adityamandaleeka
Copy link
Member

/backport to release/7.0-preview2

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

Started backporting to release/7.0-preview2: https://github.com/dotnet/aspnetcore/actions/runs/1913774976

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

@adityamandaleeka backporting to release/7.0-preview2 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: WIP - Fix incorrect h2 header decoding.
Applying: Fix test
Using index info to reconstruct a base tree...
M	src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj
M	src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj
Falling back to patching base and 3-way merge...
Auto-merging src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj
CONFLICT (content): Merge conflict in src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj
Auto-merging src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj
CONFLICT (content): Merge conflict in src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 Fix test
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

adityamandaleeka added a commit to adityamandaleeka/aspnetcore that referenced this pull request Mar 1, 2022
mmitche pushed a commit that referenced this pull request Mar 1, 2022
Co-authored-by: Aditya Mandaleeka <[email protected]>

Co-authored-by: James Newton-King <[email protected]>
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[7.0 preview 1] HTTP DELETE sometimes treated as HTTP POST
5 participants