gzip: make use of generalized compression filter (#10306)

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>

Mirrored from https://github.com/envoyproxy/envoy @ c85bf324753414c205f1006724d2f5e67dec2d76
master-ci-test
data-plane-api(CircleCI) 5 years ago
parent fc9d746a57
commit 62dff62935
  1. 5
      envoy/config/filter/http/gzip/v2/BUILD
  2. 29
      envoy/config/filter/http/gzip/v2/gzip.proto
  3. 1
      envoy/extensions/filters/http/gzip/v3/BUILD
  4. 31
      envoy/extensions/filters/http/gzip/v3/gzip.proto

@ -5,5 +5,8 @@ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
licenses(["notice"]) # Apache 2
api_proto_package(
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"],
deps = [
"//envoy/config/filter/http/compressor/v2:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)

@ -2,6 +2,8 @@ syntax = "proto3";
package envoy.config.filter.http.gzip.v2;
import "envoy/config/filter/http/compressor/v2/compressor.proto";
import "google/protobuf/wrappers.proto";
import "udpa/annotations/migrate.proto";
@ -16,7 +18,7 @@ option (udpa.annotations.file_migrate).move_to_package = "envoy.extensions.filte
// Gzip :ref:`configuration overview <config_http_filters_gzip>`.
// [#extension: envoy.filters.http.gzip]
// [#next-free-field: 10]
// [#next-free-field: 11]
message Gzip {
enum CompressionStrategy {
DEFAULT = 0;
@ -38,7 +40,10 @@ message Gzip {
google.protobuf.UInt32Value memory_level = 1 [(validate.rules).uint32 = {lte: 9 gte: 1}];
// Minimum response length, in bytes, which will trigger compression. The default value is 30.
google.protobuf.UInt32Value content_length = 2 [(validate.rules).uint32 = {gte: 30}];
// .. attention:
//
// **This field is deprecated**. Set the `compressor` field instead.
google.protobuf.UInt32Value content_length = 2 [deprecated = true];
// A value used for selecting the zlib compression level. This setting will affect speed and
// amount of compression applied to the content. "BEST" provides higher compression at the cost of
@ -59,19 +64,33 @@ message Gzip {
// application/json, text/html, etc. When this field is not defined, compression will be applied
// to the following mime-types: "application/javascript", "application/json",
// "application/xhtml+xml", "image/svg+xml", "text/css", "text/html", "text/plain", "text/xml".
repeated string content_type = 6 [(validate.rules).repeated = {max_items: 50}];
// .. attention:
//
// **This field is deprecated**. Set the `compressor` field instead.
repeated string content_type = 6 [deprecated = true];
// If true, disables compression when the response contains an etag header. When it is false, the
// filter will preserve weak etags and remove the ones that require strong validation.
bool disable_on_etag_header = 7;
// .. attention:
//
// **This field is deprecated**. Set the `compressor` field instead.
bool disable_on_etag_header = 7 [deprecated = true];
// If true, removes accept-encoding from the request headers before dispatching it to the upstream
// so that responses do not get compressed before reaching the filter.
bool remove_accept_encoding_header = 8;
// .. attention:
//
// **This field is deprecated**. Set the `compressor` field instead.
bool remove_accept_encoding_header = 8 [deprecated = true];
// Value from 9 to 15 that represents the base two logarithmic of the compressor's window size.
// Larger window results in better compression at the expense of memory usage. The default is 12
// which will produce a 4096 bytes window. For more details about this parameter, please refer to
// zlib manual > deflateInit2.
google.protobuf.UInt32Value window_bits = 9 [(validate.rules).uint32 = {lte: 15 gte: 9}];
// Set of configuration parameters common for all compression filters. If this field is set then
// the fields `content_length`, `content_type`, `disable_on_etag_header` and
// `remove_accept_encoding_header` are ignored.
compressor.v2.Compressor compressor = 10;
}

@ -7,6 +7,7 @@ licenses(["notice"]) # Apache 2
api_proto_package(
deps = [
"//envoy/config/filter/http/gzip/v2:pkg",
"//envoy/extensions/filters/http/compressor/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)

@ -2,6 +2,8 @@ syntax = "proto3";
package envoy.extensions.filters.http.gzip.v3;
import "envoy/extensions/filters/http/compressor/v3/compressor.proto";
import "google/protobuf/wrappers.proto";
import "udpa/annotations/versioning.proto";
@ -16,7 +18,7 @@ option java_multiple_files = true;
// Gzip :ref:`configuration overview <config_http_filters_gzip>`.
// [#extension: envoy.filters.http.gzip]
// [#next-free-field: 10]
// [#next-free-field: 11]
message Gzip {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.filter.http.gzip.v2.Gzip";
@ -39,13 +41,15 @@ message Gzip {
}
}
reserved 2, 6, 7, 8;
reserved "content_length", "content_type", "disable_on_etag_header",
"remove_accept_encoding_header";
// Value from 1 to 9 that controls the amount of internal memory used by zlib. Higher values
// use more memory, but are faster and produce better compression results. The default value is 5.
google.protobuf.UInt32Value memory_level = 1 [(validate.rules).uint32 = {lte: 9 gte: 1}];
// Minimum response length, in bytes, which will trigger compression. The default value is 30.
google.protobuf.UInt32Value content_length = 2 [(validate.rules).uint32 = {gte: 30}];
// A value used for selecting the zlib compression level. This setting will affect speed and
// amount of compression applied to the content. "BEST" provides higher compression at the cost of
// higher latency, "SPEED" provides lower compression with minimum impact on response time.
@ -61,23 +65,14 @@ message Gzip {
// refer to zlib manual.
CompressionStrategy compression_strategy = 4 [(validate.rules).enum = {defined_only: true}];
// Set of strings that allows specifying which mime-types yield compression; e.g.,
// application/json, text/html, etc. When this field is not defined, compression will be applied
// to the following mime-types: "application/javascript", "application/json",
// "application/xhtml+xml", "image/svg+xml", "text/css", "text/html", "text/plain", "text/xml".
repeated string content_type = 6 [(validate.rules).repeated = {max_items: 50}];
// If true, disables compression when the response contains an etag header. When it is false, the
// filter will preserve weak etags and remove the ones that require strong validation.
bool disable_on_etag_header = 7;
// If true, removes accept-encoding from the request headers before dispatching it to the upstream
// so that responses do not get compressed before reaching the filter.
bool remove_accept_encoding_header = 8;
// Value from 9 to 15 that represents the base two logarithmic of the compressor's window size.
// Larger window results in better compression at the expense of memory usage. The default is 12
// which will produce a 4096 bytes window. For more details about this parameter, please refer to
// zlib manual > deflateInit2.
google.protobuf.UInt32Value window_bits = 9 [(validate.rules).uint32 = {lte: 15 gte: 9}];
// Set of configuration parameters common for all compression filters. If this field is set then
// the fields `content_length`, `content_type`, `disable_on_etag_header` and
// `remove_accept_encoding_header` are ignored.
compressor.v3.Compressor compressor = 10;
}

Loading…
Cancel
Save