Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: turning on absolute url support by default #8329

Merged
merged 2 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Version history
* http: added the ability to configure the behavior of the server response header, via the :ref:`server_header_transformation<envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.server_header_transformation>` field.
* http: added the ability to :ref:`merge adjacent slashes<envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.merge_slashes>` in the path.
* http: remove h2c upgrade headers for HTTP/1 as h2c upgrades are currently not supported.
* http: absolute URL support is now on by default. The prior behavior can be reinstated by setting :ref:`allow_absolute_url <envoy_api_field_core.Http1ProtocolOptions.allow_absolute_url>` to false.
* listeners: added :ref:`continue_on_listener_filters_timeout <envoy_api_field_Listener.continue_on_listener_filters_timeout>` to configure whether a listener will still create a connection when listener filters time out.
* listeners: added :ref:`HTTP inspector listener filter <config_listener_filters_http_inspector>`.
* lua: extended `httpCall()` and `respond()` APIs to accept headers with entry values that can be a string or table of strings.
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Utility::parseHttp2Settings(const envoy::api::v2::core::Http2ProtocolOptions& co
Http1Settings
Utility::parseHttp1Settings(const envoy::api::v2::core::Http1ProtocolOptions& config) {
Http1Settings ret;
ret.allow_absolute_url_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, allow_absolute_url, false);
ret.allow_absolute_url_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, allow_absolute_url, true);
ret.accept_http_10_ = config.accept_http_10();
ret.default_host_for_http_10_ = config.default_host_for_http_10();
return ret;
Expand Down
14 changes: 5 additions & 9 deletions test/integration/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ std::string normalizeDate(const std::string& s) {
return std::regex_replace(s, date_regex, "date: Mon, 01 Jan 2017 00:00:00 GMT");
}

void setAllowAbsoluteUrl(
void setDisallowAbsoluteUrl(
envoy::config::filter::network::http_connection_manager::v2::HttpConnectionManager& hcm) {
envoy::api::v2::core::Http1ProtocolOptions options;
options.mutable_allow_absolute_url()->set_value(true);
hcm.mutable_http_protocol_options()->CopyFrom(options);
hcm.mutable_http_protocol_options()->mutable_allow_absolute_url()->set_value(false);
};

void setAllowHttp10WithDefaultHost(
Expand Down Expand Up @@ -393,6 +391,7 @@ TEST_P(IntegrationTest, NoHost) {
}

TEST_P(IntegrationTest, BadPath) {
config_helper_.addConfigModifier(&setDisallowAbsoluteUrl);
initialize();
std::string response;
sendRawHttpAndWaitForResponse(lookupPort("http"),
Expand All @@ -407,7 +406,6 @@ TEST_P(IntegrationTest, AbsolutePath) {
auto host = config_helper_.createVirtualHost("www.redirect.com", "/");
host.set_require_tls(envoy::api::v2::route::VirtualHost::ALL);
config_helper_.addVirtualHost(host);
config_helper_.addConfigModifier(&setAllowAbsoluteUrl);

initialize();
std::string response;
Expand All @@ -423,7 +421,6 @@ TEST_P(IntegrationTest, AbsolutePathWithPort) {
auto host = config_helper_.createVirtualHost("www.namewithport.com:1234", "/");
host.set_require_tls(envoy::api::v2::route::VirtualHost::ALL);
config_helper_.addVirtualHost(host);
config_helper_.addConfigModifier(&setAllowAbsoluteUrl);
initialize();
std::string response;
sendRawHttpAndWaitForResponse(
Expand All @@ -440,7 +437,6 @@ TEST_P(IntegrationTest, AbsolutePathWithoutPort) {
auto host = config_helper_.createVirtualHost("www.namewithport.com:1234", "/");
host.set_require_tls(envoy::api::v2::route::VirtualHost::ALL);
config_helper_.addVirtualHost(host);
config_helper_.addConfigModifier(&setAllowAbsoluteUrl);
initialize();
std::string response;
sendRawHttpAndWaitForResponse(lookupPort("http"),
Expand All @@ -460,8 +456,8 @@ TEST_P(IntegrationTest, Connect) {
cloned_listener->CopyFrom(*old_listener);
old_listener->set_name("http_forward");
});
// Set the first listener to allow absolute URLs.
config_helper_.addConfigModifier(&setAllowAbsoluteUrl);
// Set the first listener to disallow absolute URLs.
config_helper_.addConfigModifier(&setDisallowAbsoluteUrl);
initialize();

std::string response1;
Expand Down