Skip to content

Commit

Permalink
http2: updates test coverage for Http2CodecImplTest.CheckHeaderValueV…
Browse files Browse the repository at this point in the history
…alidation (#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 <[email protected]>
  • Loading branch information
birenroy authored Jan 11, 2025
1 parent 81cd00f commit 1ea7314
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/common/http/http2/codec_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<char>(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));
Expand Down

0 comments on commit 1ea7314

Please sign in to comment.