Don't require casing to match in the HTTP upgrade header. (#1)

Motivation:

The HTTP upgrade handler should not require that we case-match with
the mandatory headers.

Modifications:

Treat all headers as lowercase.

Result:

Upgrade is easier.
This commit is contained in:
Cory Benfield authored and Norman Maurer committed 2018-02-21 20:15:12 +01:00
1 parent de0bc1ed83
commit c8c8dbf2a2
3 files changed
+33 -1

No files matched your search

+1 -1
View File
@@ -125,7 +125,7 @@ public class HTTPServerUpgradeHandler: ChannelInboundHandler {
continue
}
let requiredHeaders = Set(upgrader.requiredUpgradeHeaders)
let requiredHeaders = Set(upgrader.requiredUpgradeHeaders.map { $0.lowercased() })
guard requiredHeaders.isSubset(of: allHeaderNames) && requiredHeaders.isSubset(of: connectionHeader) else {
continue
}