summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-08-11 12:30:22 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-11 19:31:27 +0000
commit8e2106dd88a61950569f9cfa8a94ad436d858658 (patch)
treeb95818b8b8d98565bc0beaae50ffb76fa3d82080 /net
parent7d42dad6d95bf258c721f9d15f734bb9d0af8014 (diff)
downloadchromium_src-8e2106dd88a61950569f9cfa8a94ad436d858658.zip
chromium_src-8e2106dd88a61950569f9cfa8a94ad436d858658.tar.gz
chromium_src-8e2106dd88a61950569f9cfa8a94ad436d858658.tar.bz2
Convert remaining StringToLowerASCII to ToLowerASCII.
Remove StringToLowerASCII. This removes the template and makes a consistent call that can take a string piece. http_response_headers.cc in HttpResponseHeaders::RemoveHeaderLine there seemed to be a bug where it did std::string old_header_name_lowercase(name); where it actually meant std::string old_header_name_lowercase(old_header_name); I fixed this. There were a number of cases where url.host() or url.scheme() was passed to ToLowerASCII. These are already guaranteed lower-case, so I removed the call. There were a number of cases in net that did return ToLowerASCII().c_str() when the return type is a std::string, which is unnecessary and wasteful. I removed the c_str() call. NOPRESUBMIT=true (for touching code with wstrings) Review URL: https://codereview.chromium.org/1282363003 Cr-Commit-Position: refs/heads/master@{#342869}
Diffstat (limited to 'net')
-rw-r--r--net/base/data_url.cc2
-rw-r--r--net/base/filename_util.cc5
-rw-r--r--net/base/filename_util_internal.cc3
-rw-r--r--net/base/host_mapping_rules.cc4
-rw-r--r--net/base/mime_util.cc8
-rw-r--r--net/base/net_util.cc2
-rw-r--r--net/base/network_change_notifier.cc2
-rw-r--r--net/base/sdch_manager.cc19
-rw-r--r--net/cert/x509_certificate.cc2
-rw-r--r--net/cookies/cookie_constants.cc3
-rw-r--r--net/cookies/parsed_cookie.cc2
-rw-r--r--net/dns/dns_config_service_win.cc2
-rw-r--r--net/dns/dns_hosts.cc2
-rw-r--r--net/dns/host_resolver_impl.cc2
-rw-r--r--net/ftp/ftp_directory_listing_parser_vms.cc4
-rw-r--r--net/ftp/ftp_network_transaction.cc2
-rw-r--r--net/http/http_auth_handler_factory.cc6
-rw-r--r--net/http/http_auth_multi_round_parse.cc2
-rw-r--r--net/http/http_log_util.cc2
-rw-r--r--net/http/http_response_headers.cc30
-rw-r--r--net/http/http_util.cc12
-rw-r--r--net/http/transport_security_state.cc3
-rw-r--r--net/proxy/proxy_bypass_rules.cc10
-rw-r--r--net/server/http_server.cc2
-rw-r--r--net/server/http_server_request_info.cc7
-rw-r--r--net/server/http_server_unittest.cc4
-rw-r--r--net/spdy/spdy_http_utils.cc4
-rw-r--r--net/test/embedded_test_server/http_request.cc7
-rw-r--r--net/tools/quic/spdy_balsa_utils.cc3
-rw-r--r--net/url_request/url_request_backoff_manager.cc2
-rw-r--r--net/url_request/url_request_throttler_manager.cc2
31 files changed, 70 insertions, 90 deletions
diff --git a/net/base/data_url.cc b/net/base/data_url.cc
index 4f26456..26720c5 100644
--- a/net/base/data_url.cc
+++ b/net/base/data_url.cc
@@ -43,7 +43,7 @@ bool DataURL::Parse(const GURL& url, std::string* mime_type,
std::vector<std::string>::iterator iter = meta_data.begin();
if (iter != meta_data.end()) {
mime_type->swap(*iter);
- base::StringToLowerASCII(mime_type);
+ *mime_type = base::ToLowerASCII(*mime_type);
++iter;
}
diff --git a/net/base/filename_util.cc b/net/base/filename_util.cc
index 01b9f63..0969f71 100644
--- a/net/base/filename_util.cc
+++ b/net/base/filename_util.cc
@@ -163,10 +163,9 @@ bool IsReservedNameOnWindows(const base::FilePath::StringType& filename) {
"com5", "com6", "com7", "com8", "com9", "lpt1", "lpt2", "lpt3",
"lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "clock$"};
#if defined(OS_WIN)
- std::string filename_lower =
- base::StringToLowerASCII(base::WideToUTF8(filename));
+ std::string filename_lower = base::ToLowerASCII(base::WideToUTF8(filename));
#elif defined(OS_POSIX)
- std::string filename_lower = base::StringToLowerASCII(filename);
+ std::string filename_lower = base::ToLowerASCII(filename);
#endif
for (size_t i = 0; i < arraysize(known_devices); ++i) {
diff --git a/net/base/filename_util_internal.cc b/net/base/filename_util_internal.cc
index 697e8cf..8b57d79 100644
--- a/net/base/filename_util_internal.cc
+++ b/net/base/filename_util_internal.cc
@@ -90,8 +90,7 @@ std::string GetFileNameFromURL(const GURL& url,
// Returns whether the specified extension is automatically integrated into the
// windows shell.
bool IsShellIntegratedExtension(const base::FilePath::StringType& extension) {
- base::FilePath::StringType extension_lower =
- base::StringToLowerASCII(extension);
+ base::FilePath::StringType extension_lower = base::ToLowerASCII(extension);
// http://msdn.microsoft.com/en-us/library/ms811694.aspx
// Right-clicking on shortcuts can be magical.
diff --git a/net/base/host_mapping_rules.cc b/net/base/host_mapping_rules.cc
index 4532b66..5e60425 100644
--- a/net/base/host_mapping_rules.cc
+++ b/net/base/host_mapping_rules.cc
@@ -74,7 +74,7 @@ bool HostMappingRules::AddRuleFromString(const std::string& rule_string) {
// Test for EXCLUSION rule.
if (parts.size() == 2 && base::LowerCaseEqualsASCII(parts[0], "exclude")) {
ExclusionRule rule;
- rule.hostname_pattern = base::StringToLowerASCII(parts[1]);
+ rule.hostname_pattern = base::ToLowerASCII(parts[1]);
exclusion_rules_.push_back(rule);
return true;
}
@@ -82,7 +82,7 @@ bool HostMappingRules::AddRuleFromString(const std::string& rule_string) {
// Test for MAP rule.
if (parts.size() == 3 && base::LowerCaseEqualsASCII(parts[0], "map")) {
MapRule rule;
- rule.hostname_pattern = base::StringToLowerASCII(parts[1]);
+ rule.hostname_pattern = base::ToLowerASCII(parts[1]);
if (!ParseHostAndPort(parts[2], &rule.replacement_hostname,
&rule.replacement_port)) {
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 9adb2fe..0d51120 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -224,12 +224,12 @@ bool MatchesMimeTypeParameters(const std::string& mime_type_pattern,
// Put the parameters to maps with the keys converted to lower case.
StringPairMap pattern_parameter_map;
for (const auto& pair : pattern_parameters) {
- pattern_parameter_map[base::StringToLowerASCII(pair.first)] = pair.second;
+ pattern_parameter_map[base::ToLowerASCII(pair.first)] = pair.second;
}
StringPairMap test_parameter_map;
for (const auto& pair : test_parameters) {
- test_parameter_map[base::StringToLowerASCII(pair.first)] = pair.second;
+ test_parameter_map[base::ToLowerASCII(pair.first)] = pair.second;
}
if (pattern_parameter_map.size() > test_parameter_map.size())
@@ -327,7 +327,7 @@ bool MimeUtil::ParseMimeTypeWithoutParameter(
}
bool MimeUtil::IsValidTopLevelMimeType(const std::string& type_string) const {
- std::string lower_type = base::StringToLowerASCII(type_string);
+ std::string lower_type = base::ToLowerASCII(type_string);
for (size_t i = 0; i < arraysize(legal_top_level_types); ++i) {
if (lower_type.compare(legal_top_level_types[i]) == 0)
return true;
@@ -521,7 +521,7 @@ void GetExtensionsForMimeType(
if (unsafe_mime_type == "*/*" || unsafe_mime_type == "*")
return;
- const std::string mime_type = base::StringToLowerASCII(unsafe_mime_type);
+ const std::string mime_type = base::ToLowerASCII(unsafe_mime_type);
base::hash_set<base::FilePath::StringType> unique_extensions;
if (base::EndsWith(mime_type, "/*", base::CompareCase::INSENSITIVE_ASCII)) {
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index b27246b..42159d9 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -65,7 +65,7 @@ namespace net {
namespace {
std::string NormalizeHostname(const std::string& host) {
- std::string result = base::StringToLowerASCII(host);
+ std::string result = base::ToLowerASCII(host);
if (!result.empty() && *result.rbegin() == '.')
result.resize(result.size() - 1);
return result;
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index d994969..12a6377 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -670,7 +670,7 @@ NetworkChangeNotifier::ConnectionTypeFromInterfaceList(
#endif
// Remove VMware network interfaces as they're internal and should not be
// used to determine the network connection type.
- if (base::StringToLowerASCII(interfaces[i].friendly_name).find("vmnet") !=
+ if (base::ToLowerASCII(interfaces[i].friendly_name).find("vmnet") !=
std::string::npos) {
continue;
}
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 52a4077..e4104e0 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -112,8 +112,7 @@ void SdchManager::BlacklistDomain(const GURL& url,
SdchProblemCode blacklist_reason) {
SetAllowLatencyExperiment(url, false);
- BlacklistInfo* blacklist_info =
- &blacklisted_domains_[base::StringToLowerASCII(url.host())];
+ BlacklistInfo* blacklist_info = &blacklisted_domains_[url.host()];
if (blacklist_info->count > 0)
return; // Domain is already blacklisted.
@@ -133,8 +132,7 @@ void SdchManager::BlacklistDomainForever(const GURL& url,
SdchProblemCode blacklist_reason) {
SetAllowLatencyExperiment(url, false);
- BlacklistInfo* blacklist_info =
- &blacklisted_domains_[base::StringToLowerASCII(url.host())];
+ BlacklistInfo* blacklist_info = &blacklisted_domains_[url.host()];
blacklist_info->count = INT_MAX;
blacklist_info->exponential_count = INT_MAX;
blacklist_info->reason = blacklist_reason;
@@ -145,14 +143,14 @@ void SdchManager::ClearBlacklistings() {
}
void SdchManager::ClearDomainBlacklisting(const std::string& domain) {
- BlacklistInfo* blacklist_info = &blacklisted_domains_[
- base::StringToLowerASCII(domain)];
+ BlacklistInfo* blacklist_info =
+ &blacklisted_domains_[base::ToLowerASCII(domain)];
blacklist_info->count = 0;
blacklist_info->reason = SDCH_OK;
}
int SdchManager::BlackListDomainCount(const std::string& domain) {
- std::string domain_lower(base::StringToLowerASCII(domain));
+ std::string domain_lower(base::ToLowerASCII(domain));
if (blacklisted_domains_.end() == blacklisted_domains_.find(domain_lower))
return 0;
@@ -160,7 +158,7 @@ int SdchManager::BlackListDomainCount(const std::string& domain) {
}
int SdchManager::BlacklistDomainExponential(const std::string& domain) {
- std::string domain_lower(base::StringToLowerASCII(domain));
+ std::string domain_lower(base::ToLowerASCII(domain));
if (blacklisted_domains_.end() == blacklisted_domains_.find(domain_lower))
return 0;
@@ -175,8 +173,7 @@ SdchProblemCode SdchManager::IsInSupportedDomain(const GURL& url) {
if (blacklisted_domains_.empty())
return SDCH_OK;
- DomainBlacklistInfo::iterator it =
- blacklisted_domains_.find(base::StringToLowerASCII(url.host()));
+ auto it = blacklisted_domains_.find(url.host());
if (blacklisted_domains_.end() == it || it->second.count == 0)
return SDCH_OK;
@@ -374,7 +371,7 @@ SdchProblemCode SdchManager::AddSdchDictionary(
break;
std::string name(dictionary_text, line_start, colon_index - line_start);
std::string value(dictionary_text, value_start, line_end - value_start);
- name = base::StringToLowerASCII(name);
+ name = base::ToLowerASCII(name);
if (name == "domain") {
domain = value;
} else if (name == "path") {
diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc
index c328904..dc3cd80 100644
--- a/net/cert/x509_certificate.cc
+++ b/net/cert/x509_certificate.cc
@@ -618,7 +618,7 @@ bool X509Certificate::VerifyHostname(
DVLOG(1) << "Bad name in cert: " << *it;
continue;
}
- std::string presented_name(base::StringToLowerASCII(*it));
+ std::string presented_name(base::ToLowerASCII(*it));
// Remove trailing dot, if any.
if (*presented_name.rbegin() == '.')
diff --git a/net/cookies/cookie_constants.cc b/net/cookies/cookie_constants.cc
index 0afe6ef..05fe22e 100644
--- a/net/cookies/cookie_constants.cc
+++ b/net/cookies/cookie_constants.cc
@@ -30,8 +30,7 @@ NET_EXPORT const std::string CookiePriorityToString(CookiePriority priority) {
}
NET_EXPORT CookiePriority StringToCookiePriority(const std::string& priority) {
- std::string priority_comp(priority);
- base::StringToLowerASCII(&priority_comp);
+ std::string priority_comp = base::ToLowerASCII(priority);
if (priority_comp == kPriorityHigh)
return COOKIE_PRIORITY_HIGH;
diff --git a/net/cookies/parsed_cookie.cc b/net/cookies/parsed_cookie.cc
index 3f281a6..bd8b0dc 100644
--- a/net/cookies/parsed_cookie.cc
+++ b/net/cookies/parsed_cookie.cc
@@ -398,7 +398,7 @@ void ParsedCookie::ParseTokenValuePairs(const std::string& cookie_line) {
// From RFC2109: "Attributes (names) (attr) are case-insensitive."
if (pair_num != 0)
- base::StringToLowerASCII(&pair.first);
+ pair.first = base::ToLowerASCII(pair.first);
// Ignore Set-Cookie directives contaning control characters. See
// http://crbug.com/238041.
if (!IsValidCookieAttributeValue(pair.first) ||
diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc
index 23206d4..443ee27 100644
--- a/net/dns/dns_config_service_win.cc
+++ b/net/dns/dns_config_service_win.cc
@@ -241,7 +241,7 @@ HostsParseWinResult AddLocalhostEntries(DnsHosts* hosts) {
!ParseDomainASCII(buffer, &localname)) {
return HOSTS_PARSE_WIN_COMPUTER_NAME_FAILED;
}
- base::StringToLowerASCII(&localname);
+ localname = base::ToLowerASCII(localname);
bool have_ipv4 =
hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)) > 0;
diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc
index 706c66b..9e641b6 100644
--- a/net/dns/dns_hosts.cc
+++ b/net/dns/dns_hosts.cc
@@ -154,7 +154,7 @@ void ParseHostsWithCommaMode(const std::string& contents,
}
} else {
DnsHostsKey key(parser.token().as_string(), family);
- base::StringToLowerASCII(&key.first);
+ key.first = base::ToLowerASCII(key.first);
IPAddressNumber* mapped_ip = &(*dns_hosts)[key];
if (mapped_ip->empty())
*mapped_ip = ip;
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index d3f8365..2fdd254 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -2118,7 +2118,7 @@ bool HostResolverImpl::ServeFromHosts(const Key& key,
addresses->clear();
// HOSTS lookups are case-insensitive.
- std::string hostname = base::StringToLowerASCII(key.hostname);
+ std::string hostname = base::ToLowerASCII(key.hostname);
const DnsHosts& hosts = dns_client_->GetConfig()->hosts;
diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc
index ac7a464..eb92a19 100644
--- a/net/ftp/ftp_directory_listing_parser_vms.cc
+++ b/net/ftp/ftp_directory_listing_parser_vms.cc
@@ -46,10 +46,10 @@ bool ParseVmsFilename(const base::string16& raw_filename,
if (filename_parts.size() != 2)
return false;
if (base::EqualsASCII(filename_parts[1], "DIR")) {
- *parsed_filename = base::StringToLowerASCII(filename_parts[0]);
+ *parsed_filename = base::ToLowerASCII(filename_parts[0]);
*type = FtpDirectoryListingEntry::DIRECTORY;
} else {
- *parsed_filename = base::StringToLowerASCII(listing_parts[0]);
+ *parsed_filename = base::ToLowerASCII(listing_parts[0]);
*type = FtpDirectoryListingEntry::FILE;
}
return true;
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index bf52c21..b3bb976 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -820,7 +820,7 @@ int FtpNetworkTransaction::ProcessResponseSYST(
// comparisons easily. If it is not ASCII, we leave the system type
// as unknown.
if (base::IsStringASCII(line)) {
- line = base::StringToLowerASCII(line);
+ line = base::ToLowerASCII(line);
// Remove all whitespace, to correctly handle cases like fancy "V M S"
// response instead of "VMS".
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc
index 4f09c9f..b148aad 100644
--- a/net/http/http_auth_handler_factory.cc
+++ b/net/http/http_auth_handler_factory.cc
@@ -106,7 +106,7 @@ void HttpAuthHandlerRegistryFactory::SetURLSecurityManager(
void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory(
const std::string& scheme,
HttpAuthHandlerFactory* factory) {
- std::string lower_scheme = base::StringToLowerASCII(scheme);
+ std::string lower_scheme = base::ToLowerASCII(scheme);
FactoryMap::iterator it = factory_map_.find(lower_scheme);
if (it != factory_map_.end()) {
delete it->second;
@@ -119,7 +119,7 @@ void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory(
HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory(
const std::string& scheme) const {
- std::string lower_scheme = base::StringToLowerASCII(scheme);
+ std::string lower_scheme = base::ToLowerASCII(scheme);
FactoryMap::const_iterator it = factory_map_.find(lower_scheme);
if (it == factory_map_.end()) {
return NULL; // |scheme| is not registered.
@@ -190,7 +190,7 @@ int HttpAuthHandlerRegistryFactory::CreateAuthHandler(
handler->reset();
return ERR_INVALID_RESPONSE;
}
- std::string lower_scheme = base::StringToLowerASCII(scheme);
+ std::string lower_scheme = base::ToLowerASCII(scheme);
FactoryMap::iterator it = factory_map_.find(lower_scheme);
if (it == factory_map_.end()) {
handler->reset();
diff --git a/net/http/http_auth_multi_round_parse.cc b/net/http/http_auth_multi_round_parse.cc
index efee2bb..1d0edac 100644
--- a/net/http/http_auth_multi_round_parse.cc
+++ b/net/http/http_auth_multi_round_parse.cc
@@ -17,7 +17,7 @@ bool SchemeIsValid(const std::string& scheme,
// There is no guarantee that challenge->scheme() is valid ASCII, but
// LowerCaseEqualsASCII will do the right thing even if it isn't.
return base::LowerCaseEqualsASCII(challenge->scheme(),
- base::StringToLowerASCII(scheme).c_str());
+ base::ToLowerASCII(scheme));
}
} // namespace
diff --git a/net/http/http_log_util.cc b/net/http/http_log_util.cc
index 8e071e3..87c2fd9 100644
--- a/net/http/http_log_util.cc
+++ b/net/http/http_log_util.cc
@@ -19,7 +19,7 @@ bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) {
if (challenge->challenge_text().find(',') != std::string::npos)
return false;
- std::string scheme = base::StringToLowerASCII(challenge->scheme());
+ std::string scheme = base::ToLowerASCII(challenge->scheme());
// Invalid input.
if (scheme.empty())
return false;
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 119ec52..c535e0a 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.
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 9abcfc8..f1e5143 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -133,13 +133,13 @@ void HttpUtil::ParseContentType(const std::string& content_type_str,
base::StringPiece(begin + type_val, begin + type_end),
mime_type->data());
if (!eq) {
- mime_type->assign(begin + type_val, begin + type_end);
- base::StringToLowerASCII(mime_type);
+ *mime_type = base::ToLowerASCII(
+ base::StringPiece(begin + type_val, begin + type_end));
}
if ((!eq && *had_charset) || type_has_charset) {
*had_charset = true;
- charset->assign(begin + charset_val, begin + charset_end);
- base::StringToLowerASCII(charset);
+ *charset = base::ToLowerASCII(
+ base::StringPiece(begin + charset_val, begin + charset_end));
}
}
}
@@ -321,7 +321,7 @@ const char* const kForbiddenHeaderFields[] = {
// static
bool HttpUtil::IsSafeHeader(const std::string& name) {
- std::string lower_name(base::StringToLowerASCII(name));
+ std::string lower_name(base::ToLowerASCII(name));
if (base::StartsWith(lower_name, "proxy-", base::CompareCase::SENSITIVE) ||
base::StartsWith(lower_name, "sec-", base::CompareCase::SENSITIVE))
return false;
@@ -821,7 +821,7 @@ bool HttpUtil::HeadersIterator::GetNext() {
bool HttpUtil::HeadersIterator::AdvanceTo(const char* name) {
DCHECK(name != NULL);
- DCHECK_EQ(0, base::StringToLowerASCII<std::string>(name).compare(name))
+ DCHECK_EQ(0, base::ToLowerASCII(name).compare(name))
<< "the header name must be in all lower case";
while (GetNext()) {
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc
index b343223..4db4696 100644
--- a/net/http/transport_security_state.cc
+++ b/net/http/transport_security_state.cc
@@ -433,8 +433,7 @@ bool DecodeHSTSPreloadRaw(const std::string& search_hostname,
// |hostname| has already undergone IDN conversion, so should be
// entirely A-Labels. The preload data is entirely normalized to
// lower case.
- base::StringToLowerASCII(&hostname);
-
+ hostname = base::ToLowerASCII(hostname);
if (hostname.empty()) {
return true;
}
diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc
index f2f3261..be18edb 100644
--- a/net/proxy/proxy_bypass_rules.cc
+++ b/net/proxy/proxy_bypass_rules.cc
@@ -24,10 +24,9 @@ class HostnamePatternRule : public ProxyBypassRules::Rule {
HostnamePatternRule(const std::string& optional_scheme,
const std::string& hostname_pattern,
int optional_port)
- : optional_scheme_(base::StringToLowerASCII(optional_scheme)),
- hostname_pattern_(base::StringToLowerASCII(hostname_pattern)),
- optional_port_(optional_port) {
- }
+ : optional_scheme_(base::ToLowerASCII(optional_scheme)),
+ hostname_pattern_(base::ToLowerASCII(hostname_pattern)),
+ optional_port_(optional_port) {}
bool Matches(const GURL& url) const override {
if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_)
@@ -38,8 +37,7 @@ class HostnamePatternRule : public ProxyBypassRules::Rule {
// Note it is necessary to lower-case the host, since GURL uses capital
// letters for percent-escaped characters.
- return base::MatchPattern(base::StringToLowerASCII(url.host()),
- hostname_pattern_);
+ return base::MatchPattern(url.host(), hostname_pattern_);
}
std::string ToString() const override {
diff --git a/net/server/http_server.cc b/net/server/http_server.cc
index a3c4b52..dff0e60 100644
--- a/net/server/http_server.cc
+++ b/net/server/http_server.cc
@@ -412,7 +412,7 @@ bool HttpServer::ParseHeaders(const char* data,
buffer.clear();
break;
case ST_NAME:
- header_name = base::StringToLowerASCII(buffer);
+ header_name = base::ToLowerASCII(buffer);
buffer.clear();
break;
case ST_VALUE:
diff --git a/net/server/http_server_request_info.cc b/net/server/http_server_request_info.cc
index df5cff6..07c15a5 100644
--- a/net/server/http_server_request_info.cc
+++ b/net/server/http_server_request_info.cc
@@ -15,7 +15,7 @@ HttpServerRequestInfo::~HttpServerRequestInfo() {}
std::string HttpServerRequestInfo::GetHeaderValue(
const std::string& header_name) const {
- DCHECK_EQ(base::StringToLowerASCII(header_name), header_name);
+ DCHECK_EQ(base::ToLowerASCII(header_name), header_name);
HttpServerRequestInfo::HeadersMap::const_iterator it =
headers.find(header_name);
if (it != headers.end())
@@ -26,9 +26,8 @@ std::string HttpServerRequestInfo::GetHeaderValue(
bool HttpServerRequestInfo::HasHeaderValue(
const std::string& header_name,
const std::string& header_value) const {
- DCHECK_EQ(base::StringToLowerASCII(header_value), header_value);
- std::string complete_value = GetHeaderValue(header_name);
- base::StringToLowerASCII(&complete_value);
+ DCHECK_EQ(base::ToLowerASCII(header_value), header_value);
+ std::string complete_value = base::ToLowerASCII(GetHeaderValue(header_name));
for (const base::StringPiece& cur :
base::SplitString(complete_value, ",", base::KEEP_WHITESPACE,
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index 8830e3f..170a720 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -297,7 +297,7 @@ TEST_F(HttpServerTest, RequestWithHeaders) {
ASSERT_EQ("", GetRequest(0).data);
for (size_t i = 0; i < arraysize(kHeaders); ++i) {
- std::string field = base::StringToLowerASCII(std::string(kHeaders[i][0]));
+ std::string field = base::ToLowerASCII(std::string(kHeaders[i][0]));
std::string value = kHeaders[i][2];
ASSERT_EQ(1u, GetRequest(0).headers.count(field)) << field;
ASSERT_EQ(value, GetRequest(0).headers[field]) << kHeaders[i][0];
@@ -325,7 +325,7 @@ TEST_F(HttpServerTest, RequestWithDuplicateHeaders) {
ASSERT_EQ("", GetRequest(0).data);
for (size_t i = 0; i < arraysize(kHeaders); ++i) {
- std::string field = base::StringToLowerASCII(std::string(kHeaders[i][0]));
+ std::string field = base::ToLowerASCII(std::string(kHeaders[i][0]));
std::string value = (field == "duplicateheader") ? "2,4" : kHeaders[i][2];
ASSERT_EQ(1u, GetRequest(0).headers.count(field)) << field;
ASSERT_EQ(value, GetRequest(0).headers[field]) << kHeaders[i][0];
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index c7dcb38..aab758a 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -105,7 +105,7 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
HttpRequestHeaders::Iterator it(request_headers);
while (it.GetNext()) {
- std::string name = base::StringToLowerASCII(it.name());
+ std::string name = base::ToLowerASCII(it.name());
if (name == "connection" || name == "proxy-connection" ||
name == "transfer-encoding" || name == "host") {
continue;
@@ -173,7 +173,7 @@ void CreateSpdyHeadersFromHttpResponse(
void* iter = NULL;
std::string raw_name, value;
while (response_headers.EnumerateHeaderLines(&iter, &raw_name, &value)) {
- std::string name = base::StringToLowerASCII(raw_name);
+ std::string name = base::ToLowerASCII(raw_name);
AddSpdyHeader(name, value, headers);
}
}
diff --git a/net/test/embedded_test_server/http_request.cc b/net/test/embedded_test_server/http_request.cc
index 26cb49e..9e0c80f 100644
--- a/net/test/embedded_test_server/http_request.cc
+++ b/net/test/embedded_test_server/http_request.cc
@@ -93,15 +93,14 @@ HttpRequestParser::ParseResult HttpRequestParser::ParseHeaders() {
DCHECK_EQ(3u, header_line_tokens.size());
// Method.
http_request_->method_string = header_line_tokens[0];
- http_request_->method = GetMethodType(base::StringToLowerASCII(
- header_line_tokens[0]));
+ http_request_->method =
+ GetMethodType(base::ToLowerASCII(header_line_tokens[0]));
// Address.
// Don't build an absolute URL as the parser does not know (should not
// know) anything about the server address.
http_request_->relative_url = header_line_tokens[1];
// Protocol.
- const std::string protocol =
- base::StringToLowerASCII(header_line_tokens[2]);
+ const std::string protocol = base::ToLowerASCII(header_line_tokens[2]);
CHECK(protocol == "http/1.0" || protocol == "http/1.1") <<
"Protocol not supported: " << protocol;
}
diff --git a/net/tools/quic/spdy_balsa_utils.cc b/net/tools/quic/spdy_balsa_utils.cc
index 76a3bdc..29d0c90 100644
--- a/net/tools/quic/spdy_balsa_utils.cc
+++ b/net/tools/quic/spdy_balsa_utils.cc
@@ -50,8 +50,7 @@ void PopulateSpdyHeaderBlock(const BalsaHeaders& headers,
// This unfortunately involves loads of copying, but its the simplest way
// to sort the headers and leverage the framer.
- string name = hi->first.as_string();
- base::StringToLowerASCII(&name);
+ string name = base::ToLowerASCII(hi->first.as_string());
SpdyHeaderBlock::iterator it = block->find(name);
if (it != block->end()) {
it->second.reserve(it->second.size() + 1 + hi->second.size());
diff --git a/net/url_request/url_request_backoff_manager.cc b/net/url_request/url_request_backoff_manager.cc
index 51560e3..13632b3 100644
--- a/net/url_request/url_request_backoff_manager.cc
+++ b/net/url_request/url_request_backoff_manager.cc
@@ -126,7 +126,7 @@ std::string URLRequestBackoffManager::GetIdFromUrl(const GURL& url) const {
return url.possibly_invalid_spec();
GURL id = url.ReplaceComponents(url_id_replacements_);
- return base::StringToLowerASCII(id.spec()).c_str();
+ return base::ToLowerASCII(id.spec());
}
void URLRequestBackoffManager::OnNetworkChange() {
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index 88a9d2c..3f08e9e 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -142,7 +142,7 @@ std::string URLRequestThrottlerManager::GetIdFromUrl(const GURL& url) const {
return url.possibly_invalid_spec();
GURL id = url.ReplaceComponents(url_id_replacements_);
- return base::StringToLowerASCII(id.spec()).c_str();
+ return base::ToLowerASCII(id.spec());
}
void URLRequestThrottlerManager::GarbageCollectEntriesIfNecessary() {