Validate request headers in H3Stream. Override QuicSpdyServerStreamBase::ValidateReceivedHeaders() in H3Stream to allow uppercase characters in header names. (CONNECT method is currently not implemented.) PiperOrigin-RevId: 574867858
diff --git a/quiche/http2/adapter/header_validator.cc b/quiche/http2/adapter/header_validator.cc index 12e01eb..d091fde 100644 --- a/quiche/http2/adapter/header_validator.cc +++ b/quiche/http2/adapter/header_validator.cc
@@ -74,12 +74,6 @@ return true; } -bool IsValidHeaderName(absl::string_view name) { - static const CharMap valid_chars = - BuildValidCharMap(kHttp2HeaderNameAllowedChars); - return AllCharsInMap(name, valid_chars); -} - bool IsValidStatus(absl::string_view status) { static const CharMap valid_chars = BuildValidCharMap(kHttp2StatusValueAllowedChars); @@ -240,6 +234,12 @@ return false; } +bool HeaderValidator::IsValidHeaderName(absl::string_view name) { + static const CharMap valid_chars = + BuildValidCharMap(kHttp2HeaderNameAllowedChars); + return AllCharsInMap(name, valid_chars); +} + bool HeaderValidator::IsValidHeaderValue(absl::string_view value, ObsTextOption option) { static const CharMap valid_chars =
diff --git a/quiche/http2/adapter/header_validator.h b/quiche/http2/adapter/header_validator.h index e9ebc8d..f1c8497 100644 --- a/quiche/http2/adapter/header_validator.h +++ b/quiche/http2/adapter/header_validator.h
@@ -26,8 +26,13 @@ // present for the given header type. bool FinishHeaderBlock(HeaderType type) override; - // Returns whether `value` is valid according to RFC 9110 Section 5.5 and RFC - // 9112 Section 8.2.1. + // Returns whether `name` is valid according to RFC 9110 Section 5.1. + // ':' is an invalid character, therefore HTTP/2 pseudo-headers must be + // validated with the leading colon removed. + static bool IsValidHeaderName(absl::string_view name); + + // Returns whether `value` is valid according to RFC 9110 Section 5.5 and + // RFC 9113 Section 8.2.1. static bool IsValidHeaderValue(absl::string_view value, ObsTextOption ops_text_option);