-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Milestone
Description
If any encodeData callbacks call addEncodedData and no StopIteration* return values are returned, the buffered data will never be read, as we never call commonContinue due to the iteration_state_ check in commonHandleAfterDataCallback:
if (status == FilterDataStatus::Continue) {
if (iteration_state_ == IterationState::StopSingleIteration) {
commonHandleBufferData(provided_data);
commonContinue();
return false;
} else {
ASSERT(headers_continued_);
}
This becomes problematic because the following code misbehaves when there's only one encodeData callback:
Http::FilterDataStatus encodeData(Buffer::Instance& data, bool end_stream) {
encoder_callbacks_->addEncodedData(data, false);
if (end_stream) {
encoder_callbacks_->modifyEncodingBuffer([](auto& buffer) {
// do something with the buffer
});
return Http::FilterDataStatus::Continue;
}
return Http::FilterDataStatus::StopIterationNoBuffer;
}
};
Since the first call is has end_stream = true, we add data to buffer but since we return Continue, the buffer is never passed to the next filter.
Reactions are currently unavailable