Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: net/http/http_response_headers.cc

Issue 2643023003: Speed up sanitizing headers received from HTTP proxies. (Closed)
Patch Set: Fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_response_headers.cc
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index b849d7848558ad8968d5599c58af1d8777a22732..6803d30ca8d8ef29cefb476fa57c2e8f9f7a8897 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -307,6 +307,19 @@ void HttpResponseHeaders::RemoveHeader(const std::string& name) {
MergeWithHeaders(new_raw_headers, to_remove);
}
+void HttpResponseHeaders::RemoveHeaders(
+ const std::unordered_set<std::string>& header_names) {
+ // Copy up to the null byte. This just copies the status line.
+ std::string new_raw_headers(raw_headers_.c_str());
+ new_raw_headers.push_back('\0');
+
+ HeaderSet to_remove;
+ for (const auto& header_name : header_names) {
+ to_remove.insert(base::ToLowerASCII(header_name));
+ }
+ MergeWithHeaders(new_raw_headers, to_remove);
+}
+
void HttpResponseHeaders::RemoveHeaderLine(const std::string& name,
const std::string& value) {
std::string name_lowercase = base::ToLowerASCII(name);

Powered by Google App Engine
This is Rietveld 408576698