-
Notifications
You must be signed in to change notification settings - Fork 5.3k
ext_proc: Support CONTINUE_AND_REPLACE from header callbacks #16437
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,8 @@ namespace ExternalProcessing { | |
| class MutationUtils : public Logger::Loggable<Logger::Id::filter> { | ||
| public: | ||
| // Convert a header map until a protobuf | ||
| static void buildHttpHeaders(const Http::HeaderMap& headers_in, | ||
| envoy::config::core::v3::HeaderMap& headers_out); | ||
| static void headersToProto(const Http::HeaderMap& headers_in, | ||
| envoy::config::core::v3::HeaderMap& proto_out); | ||
|
Comment on lines
+17
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Old code but I think unless there is a good reason this should be returning the HeaderMap instead of taking an out param?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting question, actually. The only places we call this method we're using it to set the fields of an embedded message field in protobuf. So I think that if we change it, then the code that calls this function has to first get a pointer to an embedded message by calling "mutable_whatever" on the field, and then needs to copy the result of this function into the result. Doing it this way saves the copy which seems like a good thing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright that sounds like a good enough reason for me :) |
||
|
|
||
| // Apply mutations that are common to header responses. | ||
| static void | ||
|
|
@@ -25,19 +25,20 @@ class MutationUtils : public Logger::Loggable<Logger::Id::filter> { | |
| // Modify header map based on a set of mutations from a protobuf | ||
| static void | ||
| applyHeaderMutations(const envoy::service::ext_proc::v3alpha::HeaderMutation& mutation, | ||
| Http::HeaderMap& headers); | ||
| Http::HeaderMap& headers, bool replacing_message); | ||
|
|
||
| // Apply mutations that are common to body responses. | ||
| // Mutations will be applied to the header map if it is not null. | ||
| static void applyCommonBodyResponse(const envoy::service::ext_proc::v3alpha::BodyResponse& body, | ||
| Http::HeaderMap* headers, Buffer::Instance& buffer); | ||
| Http::RequestOrResponseHeaderMap* headers, | ||
| Buffer::Instance& buffer); | ||
|
|
||
| // Modify a buffer based on a set of mutations from a protobuf | ||
| static void applyBodyMutations(const envoy::service::ext_proc::v3alpha::BodyMutation& mutation, | ||
| Buffer::Instance& buffer); | ||
|
|
||
| private: | ||
| static bool isSettableHeader(absl::string_view key); | ||
| static bool isSettableHeader(absl::string_view key, bool replacing_message); | ||
| }; | ||
|
|
||
| } // namespace ExternalProcessing | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change the other thing here, then I'll certainly do it -- if not, then I'd like to do it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe it was a suggestion on fixing a typo