Skip to content

http: initialize HeaderMap from iterator#11360

Merged
mattklein123 merged 2 commits into
envoyproxy:masterfrom
Shikugawa:headermap_iter
Jun 2, 2020
Merged

http: initialize HeaderMap from iterator#11360
mattklein123 merged 2 commits into
envoyproxy:masterfrom
Shikugawa:headermap_iter

Conversation

@Shikugawa
Copy link
Copy Markdown
Member

@Shikugawa Shikugawa commented May 29, 2020

Signed-off-by: Shikugawa rei@tetrate.io

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Commit Message: This PR allows to initialize header map from iterator in addition to the initializer list.
Additional Description: This functionality is needed in wasm extensibility. Now we can extract HeaderMap only to use a function which returns only std::vector<std::pair<absl::string_view, absl::string_view>>. When we construct the optimized header map from the raw one, we needed to allow iterator to use createHeaderMap.

Risk Level: Low
Testing: Unit
Docs Changes:
Release Notes:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]

Signed-off-by: Shikugawa <rei@tetrate.io>
@Shikugawa
Copy link
Copy Markdown
Member Author

/review @mattklein123

@mattklein123 mattklein123 self-assigned this May 29, 2020
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

/wait

static void
initFromInitList(HeaderMap& new_header_map,
const std::initializer_list<std::pair<LowerCaseString, std::string>>& values);
template <class It> static void initFromInitList(HeaderMap& new_header_map, It begin, It end) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will need some kind of warning about passing an iterator to keys that are lower cased, otherwise things will break badly. In addition to a warning, add an ASSERT below that the key is lower cased.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think that we can reject not lowercased strings when compilation.

Comment thread source/common/http/header_map_impl.h Outdated
Signed-off-by: Shikugawa <rei@tetrate.io>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123 mattklein123 merged commit dd96311 into envoyproxy:master Jun 2, 2020
aunu53 pushed a commit to aunu53/envoy that referenced this pull request Jun 4, 2020
Signed-off-by: Shikugawa <rei@tetrate.io>
Signed-off-by: Auni Ahsan <auni@google.com>
yashwant121 pushed a commit to yashwant121/envoy that referenced this pull request Jul 24, 2020
Signed-off-by: Shikugawa <rei@tetrate.io>
Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants