| Index: net/http/http_network_transaction_unittest.cc
|
| diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
|
| index 3ebe1cb4e08c14493fdb51e155d268b8c12640ed..720dc1fb219561ba293e651414f2a76bbc8ed838 100644
|
| --- a/net/http/http_network_transaction_unittest.cc
|
| +++ b/net/http/http_network_transaction_unittest.cc
|
| @@ -8807,7 +8807,8 @@ scoped_ptr<HttpNetworkSession> SetupSessionForGroupNameTests(
|
| AlternateProtocolFromNextProto(next_proto), "", 443);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair("host.with.alternate", 80), alternative_service, expiration);
|
| + url::SchemeHostPort("http", "host.with.alternate", 80),
|
| + alternative_service, expiration);
|
|
|
| return session;
|
| }
|
| @@ -9694,11 +9695,11 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) {
|
| int rv = trans->Start(&request, callback.callback(), BoundNetLog());
|
| EXPECT_EQ(ERR_IO_PENDING, rv);
|
|
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
|
|
| EXPECT_EQ(OK, callback.WaitForResult());
|
| @@ -9715,7 +9716,7 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| ASSERT_EQ(1u, alternative_service_vector.size());
|
| EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()),
|
| alternative_service_vector[0].protocol);
|
| @@ -9731,13 +9732,13 @@ TEST_P(HttpNetworkTransactionTest, ClearAlternativeServices) {
|
| scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| AlternativeService alternative_service(QUIC, "", 80);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties.SetAlternativeService(http_host_port_pair,
|
| - alternative_service, expiration);
|
| + http_server_properties.SetAlternativeService(http_origin, alternative_service,
|
| + expiration);
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_EQ(1u, alternative_service_vector.size());
|
|
|
| // Send a clear header.
|
| @@ -9776,7 +9777,7 @@ TEST_P(HttpNetworkTransactionTest, ClearAlternativeServices) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
| }
|
|
|
| @@ -9814,11 +9815,11 @@ TEST_P(HttpNetworkTransactionTest, DoNotHonorAlternativeServiceHeader) {
|
| int rv = trans->Start(&request, callback.callback(), BoundNetLog());
|
| EXPECT_EQ(ERR_IO_PENDING, rv);
|
|
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
|
|
| EXPECT_EQ(OK, callback.WaitForResult());
|
| @@ -9835,7 +9836,7 @@ TEST_P(HttpNetworkTransactionTest, DoNotHonorAlternativeServiceHeader) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
| }
|
|
|
| @@ -9872,11 +9873,11 @@ TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeader) {
|
| int rv = trans->Start(&request, callback.callback(), BoundNetLog());
|
| EXPECT_EQ(ERR_IO_PENDING, rv);
|
|
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
|
|
| EXPECT_EQ(OK, callback.WaitForResult());
|
| @@ -9893,7 +9894,7 @@ TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeader) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| ASSERT_EQ(2u, alternative_service_vector.size());
|
| EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()),
|
| alternative_service_vector[0].protocol);
|
| @@ -9939,11 +9940,11 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) {
|
| int rv = trans->Start(&request, callback.callback(), BoundNetLog());
|
| EXPECT_EQ(ERR_IO_PENDING, rv);
|
|
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
|
|
| EXPECT_EQ(OK, callback.WaitForResult());
|
| @@ -9960,7 +9961,7 @@ TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| ASSERT_EQ(1u, alternative_service_vector.size());
|
| EXPECT_EQ(443, alternative_service_vector[0].port);
|
| EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()),
|
| @@ -9991,16 +9992,16 @@ TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) {
|
|
|
| scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
|
|
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| AlternativeService alternative_service(QUIC, "", 80);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties.SetAlternativeService(http_host_port_pair,
|
| - alternative_service, expiration);
|
| + http_server_properties.SetAlternativeService(http_origin, alternative_service,
|
| + expiration);
|
|
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| ASSERT_EQ(1u, alternative_service_vector.size());
|
| EXPECT_EQ(QUIC, alternative_service_vector[0].protocol);
|
|
|
| @@ -10024,7 +10025,7 @@ TEST_P(HttpNetworkTransactionTest, EmptyAlternateProtocolHeader) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
| }
|
|
|
| @@ -10065,11 +10066,11 @@ TEST_P(HttpNetworkTransactionTest, AltSvcOverwritesAlternateProtocol) {
|
| int rv = trans->Start(&request, callback.callback(), BoundNetLog());
|
| EXPECT_EQ(ERR_IO_PENDING, rv);
|
|
|
| - HostPortPair http_host_port_pair("www.example.org", 80);
|
| + url::SchemeHostPort http_origin("http", "www.example.org", 80);
|
| HttpServerProperties& http_server_properties =
|
| *session->http_server_properties();
|
| AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| EXPECT_TRUE(alternative_service_vector.empty());
|
|
|
| EXPECT_EQ(OK, callback.WaitForResult());
|
| @@ -10086,7 +10087,7 @@ TEST_P(HttpNetworkTransactionTest, AltSvcOverwritesAlternateProtocol) {
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| alternative_service_vector =
|
| - http_server_properties.GetAlternativeServices(http_host_port_pair);
|
| + http_server_properties.GetAlternativeServices(http_origin);
|
| ASSERT_EQ(1u, alternative_service_vector.size());
|
| EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()),
|
| alternative_service_vector[0].protocol);
|
| @@ -10127,7 +10128,7 @@ TEST_P(HttpNetworkTransactionTest, DisableAlternativeServiceToDifferentHost) {
|
| 80);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(request.url), alternative_service, expiration);
|
| + url::SchemeHostPort(request.url), alternative_service, expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
|
| @@ -10180,8 +10181,9 @@ TEST_P(HttpNetworkTransactionTest, IdentifyQuicBroken) {
|
| session->http_server_properties();
|
| AlternativeService alternative_service(QUIC, alternative);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties->SetAlternativeService(origin, alternative_service,
|
| - expiration);
|
| + http_server_properties->SetAlternativeService(
|
| + url::SchemeHostPort("https", "origin.example.org", 443),
|
| + alternative_service, expiration);
|
| // Mark the QUIC alternative service as broken.
|
| http_server_properties->MarkAlternativeServiceBroken(alternative_service);
|
|
|
| @@ -10202,6 +10204,7 @@ TEST_P(HttpNetworkTransactionTest, IdentifyQuicBroken) {
|
|
|
| TEST_P(HttpNetworkTransactionTest, IdentifyQuicNotBroken) {
|
| HostPortPair origin("origin.example.org", 443);
|
| + url::SchemeHostPort scheme_origin("https", "origin.example.org", 443);
|
| HostPortPair alternative1("alternative1.example.org", 443);
|
| HostPortPair alternative2("alternative2.example.org", 443);
|
| std::string origin_url = "https://origin.example.org:443";
|
| @@ -10254,13 +10257,13 @@ TEST_P(HttpNetworkTransactionTest, IdentifyQuicNotBroken) {
|
| alternative_service_info_vector.push_back(alternative_service_info2);
|
|
|
| http_server_properties->SetAlternativeServices(
|
| - origin, alternative_service_info_vector);
|
| + scheme_origin, alternative_service_info_vector);
|
|
|
| // Mark one of the QUIC alternative service as broken.
|
| http_server_properties->MarkAlternativeServiceBroken(alternative_service1);
|
|
|
| const AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties->GetAlternativeServices(origin);
|
| + http_server_properties->GetAlternativeServices(scheme_origin);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
|
| @@ -10305,7 +10308,8 @@ TEST_P(HttpNetworkTransactionTest,
|
|
|
| base::WeakPtr<HttpServerProperties> http_server_properties =
|
| session->http_server_properties();
|
| - const HostPortPair host_port_pair = HostPortPair::FromURL(request.url);
|
| + url::SchemeHostPort scheme_origin(request.url);
|
| +
|
| // Port must be < 1024, or the header will be ignored (since initial port was
|
| // port 80 (another restricted port).
|
| const AlternativeService alternative_service(
|
| @@ -10313,7 +10317,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| 666); // Port is ignored by MockConnect anyway.
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - host_port_pair, alternative_service, expiration);
|
| + scheme_origin, alternative_service, expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
|
| @@ -10333,7 +10337,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| EXPECT_EQ("hello world", response_data);
|
|
|
| const AlternativeServiceVector alternative_service_vector =
|
| - http_server_properties->GetAlternativeServices(host_port_pair);
|
| + http_server_properties->GetAlternativeServices(scheme_origin);
|
| ASSERT_EQ(1u, alternative_service_vector.size());
|
| EXPECT_EQ(alternative_service, alternative_service_vector[0]);
|
| EXPECT_TRUE(http_server_properties->IsAlternativeServiceBroken(
|
| @@ -10378,7 +10382,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| kUnrestrictedAlternatePort);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(restricted_port_request.url), alternative_service,
|
| + url::SchemeHostPort(restricted_port_request.url), alternative_service,
|
| expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| @@ -10431,7 +10435,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| kUnrestrictedAlternatePort);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(restricted_port_request.url), alternative_service,
|
| + url::SchemeHostPort(restricted_port_request.url), alternative_service,
|
| expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| @@ -10483,7 +10487,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| kRestrictedAlternatePort);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(restricted_port_request.url), alternative_service,
|
| + url::SchemeHostPort(restricted_port_request.url), alternative_service,
|
| expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| @@ -10536,7 +10540,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| kRestrictedAlternatePort);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(unrestricted_port_request.url), alternative_service,
|
| + url::SchemeHostPort(unrestricted_port_request.url), alternative_service,
|
| expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| @@ -10588,7 +10592,7 @@ TEST_P(HttpNetworkTransactionTest,
|
| kUnrestrictedAlternatePort);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(unrestricted_port_request.url), alternative_service,
|
| + url::SchemeHostPort(unrestricted_port_request.url), alternative_service,
|
| expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| @@ -10635,7 +10639,7 @@ TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {
|
| kUnsafePort);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| http_server_properties->SetAlternativeService(
|
| - HostPortPair::FromURL(request.url), alternative_service, expiration);
|
| + url::SchemeHostPort(request.url), alternative_service, expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
|
| @@ -13362,8 +13366,9 @@ class AltSvcCertificateVerificationTest : public HttpNetworkTransactionTest {
|
| AlternativeService alternative_service(
|
| AlternateProtocolFromNextProto(GetProtocol()), alternative);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties->SetAlternativeService(origin, alternative_service,
|
| - expiration);
|
| + http_server_properties->SetAlternativeService(
|
| + url::SchemeHostPort("https", origin.host(), origin.port()),
|
| + alternative_service, expiration);
|
|
|
| // First request to alternative.
|
| if (pooling) {
|
| @@ -13467,8 +13472,9 @@ TEST_P(HttpNetworkTransactionTest, AlternativeServiceNotOnHttp11) {
|
| AlternativeService alternative_service(
|
| AlternateProtocolFromNextProto(GetProtocol()), alternative);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties->SetAlternativeService(origin, alternative_service,
|
| - expiration);
|
| + http_server_properties->SetAlternativeService(
|
| + url::SchemeHostPort("https", "origin.example.org", 443),
|
| + alternative_service, expiration);
|
|
|
| scoped_ptr<HttpTransaction> trans(
|
| new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
|
| @@ -13541,8 +13547,9 @@ TEST_P(HttpNetworkTransactionTest, FailedAlternativeServiceIsNotUserVisible) {
|
| AlternativeService alternative_service(
|
| AlternateProtocolFromNextProto(GetProtocol()), alternative);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties->SetAlternativeService(origin, alternative_service,
|
| - expiration);
|
| + http_server_properties->SetAlternativeService(
|
| + url::SchemeHostPort("https", "origin.example.org", 443),
|
| + alternative_service, expiration);
|
|
|
| HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get());
|
| HttpRequestInfo request1;
|
| @@ -13651,8 +13658,9 @@ TEST_P(HttpNetworkTransactionTest, AlternativeServiceShouldNotPoolToHttp11) {
|
| AlternativeService alternative_service(
|
| AlternateProtocolFromNextProto(GetProtocol()), alternative);
|
| base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
|
| - http_server_properties->SetAlternativeService(origin, alternative_service,
|
| - expiration);
|
| + http_server_properties->SetAlternativeService(
|
| + url::SchemeHostPort("https", "origin.example.org", 443),
|
| + alternative_service, expiration);
|
|
|
| // First transaction to alternative to open an HTTP/1.1 socket.
|
| scoped_ptr<HttpTransaction> trans1(
|
|
|