-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
quiche: enable downstream HTTP3 in quic_protocol_integration_test #15424
Changes from 19 commits
bb02ae6
09fc660
6ed3c94
186a69d
66dbde0
d5cbd00
cf08311
97a3033
e00fd2b
5682791
96c587e
725d93e
354a322
2b94626
77cb937
4e9e56a
88398b8
5c11723
39e3f9a
4c2b490
97292b2
fdc6189
280fc25
3c02978
c31225b
e1fd5d7
2dd1ae5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ QuicClientConnectionFactoryImpl::createQuicNetworkConnection( | |
Http::PersistentQuicInfo& info, Event::Dispatcher& dispatcher, | ||
Network::Address::InstanceConstSharedPtr server_addr, | ||
Network::Address::InstanceConstSharedPtr local_addr) { | ||
// This flag fix a QUICHE issue which may crash Envoy during connection close. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO/link? |
||
SetQuicReloadableFlag(quic_single_ack_in_packet2, true); | ||
PersistentQuicInfoImpl* info_impl = reinterpret_cast<PersistentQuicInfoImpl*>(&info); | ||
|
||
auto connection = std::make_unique<EnvoyQuicClientConnection>( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,10 @@ std::unique_ptr<T> spdyHeaderBlockToEnvoyHeaders(const spdy::SpdyHeaderBlock& he | |
for (auto entry : header_block) { | ||
// TODO(danzh): Avoid temporary strings and addCopy() with string_view. | ||
std::string key(entry.first); | ||
headers->addCopy(Http::LowerCaseString(key), entry.second); | ||
std::vector<absl::string_view> values = absl::StrSplit(entry.second, '\0'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was surprised to see splitting on
I've never worked with that library before but I wonder if it supplies some sort of split API we should be using rather than calling StrSplit directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Josh, is your concern that the header may be split by \0 or ;? I think the base Enovy classes can handle ; (e.g. parseCookieValue) but would basically fail to recognize quic-multi-valued-headers with \0 because HTTP/2 and below don't support that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was mostly just thinking that the \0 delim looks like an implementation detail of spdy_header_block.h and the detail should ideally be abstracted away at that level. And yes I was also wondering specifically about what the behavior would be with cookies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, SpdyHeaderBlock doesn't have such API to split the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some comments here might help at least clear up the mysticism, if it's really impossible to create an abstraction boundary around this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for more comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
for (const absl::string_view& value : values) { | ||
headers->addCopy(Http::LowerCaseString(key), value); | ||
alyssawilk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
return headers; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,10 @@ name: "envoy.filters.listener.tls_inspector" | |
)EOF"; | ||
} | ||
|
||
std::string ConfigHelper::httpProxyConfig() { | ||
std::string ConfigHelper::httpProxyConfig(bool downstream_use_quic) { | ||
if (downstream_use_quic) { | ||
return quicHttpProxyConfig(); | ||
} | ||
return absl::StrCat(baseConfig(), fmt::format(R"EOF( | ||
filter_chains: | ||
filters: | ||
|
@@ -1050,6 +1053,23 @@ void ConfigHelper::addSslConfig(const ServerSslOptions& options) { | |
filter_chain->mutable_transport_socket()->mutable_typed_config()->PackFrom(tls_context); | ||
} | ||
|
||
void ConfigHelper::addQuicDownstreamTransportSocketConfig(bool reuse_port) { | ||
envoy::extensions::transport_sockets::quic::v3::QuicDownstreamTransport | ||
quic_transport_socket_config; | ||
auto tls_context = quic_transport_socket_config.mutable_downstream_tls_context(); | ||
ConfigHelper::initializeTls(ConfigHelper::ServerSslOptions().setRsaCert(true).setTlsV13(true), | ||
*tls_context->mutable_common_tls_context()); | ||
for (auto& listener : *bootstrap_.mutable_static_resources()->mutable_listeners()) { | ||
if (listener.udp_listener_config().listener_config().typed_config().type_url() == | ||
"type.googleapis.com/envoy.config.listener.v3.QuicProtocolOptions") { | ||
auto* filter_chain = listener.mutable_filter_chains(0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we be checking that filter_chains is non-empty? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a test util function whose input is the config template defined in the same file. But I added ASSERT to help future debugging. |
||
auto* transport_socket = filter_chain->mutable_transport_socket(); | ||
transport_socket->mutable_typed_config()->PackFrom(quic_transport_socket_config); | ||
listener.set_reuse_port(reuse_port); | ||
} | ||
} | ||
} | ||
|
||
bool ConfigHelper::setAccessLog( | ||
const std::string& filename, absl::string_view format, | ||
std::vector<envoy::config::core::v3::TypedExtensionConfig> formatters) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,24 @@ TEST(EnvoyQuicUtilsTest, HeadersConversion) { | |
headers_block[":authority"] = "www.google.com"; | ||
headers_block[":path"] = "/index.hml"; | ||
headers_block[":scheme"] = "https"; | ||
headers_block.AppendValueOrAddHeader("key", "value1"); | ||
headers_block.AppendValueOrAddHeader("key", "value2"); | ||
auto envoy_headers = spdyHeaderBlockToEnvoyHeaders<Http::RequestHeaderMapImpl>(headers_block); | ||
EXPECT_EQ(headers_block.size(), envoy_headers->size()); | ||
EXPECT_EQ(headers_block.size() + 1u, envoy_headers->size()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment why the +1 please, since it's not obvious about the \0 split |
||
EXPECT_EQ("www.google.com", envoy_headers->getHostValue()); | ||
EXPECT_EQ("/index.hml", envoy_headers->getPathValue()); | ||
EXPECT_EQ("https", envoy_headers->getSchemeValue()); | ||
EXPECT_EQ("value1", envoy_headers->get(Http::LowerCaseString("key"))[0]->value().getStringView()); | ||
EXPECT_EQ("value2", envoy_headers->get(Http::LowerCaseString("key"))[1]->value().getStringView()); | ||
|
||
quic::QuicHeaderList quic_headers = quic::test::AsHeaderList(headers_block); | ||
quic::QuicHeaderList quic_headers; | ||
quic_headers.OnHeaderBlockStart(); | ||
quic_headers.OnHeader(":authority", "www.google.com"); | ||
quic_headers.OnHeader(":path", "/index.hml"); | ||
quic_headers.OnHeader(":scheme", "https"); | ||
quic_headers.OnHeader("key", "value1"); | ||
quic_headers.OnHeader("key", "value2"); | ||
quic_headers.OnHeaderBlockEnd(0, 0); | ||
auto envoy_headers2 = quicHeadersToEnvoyHeaders<Http::RequestHeaderMapImpl>(quic_headers); | ||
EXPECT_EQ(*envoy_headers, *envoy_headers2); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a TODO and/or link to a follow up issue? Do we plan on removing this later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quiche flags are like our runtime guards only they start false - it'll move to true by default and get removed over some number of import cycles.