OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_config.h" | 5 #include "net/proxy/proxy_config.h" |
6 | 6 |
7 #include "base/string_tokenizer.h" | 7 #include "base/string_tokenizer.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return &proxy_for_ftp; | 90 return &proxy_for_ftp; |
91 return NULL; // No mapping for this scheme. | 91 return NULL; // No mapping for this scheme. |
92 } | 92 } |
93 | 93 |
94 namespace { | 94 namespace { |
95 | 95 |
96 // Returns true if the given string represents an IP address. | 96 // Returns true if the given string represents an IP address. |
97 bool IsIPAddress(const std::string& domain) { | 97 bool IsIPAddress(const std::string& domain) { |
98 // From GURL::HostIsIPAddress() | 98 // From GURL::HostIsIPAddress() |
99 url_canon::RawCanonOutputT<char, 128> ignored_output; | 99 url_canon::RawCanonOutputT<char, 128> ignored_output; |
100 url_parse::Component ignored_component; | 100 url_canon::CanonHostInfo host_info; |
101 url_parse::Component domain_comp(0, domain.size()); | 101 url_parse::Component domain_comp(0, domain.size()); |
102 return url_canon::CanonicalizeIPAddress(domain.c_str(), domain_comp, | 102 url_canon::CanonicalizeIPAddress(domain.c_str(), domain_comp, |
103 &ignored_output, | 103 &ignored_output, &host_info); |
104 &ignored_component); | 104 return host_info.IsIPAddress(); |
105 } | 105 } |
106 | 106 |
107 } // namespace | 107 } // namespace |
108 | 108 |
109 void ProxyConfig::ParseNoProxyList(const std::string& no_proxy) { | 109 void ProxyConfig::ParseNoProxyList(const std::string& no_proxy) { |
110 proxy_bypass.clear(); | 110 proxy_bypass.clear(); |
111 if (no_proxy.empty()) | 111 if (no_proxy.empty()) |
112 return; | 112 return; |
113 // Traditional semantics: | 113 // Traditional semantics: |
114 // A single "*" is specifically allowed and unproxies anything. | 114 // A single "*" is specifically allowed and unproxies anything. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 it != config.proxy_bypass.end(); ++it) { | 214 it != config.proxy_bypass.end(); ++it) { |
215 out << " " << *it << "\n"; | 215 out << " " << *it << "\n"; |
216 } | 216 } |
217 out << " }\n"; | 217 out << " }\n"; |
218 } | 218 } |
219 | 219 |
220 out << " id: " << config.id() << "\n" | 220 out << " id: " << config.id() << "\n" |
221 << "}"; | 221 << "}"; |
222 return out; | 222 return out; |
223 } | 223 } |
OLD | NEW |