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: add support for skipping any port from host header #14491
Changes from 13 commits
2ddd7ae
1746a3e
32d152f
154d751
1859247
0f146e7
fcd5854
a79fd44
0874581
5130272
4d9663f
88d826b
dd2a67c
39a35d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
#include "common/common/fmt.h" | ||
#include "common/config/utility.h" | ||
#include "common/filter/http/filter_config_discovery_impl.h" | ||
#include "common/http/conn_manager_config.h" | ||
#include "common/http/conn_manager_utility.h" | ||
#include "common/http/default_server_string.h" | ||
#include "common/http/http1/codec_impl.h" | ||
|
@@ -248,7 +249,6 @@ HttpConnectionManagerConfig::HttpConnectionManagerConfig( | |
0))), | ||
#endif | ||
merge_slashes_(config.merge_slashes()), | ||
strip_matching_port_(config.strip_matching_host_port()), | ||
headers_with_underscores_action_( | ||
config.common_http_protocol_options().headers_with_underscores_action()), | ||
local_reply_(LocalReply::Factory::create(config.local_reply_config(), context)) { | ||
|
@@ -264,8 +264,16 @@ HttpConnectionManagerConfig::HttpConnectionManagerConfig( | |
idle_timeout_ = absl::nullopt; | ||
} | ||
|
||
// If we are provided a different request_id_extension implementation to use try and create a new | ||
// instance of it, otherwise use default one. | ||
if (config.strip_any_host_port()) { | ||
strip_port_type_ = Http::StripPortType::Any; | ||
} else if (config.strip_matching_host_port()) { | ||
Comment on lines
+272
to
+274
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that defaults are false, can we check if both are true and throw an error? I think this is safe to do and will approximate the future oneof? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. We can do that. Changed and added a test. PTAL |
||
strip_port_type_ = Http::StripPortType::MatchingHost; | ||
} else { | ||
strip_port_type_ = Http::StripPortType::None; | ||
} | ||
|
||
// If we are provided a different request_id_extension implementation to use try and create a | ||
// new instance of it, otherwise use default one. | ||
if (config.request_id_extension().has_typed_config()) { | ||
request_id_extension_ = | ||
Http::RequestIDExtensionFactory::fromProto(config.request_id_extension(), context_); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. Missed it. Fixed now.