Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: net/proxy/proxy_config_service_android.cc

Issue 796003002: do not send traffic to localhost through proxy for android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // There is no reasonable way to configure localhost
103 // to not go through the proxy. The Linux version of
104 // proxy_config_service does, just not the android
Torne 2014/12/11 17:44:49 Describing the reason why a change was made doesn'
105 // version. As sending communication to localhost through
106 // the proxy is silly, we force a bypass rule for
107 // localhost, causing it to never go through the proxy.
108 bypass_rules->AddRuleToBypassLocal();
109
101 std::string non_proxy_hosts = 110 std::string non_proxy_hosts =
102 get_property.Run(scheme + ".nonProxyHosts"); 111 get_property.Run(scheme + ".nonProxyHosts");
103 if (non_proxy_hosts.empty()) 112 if (non_proxy_hosts.empty())
104 return; 113 return;
105 base::StringTokenizer tokenizer(non_proxy_hosts, "|"); 114 base::StringTokenizer tokenizer(non_proxy_hosts, "|");
106 while (tokenizer.GetNext()) { 115 while (tokenizer.GetNext()) {
107 std::string token = tokenizer.token(); 116 std::string token = tokenizer.token();
108 std::string pattern; 117 std::string pattern;
109 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern); 118 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &pattern);
110 if (pattern.empty()) 119 if (pattern.empty())
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 network_task_runner, jni_task_runner, get_property_callback)) { 411 network_task_runner, jni_task_runner, get_property_callback)) {
403 delegate_->SetupJNI(); 412 delegate_->SetupJNI();
404 delegate_->FetchInitialConfig(); 413 delegate_->FetchInitialConfig();
405 } 414 }
406 415
407 void ProxyConfigServiceAndroid::ProxySettingsChanged() { 416 void ProxyConfigServiceAndroid::ProxySettingsChanged() {
408 delegate_->ProxySettingsChanged(); 417 delegate_->ProxySettingsChanged();
409 } 418 }
410 419
411 } // namespace net 420 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698