Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Minor Behavior Changes
*Changes that may cause incompatibilities for some users, but should not for most*

* access_log: add new access_log command operator ``%REQUEST_TX_DURATION%``.
* http: disable the integration between :ref:`ExtensionWithMatcher <envoy_api_msg_extensions.common.matching.v3.ExtensionWithMatcher>`
and HTTP filters by default to reflects its experimental status. This feature can be enabled by seting
``envoy.reloadable_features.experimental_matching_api`` to true.
* http: replaced setting ``envoy.reloadable_features.strict_1xx_and_204_response_headers`` with settings
``envoy.reloadable_features.require_strict_1xx_and_204_response_headers``
(require upstream 1xx or 204 responses to not have Transfer-Encoding or non-zero Content-Length headers) and
Expand Down
4 changes: 4 additions & 0 deletions source/common/http/match_wrapper/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ Envoy::Http::FilterFactoryCb MatchWrapperConfig::createFilterFactoryFromProtoTyp
const envoy::extensions::common::matching::v3::ExtensionWithMatcher& proto_config,
const std::string& prefix, Server::Configuration::FactoryContext& context) {

if (!Runtime::runtimeFeatureEnabled("envoy.reloadable_features.experimental_matching_api")) {
throw EnvoyException("Experimental matching API is not enabled");
}

ASSERT(proto_config.has_extension_config());
auto& factory =
Config::Utility::getAndCheckFactory<Server::Configuration::NamedHttpFilterConfigFactory>(
Expand Down
2 changes: 2 additions & 0 deletions source/common/runtime/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ constexpr const char* disabled_runtime_features[] = {
"envoy.reloadable_features.remove_legacy_json",
// Sentinel and test flag.
"envoy.reloadable_features.test_feature_false",
// Allows the use of ExtensionWithMatcher to wrap a HTTP filter with a match tree.
"envoy.reloadable_features.experimental_matching_api",
};

RuntimeFeatures::RuntimeFeatures() {
Expand Down
1 change: 1 addition & 0 deletions test/common/http/match_wrapper/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ envoy_cc_test(
"//source/common/http/match_wrapper:config",
"//test/mocks/server:factory_context_mocks",
"//test/test_common:registry_lib",
"//test/test_common:test_runtime_lib",
],
)
40 changes: 40 additions & 0 deletions test/common/http/match_wrapper/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "test/mocks/server/factory_context.h"
#include "test/test_common/registry.h"
#include "test/test_common/test_runtime.h"

#include "gtest/gtest.h"

Expand Down Expand Up @@ -47,7 +48,42 @@ struct TestFactory : public Envoy::Server::Configuration::NamedHttpFilterConfigF
}
};

TEST(MatchWrapper, DisbaledByDefault) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling: Disbaled

NiceMock<Envoy::Server::Configuration::MockFactoryContext> factory_context;

const auto config =
TestUtility::parseYaml<envoy::extensions::common::matching::v3::ExtensionWithMatcher>(R"EOF(
extension_config:
name: test
typed_config:
"@type": type.googleapis.com/google.protobuf.StringValue
matcher:
matcher_tree:
input:
name: request-headers
typed_config:
"@type": type.googleapis.com/envoy.type.matcher.v3.HttpRequestHeaderMatchInput
header_name: default-matcher-header
exact_match_map:
map:
match:
action:
name: skip
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.common.matcher.action.v3.SkipFilter
)EOF");

MatchWrapperConfig match_wrapper_config;
EXPECT_THROW_WITH_MESSAGE(
match_wrapper_config.createFilterFactoryFromProto(config, "", factory_context),
EnvoyException, "Experimental matching API is not enabled");
}

TEST(MatchWrapper, WithMatcher) {
TestScopedRuntime scoped_runtime;
Runtime::LoaderSingleton::getExisting()->mergeValues(
{{"envoy.reloadable_features.experimental_matching_api", "true"}});

TestFactory test_factory;
Envoy::Registry::InjectFactory<Envoy::Server::Configuration::NamedHttpFilterConfigFactory>
inject_factory(test_factory);
Expand Down Expand Up @@ -95,6 +131,10 @@ TEST(MatchWrapper, WithMatcher) {
}

TEST(MatchWrapper, WithMatcherInvalidDataInput) {
TestScopedRuntime scoped_runtime;
Runtime::LoaderSingleton::getExisting()->mergeValues(
{{"envoy.reloadable_features.experimental_matching_api", "true"}});

TestFactory test_factory;
Envoy::Registry::InjectFactory<Envoy::Server::Configuration::NamedHttpFilterConfigFactory>
inject_factory(test_factory);
Expand Down
1 change: 1 addition & 0 deletions test/integration/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ TEST_P(IntegrationTest, EnvoyProxying100ContinueWithDecodeDataPause) {
// Verifies that we can construct a match tree with a filter, and that we are able to skip
// filter invocation through the match tree.
TEST_P(IntegrationTest, MatchingHttpFilterConstruction) {
config_helper_.addRuntimeOverride("envoy.reloadable_features.experimental_matching_api", "true");
config_helper_.addFilter(R"EOF(
name: matcher
typed_config:
Expand Down