| OLD | NEW |
| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 | 258 |
| 259 bool ProxyBypassRules::AddRuleFromStringInternal( | 259 bool ProxyBypassRules::AddRuleFromStringInternal( |
| 260 const std::string& raw_untrimmed, | 260 const std::string& raw_untrimmed, |
| 261 bool use_hostname_suffix_matching) { | 261 bool use_hostname_suffix_matching) { |
| 262 std::string raw; | 262 std::string raw; |
| 263 base::TrimWhitespaceASCII(raw_untrimmed, base::TRIM_ALL, &raw); | 263 base::TrimWhitespaceASCII(raw_untrimmed, base::TRIM_ALL, &raw); |
| 264 | 264 |
| 265 // This is the special syntax used by WinInet's bypass list -- we allow it | 265 // This is the special syntax used by WinInet's bypass list -- we allow it |
| 266 // on all platforms and interpret it the same way. | 266 // on all platforms and interpret it the same way. |
| 267 if (LowerCaseEqualsASCII(raw, "<local>")) { | 267 if (base::LowerCaseEqualsASCII(raw, "<local>")) { |
| 268 AddRuleToBypassLocal(); | 268 AddRuleToBypassLocal(); |
| 269 return true; | 269 return true; |
| 270 } | 270 } |
| 271 | 271 |
| 272 // Extract any scheme-restriction. | 272 // Extract any scheme-restriction. |
| 273 std::string::size_type scheme_pos = raw.find("://"); | 273 std::string::size_type scheme_pos = raw.find("://"); |
| 274 std::string scheme; | 274 std::string scheme; |
| 275 if (scheme_pos != std::string::npos) { | 275 if (scheme_pos != std::string::npos) { |
| 276 scheme = raw.substr(0, scheme_pos); | 276 scheme = raw.substr(0, scheme_pos); |
| 277 raw = raw.substr(scheme_pos + 3); | 277 raw = raw.substr(scheme_pos + 3); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |