Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Report correct body size in buffered mode. #608

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions source/extensions/common/wasm/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,9 @@ Http::FilterDataStatus Context::decodeData(::Envoy::Buffer::Instance& data, bool
}
request_body_buffer_ = &data;
end_of_stream_ = end_stream;
auto result = convertFilterDataStatus(onRequestBody(data.length(), end_stream));
const auto buffer = getBuffer(WasmBufferType::HttpRequestBody);
const auto buffer_size = (buffer == nullptr) ? 0 : buffer->size();
auto result = convertFilterDataStatus(onRequestBody(buffer_size, end_stream));
buffering_request_body_ = false;
switch (result) {
case Http::FilterDataStatus::Continue:
Expand Down Expand Up @@ -1589,7 +1591,9 @@ Http::FilterDataStatus Context::encodeData(::Envoy::Buffer::Instance& data, bool
}
response_body_buffer_ = &data;
end_of_stream_ = end_stream;
auto result = convertFilterDataStatus(onResponseBody(data.length(), end_stream));
const auto buffer = getBuffer(WasmBufferType::HttpResponseBody);
const auto buffer_size = (buffer == nullptr) ? 0 : buffer->size();
auto result = convertFilterDataStatus(onResponseBody(buffer_size, end_stream));
buffering_response_body_ = false;
switch (result) {
case Http::FilterDataStatus::Continue:
Expand Down