-
Notifications
You must be signed in to change notification settings - Fork 5.3k
ext_authz: Make sure initiateCall only called once #6949
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,10 @@ void FilterConfigPerRoute::merge(const FilterConfigPerRoute& other) { | |
| } | ||
|
|
||
| void Filter::initiateCall(const Http::HeaderMap& headers) { | ||
| if (filter_return_ == FilterReturn::StopDecoding) { | ||
| return; | ||
| } | ||
|
|
||
| Router::RouteConstSharedPtr route = callbacks_->route(); | ||
| if (route == nullptr || route->routeEntry() == nullptr) { | ||
| return; | ||
|
|
@@ -96,8 +100,10 @@ Http::FilterHeadersStatus Filter::decodeHeaders(Http::HeaderMap& headers, bool e | |
|
|
||
| Http::FilterDataStatus Filter::decodeData(Buffer::Instance&, bool end_stream) { | ||
| if (buffer_data_) { | ||
| if (end_stream || isBufferFull()) { | ||
| ENVOY_STREAM_LOG(debug, "ext_authz filter finished buffering the request", *callbacks_); | ||
| const bool buffer_is_full = isBufferFull(); | ||
|
Member
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. shall we guard this in
Member
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. Let me try.
Member
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. Modified in c6b9334. |
||
| if (end_stream || buffer_is_full) { | ||
| ENVOY_STREAM_LOG(debug, "ext_authz filter finished buffering the request since {}", | ||
| *callbacks_, buffer_is_full ? "buffer is full" : "stream is ended"); | ||
| initiateCall(*request_headers_); | ||
| return filter_return_ == FilterReturn::StopDecoding | ||
| ? Http::FilterDataStatus::StopIterationAndWatermark | ||
|
|
||
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.
👍