diff --git a/source/common/quic/envoy_quic_server_stream.cc b/source/common/quic/envoy_quic_server_stream.cc index 5ff28165733e..16a120280cb3 100644 --- a/source/common/quic/envoy_quic_server_stream.cc +++ b/source/common/quic/envoy_quic_server_stream.cc @@ -142,7 +142,7 @@ void EnvoyQuicServerStream::OnInitialHeadersComplete(bool fin, size_t frame_len, } std::unique_ptr headers = quicHeadersToEnvoyHeaders(header_list); - if (!Http::HeaderUtility::authorityIsValid(headers->Host()->value().getStringView())) { + if (Http::HeaderUtility::requestHeadersValid(*headers) != absl::nullopt) { stream_delegate()->OnStreamError(quic::QUIC_HTTP_FRAME_ERROR, "Invalid headers"); return; } diff --git a/test/integration/quic_http_integration_test.cc b/test/integration/quic_http_integration_test.cc index 893aa7be7357..7c2d5d63f89c 100644 --- a/test/integration/quic_http_integration_test.cc +++ b/test/integration/quic_http_integration_test.cc @@ -545,6 +545,21 @@ TEST_P(QuicHttpIntegrationTest, Reset101SwitchProtocolResponse) { EXPECT_FALSE(response->complete()); } +TEST_P(QuicHttpIntegrationTest, ResetRequestWithoutAuthorityHeader) { + initialize(); + + codec_client_ = makeHttpConnection(lookupPort("http")); + auto encoder_decoder = codec_client_->startRequest(Http::TestRequestHeaderMapImpl{ + {":method", "GET"}, {":path", "/dynamo/url"}, {":scheme", "http"}}); + request_encoder_ = &encoder_decoder.first; + auto response = std::move(encoder_decoder.second); + + response->waitForEndStream(); + codec_client_->close(); + ASSERT_TRUE(response->complete()); + EXPECT_EQ("400", response->headers().getStatusValue()); +} + TEST_P(QuicHttpIntegrationTest, MultipleSetCookieAndCookieHeaders) { initialize();