diff options
author | bengr@google.com <bengr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 18:12:50 +0000 |
---|---|---|
committer | bengr@google.com <bengr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 18:12:50 +0000 |
commit | 61b4efcd2a24ed3862775093626247ebddc3f5f0 (patch) | |
tree | fd68ca0ecbeaa57986b44f2c1acf2e27fbf44c94 /net | |
parent | c8e9110081b2fbde9954c3e88285826afce13d9f (diff) | |
download | chromium_src-61b4efcd2a24ed3862775093626247ebddc3f5f0.zip chromium_src-61b4efcd2a24ed3862775093626247ebddc3f5f0.tar.gz chromium_src-61b4efcd2a24ed3862775093626247ebddc3f5f0.tar.bz2 |
Fixed unsafe passing of command-line parameter to SpdySession
The value of --trusted-spdy-proxy (formerly --allow-spdy-proxy-push-across-origins) is now being passed to a SpdySession via HttpNetworkSession::Params. This fixes unsafe memory handling in which a stack-allocated value
was being stored in a global char* in spdy_session.cc.
BUG=
TEST=
Review URL: http://codereview.chromium.org/10169033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/host_port_pair.h | 6 | ||||
-rw-r--r-- | net/base/host_port_pair_unittest.cc | 9 | ||||
-rw-r--r-- | net/http/http_cache.cc | 10 | ||||
-rw-r--r-- | net/http/http_cache.h | 3 | ||||
-rw-r--r-- | net/http/http_network_session.cc | 3 | ||||
-rw-r--r-- | net/http/http_network_session.h | 1 | ||||
-rw-r--r-- | net/http/http_network_transaction_spdy2_unittest.cc | 16 | ||||
-rw-r--r-- | net/http/http_network_transaction_spdy3_unittest.cc | 16 | ||||
-rw-r--r-- | net/spdy/spdy_network_transaction_spdy2_unittest.cc | 151 | ||||
-rw-r--r-- | net/spdy/spdy_network_transaction_spdy3_unittest.cc | 162 | ||||
-rw-r--r-- | net/spdy/spdy_session.cc | 17 | ||||
-rw-r--r-- | net/spdy/spdy_session.h | 11 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 14 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 7 | ||||
-rw-r--r-- | net/spdy/spdy_test_util_spdy2.cc | 2 | ||||
-rw-r--r-- | net/spdy/spdy_test_util_spdy2.h | 1 | ||||
-rw-r--r-- | net/spdy/spdy_test_util_spdy3.cc | 2 | ||||
-rw-r--r-- | net/spdy/spdy_test_util_spdy3.h | 1 | ||||
-rw-r--r-- | net/url_request/url_request_context_builder.cc | 3 |
19 files changed, 241 insertions, 194 deletions
diff --git a/net/base/host_port_pair.h b/net/base/host_port_pair.h index ea95356..1288a44 100644 --- a/net/base/host_port_pair.h +++ b/net/base/host_port_pair.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,6 +44,10 @@ class NET_EXPORT HostPortPair { return host_ == other.host_ && port_ == other.port_; } + bool IsEmpty() const { + return host_.empty() && port_ == 0; + } + const std::string& host() const { return host_; } diff --git a/net/base/host_port_pair_unittest.cc b/net/base/host_port_pair_unittest.cc index 1c3b56a..d654622 100644 --- a/net/base/host_port_pair_unittest.cc +++ b/net/base/host_port_pair_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,6 +28,13 @@ TEST(HostPortPairTest, BadString) { EXPECT_EQ(0, bar.port()); } +TEST(HostPortPairTest, Emptiness) { + HostPortPair foo; + EXPECT_TRUE(foo.IsEmpty()); + foo = HostPortPair::FromString("foo.com:8080"); + EXPECT_FALSE(foo.IsEmpty()); +} + } // namespace } // namespace net diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 28e8529..363b321 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -54,7 +54,8 @@ HttpNetworkSession* CreateNetworkSession( HttpAuthHandlerFactory* http_auth_handler_factory, NetworkDelegate* network_delegate, HttpServerProperties* http_server_properties, - NetLog* net_log) { + NetLog* net_log, + const std::string& trusted_spdy_proxy) { HttpNetworkSession::Params params; params.host_resolver = host_resolver; params.cert_verifier = cert_verifier; @@ -68,6 +69,7 @@ HttpNetworkSession* CreateNetworkSession( params.network_delegate = network_delegate; params.http_server_properties = http_server_properties; params.net_log = net_log; + params.trusted_spdy_proxy = trusted_spdy_proxy; return new HttpNetworkSession(params); } @@ -307,7 +309,8 @@ HttpCache::HttpCache(HostResolver* host_resolver, NetworkDelegate* network_delegate, HttpServerProperties* http_server_properties, NetLog* net_log, - BackendFactory* backend_factory) + BackendFactory* backend_factory, + const std::string& trusted_spdy_proxy) : net_log_(net_log), backend_factory_(backend_factory), building_backend_(false), @@ -329,7 +332,8 @@ HttpCache::HttpCache(HostResolver* host_resolver, http_auth_handler_factory, network_delegate, http_server_properties, - net_log))) { + net_log, + trusted_spdy_proxy))) { } diff --git a/net/http/http_cache.h b/net/http/http_cache.h index fa44f9468..84a65da 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -130,7 +130,8 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory, NetworkDelegate* network_delegate, HttpServerProperties* http_server_properties, NetLog* net_log, - BackendFactory* backend_factory); + BackendFactory* backend_factory, + const std::string& trusted_spdy_proxy); // The disk cache is initialized lazily (by CreateTransaction) in this case. // Provide an existing HttpNetworkSession, the cache can construct a diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index f5cc7b1..c40061b9 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -63,7 +63,8 @@ HttpNetworkSession::HttpNetworkSession(const Params& params) CreateSocketPoolManager(WEBSOCKET_SOCKET_POOL, params)), spdy_session_pool_(params.host_resolver, params.ssl_config_service, - params.http_server_properties), + params.http_server_properties, + params.trusted_spdy_proxy), ALLOW_THIS_IN_INITIALIZER_LIST(http_stream_factory_( new HttpStreamFactoryImpl(this))), params_(params) { diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 4ce60f2..c37f4d6 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -78,6 +78,7 @@ class NET_EXPORT HttpNetworkSession HttpServerProperties* http_server_properties; NetLog* net_log; bool force_http_pipelining; + std::string trusted_spdy_proxy; }; enum SocketPoolType { diff --git a/net/http/http_network_transaction_spdy2_unittest.cc b/net/http/http_network_transaction_spdy2_unittest.cc index df1b1cd..01b08e0 100644 --- a/net/http/http_network_transaction_spdy2_unittest.cc +++ b/net/http/http_network_transaction_spdy2_unittest.cc @@ -148,6 +148,7 @@ struct SessionDependencies { scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; HttpServerPropertiesImpl http_server_properties; NetLog* net_log; + std::string trusted_spdy_proxy; }; HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { @@ -161,6 +162,7 @@ HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { session_deps->http_auth_handler_factory.get(); params.http_server_properties = &session_deps->http_server_properties; params.net_log = session_deps->net_log; + params.trusted_spdy_proxy = session_deps->trusted_spdy_proxy; return new HttpNetworkSession(params); } @@ -4901,14 +4903,15 @@ TEST_F(HttpNetworkTransactionSpdy2Test, CrossOriginProxyPush) { push_request.method = "GET"; push_request.url = GURL("http://www.another-origin.com/foo.dat"); - // Enable cross-origin push. - net::SpdySession::set_allow_spdy_proxy_push_across_origins("myproxy:70"); - // Configure against https proxy server "myproxy:70". SessionDependencies session_deps( ProxyService::CreateFixed("https://myproxy:70")); CapturingBoundNetLog log(CapturingNetLog::kUnbounded); session_deps.net_log = log.bound().net_log(); + + // Enable cross-origin push. + session_deps.trusted_spdy_proxy = "myproxy:70"; + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); scoped_ptr<SpdyFrame> @@ -4998,14 +5001,15 @@ TEST_F(HttpNetworkTransactionSpdy2Test, CrossOriginProxyPushCorrectness) { request.method = "GET"; request.url = GURL("http://www.google.com/"); - // Enable cross-origin push. - net::SpdySession::set_allow_spdy_proxy_push_across_origins("myproxy:70"); - // Configure against https proxy server "myproxy:70". SessionDependencies session_deps( ProxyService::CreateFixed("https://myproxy:70")); CapturingBoundNetLog log(CapturingNetLog::kUnbounded); session_deps.net_log = log.bound().net_log(); + + // Enable cross-origin push. + session_deps.trusted_spdy_proxy = "myproxy:70"; + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); scoped_ptr<SpdyFrame> diff --git a/net/http/http_network_transaction_spdy3_unittest.cc b/net/http/http_network_transaction_spdy3_unittest.cc index c35def2..63fcf69 100644 --- a/net/http/http_network_transaction_spdy3_unittest.cc +++ b/net/http/http_network_transaction_spdy3_unittest.cc @@ -148,6 +148,7 @@ struct SessionDependencies { scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; HttpServerPropertiesImpl http_server_properties; NetLog* net_log; + std::string trusted_spdy_proxy; }; HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { @@ -161,6 +162,7 @@ HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { session_deps->http_auth_handler_factory.get(); params.http_server_properties = &session_deps->http_server_properties; params.net_log = session_deps->net_log; + params.trusted_spdy_proxy = session_deps->trusted_spdy_proxy; return new HttpNetworkSession(params); } @@ -4901,14 +4903,15 @@ TEST_F(HttpNetworkTransactionSpdy3Test, CrossOriginProxyPush) { push_request.method = "GET"; push_request.url = GURL("http://www.another-origin.com/foo.dat"); - // Enable cross-origin push. - net::SpdySession::set_allow_spdy_proxy_push_across_origins("myproxy:70"); - // Configure against https proxy server "myproxy:70". SessionDependencies session_deps( ProxyService::CreateFixed("https://myproxy:70")); CapturingBoundNetLog log(CapturingNetLog::kUnbounded); session_deps.net_log = log.bound().net_log(); + + // Enable cross-origin push. + session_deps.trusted_spdy_proxy = "myproxy:70"; + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); scoped_ptr<SpdyFrame> @@ -4998,14 +5001,15 @@ TEST_F(HttpNetworkTransactionSpdy3Test, CrossOriginProxyPushCorrectness) { request.method = "GET"; request.url = GURL("http://www.google.com/"); - // Enable cross-origin push. - net::SpdySession::set_allow_spdy_proxy_push_across_origins("myproxy:70"); - // Configure against https proxy server "myproxy:70". SessionDependencies session_deps( ProxyService::CreateFixed("https://myproxy:70")); CapturingBoundNetLog log(CapturingNetLog::kUnbounded); session_deps.net_log = log.bound().net_log(); + + // Enable cross-origin push. + session_deps.trusted_spdy_proxy = "myproxy:70"; + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); scoped_ptr<SpdyFrame> diff --git a/net/spdy/spdy_network_transaction_spdy2_unittest.cc b/net/spdy/spdy_network_transaction_spdy2_unittest.cc index 82db48a..e8964163 100644 --- a/net/spdy/spdy_network_transaction_spdy2_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy2_unittest.cc @@ -62,9 +62,11 @@ class SpdyNetworkTransactionSpdy2Test public: NormalSpdyTransactionHelper(const HttpRequestInfo& request, const BoundNetLog& log, - SpdyNetworkTransactionSpdy2TestTypes test_type) + SpdyNetworkTransactionSpdy2TestTypes test_type, + SpdySessionDependencies* session_deps) : request_(request), - session_deps_(new SpdySessionDependencies()), + session_deps_(session_deps == NULL ? + new SpdySessionDependencies() : session_deps), session_(SpdySessionDependencies::SpdyCreateSession( session_deps_.get())), log_(log), @@ -82,7 +84,7 @@ class SpdyNetworkTransactionSpdy2Test default: NOTREACHED(); } - } + } ~NormalSpdyTransactionHelper() { // Any test which doesn't close the socket by sending it an EOF will @@ -445,7 +447,7 @@ class SpdyNetworkTransactionSpdy2Test HttpResponseInfo* push_response, std::string& expected) { NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data); @@ -558,7 +560,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Get) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -610,7 +612,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, GetAtEachPriority) { HttpRequestInfo http_req = CreateGetRequest(); http_req.priority = p; - NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), GetParam()); + NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), + GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -673,7 +676,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGets) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -761,7 +764,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, TwoGetsLateBinding) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because two get requests are sent out, so @@ -848,7 +851,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, TwoGetsLateBindingFromPreconnect) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(preconnect_data.get()); // We require placeholder data because 3 connections are attempted (first is @@ -970,7 +973,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrent) { TransactionHelperResult out; { NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -1106,7 +1109,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, FourGetsWithMaxConcurrentPriority) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because four get requests are sent out, so @@ -1240,7 +1243,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentDelete) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -1371,7 +1374,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentSocketClose) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -1487,7 +1490,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Put) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -1558,7 +1561,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Head) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -1586,7 +1589,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Post) { new DelayedSocketData(2, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreatePostRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1618,7 +1621,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ChunkedPost) { new DelayedSocketData(2, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1657,7 +1660,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, NullPost) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1704,7 +1707,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, EmptyPost) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1741,7 +1744,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, PostWithEarlySynReply) { scoped_ptr<DelayedSocketData> data( new DelayedSocketData(0, reads, arraysize(reads), NULL, 0)); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); helper.RunDefaultTest(); @@ -1774,7 +1777,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SocketWriteReturnsZero) { new DeterministicSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.RunPreTestSetup(); helper.AddDeterministicData(data.get()); @@ -1805,7 +1808,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResponseWithoutSynReply) { scoped_ptr<DelayedSocketData> data( new DelayedSocketData(1, reads, arraysize(reads), NULL, 0)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); @@ -1831,7 +1834,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResponseWithTwoSynReplies) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -1878,7 +1881,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResetReplyWithTransferEncoding) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -1913,7 +1916,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResetPushWithTransferEncoding) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1945,7 +1948,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransaction) { writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -1984,7 +1987,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransactionSendRst) { NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), - GetParam()); + GetParam(), NULL); helper.SetDeterministic(); helper.RunPreTestSetup(); helper.AddDeterministicData(data.get()); @@ -2044,7 +2047,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, StartTransactionOnReadCallback) { writes2, arraysize(writes2))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); helper.AddData(data2.get()); @@ -2090,7 +2093,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DeleteSessionOnReadCallback) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -2249,7 +2252,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeaders) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -2308,7 +2311,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeadersInHeadersFrame) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -2346,7 +2349,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeadersOnPush) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -2680,7 +2683,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushServerAborted) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -2936,7 +2939,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID0) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -2998,7 +3001,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID9) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -3056,7 +3059,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushNoURL) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -3145,7 +3148,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -3293,7 +3296,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyHeadersVary) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -3398,7 +3401,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, InvalidSynReply) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_INCOMPLETE_SPDY_HEADERS, out.rv); @@ -3437,7 +3440,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CorruptFrameSessionError) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -3458,7 +3461,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, WriteError) { new DelayedSocketData(2, NULL, 0, writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_FAILED, out.rv); @@ -3484,7 +3487,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, PartialWrite) { new DelayedSocketData(kChunks, reads, arraysize(reads), writes.get(), kChunks)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -3516,7 +3519,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DecompressFailureOnSynReply) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -3546,7 +3549,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, NetLog) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequestWithUserAgent(), - log.bound(), GetParam()); + log.bound(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -3652,7 +3655,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferFull) { TestCompletionCallback callback; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -3742,7 +3745,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Buffering) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -3838,7 +3841,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedAll) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -3927,7 +3930,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedClosed) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4008,7 +4011,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedCancelled) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4076,7 +4079,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) { }; BoundNetLog net_log; - NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, GetParam()); + NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, + GetParam(), NULL); helper.RunPreTestSetup(); // Verify that no settings exist initially. @@ -4182,7 +4186,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsPlayback) { }; BoundNetLog net_log; - NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, GetParam()); + NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, + GetParam(), NULL); helper.RunPreTestSetup(); // Verify that no settings exist initially. @@ -4290,7 +4295,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, GoAwayWithActiveStream) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -4312,7 +4317,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CloseWithActiveStream) { writes, arraysize(writes))); BoundNetLog log; NormalSpdyTransactionHelper helper(CreateGetRequest(), - log, GetParam()); + log, GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4338,7 +4343,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CloseWithActiveStream) { // Test to make sure we can correctly connect through a proxy. TEST_P(SpdyNetworkTransactionSpdy2Test, ProxyConnect) { NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.session_deps().reset(new SpdySessionDependencies( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); helper.SetSession(make_scoped_refptr( @@ -4441,7 +4446,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DirectConnectProxyReconnect) { // When setting up the first transaction, we store the SpdySessionPool so that // we can use the same pool in the second transaction. NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); // Use a proxy service which returns a proxy fallback list from DIRECT to // myproxy:70. For this test there will be no fallback, so it is equivalent @@ -4581,7 +4586,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DirectConnectProxyReconnect) { scoped_refptr<HttpNetworkSession> session_proxy( SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); NormalSpdyTransactionHelper helper_proxy(request_proxy, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); HttpNetworkSessionPeer session_peer(session_proxy); scoped_ptr<net::ProxyService> proxy_service( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); @@ -4652,7 +4657,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, VerifyRetryOnConnectionReset) { NULL, 0)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.AddData(data1.get()); helper.AddData(data2.get()); helper.RunPreTestSetup(); @@ -4715,7 +4720,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SpdyOnOffToggle) { spdy_reads, arraysize(spdy_reads), spdy_writes, arraysize(spdy_writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -4732,7 +4737,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SpdyOnOffToggle) { new DelayedSocketData(1, http_reads, arraysize(http_reads), NULL, 0)); NormalSpdyTransactionHelper helper2(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper2.SetSpdyDisabled(); helper2.RunToCompletion(data2.get()); TransactionHelperResult out2 = helper2.output(); @@ -4795,7 +4800,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SpdyBasicAuth) { spdy_writes, arraysize(spdy_writes))); HttpRequestInfo request(CreateGetRequest()); BoundNetLog net_log; - NormalSpdyTransactionHelper helper(request, net_log, GetParam()); + NormalSpdyTransactionHelper helper(request, net_log, GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -4990,7 +4995,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) { arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); helper.RunPreTestSetup(); @@ -5141,7 +5146,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithTwoHeaderFrames) { arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); helper.RunPreTestSetup(); @@ -5262,7 +5267,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyWithHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -5320,7 +5325,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyWithLateHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -5378,7 +5383,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyWithDuplicateLateHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -5462,15 +5467,17 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushCrossOriginCorrectness) { request.method = "GET"; request.url = GURL(url_to_fetch); request.load_flags = 0; - NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); - helper.RunPreTestSetup(); - helper.AddData(data.get()); // Enable cross-origin push. Since we are not using a proxy, this should // not actually enable cross-origin SPDY push. - net::SpdySession::set_allow_spdy_proxy_push_across_origins( - "123.45.67.89:8080"); + scoped_ptr<SpdySessionDependencies> session_deps( + new SpdySessionDependencies()); + session_deps->trusted_spdy_proxy = "123.45.67.89:8080"; + NormalSpdyTransactionHelper helper(request, + BoundNetLog(), GetParam(), + session_deps.release()); + helper.RunPreTestSetup(); + helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -5525,7 +5532,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RetryAfterRefused) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); diff --git a/net/spdy/spdy_network_transaction_spdy3_unittest.cc b/net/spdy/spdy_network_transaction_spdy3_unittest.cc index b76b324..8854d55 100644 --- a/net/spdy/spdy_network_transaction_spdy3_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy3_unittest.cc @@ -63,9 +63,11 @@ class SpdyNetworkTransactionSpdy3Test public: NormalSpdyTransactionHelper(const HttpRequestInfo& request, const BoundNetLog& log, - SpdyNetworkTransactionSpdy3TestTypes test_type) + SpdyNetworkTransactionSpdy3TestTypes test_type, + SpdySessionDependencies* session_deps) : request_(request), - session_deps_(new SpdySessionDependencies()), + session_deps_(session_deps == NULL ? + new SpdySessionDependencies() : session_deps), session_(SpdySessionDependencies::SpdyCreateSession( session_deps_.get())), log_(log), @@ -85,6 +87,7 @@ class SpdyNetworkTransactionSpdy3Test } } + ~NormalSpdyTransactionHelper() { // Any test which doesn't close the socket by sending it an EOF will // have a valid session left open, which leaks the entire session pool. @@ -447,7 +450,7 @@ class SpdyNetworkTransactionSpdy3Test HttpResponseInfo* push_response, std::string& expected) { NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data); @@ -560,7 +563,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Get) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -614,7 +617,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, GetAtEachPriority) { HttpRequestInfo http_req = CreateGetRequest(); http_req.priority = p; - NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), GetParam()); + NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), + GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -677,7 +681,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGets) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -765,7 +769,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, TwoGetsLateBinding) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because two get requests are sent out, so @@ -852,7 +856,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, TwoGetsLateBindingFromPreconnect) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(preconnect_data.get()); // We require placeholder data because 3 connections are attempted (first is @@ -974,7 +978,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrent) { TransactionHelperResult out; { NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -1110,7 +1114,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FourGetsWithMaxConcurrentPriority) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because four get requests are sent out, so @@ -1244,7 +1248,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentDelete) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -1375,7 +1379,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentSocketClose) { BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); // We require placeholder data because three get requests are sent out, so @@ -1493,7 +1497,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Put) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -1566,7 +1570,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Head) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -1594,7 +1598,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Post) { new DelayedSocketData(2, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreatePostRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1626,7 +1630,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ChunkedPost) { new DelayedSocketData(2, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1665,7 +1669,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, NullPost) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1712,7 +1716,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, EmptyPost) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1749,7 +1753,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, PostWithEarlySynReply) { scoped_ptr<DelayedSocketData> data( new DelayedSocketData(0, reads, arraysize(reads), NULL, 0)); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); helper.RunDefaultTest(); @@ -1782,7 +1786,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SocketWriteReturnsZero) { new DeterministicSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.RunPreTestSetup(); helper.AddDeterministicData(data.get()); @@ -1813,7 +1817,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResponseWithoutSynReply) { scoped_ptr<DelayedSocketData> data( new DelayedSocketData(1, reads, arraysize(reads), NULL, 0)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); @@ -1839,7 +1843,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResponseWithTwoSynReplies) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -1932,7 +1936,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateReceived) { for (int i = 0; i < kFrameCount; ++i) request.upload_data->AppendBytes(content->c_str(), content->size()); - NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam()); + NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunPreTestSetup(); @@ -1987,7 +1991,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateSent) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -2093,7 +2097,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateOverflow) { request.upload_data->AppendBytes(content->c_str(), content->size()); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunPreTestSetup(); @@ -2194,7 +2198,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResume) { new std::string(kSpdyStreamInitialWindowSize, 'a')); upload_data->append(kUploadData, kUploadDataSize); request.upload_data->AppendBytes(upload_data->c_str(), upload_data->size()); - NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam()); + NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunPreTestSetup(); @@ -2289,7 +2293,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { std::string upload_data(kSpdyStreamInitialWindowSize, 'a'); upload_data.append(kUploadData, kUploadDataSize); request.upload_data->AppendBytes(upload_data.c_str(), upload_data.size()); - NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam()); + NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunPreTestSetup(); @@ -2393,7 +2397,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlNegativeSendWindowSize) { std::string upload_data(kSpdyStreamInitialWindowSize, 'a'); upload_data.append(kUploadData, kUploadDataSize); request.upload_data->AppendBytes(upload_data.c_str(), upload_data.size()); - NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam()); + NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunPreTestSetup(); @@ -2446,7 +2450,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResetReplyWithTransferEncoding) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -2483,7 +2487,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResetPushWithTransferEncoding) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -2515,7 +2519,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransaction) { writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -2554,7 +2558,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransactionSendRst) { NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), - GetParam()); + GetParam(), NULL); helper.SetDeterministic(); helper.RunPreTestSetup(); helper.AddDeterministicData(data.get()); @@ -2614,7 +2618,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, StartTransactionOnReadCallback) { writes2, arraysize(writes2))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); helper.AddData(data2.get()); @@ -2660,7 +2664,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DeleteSessionOnReadCallback) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -2818,7 +2822,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeaders) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -2877,7 +2881,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeadersInHeadersFrame) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -2918,7 +2922,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeadersOnPush) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -3252,7 +3256,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushServerAborted) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -3508,7 +3512,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID0) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -3570,7 +3574,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID9) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -3628,7 +3632,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushNoURL) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -3717,7 +3721,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -3866,7 +3870,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyHeadersVary) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -3972,7 +3976,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, InvalidSynReply) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_INCOMPLETE_SPDY_HEADERS, out.rv); @@ -4011,7 +4015,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CorruptFrameSessionError) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -4032,7 +4036,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WriteError) { new DelayedSocketData(2, NULL, 0, writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_FAILED, out.rv); @@ -4058,7 +4062,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, PartialWrite) { new DelayedSocketData(kChunks, reads, arraysize(reads), writes.get(), kChunks)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -4090,7 +4094,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DecompressFailureOnSynReply) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -4120,7 +4124,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, NetLog) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequestWithUserAgent(), - log.bound(), GetParam()); + log.bound(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -4226,7 +4230,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferFull) { TestCompletionCallback callback; NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4316,7 +4320,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Buffering) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4412,7 +4416,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedAll) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4501,7 +4505,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedClosed) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4582,7 +4586,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedCancelled) { writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4651,7 +4655,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { }; BoundNetLog net_log; - NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, GetParam()); + NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, + GetParam(), NULL); helper.RunPreTestSetup(); // Verify that no settings exist initially. @@ -4758,7 +4763,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsPlayback) { }; BoundNetLog net_log; - NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, GetParam()); + NormalSpdyTransactionHelper helper(CreateGetRequest(), net_log, + GetParam(), NULL); helper.RunPreTestSetup(); // Verify that no settings exist initially. @@ -4866,7 +4872,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, GoAwayWithActiveStream) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.AddData(data.get()); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); @@ -4888,7 +4894,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CloseWithActiveStream) { writes, arraysize(writes))); BoundNetLog log; NormalSpdyTransactionHelper helper(CreateGetRequest(), - log, GetParam()); + log, GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -4914,7 +4920,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CloseWithActiveStream) { // Test to make sure we can correctly connect through a proxy. TEST_P(SpdyNetworkTransactionSpdy3Test, ProxyConnect) { NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.session_deps().reset(new SpdySessionDependencies( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); helper.SetSession(make_scoped_refptr( @@ -5017,7 +5023,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DirectConnectProxyReconnect) { // When setting up the first transaction, we store the SpdySessionPool so that // we can use the same pool in the second transaction. NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); // Use a proxy service which returns a proxy fallback list from DIRECT to // myproxy:70. For this test there will be no fallback, so it is equivalent @@ -5157,7 +5163,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DirectConnectProxyReconnect) { scoped_refptr<HttpNetworkSession> session_proxy( SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); NormalSpdyTransactionHelper helper_proxy(request_proxy, - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); HttpNetworkSessionPeer session_peer(session_proxy); scoped_ptr<net::ProxyService> proxy_service( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); @@ -5228,7 +5234,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, VerifyRetryOnConnectionReset) { NULL, 0)); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.AddData(data1.get()); helper.AddData(data2.get()); helper.RunPreTestSetup(); @@ -5291,7 +5297,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SpdyOnOffToggle) { spdy_reads, arraysize(spdy_reads), spdy_writes, arraysize(spdy_writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -5308,7 +5314,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SpdyOnOffToggle) { new DelayedSocketData(1, http_reads, arraysize(http_reads), NULL, 0)); NormalSpdyTransactionHelper helper2(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper2.SetSpdyDisabled(); helper2.RunToCompletion(data2.get()); TransactionHelperResult out2 = helper2.output(); @@ -5371,7 +5377,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SpdyBasicAuth) { spdy_writes, arraysize(spdy_writes))); HttpRequestInfo request(CreateGetRequest()); BoundNetLog net_log; - NormalSpdyTransactionHelper helper(request, net_log, GetParam()); + NormalSpdyTransactionHelper helper(request, net_log, GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); @@ -5568,7 +5574,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushClaimBeforeHeaders) { arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); helper.RunPreTestSetup(); @@ -5720,7 +5726,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithTwoHeaderFrames) { arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); helper.RunPreTestSetup(); @@ -5844,7 +5850,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyWithHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -5902,7 +5908,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyWithLateHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -5960,7 +5966,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyWithDuplicateLateHeaders) { new DelayedSocketData(1, reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunToCompletion(data.get()); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -6044,15 +6050,17 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushCrossOriginCorrectness) { request.method = "GET"; request.url = GURL(url_to_fetch); request.load_flags = 0; - NormalSpdyTransactionHelper helper(request, - BoundNetLog(), GetParam()); - helper.RunPreTestSetup(); - helper.AddData(data.get()); // Enable cross-origin push. Since we are not using a proxy, this should // not actually enable cross-origin SPDY push. - net::SpdySession::set_allow_spdy_proxy_push_across_origins( - "123.45.67.89:8080"); + scoped_ptr<SpdySessionDependencies> session_deps( + new SpdySessionDependencies()); + session_deps->trusted_spdy_proxy = "123.45.67.89:8080"; + NormalSpdyTransactionHelper helper(request, + BoundNetLog(), GetParam(), + session_deps.release()); + helper.RunPreTestSetup(); + helper.AddData(data.get()); HttpNetworkTransaction* trans = helper.trans(); @@ -6107,7 +6115,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RetryAfterRefused) { new OrderedSocketData(reads, arraysize(reads), writes, arraysize(writes))); NormalSpdyTransactionHelper helper(CreateGetRequest(), - BoundNetLog(), GetParam()); + BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); helper.AddData(data.get()); diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 4f2ac3a..cd00eb4 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -298,7 +298,6 @@ NextProto g_default_protocol = kProtoUnknown; size_t g_init_max_concurrent_streams = 10; size_t g_max_concurrent_stream_limit = 256; bool g_enable_ping_based_connection_checking = true; -const char* g_allow_spdy_proxy_push_across_origins = NULL; } // namespace @@ -324,24 +323,19 @@ void SpdySession::set_init_max_concurrent_streams(size_t value) { } // static -void SpdySession::set_allow_spdy_proxy_push_across_origins(const char* value) { - g_allow_spdy_proxy_push_across_origins = value; -} - -// static void SpdySession::ResetStaticSettingsToInit() { // WARNING: These must match the initializers above. g_default_protocol = kProtoUnknown; g_init_max_concurrent_streams = 10; g_max_concurrent_stream_limit = 256; g_enable_ping_based_connection_checking = true; - g_allow_spdy_proxy_push_across_origins = NULL; } SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, SpdySessionPool* spdy_session_pool, HttpServerProperties* http_server_properties, bool verify_domain_authentication, + const HostPortPair& trusted_spdy_proxy, NetLog* net_log) : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), host_port_proxy_pair_(host_port_proxy_pair), @@ -384,10 +378,7 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, base::TimeDelta::FromSeconds(kTrailingPingDelayTimeSeconds)), hung_interval_( base::TimeDelta::FromSeconds(kHungIntervalSeconds)), - allow_spdy_proxy_push_across_origins_( - HostPortPair::FromString( - std::string(g_allow_spdy_proxy_push_across_origins == NULL ? - "" : g_allow_spdy_proxy_push_across_origins))) { + trusted_spdy_proxy_(trusted_spdy_proxy) { DCHECK(HttpStreamFactory::spdy_enabled()); net_log_.BeginEvent( NetLog::TYPE_SPDY_SESSION, @@ -1441,8 +1432,8 @@ void SpdySession::OnSynStream( // Check that the SYN advertises the same origin as its associated stream. // Bypass this check if and only if this session is with a SPDY proxy that - // is trusted explicitly via the allow_spdy_proxy_push_across_origins switch. - if (allow_spdy_proxy_push_across_origins_.Equals(host_port_pair())) { + // is trusted explicitly via the --trusted-spdy-proxy switch. + if (trusted_spdy_proxy_.Equals(host_port_pair())) { // Disallow pushing of HTTPS content. if (gurl.SchemeIs("https")) { ResetStream(stream_id, REFUSED_STREAM, diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index 7b93171..4eb9b45 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -63,6 +63,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, SpdySessionPool* spdy_session_pool, HttpServerProperties* http_server_properties, bool verify_domain_authentication, + const HostPortPair& trusted_spdy_proxy, NetLog* net_log); const HostPortPair& host_port_pair() const { @@ -187,10 +188,6 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, // server via SETTINGS. static void set_init_max_concurrent_streams(size_t value); - // Allow a SPDY proxy to push resources from origins that are different from - // those of their associated streams. - static void set_allow_spdy_proxy_push_across_origins(const char* proxy); - // Send WINDOW_UPDATE frame, called by a stream whenever receive window // size is increased. void SendWindowUpdate(SpdyStreamId stream_id, int32 delta_window_size); @@ -643,9 +640,9 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, // connection to be hung. base::TimeDelta hung_interval_; - // Allows a proxy to push a resource that has an origin that is different - // from its associated url. - HostPortPair allow_spdy_proxy_push_across_origins_; + // This SPDY proxy is allowed to push resources from origins that are + // different from those of their associated streams. + HostPortPair trusted_spdy_proxy_; }; class NetLogSpdySynParameter : public NetLog::EventParameters { diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index bcdbd0e..430a233 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -40,13 +40,17 @@ size_t SpdySessionPool::g_max_sessions_per_domain = kMaxSessionsPerDomain; bool SpdySessionPool::g_force_single_domain = false; bool SpdySessionPool::g_enable_ip_pooling = true; -SpdySessionPool::SpdySessionPool(HostResolver* resolver, - SSLConfigService* ssl_config_service, - HttpServerProperties* http_server_properties) +SpdySessionPool::SpdySessionPool( + HostResolver* resolver, + SSLConfigService* ssl_config_service, + HttpServerProperties* http_server_properties, + const std::string& trusted_spdy_proxy) : http_server_properties_(http_server_properties), ssl_config_service_(ssl_config_service), resolver_(resolver), - verify_domain_authentication_(true) { + verify_domain_authentication_(true), + trusted_spdy_proxy_( + HostPortPair::FromString(trusted_spdy_proxy)) { NetworkChangeNotifier::AddIPAddressObserver(this); if (ssl_config_service_) ssl_config_service_->AddObserver(this); @@ -120,6 +124,7 @@ scoped_refptr<SpdySession> SpdySessionPool::GetInternal( spdy_session = new SpdySession(host_port_proxy_pair, this, http_server_properties_, verify_domain_authentication_, + trusted_spdy_proxy_, net_log.net_log()); UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionGet", CREATED_NEW, @@ -147,6 +152,7 @@ net::Error SpdySessionPool::GetSpdySessionFromSocket( *spdy_session = new SpdySession(host_port_proxy_pair, this, http_server_properties_, verify_domain_authentication_, + trusted_spdy_proxy_, net_log.net_log()); SpdySessionList* list = GetSessionList(host_port_proxy_pair); if (!list) diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index c827af4..567f2d8 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -49,7 +49,8 @@ class NET_EXPORT SpdySessionPool public: SpdySessionPool(HostResolver* host_resolver, SSLConfigService* ssl_config_service, - HttpServerProperties* http_server_properties); + HttpServerProperties* http_server_properties, + const std::string& trusted_spdy_proxy); virtual ~SpdySessionPool(); // Either returns an existing SpdySession or creates a new SpdySession for @@ -208,6 +209,10 @@ class NET_EXPORT SpdySessionPool // Defaults to true. May be controlled via SpdySessionPoolPeer for tests. bool verify_domain_authentication_; + // This SPDY proxy is allowed to push resources from origins that are + // different from those of their associated streams. + HostPortPair trusted_spdy_proxy_; + DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); }; diff --git a/net/spdy/spdy_test_util_spdy2.cc b/net/spdy/spdy_test_util_spdy2.cc index 14178df..b933377 100644 --- a/net/spdy/spdy_test_util_spdy2.cc +++ b/net/spdy/spdy_test_util_spdy2.cc @@ -939,6 +939,8 @@ HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession( params.http_auth_handler_factory = session_deps->http_auth_handler_factory.get(); params.http_server_properties = &session_deps->http_server_properties; + params.trusted_spdy_proxy = + session_deps->trusted_spdy_proxy; return new HttpNetworkSession(params); } diff --git a/net/spdy/spdy_test_util_spdy2.h b/net/spdy/spdy_test_util_spdy2.h index 9bd8dd2..2dcd999 100644 --- a/net/spdy/spdy_test_util_spdy2.h +++ b/net/spdy/spdy_test_util_spdy2.h @@ -368,6 +368,7 @@ class SpdySessionDependencies { scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; HttpServerPropertiesImpl http_server_properties; + std::string trusted_spdy_proxy; }; class SpdyURLRequestContext : public URLRequestContext { diff --git a/net/spdy/spdy_test_util_spdy3.cc b/net/spdy/spdy_test_util_spdy3.cc index 5a651f4..bc79631 100644 --- a/net/spdy/spdy_test_util_spdy3.cc +++ b/net/spdy/spdy_test_util_spdy3.cc @@ -922,6 +922,8 @@ HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession( params.http_auth_handler_factory = session_deps->http_auth_handler_factory.get(); params.http_server_properties = &session_deps->http_server_properties; + params.trusted_spdy_proxy = + session_deps->trusted_spdy_proxy; return new HttpNetworkSession(params); } diff --git a/net/spdy/spdy_test_util_spdy3.h b/net/spdy/spdy_test_util_spdy3.h index ea41b12..11d2e62 100644 --- a/net/spdy/spdy_test_util_spdy3.h +++ b/net/spdy/spdy_test_util_spdy3.h @@ -369,6 +369,7 @@ class SpdySessionDependencies { scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; HttpServerPropertiesImpl http_server_properties; + std::string trusted_spdy_proxy; }; class SpdyURLRequestContext : public URLRequestContext { diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index 5f217d6..552f7af 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc @@ -244,7 +244,8 @@ scoped_refptr<URLRequestContext> URLRequestContextBuilder::Build() { context->network_delegate(), context->http_server_properties(), context->net_log(), - http_cache_backend); + http_cache_backend, + "" /* trusted_spdy_proxy */ ); } else { HttpNetworkSession::Params session_params; session_params.host_resolver = context->host_resolver(); |