Commit 337fe8de authored by bnc's avatar bnc Committed by Commit bot

Remove AlternateProtocol::NPN_SPDY_3_1.

BUG=624095

Review-Url: https://codereview.chromium.org/2353333005
Cr-Commit-Position: refs/heads/master@{#420587}
parent e3e308b7
...@@ -36,8 +36,6 @@ const char* AlternateProtocolToString(AlternateProtocol protocol) { ...@@ -36,8 +36,6 @@ const char* AlternateProtocolToString(AlternateProtocol protocol) {
return "quic"; return "quic";
case NPN_HTTP_2: case NPN_HTTP_2:
return "h2"; return "h2";
case NPN_SPDY_3_1:
return "npn-spdy/3.1";
case UNINITIALIZED_ALTERNATE_PROTOCOL: case UNINITIALIZED_ALTERNATE_PROTOCOL:
return "Uninitialized"; return "Uninitialized";
} }
...@@ -50,12 +48,13 @@ AlternateProtocol AlternateProtocolFromString(const std::string& str) { ...@@ -50,12 +48,13 @@ AlternateProtocol AlternateProtocolFromString(const std::string& str) {
return QUIC; return QUIC;
if (str == "h2") if (str == "h2")
return NPN_HTTP_2; return NPN_HTTP_2;
// "npn-h2" is accepted here so that persisted settings with the old string // "npn-h2" and "npn-spdy/3.1" are accepted here so that persisted settings
// can be loaded from disk. TODO(bnc): Remove around 2016 December. // with the old string can be loaded from disk. TODO(bnc): Remove around
// 2016 December.
if (str == "npn-h2") if (str == "npn-h2")
return NPN_HTTP_2; return NPN_HTTP_2;
if (str == "npn-spdy/3.1") if (str == "npn-spdy/3.1")
return NPN_SPDY_3_1; return NPN_HTTP_2;
return UNINITIALIZED_ALTERNATE_PROTOCOL; return UNINITIALIZED_ALTERNATE_PROTOCOL;
} }
......
...@@ -66,11 +66,8 @@ NET_EXPORT void HistogramBrokenAlternateProtocolLocation( ...@@ -66,11 +66,8 @@ NET_EXPORT void HistogramBrokenAlternateProtocolLocation(
BrokenAlternateProtocolLocation location); BrokenAlternateProtocolLocation location);
enum AlternateProtocol { enum AlternateProtocol {
NPN_SPDY_3_1,
ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION = NPN_SPDY_3_1,
NPN_SPDY_MINIMUM_VERSION = NPN_SPDY_3_1,
NPN_HTTP_2, NPN_HTTP_2,
NPN_SPDY_MAXIMUM_VERSION = NPN_HTTP_2, ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION = NPN_HTTP_2,
QUIC, QUIC,
ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION = QUIC, ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION = QUIC,
UNINITIALIZED_ALTERNATE_PROTOCOL, UNINITIALIZED_ALTERNATE_PROTOCOL,
......
...@@ -336,8 +336,7 @@ AlternativeServiceVector HttpServerPropertiesImpl::GetAlternativeServices( ...@@ -336,8 +336,7 @@ AlternativeServiceVector HttpServerPropertiesImpl::GetAlternativeServices(
// If the alternative service is equivalent to the origin (same host, same // If the alternative service is equivalent to the origin (same host, same
// port, and both TCP), skip it. // port, and both TCP), skip it.
if (host_port_pair.Equals(alternative_service.host_port_pair()) && if (host_port_pair.Equals(alternative_service.host_port_pair()) &&
NPN_SPDY_MINIMUM_VERSION <= alternative_service.protocol && alternative_service.protocol == NPN_HTTP_2) {
alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
++it; ++it;
continue; continue;
} }
......
...@@ -441,7 +441,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { ...@@ -441,7 +441,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Initialize) {
// |alternative_service_map| has an entry for // |alternative_service_map| has an entry for
// |test_server2|. // |test_server2|.
AlternativeServiceInfoVector alternative_service_info_vector; AlternativeServiceInfoVector alternative_service_info_vector;
const AlternativeService alternative_service2(NPN_SPDY_3_1, "bar2", 443); const AlternativeService alternative_service2(NPN_HTTP_2, "bar2", 443);
base::Time expiration2 = now + base::TimeDelta::FromDays(2); base::Time expiration2 = now + base::TimeDelta::FromDays(2);
alternative_service_info_vector.push_back( alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service2, expiration2)); AlternativeServiceInfo(alternative_service2, expiration2));
...@@ -627,7 +627,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearServerWithCanonical) { ...@@ -627,7 +627,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, ClearServerWithCanonical) {
TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) { TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) {
url::SchemeHostPort test_server1("http", "foo1", 80); url::SchemeHostPort test_server1("http", "foo1", 80);
const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo1", 443); const AlternativeService alternative_service1(NPN_HTTP_2, "foo1", 443);
SetAlternativeService(test_server1, alternative_service1); SetAlternativeService(test_server1, alternative_service1);
url::SchemeHostPort test_server2("http", "foo2", 80); url::SchemeHostPort test_server2("http", "foo2", 80);
const AlternativeService alternative_service2(NPN_HTTP_2, "foo2", 1234); const AlternativeService alternative_service2(NPN_HTTP_2, "foo2", 1234);
...@@ -699,7 +699,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAge) { ...@@ -699,7 +699,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAge) {
// First alternative service expired one day ago, should not be returned by // First alternative service expired one day ago, should not be returned by
// GetAlternativeServices(). // GetAlternativeServices().
const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
alternative_service_info_vector.push_back( alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service1, now - one_day)); AlternativeServiceInfo(alternative_service1, now - one_day));
...@@ -725,7 +725,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) { ...@@ -725,7 +725,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) {
// First alternative service expired one day ago, should not be returned by // First alternative service expired one day ago, should not be returned by
// GetAlternativeServices(). // GetAlternativeServices().
const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
alternative_service_info_vector.push_back( alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service1, now - one_day)); AlternativeServiceInfo(alternative_service1, now - one_day));
...@@ -748,7 +748,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) { ...@@ -748,7 +748,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) {
TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) { TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) {
AlternativeServiceInfoVector alternative_service_info_vector; AlternativeServiceInfoVector alternative_service_info_vector;
const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
alternative_service_info_vector.push_back( alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service1, expiration)); AlternativeServiceInfo(alternative_service1, expiration));
...@@ -784,7 +784,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) { ...@@ -784,7 +784,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, AlternativeServiceWithScheme) {
TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) { TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) {
AlternativeServiceInfoVector alternative_service_info_vector; AlternativeServiceInfoVector alternative_service_info_vector;
const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
alternative_service_info_vector.push_back( alternative_service_info_vector.push_back(
AlternativeServiceInfo(alternative_service1, expiration)); AlternativeServiceInfo(alternative_service1, expiration));
......
...@@ -284,7 +284,7 @@ TEST_P(HttpServerPropertiesManagerTest, ...@@ -284,7 +284,7 @@ TEST_P(HttpServerPropertiesManagerTest,
// Set up alternative_services for https://mail.google.com. // Set up alternative_services for https://mail.google.com.
std::unique_ptr<base::DictionaryValue> alternative_service_dict2( std::unique_ptr<base::DictionaryValue> alternative_service_dict2(
new base::DictionaryValue); new base::DictionaryValue);
alternative_service_dict2->SetString("protocol_str", "npn-spdy/3.1"); alternative_service_dict2->SetString("protocol_str", "h2");
alternative_service_dict2->SetInteger("port", 444); alternative_service_dict2->SetInteger("port", 444);
base::ListValue* alternative_service_list1 = new base::ListValue; base::ListValue* alternative_service_list1 = new base::ListValue;
alternative_service_list1->Append(std::move(alternative_service_dict2)); alternative_service_list1->Append(std::move(alternative_service_dict2));
...@@ -381,7 +381,7 @@ TEST_P(HttpServerPropertiesManagerTest, ...@@ -381,7 +381,7 @@ TEST_P(HttpServerPropertiesManagerTest,
AlternativeServiceMap::const_iterator map_it = map.begin(); AlternativeServiceMap::const_iterator map_it = map.begin();
EXPECT_EQ("mail.google.com", map_it->first.host()); EXPECT_EQ("mail.google.com", map_it->first.host());
ASSERT_EQ(1u, map_it->second.size()); ASSERT_EQ(1u, map_it->second.size());
EXPECT_EQ(NPN_SPDY_3_1, map_it->second[0].alternative_service.protocol); EXPECT_EQ(NPN_HTTP_2, map_it->second[0].alternative_service.protocol);
EXPECT_TRUE(map_it->second[0].alternative_service.host.empty()); EXPECT_TRUE(map_it->second[0].alternative_service.host.empty());
EXPECT_EQ(444, map_it->second[0].alternative_service.port); EXPECT_EQ(444, map_it->second[0].alternative_service.port);
++map_it; ++map_it;
...@@ -409,7 +409,7 @@ TEST_P(HttpServerPropertiesManagerTest, ...@@ -409,7 +409,7 @@ TEST_P(HttpServerPropertiesManagerTest,
++map_it; ++map_it;
EXPECT_EQ("mail.google.com", map_it->first.host()); EXPECT_EQ("mail.google.com", map_it->first.host());
ASSERT_EQ(1u, map_it->second.size()); ASSERT_EQ(1u, map_it->second.size());
EXPECT_EQ(NPN_SPDY_3_1, map_it->second[0].alternative_service.protocol); EXPECT_EQ(NPN_HTTP_2, map_it->second[0].alternative_service.protocol);
EXPECT_TRUE(map_it->second[0].alternative_service.host.empty()); EXPECT_TRUE(map_it->second[0].alternative_service.host.empty());
EXPECT_EQ(444, map_it->second[0].alternative_service.port); EXPECT_EQ(444, map_it->second[0].alternative_service.port);
} }
...@@ -1082,7 +1082,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) { ...@@ -1082,7 +1082,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) {
http_server_props_manager_->SetAlternativeServices( http_server_props_manager_->SetAlternativeServices(
server_www, alternative_service_info_vector); server_www, alternative_service_info_vector);
AlternativeService mail_alternative_service(NPN_SPDY_3_1, "foo.google.com", AlternativeService mail_alternative_service(NPN_HTTP_2, "foo.google.com",
444); 444);
base::Time expiration3 = base::Time::Max(); base::Time expiration3 = base::Time::Max();
http_server_props_manager_->SetAlternativeService( http_server_props_manager_->SetAlternativeService(
...@@ -1121,7 +1121,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) { ...@@ -1121,7 +1121,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) {
"\"port\":1234,\"protocol_str\":\"h2\"}]}}," "\"port\":1234,\"protocol_str\":\"h2\"}]}},"
"{\"http://mail.google.com\":{\"alternative_service\":[{" "{\"http://mail.google.com\":{\"alternative_service\":[{"
"\"expiration\":\"9223372036854775807\",\"host\":\"foo.google.com\"," "\"expiration\":\"9223372036854775807\",\"host\":\"foo.google.com\","
"\"port\":444,\"protocol_str\":\"npn-spdy/3.1\"}]," "\"port\":444,\"protocol_str\":\"h2\"}],"
"\"network_stats\":{\"srtt\":42}}}" "\"network_stats\":{\"srtt\":42}}}"
"]," "],"
"\"supports_quic\":{\"address\":\"127.0.0.1\",\"used_quic\":true}," "\"supports_quic\":{\"address\":\"127.0.0.1\",\"used_quic\":true},"
......
...@@ -1315,8 +1315,7 @@ bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const { ...@@ -1315,8 +1315,7 @@ bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const {
} }
bool HttpStreamFactoryImpl::Job::IsSpdyAlternative() const { bool HttpStreamFactoryImpl::Job::IsSpdyAlternative() const {
return alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION && return alternative_service_.protocol == NPN_HTTP_2;
alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION;
} }
bool HttpStreamFactoryImpl::Job::IsQuicAlternative() const { bool HttpStreamFactoryImpl::Job::IsQuicAlternative() const {
......
...@@ -918,8 +918,7 @@ HttpStreamFactoryImpl::JobController::GetAlternativeServiceForInternal( ...@@ -918,8 +918,7 @@ HttpStreamFactoryImpl::JobController::GetAlternativeServiceForInternal(
origin.port() < kUnrestrictedPort)) origin.port() < kUnrestrictedPort))
continue; continue;
if (alternative_service.protocol >= NPN_SPDY_MINIMUM_VERSION && if (alternative_service.protocol == NPN_HTTP_2) {
alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
if (origin.host() != alternative_service.host && if (origin.host() != alternative_service.host &&
!session_->params() !session_->params()
.enable_http2_alternative_service_with_different_host) { .enable_http2_alternative_service_with_different_host) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment