fix: handle request trailers in the test server#1548
Open
immanuwell wants to merge 1 commit into
Open
Conversation
Signed-off-by: immanuwell <pchpr.00@list.ru>
eric846
requested changes
Jun 17, 2026
| request_headers_dump_ = headers_dump.str(); | ||
| } | ||
| sendReply(*effective_config_.value()); | ||
| if (effective_config_.ok() && effective_config_.value()->echo_request_headers()) { |
Contributor
There was a problem hiding this comment.
I'm not sure, but I think there might be another bug that we might be able to address at the same time:
If there are trailers, that might mean decodeHeaders is always called with end_stream=false. If so, we would fail to dump the request headers to the response body.
To fix that, maybe we should just lift the if (effective_config.ok()... to before if (end_stream).
If you can't quickly determine if that would solve the problem correctly (possibly with an extra testcase), feel free to skip, and we can work on the case of header dumping with request trailers later.
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.
Description
This PR is related to #1103
If a request ends with trailers, the test server can miss the local reply and just hang.
Right now it only replies from
decodeHeaders(..., end_stream=true)ordecodeData(..., end_stream=true).This patch sends the reply from
decodeTrailers()too, adds a regression test, and notes the behavior in docs.Repro on
main:bazel-bin/nighthawk_test_serverprintf 'POST / HTTP/1.1\r\nHost: 127.0.0.1:10000\r\nTransfer-Encoding: chunked\r\nTrailer: x-test-trailer\r\n\r\n1\r\na\r\n0\r\nx-test-trailer: yep\r\n\r\n' | nc 127.0.0.1 10000With this patch it returns
200with the configured body. tiny fix, real gap.Notes for Reviewers
No API changes.