Internal change
PiperOrigin-RevId: 451147075
diff --git a/quiche/quic/core/http/quic_spdy_session.h b/quiche/quic/core/http/quic_spdy_session.h
index 25d3be0..f117328 100644
--- a/quiche/quic/core/http/quic_spdy_session.h
+++ b/quiche/quic/core/http/quic_spdy_session.h
@@ -515,6 +515,12 @@
// in settings and accept remote settings for.
virtual HttpDatagramSupport LocalHttpDatagramSupport();
+ // Sends any data which should be sent at the start of a connection, including
+ // the initial SETTINGS frame. When using 0-RTT, this method is called twice:
+ // once when encryption is established, and again when 1-RTT keys are
+ // available.
+ void SendInitialData();
+
private:
friend class test::QuicSpdySessionPeer;
@@ -549,12 +555,6 @@
void CloseConnectionOnDuplicateHttp3UnidirectionalStreams(
absl::string_view type);
- // Sends any data which should be sent at the start of a connection, including
- // the initial SETTINGS frame. When using 0-RTT, this method is called twice:
- // once when encryption is established, and again when 1-RTT keys are
- // available.
- void SendInitialData();
-
void FillSettingsFrame();
bool VerifySettingIsZeroOrOne(uint64_t id, uint64_t value);
diff --git a/quiche/quic/test_tools/crypto_test_utils.cc b/quiche/quic/test_tools/crypto_test_utils.cc
index 3a1ef63..4df4f8f 100644
--- a/quiche/quic/test_tools/crypto_test_utils.cc
+++ b/quiche/quic/test_tools/crypto_test_utils.cc
@@ -384,7 +384,7 @@
<< client_conn->encrypted_packets_.size() - client_i
<< " packets client->server";
MovePackets(client_conn, &client_i, server, server_conn,
- Perspective::IS_SERVER);
+ Perspective::IS_SERVER, /*process_stream_data=*/false);
if (client->one_rtt_keys_available() && server->one_rtt_keys_available() &&
server_conn->encrypted_packets_.size() == server_i) {
@@ -395,7 +395,7 @@
<< server_conn->encrypted_packets_.size() - server_i
<< " packets server->client";
MovePackets(server_conn, &server_i, client, client_conn,
- Perspective::IS_CLIENT);
+ Perspective::IS_CLIENT, /*process_stream_data=*/false);
}
}
@@ -404,7 +404,8 @@
std::function<bool()> client_condition,
PacketSavingConnection* server_conn,
QuicCryptoStream* server,
- std::function<bool()> server_condition) {
+ std::function<bool()> server_condition,
+ bool process_stream_data) {
size_t client_next_packet_to_deliver =
client_conn->number_of_packets_delivered_;
size_t server_next_packet_to_deliver =
@@ -421,7 +422,7 @@
client_next_packet_to_deliver
<< " packets client->server";
MovePackets(client_conn, &client_next_packet_to_deliver, server,
- server_conn, Perspective::IS_SERVER);
+ server_conn, Perspective::IS_SERVER, process_stream_data);
}
if (!client_condition()) {
QUIC_LOG(INFO) << "Processing "
@@ -429,7 +430,7 @@
server_next_packet_to_deliver
<< " packets server->client";
MovePackets(server_conn, &server_next_packet_to_deliver, client,
- client_conn, Perspective::IS_CLIENT);
+ client_conn, Perspective::IS_CLIENT, process_stream_data);
}
}
client_conn->number_of_packets_delivered_ = client_next_packet_to_deliver;
@@ -457,7 +458,7 @@
<< client_conn->encrypted_packets_.size() - client_i
<< " packets client->server";
MovePackets(client_conn, &client_i, server, server_conn,
- Perspective::IS_SERVER);
+ Perspective::IS_SERVER, /*process_stream_data=*/false);
}
if (server_conn->encrypted_packets_.size() != server_i) {
@@ -465,7 +466,7 @@
<< server_conn->encrypted_packets_.size() - server_i
<< " packets server->client";
MovePackets(server_conn, &server_i, client, client_conn,
- Perspective::IS_CLIENT);
+ Perspective::IS_CLIENT, /*process_stream_data=*/false);
}
return std::make_pair(client_i, server_i);
@@ -709,7 +710,7 @@
void MovePackets(PacketSavingConnection* source_conn,
size_t* inout_packet_index, QuicCryptoStream* dest_stream,
PacketSavingConnection* dest_conn,
- Perspective dest_perspective) {
+ Perspective dest_perspective, bool process_stream_data) {
SimpleQuicFramer framer(source_conn->supported_versions(), dest_perspective);
QuicFramerPeer::SetLastSerializedServerConnectionId(framer.framer(),
TestConnectionId());
@@ -779,10 +780,17 @@
QuicConnectionPeer::SetCurrentPacket(
dest_conn, source_conn->encrypted_packets_[index]->AsStringPiece());
for (const auto& stream_frame : framer.stream_frames()) {
- // Ignore stream frames that are sent on other streams in the crypto
- // event.
- if (stream_frame->stream_id == dest_stream->id()) {
- dest_stream->OnStreamFrame(*stream_frame);
+ if (process_stream_data &&
+ dest_stream->handshake_protocol() == PROTOCOL_TLS1_3) {
+ // Deliver STREAM_FRAME such that application state is available and can
+ // be stored along with resumption ticket in session cache,
+ dest_conn->OnStreamFrame(*stream_frame);
+ } else {
+ // Ignore stream frames that are sent on other streams in the crypto
+ // event.
+ if (stream_frame->stream_id == dest_stream->id()) {
+ dest_stream->OnStreamFrame(*stream_frame);
+ }
}
}
for (const auto& crypto_frame : framer.crypto_frames()) {
diff --git a/quiche/quic/test_tools/crypto_test_utils.h b/quiche/quic/test_tools/crypto_test_utils.h
index 1f8a255..d21e897 100644
--- a/quiche/quic/test_tools/crypto_test_utils.h
+++ b/quiche/quic/test_tools/crypto_test_utils.h
@@ -109,15 +109,18 @@
// CommunicateHandshakeMessagesUntil:
// 1) Moves messages from |client| to |server| until |server_condition| is met.
// 2) Moves messages from |server| to |client| until |client_condition| is met.
-// 3) Returns true if both conditions are met.
-// 4) Returns false if either connection is closed or there is no more packet to
+// 3) For IETF QUIC, if `process_stream_data` is true, STREAM_FRAME within the
+// packet containing crypto messages is also processed.
+// 4) Returns true if both conditions are met.
+// 5) Returns false if either connection is closed or there is no more packet to
// deliver before both conditions are met.
bool CommunicateHandshakeMessagesUntil(PacketSavingConnection* client_conn,
QuicCryptoStream* client,
std::function<bool()> client_condition,
PacketSavingConnection* server_conn,
QuicCryptoStream* server,
- std::function<bool()> server_condition);
+ std::function<bool()> server_condition,
+ bool process_stream_data);
// AdvanceHandshake attempts to moves messages from |client| to |server| and
// |server| to |client|. Returns the number of messages moved.
@@ -176,11 +179,13 @@
// MovePackets parses crypto handshake messages from packet number
// |*inout_packet_index| through to the last packet (or until a packet fails
// to decrypt) and has |dest_stream| process them. |*inout_packet_index| is
-// updated with an index one greater than the last packet processed.
+// updated with an index one greater than the last packet processed. For IETF
+// QUIC, if `process_stream_data` is true, STREAM_FRAME within the packet
+// containing crypto messages is also processed.
void MovePackets(PacketSavingConnection* source_conn,
size_t* inout_packet_index, QuicCryptoStream* dest_stream,
PacketSavingConnection* dest_conn,
- Perspective dest_perspective);
+ Perspective dest_perspective, bool process_stream_data);
// Return an inchoate CHLO with some basic tag value pairs.
CryptoHandshakeMessage GenerateDefaultInchoateCHLO(