| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/string_tokenizer.h" | 8 #include "base/string_tokenizer.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return false; // Didn't match scheme expectation. | 31 return false; // Didn't match scheme expectation. |
| 32 | 32 |
| 33 // Note it is necessary to lower-case the host, since GURL uses capital | 33 // Note it is necessary to lower-case the host, since GURL uses capital |
| 34 // letters for percent-escaped characters. | 34 // letters for percent-escaped characters. |
| 35 return MatchPattern(StringToLowerASCII(url.host()), hostname_pattern_); | 35 return MatchPattern(StringToLowerASCII(url.host()), hostname_pattern_); |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual std::string ToString() const { | 38 virtual std::string ToString() const { |
| 39 std::string str; | 39 std::string str; |
| 40 if (!optional_scheme_.empty()) | 40 if (!optional_scheme_.empty()) |
| 41 StringAppendF(&str, "%s://", optional_scheme_.c_str()); | 41 base::StringAppendF(&str, "%s://", optional_scheme_.c_str()); |
| 42 str += hostname_pattern_; | 42 str += hostname_pattern_; |
| 43 if (optional_port_ != -1) | 43 if (optional_port_ != -1) |
| 44 StringAppendF(&str, ":%d", optional_port_); | 44 base::StringAppendF(&str, ":%d", optional_port_); |
| 45 return str; | 45 return str; |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 const std::string optional_scheme_; | 49 const std::string optional_scheme_; |
| 50 const std::string hostname_pattern_; | 50 const std::string hostname_pattern_; |
| 51 const int optional_port_; | 51 const int optional_port_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class BypassLocalRule : public ProxyBypassRules::Rule { | 54 class BypassLocalRule : public ProxyBypassRules::Rule { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return AddRuleForHostname(scheme, raw, port); | 284 return AddRuleForHostname(scheme, raw, port); |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( | 287 bool ProxyBypassRules::AddRuleFromStringInternalWithLogging( |
| 288 const std::string& raw, | 288 const std::string& raw, |
| 289 bool use_hostname_suffix_matching) { | 289 bool use_hostname_suffix_matching) { |
| 290 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); | 290 return AddRuleFromStringInternal(raw, use_hostname_suffix_matching); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace net | 293 } // namespace net |
| OLD | NEW |