Skip to content

[HTTP/3] Fix QPACK status decode#57236

Merged
CarnaViire merged 1 commit into
dotnet:mainfrom
CarnaViire:fix-qpack-status-decode
Aug 12, 2021
Merged

[HTTP/3] Fix QPACK status decode#57236
CarnaViire merged 1 commit into
dotnet:mainfrom
CarnaViire:fix-qpack-status-decode

Conversation

@CarnaViire

Copy link
Copy Markdown
Member

Fix "Literal Header Field With Name Reference" parsing for Status code. Add tests for QPACK-ed and not QPACK-ed status receiving for all status codes (except informational).

Fix QPackStaticTable.HeaderLookup to comply with spec https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#name-static-table-2 (the order was off, so lookup didn't work correctly in some cases).

Fixes #55988

Notes:

  1. While checking spec compliance, I noticed that index 34 should access-control-allow-headers instead of access-control-allow-origin (in H3StaticTable.s_staticTable). It seems to be shared code, so I guess after this PR Kestrel will need to sync with the update? cc @JamesNK

  2. It would be nice to get rid of QPackStaticTable.HeaderLookup in favor of H3StaticTable.s_staticTable, or use a generation of some sort, but I didn't check whether it will be easy to achieve, and I don't know why there are two of them in the first place.

@CarnaViire CarnaViire requested review from a team, ManickaP, geoffkizer and wfurt August 11, 2021 20:46
@ghost ghost added the area-System.Net.Http label Aug 11, 2021
@ghost

ghost commented Aug 11, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Fix "Literal Header Field With Name Reference" parsing for Status code. Add tests for QPACK-ed and not QPACK-ed status receiving for all status codes (except informational).

Fix QPackStaticTable.HeaderLookup to comply with spec https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#name-static-table-2 (the order was off, so lookup didn't work correctly in some cases).

Fixes #55988

Notes:

  1. While checking spec compliance, I noticed that index 34 should access-control-allow-headers instead of access-control-allow-origin (in H3StaticTable.s_staticTable). It seems to be shared code, so I guess after this PR Kestrel will need to sync with the update? cc @JamesNK

  2. It would be nice to get rid of QPackStaticTable.HeaderLookup in favor of H3StaticTable.s_staticTable, or use a generation of some sort, but I didn't check whether it will be easy to achieve, and I don't know why there are two of them in the first place.

Author: CarnaViire
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@Tratcher

Copy link
Copy Markdown
Member
  1. It seems to be shared code, so I guess after this PR Kestrel will need to sync with the update?

The sync from runtime to aspnetcore is automatic. Thanks for the heads up.

H3StaticTable.Status425 => 425,
H3StaticTable.Status500 => 500,
// We should never get here, at least while we only use static table. But we can still parse staticValue.
_ => ParseStatusCode(staticIndex, staticValue)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this error? I'm not familiar with this code, but I think you're using the static index to resolve to a descriptor, and the descriptor must be :status, so any other static index at this point should be impossible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see a Debug.Fail. As long as weirdness here gets noticed then that's fine 👍

@ManickaP ManickaP left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@CarnaViire CarnaViire merged commit d27eb8d into dotnet:main Aug 12, 2021
@CarnaViire CarnaViire deleted the fix-qpack-status-decode branch August 12, 2021 15:06
@Tratcher

Copy link
Copy Markdown
Member

FYI I triggered the sync bot manually so we could get this into aspnetcore quickly. dotnet/aspnetcore#35293

@karelz karelz added this to the 6.0.0 milestone Aug 17, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HTTP/3] The server returned an invalid or unrecognized response.

5 participants