Skip to content
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

h3i: add --replay-host-override option #1867

Merged
merged 1 commit into from
Nov 25, 2024
Merged

h3i: add --replay-host-override option #1867

merged 1 commit into from
Nov 25, 2024

Conversation

LPardue
Copy link
Contributor

@LPardue LPardue commented Nov 15, 2024

One use case for replaying a recorded session with the h3i CLI is to execture
the same sequence of actions to different target servers. Many servers will
validate that there is a provided "host" or ":authority" header field, and that
it matches the certificate SAN.

This change adds the "--replay-host-override" option that can be used in
combination with the --qlog-input option. It replaces any "host" or ":authority"
header in a HEADERS frame, with the provided value.

note: the diff looks huge but most of what its doing is swapping a From impl to a function so the host_override value can be passed to the correct place

@LPardue LPardue requested a review from a team as a code owner November 15, 2024 22:40
.as_bool()
.unwrap_or_default();

match &value.frame_created.frame {
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICT this only ever creates one action per H3FrameCreatedEx. We can probably simplify the code by just implementing From<H3FrameCreatedEx> for Action, then when we iterate over the list in actions_from_qlog, we could just create the H3FrameCreatedEx and push it to the action vector directly.

We could slip host_override into the ExData when creating translating the H3FrameCreated -> H3FrameCreatedEx, then map it in the From implementation if the H3FrameCreatedEx contains a Headers frame

@evanrittenhouse
Copy link
Contributor

evanrittenhouse commented Nov 16, 2024

One thing we could do to test h3i's parser is to add sample qlogs as test data and run the parser against them to ensure they generate the correct actions, and vice versa. Doesn't need to be here, just a thought since it's touching the recordreplay code

@LPardue
Copy link
Contributor Author

LPardue commented Nov 16, 2024

Good idea

One use case for replaying a recorded session with the h3i CLI is to execture
the same sequence of actions to different target servers. Many servers will
validate that there is a provided "host" or ":authority" header field, and that
it matches the certificate SAN.

This change adds the "--replay-host-override" option that can be used in
combination with the --qlog-input option. It replaces any "host" or ":authority"
header in a HEADERS frame, with the provided value.
@LPardue
Copy link
Contributor Author

LPardue commented Nov 18, 2024

I added some simple tests for parsing a qlog with http headers with and without a host_override. Other parts of parsing are already covered in the qlog QlogSeqReader itself

@LPardue LPardue merged commit dc3b2dd into master Nov 25, 2024
38 checks passed
@LPardue LPardue deleted the h3i-host-override branch November 25, 2024 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants