Skip to content

Fixes a bug in Envoy's HTTP/3-to-HTTP/1 proxying when a transfer-enco… #39589

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fishpan1209
Copy link
Contributor

Commit Message: QUIC Stream: Fixes a bug in Envoy's HTTP/3-to-HTTP/1 proxying when a "transfer-encoding" header is incorrectly appended.
Additional Description: Envoy, when proxying via hyperloop to HTTP/1 backend, incorrectly interprets the end of an HTTP/3 HEADERS frame contained in a QUIC STREAM frame with the end_stream/fin bit set to true. This causes the HTTP/1 codec to mistakenly add a "transfer-encoding" header. This CL addresses this by inspecting the data before encoding headers. For requests containing only headers, it now explicitly signals the end of the stream with the "headers-only" indicator, which is the correct way to denote this in HTTP/3 (unlike the "fin" flag). This prevents the incorrect "transfer-encoding" header from being added.
Risk Level: low, guarded by runtime guard
Testing: internally tested with google3 e2e tests
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:] envoy_reloadable_features_quic_signal_headers_only_to_http1_backend
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

…ding header is incorrectly appended

Signed-off-by: Ting Pan <[email protected]>
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #39589 was opened by fishpan1209.

see: more, trace.

Copy link

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #39589 was opened by fishpan1209.

see: more, trace.

@fishpan1209
Copy link
Contributor Author

/retest

@fishpan1209 fishpan1209 marked this pull request as ready for review May 22, 2025 17:09
@fishpan1209
Copy link
Contributor Author

@RyanTheOptimist Hi Ryan, I restarted the pr here, added an integration test, please review again, thank you

Copy link
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

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

Looks great, but one question about the integration test.

// When downstream protocol is HTTP3 and upstream protocol is HTTP1, an OPTIONS
// request with no body will not append transfer-encoding chunked.
TEST_P(DownstreamProtocolIntegrationTest, OptionsWithNoBodyNotChunked) {
// This test is only relevant for H3 downstream to H1 upstream.
Copy link
Contributor

Choose a reason for hiding this comment

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

While this test was added specifically for HTTP/3, I think the logic applies to H2 and H1 as well, right? Does this test pass if we remove the H3 restriction here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They do pass, in that case, do you prefer to make it non-quic-specific test? in that case I'll move it to protocol_integration_test

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, good idea!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, please review again, thank you

Signed-off-by: Ting Pan <[email protected]>
@fishpan1209
Copy link
Contributor Author

/retest

@fishpan1209
Copy link
Contributor Author

/retest

Copy link
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

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

LGTM!

Any idea why CI is red?

@fishpan1209
Copy link
Contributor Author

thank you Ryan.
It fails on this flaky test:

TEST_P(ExtProcIntegrationTest, GetAndCloseStreamWithTracing) {

trying rerun

@fishpan1209
Copy link
Contributor Author

/retest

@fishpan1209
Copy link
Contributor Author

@RyanTheOptimist all green now, ready for merge, thank you

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