-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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]: Fine grained path normalization controls implementation #15450
Conversation
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
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.
Thanks for working on this!
I've left a few comments.
I'm not sure if I missed them, but I did not see the tests for PathTransformer::transform
.
I wonder if this should be moved into the HeaderMap API. I.e. the HeaderMap API would provide two methods. NormalizedPath would return path normalized for matching and the Path would return path for forwarding. |
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
I think we want to configure it in http connection manager. |
I see, I do plan to store both the path for filter use and path for forwarding in HeaderMap. |
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.
Thanks so much!!
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
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.
Thanks for working on this!
Added a few comments.
return; | ||
PathTransformer::PathTransformer(envoy::type::http::v3::PathTransformation path_transformation) { | ||
const auto& operations = path_transformation.operations(); | ||
std::vector<uint64_t> operation_hashes; |
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.
Depending on the length, it might be better to use absl::flat_hash_set
.
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.
It might be overkill to use a hash set here since we expect a very small number of transformation.
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
@@ -480,7 +485,8 @@ class RequestHeaderMapImpl final : public TypedHeaderMapImpl<RequestHeaderMap>, | |||
}; | |||
|
|||
using HeaderHandles = ConstSingleton<HeaderHandleValues>; | |||
|
|||
std::string forwarding_path_; |
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.
Should the intended use for these two be documented?
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.
Makes sense.
|
||
// Take a string_view as argument and return an optional string. | ||
// The optional will be null if the transformation fail. | ||
absl::optional<std::string> transform(const absl::string_view original_path) const; |
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.
Nit: could you mention that this will execute all configured transformations, or something along those lines?
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.
Thanks, will add comments.
source/extensions/filters/network/http_connection_manager/config.h
Outdated
Show resolved
Hide resolved
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
@@ -807,6 +814,14 @@ class RequestHeaderMap | |||
public: | |||
INLINE_REQ_STRING_HEADERS(DEFINE_INLINE_STRING_HEADER) | |||
INLINE_REQ_NUMERIC_HEADERS(DEFINE_INLINE_NUMERIC_HEADER) | |||
virtual absl::string_view getForwardingPath() PURE; |
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.
Please add comments explaining what these methods are for.
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.
Thanks, will fix.
source/extensions/filters/network/http_connection_manager/config.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/network/http_connection_manager/config.h
Outdated
Show resolved
Hide resolved
cc @yangminzhu |
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
/retest |
Retrying Azure Pipelines: |
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
reopen |
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Commit Message: Currently, envoy apply path normalization in http connection manager. When a path transformation is enabled, it is visible to all the filters and the upstream server. For fine grained control, we want some path normalization to be visible to filter but not the upstream server. The new hcm api(#15044) allow user to split the path transformation for filter use and for forwarding. This PR intends to implement fine grained path normalization control(#6589) based on the new api. This is a draft used to collect opinions early.
Additional Description:
Risk Level: high
Testing: by now only unit test
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]