summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 00:58:37 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 00:58:37 +0000
commitbfeb7233a965b2220bccbcf7bdacb3f2765168d9 (patch)
treee4846147faa3a7e7d5e67dc09fdbdf1941a685b8 /net/proxy
parent81b919c7669f3ab92e55e415595bdaa131010fd4 (diff)
downloadchromium_src-bfeb7233a965b2220bccbcf7bdacb3f2765168d9.zip
chromium_src-bfeb7233a965b2220bccbcf7bdacb3f2765168d9.tar.gz
chromium_src-bfeb7233a965b2220bccbcf7bdacb3f2765168d9.tar.bz2
Linux: KDE: support recent KDE's socksProxy setting.
BUG=131556 Review URL: https://chromiumcodereview.appspot.com/10545073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/proxy_config_service_linux.cc11
-rw-r--r--net/proxy/proxy_config_service_linux_unittest.cc32
2 files changed, 37 insertions, 6 deletions
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index 5012d5f..fb001cd 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -1125,12 +1125,6 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
}
void AddKDESetting(const std::string& key, const std::string& value) {
- // The astute reader may notice that there is no mention of SOCKS
- // here. That's because KDE handles socks is a strange way, and we
- // don't support it. Rather than just a setting for the SOCKS server,
- // it has a setting for a library to LD_PRELOAD in all your programs
- // that will transparently SOCKSify them. Such libraries each have
- // their own configuration, and thus, we can't get it from KDE.
if (key == "ProxyType") {
const char* mode = "none";
indirect_manual_ = false;
@@ -1164,6 +1158,11 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
AddProxy(PROXY_HTTPS_HOST, value);
} else if (key == "ftpProxy") {
AddProxy(PROXY_FTP_HOST, value);
+ } else if (key == "socksProxy") {
+ // Older versions of KDE configure SOCKS in a weird way involving
+ // LD_PRELOAD and a library that intercepts network calls to SOCKSify
+ // them. We don't support it. KDE 4.8 added a proper SOCKS setting.
+ AddProxy(PROXY_SOCKS_HOST, value);
} else if (key == "ReversedException") {
// We count "true" or any nonzero number as true, otherwise false.
// Note that if the value is not actually numeric StringToInt()
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 0c292a5..d25dde9 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -1231,6 +1231,38 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
},
{
+ TEST_DESC("socks"),
+
+ // Input.
+ "[Proxy Settings]\nProxyType=1\nsocksProxy=socks.com 888\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::Single(
+ "socks5://socks.com:888", // single proxy
+ ""), // bypass rules
+ },
+
+ {
+ TEST_DESC("socks4"),
+
+ // Input.
+ "[Proxy Settings]\nProxyType=1\nsocksProxy=socks4://socks.com 888\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::Single(
+ "socks4://socks.com:888", // single proxy
+ ""), // bypass rules
+ },
+
+ {
TEST_DESC("Treat all hostname patterns as wildcard patterns"),
// Input.