Support LengthPrefixedConnectionIds in v99
This CL adds support for the invariants change from draft-22. It introduces a new parsing method QuicFramer::ParsePublicHeader which can parse both old and new formats, and uses it for v99 and also for all versions when gfe2_reloadable_flag_quic_use_parse_public_header is true.
gfe-relnote: change v99 encoding, protected by disabled v99 flag and by gfe2_reloadable_flag_quic_use_parse_public_header.
PiperOrigin-RevId: 260871822
Change-Id: I680d12141b2731401a818ed335af03e7c5365219
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index ee7b651..f0152cd 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -6774,16 +6774,20 @@
}
TEST_P(QuicConnectionTest, ClientHandlesVersionNegotiation) {
- // Start out with an unsupported version.
- QuicConnectionPeer::GetFramer(&connection_)
- ->set_version_for_tests(QuicVersionReservedForNegotiation());
+ // All supported versions except the one the connection supports.
+ ParsedQuicVersionVector versions;
+ for (auto version : AllSupportedVersions()) {
+ if (version != connection_.version()) {
+ versions.push_back(version);
+ }
+ }
// Send a version negotiation packet.
std::unique_ptr<QuicEncryptedPacket> encrypted(
QuicFramer::BuildVersionNegotiationPacket(
connection_id_, EmptyQuicConnectionId(),
VersionHasIetfInvariantHeader(connection_.transport_version()),
- AllSupportedVersions()));
+ connection_.version().HasLengthPrefixedConnectionIds(), versions));
std::unique_ptr<QuicReceivedPacket> received(
ConstructReceivedPacket(*encrypted, QuicTime::Zero()));
EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
@@ -6804,6 +6808,7 @@
QuicFramer::BuildVersionNegotiationPacket(
connection_id_, EmptyQuicConnectionId(),
VersionHasIetfInvariantHeader(connection_.transport_version()),
+ connection_.version().HasLengthPrefixedConnectionIds(),
AllSupportedVersions()));
std::unique_ptr<QuicReceivedPacket> received(
ConstructReceivedPacket(*encrypted, QuicTime::Zero()));