fix(server): use case-insensitive comparison for Expect: 100-continue (#2709)

According to rfc2616#section-14.20 the header value is case-insensitive. Certain clients send the expectation as `100-Continue` and this should be handled by the server.

Closes #2708
This commit is contained in:
Jonathan Murray
2021-11-30 17:58:50 +01:00
committed by GitHub
parent 5f938fffa6
commit 7435cc3399
2 changed files with 37 additions and 1 deletions

View File

@@ -271,7 +271,10 @@ impl Http1Transaction for Server {
}
}
header::EXPECT => {
expect_continue = value.as_bytes() == b"100-continue";
// According to https://datatracker.ietf.org/doc/html/rfc2616#section-14.20
// Comparison of expectation values is case-insensitive for unquoted tokens
// (including the 100-continue token)
expect_continue = value.as_bytes().eq_ignore_ascii_case(b"100-continue");
}
header::UPGRADE => {
// Upgrades are only allowed with HTTP/1.1