Add QUIC connection options for testing: - CHP1: Add 1-packet padding to CHLO. - CHP2: Add 2-packet padding to CHLO. PiperOrigin-RevId: 681031206
diff --git a/quiche/quic/core/crypto/crypto_protocol.h b/quiche/quic/core/crypto/crypto_protocol.h index d76547d..48e98d5 100644 --- a/quiche/quic/core/crypto/crypto_protocol.h +++ b/quiche/quic/core/crypto/crypto_protocol.h
@@ -472,6 +472,10 @@ // Universal tags const QuicTag kPAD = TAG('P', 'A', 'D', '\0'); // Padding +// Client Hello Padding tags, for experiments. +const QuicTag kCHP1 = TAG('C', 'H', 'P', '1'); // 1-packet padding to CHLO. +const QuicTag kCHP2 = TAG('C', 'H', 'P', '2'); // 2-packet padding to CHLO. + // Stats collection tags const QuicTag kEPID = TAG('E', 'P', 'I', 'D'); // Endpoint identifier.
diff --git a/quiche/quic/core/http/end_to_end_test.cc b/quiche/quic/core/http/end_to_end_test.cc index 452586c..8732d4b 100644 --- a/quiche/quic/core/http/end_to_end_test.cc +++ b/quiche/quic/core/http/end_to_end_test.cc
@@ -1211,8 +1211,7 @@ TEST_P(EndToEndTest, TestDispatcherAckWithTwoPacketCHLO) { SetQuicFlag(quic_allow_chlo_buffering, true); SetQuicFlag(quic_dispatcher_max_ack_sent_per_connection, 1); - std::string google_handshake_message(kEthernetMTU, 'a'); - client_config_.SetGoogleHandshakeMessageToSend(google_handshake_message); + client_extra_copts_.push_back(kCHP1); ASSERT_TRUE(Initialize()); if (!version_.HasIetfQuicFrames()) { return; @@ -1359,8 +1358,7 @@ TEST_P(EndToEndTest, TestDispatcherAckWithThreePacketCHLO) { SetQuicFlag(quic_allow_chlo_buffering, true); SetQuicFlag(quic_dispatcher_max_ack_sent_per_connection, 2); - std::string google_handshake_message(2 * kEthernetMTU, 'a'); - client_config_.SetGoogleHandshakeMessageToSend(google_handshake_message); + client_extra_copts_.push_back(kCHP2); ASSERT_TRUE(Initialize()); if (!version_.HasIetfQuicFrames()) { return;
diff --git a/quiche/quic/core/quic_session.cc b/quiche/quic/core/quic_session.cc index 66d8935..afdb44b 100644 --- a/quiche/quic/core/quic_session.cc +++ b/quiche/quic/core/quic_session.cc
@@ -172,6 +172,15 @@ connection_->SetSessionNotifier(this); connection_->SetDataProducer(this); connection_->SetUnackedMapInitialCapacity(); + if (perspective_ == Perspective::IS_CLIENT) { + if (config_.HasClientSentConnectionOption(kCHP1, perspective_)) { + config_.SetGoogleHandshakeMessageToSend( + std::string(kDefaultMaxPacketSize, '0')); + } else if (config_.HasClientSentConnectionOption(kCHP2, perspective_)) { + config_.SetGoogleHandshakeMessageToSend( + std::string(kDefaultMaxPacketSize * 2, '0')); + } + } connection_->SetFromConfig(config_); if (perspective_ == Perspective::IS_CLIENT) { if (config_.HasClientRequestedIndependentOption(kAFFE, perspective_) && @@ -1862,6 +1871,11 @@ MaybeSendAddressToken(); } } + if (perspective_ == Perspective::IS_CLIENT && + (config_.HasClientSentConnectionOption(kCHP1, perspective_) || + config_.HasClientSentConnectionOption(kCHP2, perspective_))) { + config_.ClearGoogleHandshakeMessage(); + } } bool QuicSession::MaybeSendAddressToken() {