Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions source/common/http/header_utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,6 @@ bool HeaderUtility::requestShouldHaveNoBody(const RequestHeaderMap& headers) {
headers.Method()->value() == Http::Headers::get().MethodValues.Connect));
}

void HeaderUtility::addHeaders(HeaderMap& headers, const HeaderMap& headers_to_add) {
headers_to_add.iterate([&headers](const HeaderEntry& header) -> HeaderMap::Iterate {
HeaderString k;
k.setCopy(header.key().getStringView());
HeaderString v;
v.setCopy(header.value().getStringView());
headers.addViaMove(std::move(k), std::move(v));
return HeaderMap::Iterate::Continue;
});
}

bool HeaderUtility::isEnvoyInternalRequest(const RequestHeaderMap& headers) {
const HeaderEntry* internal_request_header = headers.EnvoyInternalRequest();
return internal_request_header != nullptr &&
Expand Down
7 changes: 0 additions & 7 deletions source/common/http/header_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ class HeaderUtility {

static bool requestShouldHaveNoBody(const RequestHeaderMap& headers);

/**
* Add headers from one HeaderMap to another
* @param headers target where headers will be added
* @param headers_to_add supplies the headers to be added
*/
static void addHeaders(HeaderMap& headers, const HeaderMap& headers_to_add);

/**
* @brief a helper function to determine if the headers represent an envoy internal request
*/
Expand Down
6 changes: 3 additions & 3 deletions source/extensions/filters/http/ratelimit/ratelimit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void Filter::complete(Filters::Common::RateLimit::LimitStatus status,
if (response_headers_to_add_ == nullptr) {
response_headers_to_add_ = Http::ResponseHeaderMapImpl::create();
}
Http::HeaderUtility::addHeaders(*response_headers_to_add_, *rate_limit_headers);
Http::HeaderMapImpl::copyFrom(*response_headers_to_add_, *rate_limit_headers);
} else {
descriptor_statuses = nullptr;
}
Expand Down Expand Up @@ -255,14 +255,14 @@ void Filter::populateResponseHeaders(Http::HeaderMap& response_headers, bool fro
if (from_local_reply && !response_headers_to_add_->getContentTypeValue().empty()) {
response_headers.remove(Http::Headers::get().ContentType);
}
Http::HeaderUtility::addHeaders(response_headers, *response_headers_to_add_);
Http::HeaderMapImpl::copyFrom(response_headers, *response_headers_to_add_);
response_headers_to_add_ = nullptr;
}
}

void Filter::appendRequestHeaders(Http::HeaderMapPtr& request_headers_to_add) {
if (request_headers_to_add && request_headers_) {
Http::HeaderUtility::addHeaders(*request_headers_, *request_headers_to_add);
Http::HeaderMapImpl::copyFrom(*request_headers_, *request_headers_to_add);
request_headers_to_add = nullptr;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/common/http/header_utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ TEST(HeaderAddTest, HeaderAdd) {
TestRequestHeaderMapImpl headers{{"myheader1", "123value"}};
TestRequestHeaderMapImpl headers_to_add{{"myheader2", "456value"}};

HeaderUtility::addHeaders(headers, headers_to_add);
HeaderMapImpl::copyFrom(headers, headers_to_add);

headers_to_add.iterate([&headers](const Http::HeaderEntry& entry) -> Http::HeaderMap::Iterate {
Http::LowerCaseString lower_key{std::string(entry.key().getStringView())};
Expand Down