Commit ed153214 authored by David Benjamin's avatar David Benjamin Committed by Commit Bot

Avoid an unnecessary copy in IsSafeHeader.

We can just tell //base to act case-insensitively.

Change-Id: I5d4a9ecfa09cd7fada0b0af792d0f414de888904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575172
Auto-Submit: David Benjamin <davidben@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: David Benjamin <davidben@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652685}
parent cab3043d
...@@ -433,13 +433,12 @@ bool HttpUtil::IsMethodIdempotent(base::StringPiece method) { ...@@ -433,13 +433,12 @@ bool HttpUtil::IsMethodIdempotent(base::StringPiece method) {
// static // static
bool HttpUtil::IsSafeHeader(base::StringPiece name) { bool HttpUtil::IsSafeHeader(base::StringPiece name) {
std::string lower_name(base::ToLowerASCII(name)); if (base::StartsWith(name, "proxy-", base::CompareCase::INSENSITIVE_ASCII) ||
if (base::StartsWith(lower_name, "proxy-", base::CompareCase::SENSITIVE) || base::StartsWith(name, "sec-", base::CompareCase::INSENSITIVE_ASCII))
base::StartsWith(lower_name, "sec-", base::CompareCase::SENSITIVE))
return false; return false;
for (const char* field : kForbiddenHeaderFields) { for (const char* field : kForbiddenHeaderFields) {
if (lower_name == field) if (base::LowerCaseEqualsASCII(name, field))
return false; return false;
} }
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment