thrift filter: support skip decoding data after metadata in the thrift message (#13592)

Fixes #13082

Support skip decoding data after metadata in the thrift message.

In payload_passthrough mode, there are some issues:

Envoy cannot detect some errors and exceptions ( e.g. a reply that contains exceptions ). It's possible to improve this by peeking beginning of the payload.

payload_passthrough controls both request and response path. It can be split into two options if we want more fine-grained control.

FilterStatus passthroughData(Buffer::Instance& data, uint64_t bytes_to_passthrough) will not prohibit custom filters to modify buffer. Now it is assumed custom filters won't do that, otherwise behavior is undefined.

Risk Level: Medium
Testing:

unit test:

config
decoder
router
conn_manager
integration:

add an parameter payload_passthrough
manual:

send requests and verify responses

Signed-off-by: Tong Cai <caitong93@gmail.com>

Mirrored from https://github.com/envoyproxy/envoy @ 2aee439cd15762cecda768a481b33bd88c999086
pull/623/head
data-plane-api(Azure Pipelines) 4 years ago
parent d77fdefd58
commit 365457f885
  1. 8
      envoy/extensions/filters/network/thrift_proxy/v3/thrift_proxy.proto
  2. 8
      envoy/extensions/filters/network/thrift_proxy/v4alpha/thrift_proxy.proto

@ -58,7 +58,7 @@ enum ProtocolType {
TWITTER = 4;
}
// [#next-free-field: 6]
// [#next-free-field: 7]
message ThriftProxy {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.filter.network.thrift_proxy.v2alpha1.ThriftProxy";
@ -82,6 +82,12 @@ message ThriftProxy {
// compatibility, if no thrift_filters are specified, a default Thrift router filter
// (`envoy.filters.thrift.router`) is used.
repeated ThriftFilter thrift_filters = 5;
// If set to true, Envoy will try to skip decode data after metadata in the Thrift message.
// This mode will only work if the upstream and downstream protocols are the same and the transport
// is the same, the transport type is framed and the protocol is not Twitter. Otherwise Envoy will
// fallback to decode the data.
bool payload_passthrough = 6;
}
// ThriftFilter configures a Thrift filter.

@ -58,7 +58,7 @@ enum ProtocolType {
TWITTER = 4;
}
// [#next-free-field: 6]
// [#next-free-field: 7]
message ThriftProxy {
option (udpa.annotations.versioning).previous_message_type =
"envoy.extensions.filters.network.thrift_proxy.v3.ThriftProxy";
@ -82,6 +82,12 @@ message ThriftProxy {
// compatibility, if no thrift_filters are specified, a default Thrift router filter
// (`envoy.filters.thrift.router`) is used.
repeated ThriftFilter thrift_filters = 5;
// If set to true, Envoy will try to skip decode data after metadata in the Thrift message.
// This mode will only work if the upstream and downstream protocols are the same and the transport
// is the same, the transport type is framed and the protocol is not Twitter. Otherwise Envoy will
// fallback to decode the data.
bool payload_passthrough = 6;
}
// ThriftFilter configures a Thrift filter.

Loading…
Cancel
Save