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

Side by Side Diff: net/proxy/proxy_bypass_rules.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/http/http_util.cc ('k') | net/proxy/proxy_config_service_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/proxy/proxy_bypass_rules.h" 5 #include "net/proxy/proxy_bypass_rules.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "base/strings/string_tokenizer.h" 10 #include "base/strings/string_tokenizer.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 raw.end()), 321 raw.end()),
322 &port) || 322 &port) ||
323 (port < 0 || port > 0xFFFF)) { 323 (port < 0 || port > 0xFFFF)) {
324 return false; // Port was invalid. 324 return false; // Port was invalid.
325 } 325 }
326 raw = raw.substr(0, pos_colon); 326 raw = raw.substr(0, pos_colon);
327 } 327 }
328 328
329 // Special-case hostnames that begin with a period. 329 // Special-case hostnames that begin with a period.
330 // For example, we remap ".google.com" --> "*.google.com". 330 // For example, we remap ".google.com" --> "*.google.com".
331 if (StartsWithASCII(raw, ".", false)) 331 if (base::StartsWithASCII(raw, ".", false))
332 raw = "*" + raw; 332 raw = "*" + raw;
333 333
334 // If suffix matching was asked for, make sure the pattern starts with a 334 // If suffix matching was asked for, make sure the pattern starts with a
335 // wildcard. 335 // wildcard.
336 if (use_hostname_suffix_matching && !StartsWithASCII(raw, "*", false)) 336 if (use_hostname_suffix_matching && !base::StartsWithASCII(raw, "*", false))
337 raw = "*" + raw; 337 raw = "*" + raw;
338 338
339 return AddRuleForHostname(scheme, raw, port); 339 return AddRuleForHostname(scheme, raw, port);
340 } 340 }
341 341
342 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( 342 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging(
343 const std::string& raw, 343 const std::string& raw,
344 bool use_hostname_suffix_matching) { 344 bool use_hostname_suffix_matching) {
345 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); 345 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching);
346 } 346 }
347 347
348 } // namespace net 348 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_util.cc ('k') | net/proxy/proxy_config_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698