From afc551258da8d538981e448575d920a2803794df Mon Sep 17 00:00:00 2001 From: Nathanael DEMACON Date: Fri, 9 Feb 2024 11:54:25 +0100 Subject: [PATCH] allow "trailers" Signed-off-by: Nathanael DEMACON --- source/common/http/conn_manager_utility.cc | 4 +--- test/integration/protocol_integration_test.cc | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/source/common/http/conn_manager_utility.cc b/source/common/http/conn_manager_utility.cc index 20b84725269f..edb4c1fa2b45 100644 --- a/source/common/http/conn_manager_utility.cc +++ b/source/common/http/conn_manager_utility.cc @@ -94,9 +94,7 @@ ConnectionManagerUtility::MutateRequestHeadersResult ConnectionManagerUtility::m request_headers.removeUpgrade(); if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.sanitize_te")) { - if (Grpc::Common::isGrpcRequestHeaders(request_headers)) { - request_headers.setTE(Http::Headers::get().TEValues.Trailers); - } else { + if (request_headers.TE() != Http::Headers::get().TEValues.Trailers) { request_headers.removeTE(); } } diff --git a/test/integration/protocol_integration_test.cc b/test/integration/protocol_integration_test.cc index aa5a73557a3a..ef0a0c43ccf8 100644 --- a/test/integration/protocol_integration_test.cc +++ b/test/integration/protocol_integration_test.cc @@ -809,7 +809,7 @@ TEST_P(DownstreamProtocolIntegrationTest, TeSanitization) { EXPECT_EQ("", upstream_headers->getTEValue()); } -TEST_P(DownstreamProtocolIntegrationTest, TeSanitizationGrpc) { +TEST_P(DownstreamProtocolIntegrationTest, TeSanitizationTrailers) { if (downstreamProtocol() != Http::CodecType::HTTP1) { return; } @@ -817,8 +817,7 @@ TEST_P(DownstreamProtocolIntegrationTest, TeSanitizationGrpc) { autonomous_upstream_ = true; config_helper_.addRuntimeOverride("envoy.reloadable_features.sanitize_te", "true"); - default_request_headers_.setTE("gzip"); - default_request_headers_.setContentType("application/grpc"); + default_request_headers_.setTE("trailers"); initialize(); codec_client_ = makeHttpConnection(lookupPort("http"));