Index: net/http/http_response_headers.cc |
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc |
index 119ec527ef51acb38ec0e2cd71f0f17f4c3cef78..c535e0ab64e1d815972aede695d53b071770fa96 100644 |
--- a/net/http/http_response_headers.cc |
+++ b/net/http/http_response_headers.cc |
@@ -206,9 +206,8 @@ void HttpResponseHeaders::Persist(base::Pickle* pickle, |
while (++k < parsed_.size() && parsed_[k].is_continuation()) {} |
--k; |
- std::string header_name(parsed_[i].name_begin, parsed_[i].name_end); |
- base::StringToLowerASCII(&header_name); |
- |
+ std::string header_name = base::ToLowerASCII( |
+ base::StringPiece(parsed_[i].name_begin, parsed_[i].name_end)); |
if (filter_headers.find(header_name) == filter_headers.end()) { |
// Make sure there is a null after the value. |
blob.append(parsed_[i].name_begin, parsed_[k].value_end); |
@@ -248,9 +247,7 @@ void HttpResponseHeaders::Update(const HttpResponseHeaders& new_headers) { |
base::StringPiece name(new_parsed[i].name_begin, new_parsed[i].name_end); |
if (ShouldUpdateHeader(name)) { |
- std::string name_lower; |
- name.CopyToString(&name_lower); |
- base::StringToLowerASCII(&name_lower); |
+ std::string name_lower = base::ToLowerASCII(name); |
updated_headers.insert(name_lower); |
// Preserve this header line in the merged result, making sure there is |
@@ -277,8 +274,8 @@ void HttpResponseHeaders::MergeWithHeaders(const std::string& raw_headers, |
while (++k < parsed_.size() && parsed_[k].is_continuation()) {} |
--k; |
- std::string name(parsed_[i].name_begin, parsed_[i].name_end); |
- base::StringToLowerASCII(&name); |
+ std::string name = base::ToLowerASCII( |
+ base::StringPiece(parsed_[i].name_begin, parsed_[i].name_end)); |
if (headers_to_remove.find(name) == headers_to_remove.end()) { |
// It's ok to preserve this header in the final result. |
new_raw_headers.append(parsed_[i].name_begin, parsed_[k].value_end); |
@@ -300,8 +297,7 @@ void HttpResponseHeaders::RemoveHeader(const std::string& name) { |
std::string new_raw_headers(raw_headers_.c_str()); |
new_raw_headers.push_back('\0'); |
- std::string lowercase_name(name); |
- base::StringToLowerASCII(&lowercase_name); |
+ std::string lowercase_name = base::ToLowerASCII(name); |
HeaderSet to_remove; |
to_remove.insert(lowercase_name); |
MergeWithHeaders(new_raw_headers, to_remove); |
@@ -309,8 +305,7 @@ void HttpResponseHeaders::RemoveHeader(const std::string& name) { |
void HttpResponseHeaders::RemoveHeaderLine(const std::string& name, |
const std::string& value) { |
- std::string name_lowercase(name); |
- base::StringToLowerASCII(&name_lowercase); |
+ std::string name_lowercase = base::ToLowerASCII(name); |
std::string new_raw_headers(GetStatusLine()); |
new_raw_headers.push_back('\0'); |
@@ -321,9 +316,7 @@ void HttpResponseHeaders::RemoveHeaderLine(const std::string& name, |
std::string old_header_name; |
std::string old_header_value; |
while (EnumerateHeaderLines(&iter, &old_header_name, &old_header_value)) { |
- std::string old_header_name_lowercase(name); |
- base::StringToLowerASCII(&old_header_name_lowercase); |
- |
+ std::string old_header_name_lowercase = base::ToLowerASCII(old_header_name); |
if (name_lowercase == old_header_name_lowercase && |
value == old_header_value) |
continue; |
@@ -473,7 +466,7 @@ void HttpResponseHeaders::GetNormalizedHeaders(std::string* output) const { |
DCHECK(!parsed_[i].is_continuation()); |
std::string name(parsed_[i].name_begin, parsed_[i].name_end); |
- std::string lower_name = base::StringToLowerASCII(name); |
+ std::string lower_name = base::ToLowerASCII(name); |
iter = headers_map.find(lower_name); |
if (iter == headers_map.end()) { |
@@ -843,9 +836,8 @@ void HttpResponseHeaders::AddNonCacheableHeaders(HeaderSet* result) const { |
// assuming the header is not empty, lowercase and insert into set |
if (item_end > item) { |
- std::string name(&*item, item_end - item); |
- base::StringToLowerASCII(&name); |
- result->insert(name); |
+ result->insert( |
+ base::ToLowerASCII(base::StringPiece(&*item, item_end - item))); |
} |
// Continue to next item. |