Merge commit from fork

This commit is contained in:
Fabian Fett authored and GitHub committed 2026-05-20 10:08:41 +01:00
1 parent 81cc18264f
commit 61d1b44f6e
4 files changed
+276 -3

No files matched your search

+10
View File
@@ -783,11 +783,21 @@ extension HPACKHeaders {
}
if let headerValue = headerValue {
if !Self.isValidPseudoHeaderValue(headerValue) {
throw NIOHTTP2Errors.invalidPseudoHeaderValue(name: name, value: headerValue)
}
return headerValue
} else {
throw NIOHTTP2Errors.missingPseudoHeader(name)
}
}
static func isValidPseudoHeaderValue(_ value: String) -> Bool {
// Pseudo-header values must not contain CR, LF, or NUL bytes. These characters could
// enable HTTP/2-to-HTTP/1.1 request smuggling when the value is placed into an HTTP/1.1
// message (e.g. :path becomes the request-target).
!value.utf8.contains(where: { $0 == 0x0A || $0 == 0x0D || $0 == 0x00 })
}
}
extension HTTPHeaders {