Skip to content

Commit

Permalink
[http] Remove legacy codecs (#14381)
Browse files Browse the repository at this point in the history
Removes legacy codecs

Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa authored Dec 16, 2020
1 parent 0e00d2d commit 09134ff
Show file tree
Hide file tree
Showing 34 changed files with 424 additions and 5,017 deletions.
5 changes: 0 additions & 5 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@ config_setting(
values = {"define": "path_normalization_by_default=true"},
)

config_setting(
name = "enable_legacy_codecs_in_integration_tests",
values = {"define": "use_new_codecs_in_integration_tests=false"},
)

cc_proto_library(
name = "grpc_health_proto",
deps = ["@com_github_grpc_grpc//src/proto/grpc/health/v1:_health_proto_only"],
Expand Down
2 changes: 0 additions & 2 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ load(
_envoy_select_boringssl = "envoy_select_boringssl",
_envoy_select_google_grpc = "envoy_select_google_grpc",
_envoy_select_hot_restart = "envoy_select_hot_restart",
_envoy_select_new_codecs_in_integration_tests = "envoy_select_new_codecs_in_integration_tests",
_envoy_select_wasm = "envoy_select_wasm",
_envoy_select_wasm_v8 = "envoy_select_wasm_v8",
_envoy_select_wasm_wasmtime = "envoy_select_wasm_wasmtime",
Expand Down Expand Up @@ -195,7 +194,6 @@ envoy_select_wasm = _envoy_select_wasm
envoy_select_wasm_wavm = _envoy_select_wasm_wavm
envoy_select_wasm_wasmtime = _envoy_select_wasm_wasmtime
envoy_select_wasm_v8 = _envoy_select_wasm_v8
envoy_select_new_codecs_in_integration_tests = _envoy_select_new_codecs_in_integration_tests

# Binary wrappers (from envoy_binary.bzl)
envoy_cc_binary = _envoy_cc_binary
Expand Down
7 changes: 0 additions & 7 deletions bazel/envoy_select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,3 @@ def envoy_select_wasm_wasmtime(xs):
"@envoy//bazel:wasm_wasmtime": xs,
"//conditions:default": [],
})

# Select the given values by default and remove if use new codecs are disabled for current build.
def envoy_select_new_codecs_in_integration_tests(xs, repository = ""):
return select({
repository + "//bazel:enable_legacy_codecs_in_integration_tests": [],
"//conditions:default": xs,
})
1 change: 0 additions & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ elif [[ "$CI_TARGET" == "bazel.compile_time_options" ]]; then
"--define" "quiche=enabled"
"--define" "path_normalization_by_default=true"
"--define" "deprecated_features=disabled"
"--define" "use_new_codecs_in_integration_tests=false"
"--define" "tcmalloc=gperftools"
"--define" "zlib=ng"
"--@envoy//source/extensions/filters/http/kill_request:enabled"
Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Removed Config or Runtime
* ext_authz: removed auto ignore case in HTTP-based `ext_authz` header matching and the runtime guard `envoy.reloadable_features.ext_authz_http_service_enable_case_sensitive_string_matcher`. To ignore case, set the :ref:`ignore_case <envoy_api_field_type.matcher.StringMatcher.ignore_case>` field to true.
* http: flip default HTTP/1 and HTTP/2 server codec implementations to new codecs that remove the use of exceptions for control flow. To revert to old codec behavior, set the runtime feature `envoy.reloadable_features.new_codec_behavior` to false.
* http: removed `envoy.reloadable_features.http1_flood_protection` and legacy code path for turning flood protection off.
* http: removed `envoy.reloadable_features.new_codec_behavior` and legacy codecs.

New Features
------------
Expand Down
7 changes: 0 additions & 7 deletions source/common/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,16 @@ envoy_cc_library(
"//include/envoy/http:codec_interface",
"//include/envoy/network:connection_interface",
"//include/envoy/network:filter_interface",
"//include/envoy/runtime:runtime_interface",
"//source/common/common:assert_lib",
"//source/common/common:enum_to_int",
"//source/common/common:linked_object",
"//source/common/common:minimal_logger_lib",
"//source/common/config:utility_lib",
"//source/common/http/http1:codec_legacy_lib",
"//source/common/http/http1:codec_lib",
"//source/common/http/http2:codec_legacy_lib",
"//source/common/http/http2:codec_lib",
"//source/common/http/http3:quic_codec_factory_lib",
"//source/common/http/http3:well_known_names",
"//source/common/network:filter_lib",
"//source/common/runtime:runtime_features_lib",
"//source/common/runtime:runtime_lib",
],
)

