From 1ea7314775280dc6adbfead0a3b2e5b4a4ce623e Mon Sep 17 00:00:00 2001 From: birenroy Date: Fri, 10 Jan 2025 22:32:30 -0500 Subject: [PATCH] http2: updates test coverage for Http2CodecImplTest.CheckHeaderValueValidation (#37966) The only case where codec behavior differs is `\0`, so that case is still skipped. UHV + oghttp2 is also skipped, as otherwise the `compile-time-options` build fails. Commit Message: Additional Description: Risk Level: none, test only Testing: ran codec_impl_test locally Docs Changes: Release Notes: Platform Specific Features: --------- Signed-off-by: Biren Roy --- test/common/http/http2/codec_impl_test.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/common/http/http2/codec_impl_test.cc b/test/common/http/http2/codec_impl_test.cc index c70503507ea0..70d2bd7266ea 100644 --- a/test/common/http/http2/codec_impl_test.cc +++ b/test/common/http/http2/codec_impl_test.cc @@ -4448,18 +4448,29 @@ TEST_P(Http2CodecImplTest, CheckHeaderValueValidation) { scoped_runtime_.mergeValues({{"envoy.reloadable_features.validate_upstream_headers", "false"}}); stream_error_on_invalid_http_messaging_ = true; initialize(); + +#ifdef ENVOY_ENABLE_UHV + // UHV does not appear to reject some header value chars. if (http2_implementation_ == Http2Impl::Oghttp2) { - // oghttp2 fails this test for now. - return; + GTEST_SKIP(); } +#endif // Change one character in the header value and verify that codec correctly // accepts or rejects based on the table above. std::string header_value{"aaaaaaaa"}; for (int i = 0; i <= 0xff; ++i) { + if (i == 0 && http2_implementation_ == Http2Impl::Oghttp2) { + // oghttp2 fails this specific case for now. + continue; + } + TestRequestHeaderMapImpl request_headers; HttpTestUtility::addDefaultHeaders(request_headers); header_value[2] = static_cast(i); + + SCOPED_TRACE(absl::StrCat("header value: [", absl::CEscape(header_value), "]")); + HeaderString header_string("a"); setHeaderStringUnvalidated(header_string, header_value); request_headers.addViaMove(HeaderString(absl::string_view("foo")), std::move(header_string));