summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 16:16:16 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 16:16:16 +0000
commitcf3e3cd61eb090fe9833e99bfd5e1d0d13e3db49 (patch)
treeeabf0e41fe5c9e8808e4ffdb1ca27bab9527ff36 /net
parent9824c4a3c726381011a4bde95274950bef0ecf98 (diff)
downloadchromium_src-cf3e3cd61eb090fe9833e99bfd5e1d0d13e3db49.zip
chromium_src-cf3e3cd61eb090fe9833e99bfd5e1d0d13e3db49.tar.gz
chromium_src-cf3e3cd61eb090fe9833e99bfd5e1d0d13e3db49.tar.bz2
Enable QUIC proxies to be used for HTTP URLs.
BUG=335275 Review URL: https://codereview.chromium.org/138283005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/http_stream_factory_impl_job.cc21
-rw-r--r--net/quic/quic_network_transaction_unittest.cc37
2 files changed, 51 insertions, 7 deletions
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index a68b21f..40e2771 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -675,7 +675,7 @@ int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) {
if (result == OK) {
// Remove unsupported proxies from the list.
proxy_info_.RemoveProxiesWithoutScheme(
- ProxyServer::SCHEME_DIRECT |
+ ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_QUIC |
ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS |
ProxyServer::SCHEME_SOCKS4 | ProxyServer::SCHEME_SOCKS5);
@@ -743,18 +743,25 @@ int HttpStreamFactoryImpl::Job::DoInitConnection() {
if (ShouldForceQuic())
using_quic_ = true;
+ if (proxy_info_.is_quic())
+ using_quic_ = true;
+
if (using_quic_) {
DCHECK(session_->params().enable_quic);
- if (!proxy_info_.is_direct()) {
+ if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) {
NOTREACHED();
- // TODO(rch): support QUIC proxies.
+ // TODO(rch): support QUIC proxies for HTTPS urls.
return ERR_NOT_IMPLEMENTED;
}
+ HostPortProxyPair destination;
+ destination.first = proxy_info_.is_quic() ?
+ proxy_info_.proxy_server().host_port_pair() : origin_;
+ destination.second = ProxyServer::Direct();
next_state_ = STATE_INIT_CONNECTION_COMPLETE;
- const ProxyServer& proxy_server = proxy_info_.proxy_server();
- int rv = quic_request_.Request(HostPortProxyPair(origin_, proxy_server),
- using_ssl_, session_->cert_verifier(),
- net_log_, io_callback_);
+ bool secure_quic = using_ssl_ || proxy_info_.is_quic();
+ int rv = quic_request_.Request(
+ destination, secure_quic, session_->cert_verifier(), net_log_,
+ io_callback_);
if (rv != OK) {
// OK, there's no available QUIC session. Let |waiting_job_| resume
// if it's paused.
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index dd0bdb7..851371d 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -396,6 +396,43 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) {
EXPECT_EQ(3, log_stream_id);
}
+TEST_P(QuicNetworkTransactionTest, QuicProxy) {
+ proxy_service_.reset(
+ ProxyService::CreateFixedFromPacResult("QUIC myproxy:70"));
+
+ QuicStreamId stream_id = GetParam() > QUIC_VERSION_12 ? 5 : 3;
+ MockQuicData mock_quic_data;
+ if (GetParam() > QUIC_VERSION_12) {
+ mock_quic_data.AddWrite(
+ ConstructRequestHeadersPacket(1, stream_id, true, true,
+ GetRequestHeaders("GET", "http", "/")));
+ mock_quic_data.AddRead(
+ ConstructResponseHeadersPacket(1, stream_id, false, false,
+ GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(
+ ConstructDataPacket(2, stream_id, false, true, 0, "hello!"));
+ mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
+ } else {
+ mock_quic_data.AddWrite(
+ ConstructDataPacket(1, stream_id, true, true, 0,
+ GetRequestString("GET", "http", "/")));
+ mock_quic_data.AddRead(
+ ConstructDataPacket(1, stream_id, false, true, 0,
+ GetResponseString("200 OK", "hello!")));
+ mock_quic_data.AddWrite(ConstructAckPacket(1, 0));
+ }
+ mock_quic_data.AddRead(SYNCHRONOUS, 0); // EOF
+
+ mock_quic_data.AddDelayedSocketDataToFactory(&socket_factory_, 1);
+
+ // There is no need to set up an alternate protocol job, because
+ // no attempt will be made to speak to the proxy over TCP.
+
+ CreateSession();
+
+ SendRequestAndExpectQuicResponse("hello!");
+}
+
TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) {
params_.origin_to_force_quic_on =
HostPortPair::FromString("www.google.com:80");