Skip to content

ext_proc: Support CONTINUE_AND_REPLACE from header callbacks - #16437

Merged
snowp merged 3 commits into
envoyproxy:mainfrom
gbrail:ext-proc-replace
May 20, 2021
Merged

snowp merged 3 commits into
envoyproxy:mainfrom
gbrail:ext-proc-replace

Conversation

@gbrail

@gbrail gbrail commented May 11, 2021

Copy link
Copy Markdown
Contributor

Commit Message: Support the CONTINUE_AND_REPLACE status
for reponses from header callbacks

Additional Description: This makes it possible for a processor
to add a body to a request or response that does not have one,
or replace the entire body in the response from a header callback
without otherwise touching it.

Risk Level: Low. Not enabled by default.

Testing: New unit and integration tests.

Release Notes: The CONTINUE_AND_REPLACE processing status can be
used to replace the body or create a new body from inside the response
to a header callback.

Signed-off-by: Gregory Brail [email protected]

Commit Message: Support the CONTINUE_AND_REPLACE status
for reponses from header callbacks

Additional Description: This makes it possible for a processor
to add a body to a request or response that does not have one,
or replace the entire body in the response from a header callback
without otherwise touching it.

Risk Level: Low. Not enabled by default.

Testing: New unit and integration tests.

Release Notes: The CONTINUE_AND_REPLACE processing status can be
used to replace the body or create a new body from inside the response
to a header callback.

Signed-off-by: Gregory Brail <[email protected]>
@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #16437 was opened by gbrail.

see: more, trace.

@antoniovicente

Copy link
Copy Markdown
Contributor

/assign-from @envoyproxy/first-pass-reviewers

@repokitteh-read-only

Copy link
Copy Markdown

@envoyproxy/first-pass-reviewers assignee is @antoniovicente

🐱

Caused by: a #16437 (comment) was created by @antoniovicente.

see: more, trace.

@gbrail
gbrail marked this pull request as ready for review May 12, 2021 03:05
@gbrail
gbrail requested a review from snowp as a code owner May 12, 2021 03:05
@htuch

htuch commented May 13, 2021

Copy link
Copy Markdown
Member

@antoniovicente I think it makes sense for @snowp to take this one e2e.

@adisuissa adisuissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this.
A minor API comment.

@gbrail
gbrail force-pushed the ext-proc-replace branch from 7786810 to 03c6212 Compare May 14, 2021 00:18

@snowp snowp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks this looks good to me, just a few comments that apply to old code so not really blockung less you want to fix them with this PR, lmk.

@@ -14,8 +14,8 @@ namespace ExternalProcessing {
class MutationUtils : public Logger::Loggable<Logger::Id::filter> {
public:
// Convert a header map until a protobuf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

into?

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown

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

Suggested change
// Convert a header map until a protobuf
// Convert a header map into a protobuf

Comment on lines +17 to +18
static void headersToProto(const Http::HeaderMap& headers_in,
envoy::config::core::v3::HeaderMap& proto_out);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright that sounds like a good enough reason for me :)

@snowp

snowp commented May 14, 2021

Copy link
Copy Markdown
Contributor

Needs @envoyproxy/api-shepherds review then this should be good to go

@adisuissa

Copy link
Copy Markdown
Contributor

/lgtm api

@snowp
snowp merged commit c307494 into envoyproxy:main May 20, 2021
@gbrail
gbrail deleted the ext-proc-replace branch August 2, 2021 17:03
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
…oxy#16437)

This makes it possible for a processor to add a body to a request or response that does
not have one, or replace the entire body in the response from a header callback
without otherwise touching it.

Signed-off-by: Gregory Brail <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants