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

Make http3 codec not encode empty trailers block #35907

Merged
merged 5 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ bug_fixes:
- area: http3
change: |
Fixed a bug where an empty trailers block could be sent. This would occur if a filter removed
the last trailer - a likely occurrence with the ``grpc_web_filter``.
the last trailer - a likely occurrence with the ``grpc_web_filter``. This change makes http3 codec
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
the last trailer - a likely occurrence with the ``grpc_web_filter``. This change makes http3 codec
the last trailer - a likely occurrence with the ``grpc_web_filter``. This change makes HTTP/3 codec

behave the same way http2 codec does, converting an empty trailers block to no trailers.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
behave the same way http2 codec does, converting an empty trailers block to no trailers.
behave the same way HTTP/2 codec does, converting an empty trailers block to no trailers.

This behavior can be reverted by setting the runtime guard ``envoy.reloadable_features.http3_remove_empty_trailers`` to false.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This behavior can be reverted by setting the runtime guard ``envoy.reloadable_features.http3_remove_empty_trailers`` to false.
This behavior can be reverted by setting the runtime guard ``envoy.reloadable_features.http3_remove_empty_trailers`` to ``false``.

- area: http
change: |
Fixed a bug where an incomplete request (missing body or trailers) may be proxied to the upstream when the limit on
Expand Down
14 changes: 8 additions & 6 deletions source/common/quic/envoy_quic_server_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ void EnvoyQuicServerStream::encodeHeaders(const Http::ResponseHeaderMap& headers
}

void EnvoyQuicServerStream::encodeTrailers(const Http::ResponseTrailerMap& trailers) {
if (trailers.empty()) {
ENVOY_STREAM_LOG(debug, "skipping submitting empty trailers", *this);
// Instead of submitting empty trailers, we send empty data with end_stream=true instead.
Buffer::OwnedImpl empty_buffer;
encodeData(empty_buffer, true);
return;
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.http3_remove_empty_trailers")) {
if (trailers.empty()) {
ENVOY_STREAM_LOG(debug, "skipping submitting empty trailers", *this);
// Instead of submitting empty trailers, we send empty data with end_stream=true instead.
Buffer::OwnedImpl empty_buffer;
encodeData(empty_buffer, true);
return;
}
}
ENVOY_STREAM_LOG(debug, "encodeTrailers: {}.", *this, trailers);
encodeTrailersImpl(envoyHeadersToHttp2HeaderBlock(trailers));
Expand Down
1 change: 1 addition & 0 deletions source/common/runtime/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ RUNTIME_GUARD(envoy_reloadable_features_http2_use_oghttp2);
RUNTIME_GUARD(envoy_reloadable_features_http2_use_visitor_for_data);
RUNTIME_GUARD(envoy_reloadable_features_http2_validate_authority_with_quiche);
RUNTIME_GUARD(envoy_reloadable_features_http3_happy_eyeballs);
RUNTIME_GUARD(envoy_reloadable_features_http3_remove_empty_trailers);
RUNTIME_GUARD(envoy_reloadable_features_http_filter_avoid_reentrant_local_reply);
// Delay deprecation and decommission until UHV is enabled.
RUNTIME_GUARD(envoy_reloadable_features_http_reject_path_with_fragment);
Expand Down
Loading