Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: make HeaderHashMethod hashing all the header values #15486
http: make HeaderHashMethod hashing all the header values #15486
Changes from 20 commits
163a273
21a088d
cd04222
629013c
b7c57d3
35164eb
c79d4ca
d8eea4f
7296292
8c03bb1
4ca2cdd
b16fc57
2be9e38
d5865cc
fd987a4
2cb6296
bf8bd4f
052b353
3ee5730
ce1e9a7
94a4f0e
9be2cdc
81ac401
43dbeb5
cfa08d5
f99f93b
964e602
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
does this case occur?
If so, just use
XX64(nullptr, 0, seed)
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.
Or maybe just don't test for that. Remove the
if
and let it return seed on an empty array.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.
We didn't use that case when hashing the header value, special with the check
num_headers_to_hash
:envoy/source/common/http/hash_policy.cc
Line 71 in ce1e9a7
I just match this behavior with
static uint64_t xxHash64(absl::string_view input, uint64_t seed = 0)
.Then those two methods get the same value for empty string and empty vector, you can see that from the unittest
envoy/test/common/common/hash_test.cc
Lines 6 to 19 in ce1e9a7
The upside to handle this empty vector case is in case someone pass the empty vector, then it will get a same behavior just like the empty string one.
But I'm also ok to remove it if you think it needless to a case we didn't use it today.
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.
Nice I hadn't thought of using the seed arg to XX64 as a carry.
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.
I think Matt commented above but you don't need this conditional. num_headers_hash can be set to a value greater than one online if check_multiple_values is true, and the sorting will be a no-op for size==1.
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.
that is what Matt is look for, better to have @mattklein123 check again. also I have comment about the runtime flag above, it may needn't this check anymore.
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.
See my above comment. I think we do need the flag, but we can just set the size to 1 or not above and then we can collapse all of this logic.
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.
I updated, hope I understand correctly.