Skip to content

Commit

Permalink
Remove |parse_alternative_service| flag.
Browse files Browse the repository at this point in the history
|parse_alternative_service| is already true by default both in production and in
tests.

* Remove flag from HttpNetworkSession::Params and SpdySessionDependencies.
* Remove "ParseAltSvc" field trial.
* Remove Alternate-Protocol parsing code.
* Remove tests testing Alternate-Protocol that had Alt-Svc counterparts.
* Change tests to test Alt-Svc if no such test existed yet.

BUG=581331

Review-Url: https://codereview.chromium.org/2011983002
Cr-Commit-Position: refs/heads/master@{#396643}
  • Loading branch information
bnc authored and Commit bot committed May 28, 2016
1 parent 21bd980 commit 1c196c6
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 726 deletions.
1 change: 0 additions & 1 deletion components/cronet/ios/cronet_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ void CronetEnvironment::InitializeOnNetworkThread() {
params.http_server_properties = main_context_->http_server_properties();
params.net_log = main_context_->net_log();
params.enable_http2 = http2_enabled();
params.parse_alternative_services = true;
params.enable_quic = quic_enabled();

for (const auto& quic_hint : quic_hints_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ TEST_F(DataReductionProxyIODataTest, TestConstruction) {
request_context->GetNetworkSessionParams();
EXPECT_FALSE(http_params->enable_spdy31);
EXPECT_FALSE(http_params->enable_http2);
EXPECT_TRUE(http_params->parse_alternative_services);
EXPECT_TRUE(http_params->enable_alternative_service_with_different_host);
EXPECT_FALSE(http_params->enable_quic);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ const char kSpdyFieldTrialSpdy31GroupNamePrefix[] = "Spdy31Enabled";
const char kSpdyFieldTrialSpdy4GroupNamePrefix[] = "Spdy4Enabled";
const char kSpdyFieldTrialParametrizedPrefix[] = "Parametrized";

// The AltSvc trial controls whether Alt-Svc headers are parsed.
// Disabled:
// Alt-Svc headers are not parsed.
// Alternate-Protocol headers are parsed.
// Enabled:
// Alt-Svc headers are parsed, but only same-host entries are used by
// default. (Use "enable_alternative_service_with_different_host" QUIC
// parameter to enable entries with different hosts.)
// Alternate-Protocol headers are ignored for responses that have an Alt-Svc
// header.
const char kAltSvcFieldTrialName[] = "ParseAltSvc";
const char kAltSvcFieldTrialDisabledPrefix[] = "AltSvcDisabled";
const char kAltSvcFieldTrialEnabledPrefix[] = "AltSvcEnabled";

// Field trial for NPN.
const char kNpnTrialName[] = "NPN";
const char kNpnTrialEnabledGroupNamePrefix[] = "Enable";
Expand Down Expand Up @@ -154,18 +140,6 @@ void ConfigureSpdyParams(const base::CommandLine& command_line,
}
}

void ConfigureAltSvcParams(const base::CommandLine& command_line,
base::StringPiece altsvc_trial_group,
net::HttpNetworkSession::Params* params) {
if (altsvc_trial_group.starts_with(kAltSvcFieldTrialEnabledPrefix)) {
params->parse_alternative_services = true;
return;
}
if (altsvc_trial_group.starts_with(kAltSvcFieldTrialDisabledPrefix)) {
params->parse_alternative_services = false;
}
}

void ConfigureNPNParams(const base::CommandLine& command_line,
base::StringPiece npn_trial_group,
net::HttpNetworkSession::Params* params) {
Expand Down Expand Up @@ -547,10 +521,6 @@ void ParseFieldTrialsAndCommandLineInternal(
// The command line flags will be associated with a group that is reported so
// long as trial is actually queried.

std::string altsvc_trial_group =
base::FieldTrialList::FindFullName(kAltSvcFieldTrialName);
ConfigureAltSvcParams(command_line, altsvc_trial_group, params);

std::string quic_trial_group =
base::FieldTrialList::FindFullName(kQuicFieldTrialName);
VariationParameters quic_trial_params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ TEST_F(NetworkSessionConfiguratorTest, Defaults) {
EXPECT_FALSE(params_.enable_spdy31);
EXPECT_TRUE(params_.enable_http2);
EXPECT_FALSE(params_.enable_tcp_fast_open_for_ssl);
EXPECT_TRUE(params_.parse_alternative_services);
EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
EXPECT_FALSE(params_.enable_npn);
EXPECT_TRUE(params_.enable_priority_dependencies);
Expand Down Expand Up @@ -85,24 +84,6 @@ TEST_F(NetworkSessionConfiguratorTest, TestingFixedPort) {
EXPECT_EQ(1234u, params_.testing_fixed_https_port);
}

TEST_F(NetworkSessionConfiguratorTest, AltSvcFieldTrialEnabled) {
base::FieldTrialList::CreateFieldTrial("ParseAltSvc", "AltSvcEnabled");

ParseFieldTrials();

EXPECT_TRUE(params_.parse_alternative_services);
EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
}

TEST_F(NetworkSessionConfiguratorTest, AltSvcFieldTrialDisabled) {
base::FieldTrialList::CreateFieldTrial("ParseAltSvc", "AltSvcDisabled");

ParseFieldTrials();

EXPECT_FALSE(params_.parse_alternative_services);
EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
}

TEST_F(NetworkSessionConfiguratorTest, SpdyFieldTrialHoldbackEnabled) {
net::HttpStreamFactory::set_spdy_enabled(true);
base::FieldTrialList::CreateFieldTrial("SPDY", "SpdyDisabled");
Expand Down Expand Up @@ -214,7 +195,6 @@ TEST_F(NetworkSessionConfiguratorTest, EnableQuicFromFieldTrialGroup) {
EXPECT_FALSE(params_.quic_enable_non_blocking_io);
EXPECT_FALSE(params_.quic_disable_disk_cache);
EXPECT_FALSE(params_.quic_prefer_aes);
EXPECT_TRUE(params_.parse_alternative_services);
EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections);
EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold);
Expand Down Expand Up @@ -279,7 +259,6 @@ TEST_F(NetworkSessionConfiguratorTest,
ParseFieldTrialsAndCommandLine();

EXPECT_FALSE(params_.enable_quic);
EXPECT_TRUE(params_.parse_alternative_services);
EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
}

Expand All @@ -292,7 +271,6 @@ TEST_F(NetworkSessionConfiguratorTest,
ParseFieldTrialsAndCommandLine();

EXPECT_TRUE(params_.enable_quic);
EXPECT_TRUE(params_.parse_alternative_services);
EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
}

Expand Down Expand Up @@ -524,8 +502,6 @@ TEST_F(NetworkSessionConfiguratorTest,
ParseFieldTrials();

EXPECT_TRUE(params_.enable_alternative_service_with_different_host);
// QUIC AltSvc pooling parameter should also enable AltSvc parsing.
EXPECT_TRUE(params_.parse_alternative_services);
}

TEST_F(NetworkSessionConfiguratorTest,
Expand Down
1 change: 0 additions & 1 deletion ios/crnet/crnet_environment.mm
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ bool IsRequestSupported(NSURLRequest* request) override {
params.net_log = main_context_->net_log();
params.enable_spdy31 = spdy_enabled();
params.enable_http2 = spdy_enabled();
params.parse_alternative_services = true;
params.enable_quic = quic_enabled();

if (!params.channel_id_service) {
Expand Down
2 changes: 0 additions & 2 deletions jingle/glue/proxy_resolving_client_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ ProxyResolvingClientSocket::ProxyResolvingClientSocket(
reference_params->testing_fixed_https_port;
session_params.enable_spdy31 = reference_params->enable_spdy31;
session_params.enable_http2 = reference_params->enable_http2;
session_params.parse_alternative_services =
reference_params->parse_alternative_services;
session_params.enable_alternative_service_with_different_host =
reference_params->enable_alternative_service_with_different_host;
}
Expand Down
1 change: 0 additions & 1 deletion net/http/bidirectional_stream_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,6 @@ TEST_F(BidirectionalStreamTest, TestHonorAlternativeServiceHeader) {
url::SchemeHostPort server("https", "www.example.org", 443);
SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
PRIVACY_MODE_DISABLED);
session_deps_.parse_alternative_services = true;
// Enable QUIC so that the alternative service header can be added to
// HttpServerProperties.
session_deps_.enable_quic = true;
Expand Down
1 change: 0 additions & 1 deletion net/http/http_network_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ HttpNetworkSession::Params::Params()
spdy_session_max_recv_window_size(kSpdySessionMaxRecvWindowSize),
spdy_stream_max_recv_window_size(kSpdyStreamMaxRecvWindowSize),
time_func(&base::TimeTicks::Now),
parse_alternative_services(true),
enable_alternative_service_with_different_host(true),
enable_npn(false),
enable_priority_dependencies(true),
Expand Down
2 changes: 0 additions & 2 deletions net/http/http_network_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ class NET_EXPORT HttpNetworkSession
size_t spdy_stream_max_recv_window_size;
// Source of time for SPDY connections.
SpdySessionPool::TimeFunc time_func;
// Whether to parse Alt-Svc headers.
bool parse_alternative_services;
// Whether to enable Alt-Svc entries with hostname different than that of
// the origin.
bool enable_alternative_service_with_different_host;
Expand Down
Loading

0 comments on commit 1c196c6

Please sign in to comment.