diff --git a/fizz/server/State.cpp b/fizz/server/State.cpp index 2c2c47ecfb5..b90711ede4c 100644 --- a/fizz/server/State.cpp +++ b/fizz/server/State.cpp @@ -66,6 +66,10 @@ void HandshakeLogging::populateFromClientHello(const ClientHello& chlo) { clientSessionIdSent = chlo.legacy_session_id && !chlo.legacy_session_id->empty(); clientRandom = chlo.random; + + if (chlo.originalEncoding.hasValue()) { + originalChloSize = chlo.originalEncoding.value()->computeChainDataLength(); + } } folly::StringPiece toString(StateEnum state) { diff --git a/fizz/server/State.h b/fizz/server/State.h index 437c6de0e4c..9dc6e4ad2e2 100644 --- a/fizz/server/State.h +++ b/fizz/server/State.h @@ -66,6 +66,7 @@ struct HandshakeLogging { folly::Optional clientRandom; folly::Optional testExtensionByte; std::vector clientAlpns; + size_t originalChloSize{0}; void populateFromClientHello(const ClientHello& chlo); }; diff --git a/fizz/server/test/ServerProtocolTest.cpp b/fizz/server/test/ServerProtocolTest.cpp index b231ca3f41f..cb3474f5c2b 100644 --- a/fizz/server/test/ServerProtocolTest.cpp +++ b/fizz/server/test/ServerProtocolTest.cpp @@ -5074,7 +5074,13 @@ TEST_F(ServerProtocolTest, TestClientHelloRejectEarlyDataInvalidAppToken) { TEST_F(ServerProtocolTest, TestClientHelloHandshakeLogging) { setUpExpectingClientHello(); state_.handshakeLogging() = std::make_unique(); - fizz::Param param = TestMessages::clientHello(); + auto chlo = TestMessages::clientHello(); + size_t originalEncodingSize = 0; + if (chlo.originalEncoding.hasValue()) { + originalEncodingSize = + chlo.originalEncoding.value()->computeChainDataLength(); + } + fizz::Param param = std::move(chlo); auto actions = getActions(detail::processEvent(state_, param)); processStateMutations(actions); EXPECT_EQ( @@ -5103,7 +5109,8 @@ TEST_F(ServerProtocolTest, TestClientHelloHandshakeLogging) { {SignatureScheme::ecdsa_secp256r1_sha256, SignatureScheme::rsa_pss_sha256})); EXPECT_EQ(*state_.handshakeLogging()->clientSessionIdSent, false); - EXPECT_TRUE(state_.handshakeLogging()->clientRandom.has_value()); + EXPECT_TRUE(state_.handshakeLogging()->clientRandom.hasValue()); + EXPECT_EQ(originalEncodingSize, state_.handshakeLogging()->originalChloSize); } TEST_F(ServerProtocolTest, TestClientHelloTestByte) {