Internal QUICHE change PiperOrigin-RevId: 309442513 Change-Id: I6586d984840e83d07bc374973db8a5446d12b580
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index 4e29da5..422b691 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -1543,8 +1543,8 @@ EXPECT_THAT(client_->connection_error(), IsError(QUIC_INVALID_STREAM_ID)); } -// Test that if the server will close the connection if the client attempts -// to send a request with overly large headers. +// Test that the server resets the stream if the client sends a request +// with overly large headers. TEST_P(EndToEndTest, LargeHeaders) { ASSERT_TRUE(Initialize()); EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); @@ -1561,16 +1561,17 @@ client_->SendCustomSynchronousRequest(headers, body); - if (VersionUsesHttp3(client_->client() - ->client_session() - ->connection() - ->transport_version())) { - EXPECT_THAT(client_->connection_error(), - IsError(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE)); + if (VersionUsesHttp3(GetClientConnection()->transport_version())) { + // QuicSpdyStream::OnHeadersTooLarge() resets the stream with + // QUIC_HEADERS_TOO_LARGE. This is sent as H3_EXCESSIVE_LOAD, the closest + // HTTP/3 error code, and translated back to QUIC_STREAM_EXCESSIVE_LOAD on + // the receiving side. + EXPECT_THAT(client_->stream_error(), + IsStreamError(QUIC_STREAM_EXCESSIVE_LOAD)); } else { EXPECT_THAT(client_->stream_error(), IsStreamError(QUIC_HEADERS_TOO_LARGE)); - EXPECT_THAT(client_->connection_error(), IsQuicNoError()); } + EXPECT_THAT(client_->connection_error(), IsQuicNoError()); } TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) {
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc index 1a83784..51f7c5c 100644 --- a/quic/core/http/quic_spdy_stream.cc +++ b/quic/core/http/quic_spdy_stream.cc
@@ -615,16 +615,7 @@ } void QuicSpdyStream::OnHeadersTooLarge() { - if (VersionUsesHttp3(transport_version())) { - // TODO(b/124216424): Reset stream with H3_REQUEST_CANCELLED (if client) - // or with H3_REQUEST_REJECTED (if server). - std::string error_message = - quiche::QuicheStrCat("Too large headers received on stream ", id()); - OnUnrecoverableError(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE, - error_message); - } else { - Reset(QUIC_HEADERS_TOO_LARGE); - } + Reset(QUIC_HEADERS_TOO_LARGE); } void QuicSpdyStream::OnInitialHeadersComplete(
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc index 6535328..8a4dfba 100644 --- a/quic/core/http/quic_spdy_stream_test.cc +++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -501,15 +501,18 @@ QuicStreamFrame frame(stream_->id(), false, 0, headers); - EXPECT_CALL( - *connection_, - CloseConnection(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE, - MatchesRegex("Too large headers received on stream \\d+"), - _)); + EXPECT_CALL(*session_, + SendRstStream(stream_->id(), QUIC_HEADERS_TOO_LARGE, 0)); + + auto qpack_decoder_stream = + QuicSpdySessionPeer::GetQpackDecoderSendStream(session_.get()); + // Stream type and stream cancellation. + EXPECT_CALL(*session_, + WritevData(qpack_decoder_stream->id(), _, _, NO_FIN, _, _)) + .Times(2); stream_->OnStreamFrame(frame); - - EXPECT_TRUE(stream_->header_list().empty()); + EXPECT_THAT(stream_->stream_error(), IsStreamError(QUIC_HEADERS_TOO_LARGE)); } TEST_P(QuicSpdyStreamTest, ProcessHeaderListWithFin) {