Validate no uppercase characters in header field names. (#84)

Motivation:

RFC 7540 forbids uppercase characters in header field names, but we
currently allow them. We shouldn't.

This is the first in a series of patches that will validate header blocks
when reasonable. As a result, it seems larger than necessary, as it adds
a bunch of scaffolding for extending with further validation code.

Modifications:

- Added header field validation scaffolding.
- Validates that header field names do not contain uppercase chars.
- Allows sending RST_STREAM frame before stream setup.

Result:

Better header field validation.
This commit is contained in:
Cory Benfield authored and GitHub committed 2019-04-05 18:01:22 +02:00
1 parent 70ac404a42
commit 74b8f4f110
13 files changed
+470 -63

No files matched your search

+9
View File
@@ -210,6 +210,15 @@ public enum NIOHTTP2Errors {
self.streamID = streamID
}
}
/// An attempt was made to send a header field with a field name that is not valid in HTTP/2.
public struct InvalidHTTP2HeaderFieldName: NIOHTTP2Error {
public var fieldName: String
public init(_ fieldName: String) {
self.fieldName = fieldName
}
}
}