http: add HTTP/1.1 case preservation (#15619)

1) Add new stateful header formatter extension point
2) Add preserve case formatter extension

Fixes https://github.com/envoyproxy/envoy/issues/14363

Signed-off-by: Matt Klein <mklein@lyft.com>

Mirrored from https://github.com/envoyproxy/envoy @ 2a4d97ce66db565d191b42cdf51f4b99edf04f12
pull/624/head
data-plane-api(Azure Pipelines) 4 years ago
parent 6d4c657377
commit 80c2b65417
  1. 1
      BUILD
  2. 7
      envoy/config/core/v3/protocol.proto
  3. 7
      envoy/config/core/v4alpha/protocol.proto
  4. 9
      envoy/extensions/http/header_formatters/preserve_case/v3/BUILD
  5. 19
      envoy/extensions/http/header_formatters/preserve_case/v3/preserve_case.proto
  6. 1
      versioning/BUILD

@ -243,6 +243,7 @@ proto_library(
"//envoy/extensions/filters/udp/dns_filter/v3alpha:pkg",
"//envoy/extensions/filters/udp/udp_proxy/v3:pkg",
"//envoy/extensions/health_checkers/redis/v3:pkg",
"//envoy/extensions/http/header_formatters/preserve_case/v3:pkg",
"//envoy/extensions/internal_redirect/allow_listed_routes/v3:pkg",
"//envoy/extensions/internal_redirect/previous_routes/v3:pkg",
"//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg",

@ -2,6 +2,7 @@ syntax = "proto3";
package envoy.config.core.v3;
import "envoy/config/core/v3/extension.proto";
import "envoy/type/v3/percent.proto";
import "google/protobuf/duration.proto";
@ -118,6 +119,7 @@ message Http1ProtocolOptions {
option (udpa.annotations.versioning).previous_message_type =
"envoy.api.v2.core.Http1ProtocolOptions";
// [#next-free-field: 9]
message HeaderKeyFormat {
option (udpa.annotations.versioning).previous_message_type =
"envoy.api.v2.core.Http1ProtocolOptions.HeaderKeyFormat";
@ -136,6 +138,11 @@ message Http1ProtocolOptions {
// Note that while this results in most headers following conventional casing, certain headers
// are not covered. For example, the "TE" header will be formatted as "Te".
ProperCaseWords proper_case_words = 1;
// Configuration for stateful formatter extensions that allow using received headers to
// affect the output of encoding headers. E.g., preserving case during proxying.
// [#extension-category: envoy.http.stateful_header_formatters]
TypedExtensionConfig stateful_formatter = 8;
}
}

@ -2,6 +2,7 @@ syntax = "proto3";
package envoy.config.core.v4alpha;
import "envoy/config/core/v4alpha/extension.proto";
import "envoy/type/v3/percent.proto";
import "google/protobuf/duration.proto";
@ -121,6 +122,7 @@ message Http1ProtocolOptions {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.core.v3.Http1ProtocolOptions";
// [#next-free-field: 9]
message HeaderKeyFormat {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat";
@ -139,6 +141,11 @@ message Http1ProtocolOptions {
// Note that while this results in most headers following conventional casing, certain headers
// are not covered. For example, the "TE" header will be formatted as "Te".
ProperCaseWords proper_case_words = 1;
// Configuration for stateful formatter extensions that allow using received headers to
// affect the output of encoding headers. E.g., preserving case during proxying.
// [#extension-category: envoy.http.stateful_header_formatters]
TypedExtensionConfig stateful_formatter = 8;
}
}

@ -0,0 +1,9 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.
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"],
)

@ -0,0 +1,19 @@
syntax = "proto3";
package envoy.extensions.http.header_formatters.preserve_case.v3;
import "udpa/annotations/status.proto";
option java_package = "io.envoyproxy.envoy.extensions.http.header_formatters.preserve_case.v3";
option java_outer_classname = "PreserveCaseProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: Preserve case header formatter]
// [#extension: envoy.http.stateful_header_formatters.preserve_case]
// Configuration for the preserve case header formatter.
// See the :ref:`header casing <config_http_conn_man_header_casing>` configuration guide for more
// information.
message PreserveCaseFormatterConfig {
}

@ -126,6 +126,7 @@ proto_library(
"//envoy/extensions/filters/udp/dns_filter/v3alpha:pkg",
"//envoy/extensions/filters/udp/udp_proxy/v3:pkg",
"//envoy/extensions/health_checkers/redis/v3:pkg",
"//envoy/extensions/http/header_formatters/preserve_case/v3:pkg",
"//envoy/extensions/internal_redirect/allow_listed_routes/v3:pkg",
"//envoy/extensions/internal_redirect/previous_routes/v3:pkg",
"//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg",

Loading…
Cancel
Save