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

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

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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
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 (base::StartsWithASCII(raw, ".", false)) 331 if (base::StartsWith(raw, ".", base::CompareCase::INSENSITIVE_ASCII))
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 && !base::StartsWithASCII(raw, "*", false)) 336 if (use_hostname_suffix_matching &&
337 !base::StartsWith(raw, "*", base::CompareCase::SENSITIVE))
Ryan Sleevi 2015/07/06 08:52:02 CONSISTENCY NIT: Why'd you change this to SENSITIV
brettw 2015/07/06 16:52:34 Correct. I updated 331 also.
337 raw = "*" + raw; 338 raw = "*" + raw;
338 339
339 return AddRuleForHostname(scheme, raw, port); 340 return AddRuleForHostname(scheme, raw, port);
340 } 341 }
341 342
342 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( 343 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging(
343 const std::string& raw, 344 const std::string& raw,
344 bool use_hostname_suffix_matching) { 345 bool use_hostname_suffix_matching) {
345 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); 346 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching);
346 } 347 }
347 348
348 } // namespace net 349 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698