-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
- Loading branch information
1 parent
d9dd886
commit 219472d
Showing
4 changed files
with
13 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
#include "common/common/utility.h" | ||
#include "common/singleton/const_singleton.h" | ||
|
||
#include "absl/strings/match.h" | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
|
||
|
@@ -464,14 +466,14 @@ void HeaderMapImpl::remove(const LowerCaseString& key) { | |
} | ||
} | ||
|
||
void HeaderMapImpl::remove(const std::regex& regex) { | ||
void HeaderMapImpl::removePrefix(const LowerCaseString& prefix) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alyssawilk
Author
Contributor
|
||
headers_.remove_if([&](const HeaderEntryImpl& entry) { | ||
absl::string_view key = entry.key().getStringView(); | ||
bool to_remove = std::regex_search(key.begin(), key.end(), regex); | ||
bool to_remove = absl::StartsWith(entry.key().getStringView(), prefix.get()); | ||
if (to_remove) { | ||
// If this header should be removed, make sure any references in the | ||
// static lookup table are cleared as well. | ||
StaticLookupEntry::EntryCb cb = ConstSingleton<StaticLookupTable>::get().find(key.data()); | ||
StaticLookupEntry::EntryCb cb = | ||
ConstSingleton<StaticLookupTable>::get().find(entry.key().c_str()); | ||
if (cb) { | ||
StaticLookupResponse ref_lookup_response = cb(*this); | ||
if (ref_lookup_response.entry_) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
any particular reason to take this as a LowerCaseString as opposed to an absl::string_view lower_case_prefix?