OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_service_android.h" | 5 #include "net/proxy/proxy_config_service_android.h" |
6 | 6 |
7 #include <sys/system_properties.h> | 7 #include <sys/system_properties.h> |
8 | 8 |
9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 return ProxyServer(); | 91 return ProxyServer(); |
92 } | 92 } |
93 | 93 |
94 void AddBypassRules(const std::string& scheme, | 94 void AddBypassRules(const std::string& scheme, |
95 const GetPropertyCallback& get_property, | 95 const GetPropertyCallback& get_property, |
96 ProxyBypassRules* bypass_rules) { | 96 ProxyBypassRules* bypass_rules) { |
97 // The format of a hostname pattern is a list of hostnames that are separated | 97 // The format of a hostname pattern is a list of hostnames that are separated |
98 // by | and that use * as a wildcard. For example, setting the | 98 // by | and that use * as a wildcard. For example, setting the |
99 // http.nonProxyHosts property to *.android.com|*.kernel.org will cause | 99 // http.nonProxyHosts property to *.android.com|*.kernel.org will cause |
100 // requests to http://developer.android.com to be made without a proxy. | 100 // requests to http://developer.android.com to be made without a proxy. |
| 101 |
| 102 // Force localhost to be on the proxy exclusion list; |
| 103 // otherwise all localhost traffic is routed through |
| 104 // the proxy which is not desired. |
| 105 bypass_rules->AddRuleToBypassLocal(); |
| 106 |
101 std::string non_proxy_hosts = | 107 std::string non_proxy_hosts = |
102 get_property.Run(scheme + ".nonProxyHosts"); | 108 get_property.Run(scheme + ".nonProxyHosts"); |
103 if (non_proxy_hosts.empty()) | 109 if (non_proxy_hosts.empty()) |
104 return; | 110 return; |
105 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); | 111 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); |
106 while (tokenizer.GetNext()) { | 112 while (tokenizer.GetNext()) { |
107 std::string token = tokenizer.token(); | 113 std::string token = tokenizer.token(); |
108 std::string pattern; | 114 std::string pattern; |
109 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern); | 115 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern); |
110 if (pattern.empty()) | 116 if (pattern.empty()) |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 network_task_runner, jni_task_runner, get_property_callback)) { | 408 network_task_runner, jni_task_runner, get_property_callback)) { |
403 delegate_->SetupJNI(); | 409 delegate_->SetupJNI(); |
404 delegate_->FetchInitialConfig(); | 410 delegate_->FetchInitialConfig(); |
405 } | 411 } |
406 | 412 |
407 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 413 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
408 delegate_->ProxySettingsChanged(); | 414 delegate_->ProxySettingsChanged(); |
409 } | 415 } |
410 | 416 |
411 } // namespace net | 417 } // namespace net |
OLD | NEW |