summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_server.cc
diff options
context:
space:
mode:
authorbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 16:29:33 +0000
committerbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 16:29:33 +0000
commite84925d3e94486d97ba4c477b830ef2249cffff7 (patch)
tree5c74000c30019350fb35fa574d31acc99bc35611 /net/proxy/proxy_server.cc
parent0983c7a0180c34abe1b0d305797e538c65fce6cc (diff)
downloadchromium_src-e84925d3e94486d97ba4c477b830ef2249cffff7.zip
chromium_src-e84925d3e94486d97ba4c477b830ef2249cffff7.tar.gz
chromium_src-e84925d3e94486d97ba4c477b830ef2249cffff7.tar.bz2
Migrate Proxy Settings API to net::ProxyServer
BUG=none TEST=none Review URL: http://codereview.chromium.org/6450006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_server.cc')
-rw-r--r--net/proxy/proxy_server.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index 0bcf89c..eb160dc 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -15,11 +15,12 @@ namespace net {
namespace {
-// Parse the proxy type from a PAC string, to a ProxyServer::Scheme.
+// Parses the proxy type from a PAC string, to a ProxyServer::Scheme.
// This mapping is case-insensitive. If no type could be matched
// returns SCHEME_INVALID.
-ProxyServer::Scheme GetSchemeFromPacType(std::string::const_iterator begin,
- std::string::const_iterator end) {
+ProxyServer::Scheme GetSchemeFromPacTypeInternal(
+ std::string::const_iterator begin,
+ std::string::const_iterator end) {
if (LowerCaseEqualsASCII(begin, end, "proxy"))
return ProxyServer::SCHEME_HTTP;
if (LowerCaseEqualsASCII(begin, end, "socks")) {
@@ -40,11 +41,11 @@ ProxyServer::Scheme GetSchemeFromPacType(std::string::const_iterator begin,
return ProxyServer::SCHEME_INVALID;
}
-// Parse the proxy scheme from a URL-like representation, to a
-// ProxyServer::Scheme. This corresponds with the values used in
+// Parses the proxy scheme from a URL-like representation, to a
+// ProxyServer::Scheme. This corresponds with the values used in
// ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID.
-ProxyServer::Scheme GetSchemeFromURI(std::string::const_iterator begin,
- std::string::const_iterator end) {
+ProxyServer::Scheme GetSchemeFromURIInternal(std::string::const_iterator begin,
+ std::string::const_iterator end) {
if (LowerCaseEqualsASCII(begin, end, "http"))
return ProxyServer::SCHEME_HTTP;
if (LowerCaseEqualsASCII(begin, end, "socks4"))
@@ -110,7 +111,7 @@ ProxyServer ProxyServer::FromURI(std::string::const_iterator begin,
(end - colon) >= 3 &&
*(colon + 1) == '/' &&
*(colon + 2) == '/') {
- scheme = GetSchemeFromURI(begin, colon);
+ scheme = GetSchemeFromURIInternal(begin, colon);
begin = colon + 3; // Skip past the "://"
}
@@ -161,7 +162,7 @@ ProxyServer ProxyServer::FromPacString(std::string::const_iterator begin,
}
// Everything to the left of the space is the scheme.
- Scheme scheme = GetSchemeFromPacType(begin, space);
+ Scheme scheme = GetSchemeFromPacTypeInternal(begin, space);
// And everything to the right of the space is the
// <host>[":" <port>].
@@ -204,6 +205,11 @@ int ProxyServer::GetDefaultPortForScheme(Scheme scheme) {
}
// static
+ProxyServer::Scheme ProxyServer::GetSchemeFromURI(const std::string& scheme) {
+ return GetSchemeFromURIInternal(scheme.begin(), scheme.end());
+}
+
+// static
ProxyServer ProxyServer::FromSchemeHostAndPort(
Scheme scheme,
std::string::const_iterator begin,