Skip to content

Commit

Permalink
Skip metadata processing after sending local reply
Browse files Browse the repository at this point in the history
Signed-off-by: Yiming Jin <[email protected]>
  • Loading branch information
GinYM committed May 15, 2021
1 parent ae780e2 commit 27e1563
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/common/http/filter_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,12 @@ void FilterManager::decodeHeaders(ActiveStreamDecoderFilter* filter, RequestHead
(*entry)->handle_->decodeComplete();
}

// Skip processing metadata after sending local reply
if (state_.local_complete_ && std::next(entry) != decoder_filters_.end()) {
maybeContinueDecoding(continue_data_entry);
return;
}

const bool new_metadata_added = processNewlyAddedMetadata();
// If end_stream is set in headers, and a filter adds new metadata, we need to delay end_stream
// in headers by inserting an empty data frame with end_stream set. The empty data frame is sent
Expand All @@ -542,8 +548,7 @@ void FilterManager::decodeHeaders(ActiveStreamDecoderFilter* filter, RequestHead
addDecodedData(*((*entry).get()), empty_data, true);
}

if ((!continue_iteration || state_.local_complete_) &&
std::next(entry) != decoder_filters_.end()) {
if (!continue_iteration && std::next(entry) != decoder_filters_.end()) {
// Stop iteration IFF this is not the last filter. If it is the last filter, continue with
// processing since we need to handle the case where a terminal filter wants to buffer, but
// a previous filter has added body.
Expand Down

0 comments on commit 27e1563

Please sign in to comment.