mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-24 04:01:07 +03:00
Accept session tickets with additional optional parameters
Summary: Allow server to accept session tickets with additional paramters that won't be used. A subset of servers can include additional transport parameters in the session ticket that are only useful to them. This allows other servers to still use the ticket as long as it has the fields they expect, ignoring any additional parameters. Reviewed By: mjoras Differential Revision: D43131800 fbshipit-source-id: ff4ea503c2e30b9bd0e1caf77b418c3891ffdd7f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ccde77f256
commit
62d4ef978a
@@ -57,6 +57,39 @@ TEST(DefaultAppTokenValidatorTest, TestValidParams) {
|
||||
EXPECT_TRUE(validator.validate(resState));
|
||||
}
|
||||
|
||||
TEST(DefaultAppTokenValidatorTest, TestValidOptionalParameter) {
|
||||
QuicServerConnectionState conn(
|
||||
FizzServerQuicHandshakeContext::Builder().build());
|
||||
conn.peerAddress = folly::SocketAddress("1.2.3.4", 443);
|
||||
conn.version = QuicVersion::MVFST;
|
||||
conn.transportSettings.zeroRttSourceTokenMatchingPolicy =
|
||||
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
|
||||
auto quicStats = std::make_shared<MockQuicStats>();
|
||||
conn.statsCallback = quicStats.get();
|
||||
|
||||
AppToken appToken;
|
||||
appToken.transportParams = createTicketTransportParameters(
|
||||
conn.transportSettings.idleTimeout.count(),
|
||||
conn.transportSettings.maxRecvPacketSize,
|
||||
conn.transportSettings.advertisedInitialConnectionWindowSize,
|
||||
conn.transportSettings.advertisedInitialBidiLocalStreamWindowSize,
|
||||
conn.transportSettings.advertisedInitialBidiRemoteStreamWindowSize,
|
||||
conn.transportSettings.advertisedInitialUniStreamWindowSize,
|
||||
conn.transportSettings.advertisedInitialMaxStreamsBidi,
|
||||
conn.transportSettings.advertisedInitialMaxStreamsUni);
|
||||
appToken.transportParams.parameters.push_back(
|
||||
encodeIntegerParameter(TransportParameterId::disable_migration, 1));
|
||||
ResumptionState resState;
|
||||
resState.appToken = encodeAppToken(appToken);
|
||||
|
||||
conn.earlyDataAppParamsValidator = [](const folly::Optional<std::string>&,
|
||||
const Buf&) { return true; };
|
||||
DefaultAppTokenValidator validator(&conn);
|
||||
EXPECT_CALL(*quicStats, onZeroRttAccepted()).Times(1);
|
||||
EXPECT_CALL(*quicStats, onZeroRttRejected()).Times(0);
|
||||
EXPECT_TRUE(validator.validate(resState));
|
||||
}
|
||||
|
||||
TEST(
|
||||
DefaultAppTokenValidatorTest,
|
||||
TestValidUnequalParamsUpdateTransportSettings) {
|
||||
|
||||
Reference in New Issue
Block a user