[http_request] Remove unnecessary lowercase_headers template helper

The template only existed to share a loop between set and vector
iterators. Instead, have the deprecated set overload forward to
the vector overload, and inline the loop there.
This commit is contained in:
J. Nick Koston
2026-02-16 18:38:31 -06:00
parent 7726d0aac9
commit 2fa6c15fc1

View File

@@ -90,16 +90,6 @@ inline bool should_collect_header(const std::vector<std::string> &collect_header
return false;
}
/// Lowercase a range of strings into a vector
template<typename Iter> inline std::vector<std::string> lowercase_headers(Iter begin, Iter end) {
std::vector<std::string> result;
result.reserve(std::distance(begin, end));
for (auto it = begin; it != end; ++it) {
result.push_back(str_lower_case(*it));
}
return result;
}
/*
* HTTP Container Read Semantics
* =============================
@@ -374,15 +364,19 @@ class HttpRequestComponent : public Component {
std::shared_ptr<HttpContainer> start(const std::string &url, const std::string &method, const std::string &body,
const std::list<Header> &request_headers,
const std::set<std::string> &collect_headers) {
return this->perform(url, method, body, request_headers,
lowercase_headers(collect_headers.begin(), collect_headers.end()));
return this->start(url, method, body, request_headers,
std::vector<std::string>(collect_headers.begin(), collect_headers.end()));
}
std::shared_ptr<HttpContainer> start(const std::string &url, const std::string &method, const std::string &body,
const std::list<Header> &request_headers,
const std::vector<std::string> &collect_headers) {
return this->perform(url, method, body, request_headers,
lowercase_headers(collect_headers.begin(), collect_headers.end()));
std::vector<std::string> lower;
lower.reserve(collect_headers.size());
for (const auto &h : collect_headers) {
lower.push_back(str_lower_case(h));
}
return this->perform(url, method, body, request_headers, lower);
}
protected: