summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 07:38:01 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 07:38:01 +0000
commita3c5c07dd1717fd7d372622bb51c8391aa54a35d (patch)
tree6eef2d04e32163e78bc09a965fe1f442d4765ac4 /net/proxy
parentecf95d98d5ac5026b93eb2152ebc40351d5cb277 (diff)
downloadchromium_src-a3c5c07dd1717fd7d372622bb51c8391aa54a35d.zip
chromium_src-a3c5c07dd1717fd7d372622bb51c8391aa54a35d.tar.gz
chromium_src-a3c5c07dd1717fd7d372622bb51c8391aa54a35d.tar.bz2
Implement support for QUIC proxies in ProxyServer
BUG=335275 Review URL: https://codereview.chromium.org/144623006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/proxy_info.h7
-rw-r--r--net/proxy/proxy_server.cc15
-rw-r--r--net/proxy/proxy_server.h8
3 files changed, 28 insertions, 2 deletions
diff --git a/net/proxy/proxy_info.h b/net/proxy/proxy_info.h
index 243cbba..336cb3a 100644
--- a/net/proxy/proxy_info.h
+++ b/net/proxy/proxy_info.h
@@ -75,6 +75,13 @@ class NET_EXPORT ProxyInfo {
return proxy_server().is_http();
}
+ // Returns true if the first valid proxy server is a quic proxy.
+ bool is_quic() const {
+ if (is_empty())
+ return false;
+ return proxy_server().is_quic();
+ }
+
// Returns true if the first valid proxy server is a socks server.
bool is_socks() const {
if (is_empty())
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index deb77913..b0997e0 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -36,6 +36,8 @@ ProxyServer::Scheme GetSchemeFromPacTypeInternal(
return ProxyServer::SCHEME_DIRECT;
if (LowerCaseEqualsASCII(begin, end, "https"))
return ProxyServer::SCHEME_HTTPS;
+ if (LowerCaseEqualsASCII(begin, end, "quic"))
+ return ProxyServer::SCHEME_QUIC;
return ProxyServer::SCHEME_INVALID;
}
@@ -57,6 +59,8 @@ ProxyServer::Scheme GetSchemeFromURIInternal(std::string::const_iterator begin,
return ProxyServer::SCHEME_DIRECT;
if (LowerCaseEqualsASCII(begin, end, "https"))
return ProxyServer::SCHEME_HTTPS;
+ if (LowerCaseEqualsASCII(begin, end, "quic"))
+ return ProxyServer::SCHEME_QUIC;
return ProxyServer::SCHEME_INVALID;
}
@@ -131,6 +135,8 @@ std::string ProxyServer::ToURI() const {
return std::string("socks5://") + host_port_pair().ToString();
case SCHEME_HTTPS:
return std::string("https://") + host_port_pair().ToString();
+ case SCHEME_QUIC:
+ return std::string("quic://") + host_port_pair().ToString();
default:
// Got called with an invalid scheme.
NOTREACHED();
@@ -181,6 +187,8 @@ std::string ProxyServer::ToPacString() const {
return std::string("SOCKS5 ") + host_port_pair().ToString();
case SCHEME_HTTPS:
return std::string("HTTPS ") + host_port_pair().ToString();
+ case SCHEME_QUIC:
+ return std::string("QUIC ") + host_port_pair().ToString();
default:
// Got called with an invalid scheme.
NOTREACHED();
@@ -197,10 +205,13 @@ int ProxyServer::GetDefaultPortForScheme(Scheme scheme) {
case SCHEME_SOCKS5:
return 1080;
case SCHEME_HTTPS:
+ case SCHEME_QUIC:
return 443;
- default:
- return -1;
+ case SCHEME_INVALID:
+ case SCHEME_DIRECT:
+ break;
}
+ return -1;
}
// static
diff --git a/net/proxy/proxy_server.h b/net/proxy/proxy_server.h
index 08a20c0..27b8b04 100644
--- a/net/proxy/proxy_server.h
+++ b/net/proxy/proxy_server.h
@@ -31,6 +31,9 @@ class NET_EXPORT ProxyServer {
SCHEME_SOCKS4 = 1 << 3,
SCHEME_SOCKS5 = 1 << 4,
SCHEME_HTTPS = 1 << 5,
+ // A QUIC proxy is an HTTP proxy in which QUIC is used as the transport,
+ // instead of TCP.
+ SCHEME_QUIC = 1 << 6,
};
// Default copy-constructor and assignment operator are OK!
@@ -59,6 +62,9 @@ class NET_EXPORT ProxyServer {
return scheme_ == SCHEME_SOCKS4 || scheme_ == SCHEME_SOCKS5;
}
+ // Returns true if this ProxyServer is a QUIC proxy.
+ bool is_quic() const { return scheme_ == SCHEME_QUIC; }
+
const HostPortPair& host_port_pair() const;
// Parses from an input with format:
@@ -77,6 +83,7 @@ class NET_EXPORT ProxyServer {
// "socks5://foopy" {scheme=SOCKS5, host="foopy", port=1080}
// "http://foopy:17" {scheme=HTTP, host="foopy", port=17}
// "https://foopy:17" {scheme=HTTPS, host="foopy", port=17}
+ // "quic://foopy:17" {scheme=QUIC, host="foopy", port=17}
// "direct://" {scheme=DIRECT}
// "foopy:X" INVALID -- bad port.
static ProxyServer FromURI(const std::string& uri, Scheme default_scheme);
@@ -99,6 +106,7 @@ class NET_EXPORT ProxyServer {
// "DIRECT" {scheme=DIRECT}
// "SOCKS5 foopy" {scheme=SOCKS5, host="foopy", port=1080}
// "HTTPS foopy:123" {scheme=HTTPS, host="foopy", port=123}
+ // "QUIC foopy:123" {scheme=QUIC, host="foopy", port=123}
// "BLAH xxx:xx" INVALID
static ProxyServer FromPacString(const std::string& pac_string);
static ProxyServer FromPacString(std::string::const_iterator pac_string_begin,