OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #if defined(USE_GCONF) | 9 #if defined(USE_GCONF) |
10 #include <gconf/gconf-client.h> | 10 #include <gconf/gconf-client.h> |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 } | 1091 } |
1092 | 1092 |
1093 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { | 1093 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { |
1094 return kde_home.Append("share").Append("config"); | 1094 return kde_home.Append("share").Append("config"); |
1095 } | 1095 } |
1096 | 1096 |
1097 void AddProxy(StringSetting host_key, const std::string& value) { | 1097 void AddProxy(StringSetting host_key, const std::string& value) { |
1098 if (value.empty() || value.substr(0, 3) == "//:") | 1098 if (value.empty() || value.substr(0, 3) == "//:") |
1099 // No proxy. | 1099 // No proxy. |
1100 return; | 1100 return; |
1101 // We don't need to parse the port number out; GetProxyFromSettings() | 1101 size_t space = value.find(' '); |
1102 // would only append it right back again. So we just leave the port | 1102 if (space != std::string::npos) { |
1103 // number right in the host string. | 1103 // Newer versions of KDE use a space rather than a colon to separate the |
1104 string_table_[host_key] = value; | 1104 // port number from the hostname. If we find this, we need to convert it. |
| 1105 std::string fixed = value; |
| 1106 fixed[space] = ':'; |
| 1107 string_table_[host_key] = fixed; |
| 1108 } else { |
| 1109 // We don't need to parse the port number out; GetProxyFromSettings() |
| 1110 // would only append it right back again. So we just leave the port |
| 1111 // number right in the host string. |
| 1112 string_table_[host_key] = value; |
| 1113 } |
1105 } | 1114 } |
1106 | 1115 |
1107 void AddHostList(StringListSetting key, const std::string& value) { | 1116 void AddHostList(StringListSetting key, const std::string& value) { |
1108 std::vector<std::string> tokens; | 1117 std::vector<std::string> tokens; |
1109 StringTokenizer tk(value, ", "); | 1118 StringTokenizer tk(value, ", "); |
1110 while (tk.GetNext()) { | 1119 while (tk.GetNext()) { |
1111 std::string token = tk.token(); | 1120 std::string token = tk.token(); |
1112 if (!token.empty()) | 1121 if (!token.empty()) |
1113 tokens.push_back(token); | 1122 tokens.push_back(token); |
1114 } | 1123 } |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1798 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
1790 delegate_->RemoveObserver(observer); | 1799 delegate_->RemoveObserver(observer); |
1791 } | 1800 } |
1792 | 1801 |
1793 ProxyConfigService::ConfigAvailability | 1802 ProxyConfigService::ConfigAvailability |
1794 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1803 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
1795 return delegate_->GetLatestProxyConfig(config); | 1804 return delegate_->GetLatestProxyConfig(config); |
1796 } | 1805 } |
1797 | 1806 |
1798 } // namespace net | 1807 } // namespace net |
OLD | NEW |