OLD | NEW |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 scheme = ProxyServer::SCHEME_SOCKS5; | 65 scheme = ProxyServer::SCHEME_SOCKS5; |
66 } | 66 } |
67 // Strip the scheme if any. | 67 // Strip the scheme if any. |
68 std::string::size_type colon = host.find("://"); | 68 std::string::size_type colon = host.find("://"); |
69 if (colon != std::string::npos) | 69 if (colon != std::string::npos) |
70 host = host.substr(colon + 3); | 70 host = host.substr(colon + 3); |
71 // If a username and perhaps password are specified, give a warning. | 71 // If a username and perhaps password are specified, give a warning. |
72 std::string::size_type at_sign = host.find("@"); | 72 std::string::size_type at_sign = host.find("@"); |
73 // Should this be supported? | 73 // Should this be supported? |
74 if (at_sign != std::string::npos) { | 74 if (at_sign != std::string::npos) { |
75 LOG(ERROR) << "Proxy authentication not supported"; | 75 // ProxyConfig does not support authentication parameters, but Chrome |
76 // Disregard the authentication parameters and continue with this hostname. | 76 // will prompt for the password later. Disregard the |
| 77 // authentication parameters and continue with this hostname. |
| 78 LOG(WARNING) << "Proxy authentication parameters ignored, see bug 16709"; |
77 host = host.substr(at_sign + 1); | 79 host = host.substr(at_sign + 1); |
78 } | 80 } |
79 // If this is a socks proxy, prepend a scheme so as to tell | 81 // If this is a socks proxy, prepend a scheme so as to tell |
80 // ProxyServer. This also allows ProxyServer to choose the right | 82 // ProxyServer. This also allows ProxyServer to choose the right |
81 // default port. | 83 // default port. |
82 if (scheme == ProxyServer::SCHEME_SOCKS4) | 84 if (scheme == ProxyServer::SCHEME_SOCKS4) |
83 host = "socks4://" + host; | 85 host = "socks4://" + host; |
84 else if (scheme == ProxyServer::SCHEME_SOCKS5) | 86 else if (scheme == ProxyServer::SCHEME_SOCKS5) |
85 host = "socks5://" + host; | 87 host = "socks5://" + host; |
86 return host; | 88 return host; |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 504 |
503 if (config->proxy_rules.empty()) { | 505 if (config->proxy_rules.empty()) { |
504 // Manual mode but we couldn't parse any rules. | 506 // Manual mode but we couldn't parse any rules. |
505 return false; | 507 return false; |
506 } | 508 } |
507 | 509 |
508 // Check for authentication, just so we can warn. | 510 // Check for authentication, just so we can warn. |
509 bool use_auth; | 511 bool use_auth; |
510 gconf_getter_->GetBoolean("/system/http_proxy/use_authentication", | 512 gconf_getter_->GetBoolean("/system/http_proxy/use_authentication", |
511 &use_auth); | 513 &use_auth); |
512 if (use_auth) | 514 if (use_auth) { |
513 LOG(ERROR) << "Proxy authentication not supported"; | 515 // ProxyConfig does not support authentication parameters, but |
| 516 // Chrome will prompt for the password later. So we ignore |
| 517 // /system/http_proxy/*auth* settings. |
| 518 LOG(WARNING) << "Proxy authentication parameters ignored, see bug 16709"; |
| 519 } |
514 | 520 |
515 // Now the bypass list. | 521 // Now the bypass list. |
516 gconf_getter_->GetStringList("/system/http_proxy/ignore_hosts", | 522 gconf_getter_->GetStringList("/system/http_proxy/ignore_hosts", |
517 &config->proxy_bypass); | 523 &config->proxy_bypass); |
518 // Note that there are no settings with semantics corresponding to | 524 // Note that there are no settings with semantics corresponding to |
519 // config->proxy_bypass_local_names. | 525 // config->proxy_bypass_local_names. |
520 | 526 |
521 return true; | 527 return true; |
522 } | 528 } |
523 | 529 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 new GConfSettingGetterImpl())) { | 677 new GConfSettingGetterImpl())) { |
672 } | 678 } |
673 | 679 |
674 ProxyConfigServiceLinux::ProxyConfigServiceLinux( | 680 ProxyConfigServiceLinux::ProxyConfigServiceLinux( |
675 EnvironmentVariableGetter* env_var_getter, | 681 EnvironmentVariableGetter* env_var_getter, |
676 GConfSettingGetter* gconf_getter) | 682 GConfSettingGetter* gconf_getter) |
677 : delegate_(new Delegate(env_var_getter, gconf_getter)) { | 683 : delegate_(new Delegate(env_var_getter, gconf_getter)) { |
678 } | 684 } |
679 | 685 |
680 } // namespace net | 686 } // namespace net |
OLD | NEW |