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

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

Issue 149191: Whenever proxy configurations contain socks and http/https/ftp proxies, socks... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: adding disabled win test Created 11 years, 5 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_linux.h" 5 #include "net/proxy/proxy_config_service_linux.h"
6 6
7 #include <gconf/gconf-client.h> 7 #include <gconf/gconf-client.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 } // namespace 88 } // namespace
89 89
90 bool ProxyConfigServiceLinux::Delegate::GetProxyFromEnvVarForScheme( 90 bool ProxyConfigServiceLinux::Delegate::GetProxyFromEnvVarForScheme(
91 const char* variable, ProxyServer::Scheme scheme, 91 const char* variable, ProxyServer::Scheme scheme,
92 ProxyServer* result_server) { 92 ProxyServer* result_server) {
93 std::string env_value; 93 std::string env_value;
94 if (env_var_getter_->Getenv(variable, &env_value)) { 94 if (env_var_getter_->Getenv(variable, &env_value)) {
95 if (!env_value.empty()) { 95 if (!env_value.empty()) {
96 env_value = FixupProxyHostScheme(scheme, env_value); 96 env_value = FixupProxyHostScheme(scheme, env_value);
97 ProxyServer proxy_server = ProxyServer::FromURI(env_value); 97 ProxyServer proxy_server =
98 ProxyServer::FromURI(env_value, ProxyServer::SCHEME_HTTP);
98 if (proxy_server.is_valid() && !proxy_server.is_direct()) { 99 if (proxy_server.is_valid() && !proxy_server.is_direct()) {
99 *result_server = proxy_server; 100 *result_server = proxy_server;
100 return true; 101 return true;
101 } else { 102 } else {
102 LOG(ERROR) << "Failed to parse environment variable " << variable; 103 LOG(ERROR) << "Failed to parse environment variable " << variable;
103 } 104 }
104 } 105 }
105 } 106 }
106 return false; 107 return false;
107 } 108 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // Check for an optional port. 380 // Check for an optional port.
380 int port; 381 int port;
381 gconf_getter_->GetInt((key + "port").c_str(), &port); 382 gconf_getter_->GetInt((key + "port").c_str(), &port);
382 if (port != 0) { 383 if (port != 0) {
383 // If a port is set and non-zero: 384 // If a port is set and non-zero:
384 host += ":" + IntToString(port); 385 host += ":" + IntToString(port);
385 } 386 }
386 host = FixupProxyHostScheme( 387 host = FixupProxyHostScheme(
387 is_socks ? ProxyServer::SCHEME_SOCKS4 : ProxyServer::SCHEME_HTTP, 388 is_socks ? ProxyServer::SCHEME_SOCKS4 : ProxyServer::SCHEME_HTTP,
388 host); 389 host);
389 ProxyServer proxy_server = ProxyServer::FromURI(host); 390 // TODO(arindam): verify on linux
eroman 2009/07/10 21:24:46 what is this todo about? this looks good to me. y
Arindam 2009/07/11 00:53:35 It was a legacy comment, I guess.
391 ProxyServer proxy_server = ProxyServer::FromURI(host,
392 ProxyServer::SCHEME_HTTP);
390 if (proxy_server.is_valid()) { 393 if (proxy_server.is_valid()) {
391 *result_server = proxy_server; 394 *result_server = proxy_server;
392 return true; 395 return true;
393 } 396 }
394 return false; 397 return false;
395 } 398 }
396 399
397 bool ProxyConfigServiceLinux::Delegate::GetConfigFromGConf( 400 bool ProxyConfigServiceLinux::Delegate::GetConfigFromGConf(
398 ProxyConfig* config) { 401 ProxyConfig* config) {
399 std::string mode; 402 std::string mode;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 new GConfSettingGetterImpl())) { 655 new GConfSettingGetterImpl())) {
653 } 656 }
654 657
655 ProxyConfigServiceLinux::ProxyConfigServiceLinux( 658 ProxyConfigServiceLinux::ProxyConfigServiceLinux(
656 EnvironmentVariableGetter* env_var_getter, 659 EnvironmentVariableGetter* env_var_getter,
657 GConfSettingGetter* gconf_getter) 660 GConfSettingGetter* gconf_getter)
658 : delegate_(new Delegate(env_var_getter, gconf_getter)) { 661 : delegate_(new Delegate(env_var_getter, gconf_getter)) {
659 } 662 }
660 663
661 } // namespace net 664 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698