mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-14 10:29:35 +00:00
Compare the Range unit case-insensitively
RFC 9110 §14.1 makes range unit names case-insensitive, but parse_range_header() matched "bytes=" exactly, so a request with Range: Bytes=1-3 was answered with 416.
This commit is contained in:
1 parent
5107381963
commit
33d84a12b6
2 files changed
+8
-1
No files matched your search
@@ -2033,6 +2033,13 @@ TEST(ParseHeaderValueTest, Range) {
|
||||
EXPECT_EQ(0, ranges[0].first);
|
||||
EXPECT_EQ(-1, ranges[0].second);
|
||||
}
|
||||
|
||||
// RFC 9110 14.1: range unit names are case-insensitive.
|
||||
for (const auto &s : {"Bytes=1-10", "BYTES=1-10", "bYtEs=1-10"}) {
|
||||
Ranges ranges;
|
||||
EXPECT_TRUE(detail::parse_range_header(s, ranges)) << s;
|
||||
EXPECT_EQ((Ranges{{1, 10}}), ranges) << s;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ParseAcceptEncoding1, AcceptEncoding) {
|
||||
|
||||
Reference in new issue
Block a user