| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/pattern.h" | 8 #include "base/strings/pattern.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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 bool Matches(const GURL& url) const override { | 95 bool Matches(const GURL& url) const override { |
| 96 if (!url.HostIsIPAddress()) | 96 if (!url.HostIsIPAddress()) |
| 97 return false; | 97 return false; |
| 98 | 98 |
| 99 if (!optional_scheme_.empty() && url.scheme() != optional_scheme_) | 99 if (!optional_scheme_.empty() && url.scheme() != optional_scheme_) |
| 100 return false; // Didn't match scheme expectation. | 100 return false; // Didn't match scheme expectation. |
| 101 | 101 |
| 102 // Parse the input IP literal to a number. | 102 // Parse the input IP literal to a number. |
| 103 IPAddress ip_address; | 103 IPAddress ip_address; |
| 104 if (!ip_address.AssignFromIPLiteral(url.HostNoBrackets())) | 104 if (!ip_address.AssignFromIPLiteral(url.HostNoBracketsPiece())) |
| 105 return false; | 105 return false; |
| 106 | 106 |
| 107 // Test if it has the expected prefix. | 107 // Test if it has the expected prefix. |
| 108 return IPAddressMatchesPrefix(ip_address, ip_prefix_, | 108 return IPAddressMatchesPrefix(ip_address, ip_prefix_, |
| 109 prefix_length_in_bits_); | 109 prefix_length_in_bits_); |
| 110 } | 110 } |
| 111 | 111 |
| 112 std::string ToString() const override { return description_; } | 112 std::string ToString() const override { return description_; } |
| 113 | 113 |
| 114 std::unique_ptr<Rule> Clone() const override { | 114 std::unique_ptr<Rule> Clone() const override { |
| (...skipping 224 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 |