client: add --request-body-file to send a file's bytes as the request body - #1601
Merged
Merged
Conversation
… body
Nighthawk could only send a synthetic body ('a' repeated --request-body-size
times) or, through a request source plugin, a UTF-8 json_body string. Add
--request-body-file, which reads the whole file and sends its bytes
verbatim on every request (binary safe), carried over the gRPC service API
in the new RequestOptions.request_body bytes field. Content-Length is set
from the body size; no Content-Type is assumed, supply one with
--request-header. Mutually exclusive with --request-body-size.
StaticRequestSourceImpl gains an optional body so the static request source
can yield it; the plugin and remote request sources are unchanged.
Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
This was referenced Sep 7, 2026
eric846
previously approved these changes
Sep 16, 2026
Keeps the branch mergeable after the Envoy bump to 82c182e, the envoy_package additions and envoyproxy#1598 landing. The only conflict was the version history changelist, where both sides add a bullet; both are kept. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
Second update in a row: envoyproxy#1599 landed while this branch was being brought up to date. Conflicts were all "both sides added something in the same place": - toCommandLineOptionsInternal(): envoyproxy#1599 hoisted the request_body_size emission out of the request header loop, this branch added the request_body emission next to it. Both are kept; an explicitly emitted request_body_size of 0 does not trip the exclusivity check in validate(), which tests request_body_size_ > 0. - options_test.cc and the version history changelist: both sides append their own test / bullet, both are kept. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
Contributor
Author
|
@eric846 gentle ping after fixing conflicts 🙏 ? |
eric846
approved these changes
Sep 17, 2026
bpalermo
added a commit
to bpalermo/nighthawk
that referenced
this pull request
Sep 17, 2026
Brings the branch up to date after envoyproxy#1601 landed. The only conflict was the version history changelist, where both sides add a bullet; both are kept. Pushing this also gives the tsan job a second run: the failure eric846 saw was test_https_prefetching, which asserts 50 TLS connections are established inside a 1 second run, and it failed because the counter was absent rather than wrong, i.e. no connection completed in time. Signed-off-by: Bruno Palermo <bruno.palermo@superbid.net>
bpalermo
added a commit
to bpalermo/nighthawk
that referenced
this pull request
Sep 17, 2026
envoyproxy#1601 was squash merged, so main carries the --request-body-file change as a single commit while this branch still carries its originals. Every conflict was this branch's unary additions against main's post squash text, with no hunk where main had content this branch lacked, so each was resolved in favour of this branch. The version history changelist keeps main's entries plus this branch's. Signed-off-by: Bruno Palermo <b@palermo.dev>
bpalermo
added a commit
to bpalermo/nighthawk
that referenced
this pull request
Sep 17, 2026
Brings in that branch's merge of upstream main, which resolves this branch against main after envoyproxy#1601 was squash merged. No conflicts. Signed-off-by: Bruno Palermo <b@palermo.dev>
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 #1608
Nighthawk can only send a synthetic body (
'a'repeated--request-body-sizetimes) or, through a request source plugin, ajson_body, which is a proto3stringand therefore must be UTF-8. That rules out sending an arbitrary payload such as a serialized protobuf.This adds
--request-body-file <path>: the file's bytes are sent verbatim on every request (binary safe). Over the gRPC service API the body travels in the newRequestOptions.request_body(bytes) field.Content-Lengthis set from the body size; noContent-Typeis assumed, pass one with--request-header.--request-body-sizebehavior is unchanged, and the two are mutually exclusive.Notes for Reviewers
OptionsImplreads the file at parse time (size cap, clear errors for unreadable files);StaticRequestSourceImplgains an optional body;RequestSourceFactoryImplpasses it through. Plugin and remote request sources are unchanged.//test:options_test(verbatim binary content and proto round trip, missing file, mutual exclusion),//test:factories_test(body,Content-Length, noContent-Type),test/integration/test_request_body_file.py(full run posting a binary file to the test server). README usage regenerated; version history updated.