Commit e0456063 authored by David Schinazi's avatar David Schinazi Committed by Commit Bot

Introduce Legacy Version Encapsulation

This CL rolls QUICHE to include two changes:
Legacy Version Encapsulation, and a fix to
ParseQuicTagVector. It additionally adds the
support required for Legacy Version
Encapsulation to work, and adds a command-line
flag that allows us to test it. This CL also
removes quic_utils_chromium since every method
in it has now been moved to QUICHE.

R=renjietang@chromium.org

Change-Id: Iac2423df461656a47398f4579c279a22254390e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2261103
Commit-Queue: David Schinazi <dschinazi@chromium.org>
Reviewed-by: default avatarRenjie Tang <renjietang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781645}
parent cca486ca
......@@ -309,7 +309,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
'quiche_revision': 'bd7ad68ab12b14b22cad5054f792e8474232b8be',
'quiche_revision': '6bb377091bbe3295a364f8683e8c9629be7a9571',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling ios_webkit
# and whatever else without interference from each other.
......
......@@ -31,11 +31,11 @@
#include "net/http/http_server_properties.h"
#include "net/log/net_log.h"
#include "net/nqe/network_quality_estimator_params.h"
#include "net/quic/quic_utils_chromium.h"
#include "net/reporting/reporting_policy.h"
#include "net/socket/ssl_client_socket.h"
#include "net/ssl/ssl_key_logger_impl.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/quic_tag.h"
#include "net/url_request/url_request_context_builder.h"
#if BUILDFLAG(ENABLE_REPORTING)
......@@ -324,14 +324,14 @@ void URLRequestContextConfig::ParseAndSetExperimentalOptions(
if (quic_args->GetString(kQuicConnectionOptions,
&quic_connection_options)) {
quic_params->connection_options =
net::ParseQuicConnectionOptions(quic_connection_options);
quic::ParseQuicTagVector(quic_connection_options);
}
std::string quic_client_connection_options;
if (quic_args->GetString(kQuicClientConnectionOptions,
&quic_client_connection_options)) {
quic_params->client_connection_options =
net::ParseQuicConnectionOptions(quic_client_connection_options);
quic::ParseQuicTagVector(quic_client_connection_options);
}
// TODO(rtenneti): Delete this option after apps stop using it.
......
......@@ -27,10 +27,10 @@
#include "net/http/http_stream_factory.h"
#include "net/quic/platform/impl/quic_flags_impl.h"
#include "net/quic/quic_context.h"
#include "net/quic/quic_utils_chromium.h"
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_session_pool.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/quic_tag.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
#if defined(OS_MACOSX) && !defined(OS_IOS)
......@@ -205,7 +205,7 @@ quic::QuicTagVector GetQuicConnectionOptions(
return quic::QuicTagVector();
}
return net::ParseQuicConnectionOptions(it->second);
return quic::ParseQuicTagVector(it->second);
}
quic::QuicTagVector GetQuicClientConnectionOptions(
......@@ -215,7 +215,7 @@ quic::QuicTagVector GetQuicClientConnectionOptions(
return quic::QuicTagVector();
}
return net::ParseQuicConnectionOptions(it->second);
return quic::ParseQuicTagVector(it->second);
}
bool ShouldQuicCloseSessionsOnIpChange(
......@@ -625,9 +625,14 @@ void ParseCommandLineAndFieldTrials(const base::CommandLine& command_line,
if (params->enable_quic) {
if (command_line.HasSwitch(switches::kQuicConnectionOptions)) {
quic_params->connection_options = net::ParseQuicConnectionOptions(
quic_params->connection_options = quic::ParseQuicTagVector(
command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions));
}
if (command_line.HasSwitch(switches::kQuicClientConnectionOptions)) {
quic_params->client_connection_options =
quic::ParseQuicTagVector(command_line.GetSwitchValueASCII(
switches::kQuicClientConnectionOptions));
}
if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) {
unsigned value;
......
......@@ -32,6 +32,9 @@ NETWORK_SWITCH(kOriginToForceQuicOn, "origin-to-force-quic-on")
// the server.
NETWORK_SWITCH(kQuicConnectionOptions, "quic-connection-options")
// Specifies a comma separated list of QUIC client connection options.
NETWORK_SWITCH(kQuicClientConnectionOptions, "quic-client-connection-options")
// Specifies the maximum length for a QUIC packet.
NETWORK_SWITCH(kQuicMaxPacketLength, "quic-max-packet-length")
......
......@@ -941,8 +941,6 @@ component("net") {
"quic/quic_transport_client.h",
"quic/quic_transport_error.cc",
"quic/quic_transport_error.h",
"quic/quic_utils_chromium.cc",
"quic/quic_utils_chromium.h",
"quiche/common/platform/impl/quiche_arraysize_impl.h",
"quiche/common/platform/impl/quiche_endian_impl.h",
"quiche/common/platform/impl/quiche_export_impl.h",
......@@ -4348,7 +4346,6 @@ test("net_unittests") {
"quic/quic_test_packet_maker.cc",
"quic/quic_test_packet_maker.h",
"quic/quic_transport_end_to_end_test.cc",
"quic/quic_utils_chromium_test.cc",
"quic/test_quic_crypto_client_config_handle.cc",
"quic/test_quic_crypto_client_config_handle.h",
"socket/client_socket_pool_base_unittest.cc",
......
......@@ -994,6 +994,13 @@ void QuicChromiumClientSession::Initialize() {
quic::QuicSpdyClientSessionBase::SetMaxPushId(max_allowed_push_id_);
}
set_max_inbound_header_list_size(kQuicMaxHeaderListSize);
if (config()->HasClientRequestedIndependentOption(
quic::kQLVE, quic::Perspective::IS_CLIENT)) {
connection()->EnableLegacyVersionEncapsulation(session_key_.host());
// Legacy Version Encapsulation needs CHLO padding to be disabled.
// TODO(dschinazi) remove this line once we deprecate quic_dont_pad_chlo.
crypto_config_->GetConfig()->set_disable_chlo_padding(true);
}
quic::QuicSpdyClientSessionBase::Initialize();
SetHpackEncoderDebugVisitor(std::make_unique<HpackEncoderDebugVisitor>());
SetHpackDecoderDebugVisitor(std::make_unique<HpackDecoderDebugVisitor>());
......
......@@ -465,3 +465,10 @@ QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_dont_pad_chlo, false)
// If true, include MinPlaintextPacketSize when determine whether removing soft
// limit for crypto frames.
QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_min_crypto_frame_size, true)
// When true, QuicDispatcher supports decapsulation of Legacy Version
// Encapsulation packets.
QUIC_FLAG(
bool,
FLAGS_quic_reloadable_flag_quic_dispatcher_legacy_version_encapsulation,
false)
// Copyright (c) 2016 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.
#include "net/quic/quic_utils_chromium.h"
#include "base/containers/adapters.h"
#include "base/strings/string_split.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace net {
quic::QuicTagVector ParseQuicConnectionOptions(
const std::string& connection_options) {
quic::QuicTagVector options;
// Tokens are expected to be no more than 4 characters long, but
// handle overflow gracefully.
for (const quiche::QuicheStringPiece& token :
base::SplitStringPiece(connection_options, ",", base::TRIM_WHITESPACE,
base::SPLIT_WANT_ALL)) {
uint32_t option = 0;
for (char token_char : base::Reversed(token)) {
option <<= 8;
option |= static_cast<unsigned char>(token_char);
}
options.push_back(option);
}
return options;
}
} // namespace net
// Copyright 2014 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.
//
// Some helpers for quic that are for chromium codebase.
#ifndef NET_QUIC_QUIC_UTILS_CHROMIUM_H_
#define NET_QUIC_QUIC_UTILS_CHROMIUM_H_
#include <string>
#include "net/base/net_export.h"
#include "net/third_party/quiche/src/quic/core/quic_tag.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
namespace net {
// Returns the list of QUIC tags represented by the comma separated
// string in |connection_options|.
NET_EXPORT quic::QuicTagVector ParseQuicConnectionOptions(
const std::string& connection_options);
} // namespace net
#endif // NET_QUIC_QUIC_UTILS_CHROMIUM_H_
// Copyright 2014 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.
#include "net/quic/quic_utils_chromium.h"
#include <map>
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using ::testing::ElementsAre;
using ::testing::IsEmpty;
namespace net {
namespace test {
namespace {
TEST(QuicUtilsChromiumTest, ParseQuicConnectionOptions) {
quic::QuicTagVector empty_options = ParseQuicConnectionOptions("");
EXPECT_TRUE(empty_options.empty());
quic::QuicTagVector parsed_options =
ParseQuicConnectionOptions("TIMER,TBBR,REJ");
quic::QuicTagVector expected_options;
expected_options.push_back(quic::kTIME);
expected_options.push_back(quic::kTBBR);
expected_options.push_back(quic::kREJ);
EXPECT_EQ(expected_options, parsed_options);
}
} // namespace
} // namespace test
} // namespace net
......@@ -432,6 +432,8 @@ source_set("quiche") {
"src/quic/core/quic_interval.h",
"src/quic/core/quic_interval_deque.h",
"src/quic/core/quic_interval_set.h",
"src/quic/core/quic_legacy_version_encapsulator.cc",
"src/quic/core/quic_legacy_version_encapsulator.h",
"src/quic/core/quic_lru_cache.h",
"src/quic/core/quic_mtu_discovery.cc",
"src/quic/core/quic_mtu_discovery.h",
......@@ -1333,6 +1335,7 @@ source_set("quiche_tests") {
"src/quic/core/quic_interval_deque_test.cc",
"src/quic/core/quic_interval_set_test.cc",
"src/quic/core/quic_interval_test.cc",
"src/quic/core/quic_legacy_version_encapsulator_test.cc",
"src/quic/core/quic_lru_cache_test.cc",
"src/quic/core/quic_network_blackhole_detector_test.cc",
"src/quic/core/quic_one_block_arena_test.cc",
......
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