Expand Down Expand Up @@ -248,9 +243,7 @@ envoy_cc_library(
"//source/common/common:scope_tracker",
"//source/common/common:utility_lib",
"//source/common/config:utility_lib",
"//source/common/http/http1:codec_legacy_lib",
"//source/common/http/http1:codec_lib",
"//source/common/http/http2:codec_legacy_lib",
"//source/common/http/http2:codec_lib",
"//source/common/http/http3:quic_codec_factory_lib",
"//source/common/http/http3:well_known_names",
Expand Down
16 changes: 3 additions & 13 deletions source/common/http/codec_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
#include "common/config/utility.h"
#include "common/http/exception.h"
#include "common/http/http1/codec_impl.h"
#include "common/http/http1/codec_impl_legacy.h"
#include "common/http/http2/codec_impl.h"
#include "common/http/http2/codec_impl_legacy.h"
#include "common/http/http3/quic_codec_factory.h"
#include "common/http/http3/well_known_names.h"
#include "common/http/status.h"
#include "common/http/utility.h"
#include "common/runtime/runtime_features.h"
#include "common/runtime/runtime_impl.h"

namespace Envoy {
namespace Http {
Expand Down Expand Up @@ -162,15 +158,9 @@ CodecClientProd::CodecClientProd(Type type, Network::ClientConnectionPtr&& conne

switch (type) {
case Type::HTTP1: {
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.new_codec_behavior")) {
codec_ = std::make_unique<Http1::ClientConnectionImpl>(
*connection_, host->cluster().http1CodecStats(), *this, host->cluster().http1Settings(),
host->cluster().maxResponseHeadersCount());
} else {
codec_ = std::make_unique<Legacy::Http1::ClientConnectionImpl>(
*connection_, host->cluster().http1CodecStats(), *this, host->cluster().http1Settings(),
host->cluster().maxResponseHeadersCount());
}
codec_ = std::make_unique<Http1::ClientConnectionImpl>(
*connection_, host->cluster().http1CodecStats(), *this, host->cluster().http1Settings(),
host->cluster().maxResponseHeadersCount());
break;
}
case Type::HTTP2: {
Expand Down
26 changes: 6 additions & 20 deletions source/common/http/conn_manager_utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#include "common/http/header_utility.h"
#include "common/http/headers.h"
#include "common/http/http1/codec_impl.h"
#include "common/http/http1/codec_impl_legacy.h"
#include "common/http/http2/codec_impl.h"
#include "common/http/http2/codec_impl_legacy.h"
#include "common/http/path_utility.h"
#include "common/http/utility.h"
#include "common/network/utility.h"
Expand Down Expand Up @@ -53,26 +51,14 @@ ServerConnectionPtr ConnectionManagerUtility::autoCreateCodec(
headers_with_underscores_action) {
if (determineNextProtocol(connection, data) == Utility::AlpnNames::get().Http2) {
Http2::CodecStats& stats = Http2::CodecStats::atomicGet(http2_codec_stats, scope);
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.new_codec_behavior")) {
return std::make_unique<Http2::ServerConnectionImpl>(
connection, callbacks, stats, random, http2_options, max_request_headers_kb,
max_request_headers_count, headers_with_underscores_action);
} else {
return std::make_unique<Legacy::Http2::ServerConnectionImpl>(
connection, callbacks, stats, random, http2_options, max_request_headers_kb,
max_request_headers_count, headers_with_underscores_action);
}
return std::make_unique<Http2::ServerConnectionImpl>(
connection, callbacks, stats, random, http2_options, max_request_headers_kb,
max_request_headers_count, headers_with_underscores_action);
} else {
Http1::CodecStats& stats = Http1::CodecStats::atomicGet(http1_codec_stats, scope);
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.new_codec_behavior")) {
return std::make_unique<Http1::ServerConnectionImpl>(
connection, stats, callbacks, http1_settings, max_request_headers_kb,
max_request_headers_count, headers_with_underscores_action);
} else {
return std::make_unique<Legacy::Http1::ServerConnectionImpl>(
connection, stats, callbacks, http1_settings, max_request_headers_kb,
max_request_headers_count, headers_with_underscores_action);
}
return std::make_unique<Http1::ServerConnectionImpl>(
connection, stats, callbacks, http1_settings, max_request_headers_kb,
max_request_headers_count, headers_with_underscores_action);
}
}

Expand Down
59 changes: 25 additions & 34 deletions source/common/http/http1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,36 @@ envoy_cc_library(
],
)

CODEC_LIB_DEPS = [
":codec_stats_lib",
":header_formatter_lib",
"//include/envoy/buffer:buffer_interface",
"//include/envoy/http:codec_interface",
"//include/envoy/http:header_map_interface",
"//include/envoy/network:connection_interface",
"//source/common/buffer:buffer_lib",
"//source/common/buffer:watermark_buffer_lib",
"//source/common/common:assert_lib",
"//source/common/common:statusor_lib",
"//source/common/common:utility_lib",
"//source/common/grpc:common_lib",
"//source/common/http:codec_helper_lib",
"//source/common/http:codes_lib",
"//source/common/http:exception_lib",
"//source/common/http:header_map_lib",
"//source/common/http:header_utility_lib",
"//source/common/http:headers_lib",
"//source/common/http:status_lib",
"//source/common/http:utility_lib",
"//source/common/runtime:runtime_features_lib",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
]

envoy_cc_library(
name = "codec_lib",
srcs = ["codec_impl.cc"],
hdrs = ["codec_impl.h"],
external_deps = ["http_parser"],
deps = CODEC_LIB_DEPS + ["//source/common/common:cleanup_lib"],
)

envoy_cc_library(
name = "codec_legacy_lib",
srcs = ["codec_impl_legacy.cc"],
hdrs = ["codec_impl_legacy.h"],
external_deps = ["http_parser"],
deps = CODEC_LIB_DEPS,
deps = [
":codec_stats_lib",
":header_formatter_lib",
"//include/envoy/buffer:buffer_interface",
"//include/envoy/http:codec_interface",
"//include/envoy/http:header_map_interface",
"//include/envoy/network:connection_interface",
"//source/common/buffer:buffer_lib",
"//source/common/buffer:watermark_buffer_lib",
"//source/common/common:assert_lib",
"//source/common/common:cleanup_lib",
"//source/common/common:statusor_lib",
"//source/common/common:utility_lib",
"//source/common/grpc:common_lib",
"//source/common/http:codec_helper_lib",
"//source/common/http:codes_lib",
"//source/common/http:exception_lib",
"//source/common/http:header_map_lib",
"//source/common/http:header_utility_lib",
"//source/common/http:headers_lib",
"//source/common/http:status_lib",
"//source/common/http:utility_lib",
"//source/common/runtime:runtime_features_lib",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
],
)

envoy_cc_library(
Expand Down
Loading

0 comments on commit 09134ff

Please sign in to comment.