-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
http: support passing match result action to filter #14462
Merged
+221
−67
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ef34466
basic custom action + test
snowp d848aaf
foramt
snowp d22c8d4
test for dual filter
snowp fe94c53
remove self import
snowp a838129
init bool field
snowp 66e1cd0
store skip result on state, handle filter handle
snowp 007ff2d
Merge remote-tracking branch 'envoy/master' into filter-action-match
snowp b314178
update tests to use new optref helper
snowp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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'm a little confused by this. Doesn't this need to be configurable or potentially context specific? Or the idea here is that a single filter registered twice would then only get the callbacks once and it doesn't actually matter whether they are in the encoding or decoding path? And this is really only needed for state that has to go through to the underlying impl like skip? Is skip the only case where this matters?
Given that the pointers are going to be the same if they are both set (right?), could the skip case be handled by just calling a method on the filter base which somehow knows how to set skip for both encoding and decoding direction?
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.
The problem is that we have two distinct filter wrappers around the same underlying filter: https://github.com/envoyproxy/envoy/blob/master/source/common/http/filter_manager.h#L705-L708
As a result, we need both wrappers to know about the fact that a skip action has been evaluated, since the skip action isn't associated with a specific filter wrapper, but to the filter itself. This here is one strategy where we have the FilterMatchState responsible for doing the matching and setting the skip_ flag on each of the wrappers. I can imagine another approach where we instead have the wrappers check the FilterMatchState to see whether it should skip?
For the filter action in the dual filter case we have two wrappers but we only want to notify the filter once about the match action, so we can get away with just arbitrarily picking one of the wrappers to use. Alternatively we could just hold onto a reference to the underlying filter instead: that way we're bypassing the wrappers in this case and things might be a bit clearer?
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 think this is what I would do since the state is shared?
Yeah +1.
So yeah personally I would make the above changes but if you don't can you add some more comments somewhere leaving a trail about this?
/wait