summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 23:27:55 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 23:27:55 +0000
commit4b90c2064ae457ae2caed9b2c57a73ea030d7954 (patch)
tree4e8bd6bb905244778077ffa2abe6e37f2c735e70
parent256d27329ccedbdde3c25b6a4ad75a70ac2ea297 (diff)
downloadchromium_src-4b90c2064ae457ae2caed9b2c57a73ea030d7954.zip
chromium_src-4b90c2064ae457ae2caed9b2c57a73ea030d7954.tar.gz
chromium_src-4b90c2064ae457ae2caed9b2c57a73ea030d7954.tar.bz2
Linux: Add support for new KDE space-delimited proxy port numbers.
BUG=123288 Review URL: http://codereview.chromium.org/10217008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133802 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/proxy/proxy_config_service_linux.cc17
-rw-r--r--net/proxy/proxy_config_service_linux_unittest.cc19
2 files changed, 32 insertions, 4 deletions
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index af0e4cd..c05e84f 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -1099,10 +1099,19 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
if (value.empty() || value.substr(0, 3) == "//:")
// No proxy.
return;
- // We don't need to parse the port number out; GetProxyFromSettings()
- // would only append it right back again. So we just leave the port
- // number right in the host string.
- string_table_[host_key] = value;
+ size_t space = value.find(' ');
+ if (space != std::string::npos) {
+ // Newer versions of KDE use a space rather than a colon to separate the
+ // port number from the hostname. If we find this, we need to convert it.
+ std::string fixed = value;
+ fixed[space] = ':';
+ string_table_[host_key] = fixed;
+ } else {
+ // We don't need to parse the port number out; GetProxyFromSettings()
+ // would only append it right back again. So we just leave the port
+ // number right in the host string.
+ string_table_[host_key] = value;
+ }
}
void AddHostList(StringListSetting key, const std::string& value) {
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index ad12ea6..766155b 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -1155,6 +1155,25 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
},
{
+ TEST_DESC("Only HTTP proxy specified, different port, space-delimited"),
+
+ // Input.
+ "[Proxy Settings]\nProxyType=1\n"
+ "httpProxy=www.google.com 88\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::PerScheme(
+ "www.google.com:88", // http
+ "", // https
+ "", // ftp
+ ""), // bypass rules
+ },
+
+ {
TEST_DESC("Bypass *.google.com"),
// Input.