Repository navigation
Conversation
Member
Author
|
cc @jwendell this is the follow up from your backports |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A critical issue clears the buffered final body's end-of-stream state when stopped headers are injected, leaving both decoder and encoder chains incomplete and requiring a fix with regression tests.
1 open issue
What changed in this PR
Updates Envoy’s HTTP filter manager to preserve injected headers’ end-of-stream state when a later filter pauses and resumes them, allowing an added body to follow.
Changes:
- Records injected-header state on request and response paths under the existing runtime guard.
- Adds regression tests for continuation before body injection.
- Documents the fix and runtime rollback option.
| File | Description |
|---|---|
test/common/http/conn_manager_impl_test_3.cc |
Adds request and response continuation regression tests. |
source/common/http/filter_manager.cc |
Updates observed end-of-stream state during header injection. |
changelogs/current/bug_fixes/http__inject-headers-end-stream.rst |
Describes the fix and rollback guard. |
Review effort: Balanced
phlax
marked this pull request as draft
November 18, 2026 19:39
…of the stream `injectDecodedHeadersToFilterChain()` and `injectEncodedHeadersToFilterChain()` (envoyproxy#47475) send the headers on with the `end_stream` the filter gives them, so a filter can add a body to a header-only request or response: it injects the headers without `end_stream`, and the body later. A later filter that stops those headers continues them with the end of stream the filter manager has observed (`commonContinue()`), which for a header-only message is "ended". If it continued before the body was injected, it passed the headers on as the end of the stream, and the body followed a stream the rest of the chain had seen complete. The filter manager now records that the headers were injected without `end_stream`, and a filter that stopped them does not continue them as the end of the stream. Only that: the observed end of stream is not changed, so data that was buffered, and trailers, end the stream as they did (a filter that buffers the whole body, injects the headers and then continues still sends the body with `end_stream`). Nothing in the tree is affected today: the one caller (ext_proc, in streamed modes) does not inject the headers of a message without a body. Risk Level: Low Testing: Unit tests for the request and the response paths: a later filter continuing the injected headers of a header-only message (fails without the change), and a buffered body continued after the headers are injected Docs Changes: N/A Release Notes: Added Runtime guard: envoy.reloadable_features.http_inject_headers_without_end_stream Signed-off-by: Ryan Northey <ryan@synca.io>
phlax
force-pushed
the
http-inject-headers-end-stream
branch
from
November 18, 2026 19:50
75148d5 to
6496068
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Mixed header injections can leave a stale flag that forwards terminal headers with end_stream=false and stalls decoding or encoding, and disabled-guard coverage is missing.
2 open issues
1 resolved since last review
Review effort: Balanced
Comment on lines
+528
to
+532
| if (!end_stream && | ||
| Runtime::runtimeFeatureEnabled( | ||
| "envoy.reloadable_features.http_inject_headers_without_end_stream")) { | ||
| parent_.state().decode_headers_injected_without_end_stream_ = true; | ||
| } |
| // Filter adds a body to a header-only request: it injects the headers without end_stream, and the | ||
| // next filter stops them, and continues before the body is injected. The headers it continues | ||
| // with are not the end of the stream. | ||
| TEST_F(HttpConnectionManagerImplTest, FilterStopIterationInjectHeadersLaterFilterContinues) { |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


injectDecodedHeadersToFilterChain()andinjectEncodedHeadersToFilterChain()(#47475) send the headers on with the
end_streamthe filter gives them, so afilter can add a body to a header-only request or response: it injects the
headers without
end_stream, and the body later.A later filter that stops those headers continues them with the end of stream
the filter manager has observed (
commonContinue()), which for a header-onlymessage is "ended". If it continued before the body was injected, it passed
the headers on as the end of the stream, and the body followed a stream the
rest of the chain had seen complete.
The filter manager now records that the headers were injected without
end_stream, and a filter that stopped them does not continue them as theend of the stream. Only that: the observed end of stream is not changed, so
data that was buffered, and trailers, end the stream as they did (a filter
that buffers the whole body, injects the headers and then continues still
sends the body with
end_stream).Nothing in the tree is affected today: the one caller (ext_proc, in streamed
modes) does not inject the headers of a message without a body.
Risk Level: Low
Testing: Unit tests for the request and the response paths: a later filter continuing the injected headers of a header-only message (without the change both fail:
Expected arg #1: is equal to false, Actual: trueon the last filter's headers), and a buffered body continued after the headers are injected. With the change,//test/common/http/...and//test/extensions/filters/http/ext_proc/...pass.Docs Changes: N/A
Release Notes: Added
Runtime guard: envoy.reloadable_features.http_inject_headers_without_end_stream
Found from the review of the backports of #47475 (#49404, #49405, #49406), which have the same code.