Enforce pseudo-headers must be first in a header block. (#90)

Motivation:

RFC 7540 requires that HTTP/2 pseudo-headers must be first in a HTTP/2
header block, and must occur before any regular headers. We should enforce
that requirement.

Modifications:

- Added checking that pseudo-headers are first in a header block.

Result:

Better RFC 7540 validation.
This commit is contained in:
Cory Benfield authored and GitHub committed 2019-04-11 14:22:01 +01:00
1 parent 99e35a8ebb
commit 80b243d8a5
4 files changed
+137 -9

No files matched your search

+9
View File
@@ -172,6 +172,15 @@ public enum NIOHTTP2Errors {
}
}
/// A header block contained a pseudo-header after a regular header.
public struct PseudoHeaderAfterRegularHeader: NIOHTTP2Error {
public var name: String
public init(_ name: String) {
self.name = name
}
}
/// An outbound request was about to be sent, but does not contain a Host header.
public struct MissingHostHeader: NIOHTTP2Error {
public init() { }