Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: net/proxy/proxy_config_service_linux.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/proxy/proxy_bypass_rules.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 namespace { 48 namespace {
49 49
50 // Given a proxy hostname from a setting, returns that hostname with 50 // Given a proxy hostname from a setting, returns that hostname with
51 // an appropriate proxy server scheme prefix. 51 // an appropriate proxy server scheme prefix.
52 // scheme indicates the desired proxy scheme: usually http, with 52 // scheme indicates the desired proxy scheme: usually http, with
53 // socks 4 or 5 as special cases. 53 // socks 4 or 5 as special cases.
54 // TODO(arindam): Remove URI string manipulation by using MapUrlSchemeToProxy. 54 // TODO(arindam): Remove URI string manipulation by using MapUrlSchemeToProxy.
55 std::string FixupProxyHostScheme(ProxyServer::Scheme scheme, 55 std::string FixupProxyHostScheme(ProxyServer::Scheme scheme,
56 std::string host) { 56 std::string host) {
57 if (scheme == ProxyServer::SCHEME_SOCKS5 && 57 if (scheme == ProxyServer::SCHEME_SOCKS5 &&
58 base::StartsWithASCII(host, "socks4://", false)) { 58 base::StartsWith(host, "socks4://",
59 base::CompareCase::INSENSITIVE_ASCII)) {
59 // We default to socks 5, but if the user specifically set it to 60 // We default to socks 5, but if the user specifically set it to
60 // socks4://, then use that. 61 // socks4://, then use that.
61 scheme = ProxyServer::SCHEME_SOCKS4; 62 scheme = ProxyServer::SCHEME_SOCKS4;
62 } 63 }
63 // Strip the scheme if any. 64 // Strip the scheme if any.
64 std::string::size_type colon = host.find("://"); 65 std::string::size_type colon = host.find("://");
65 if (colon != std::string::npos) 66 if (colon != std::string::npos)
66 host = host.substr(colon + 3); 67 host = host.substr(colon + 3);
67 // If a username and perhaps password are specified, give a warning. 68 // If a username and perhaps password are specified, give a warning.
68 std::string::size_type at_sign = host.find("@"); 69 std::string::size_type at_sign = host.find("@");
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { 1773 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) {
1773 delegate_->RemoveObserver(observer); 1774 delegate_->RemoveObserver(observer);
1774 } 1775 }
1775 1776
1776 ProxyConfigService::ConfigAvailability 1777 ProxyConfigService::ConfigAvailability
1777 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { 1778 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) {
1778 return delegate_->GetLatestProxyConfig(config); 1779 return delegate_->GetLatestProxyConfig(config);
1779 } 1780 }
1780 1781
1781 } // namespace net 1782 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_bypass_rules.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698