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
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index af0e4cda0..c05e84f 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -1099,10 +1099,19 @@
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) {