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
@@ -9189,7 +9189,7 @@ inline bool parse_range_header(const std::string &s, Ranges &ranges) try {
|
||||
return std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
|
||||
};
|
||||
|
||||
if (s.size() > 7 && s.compare(0, 6, "bytes=") == 0) {
|
||||
if (s.size() > 7 && case_ignore::equal(s.substr(0, 6), "bytes=")) {
|
||||
const auto pos = static_cast<size_t>(6);
|
||||
const auto len = static_cast<size_t>(s.size() - 6);
|
||||
auto all_valid_ranges = true;
|
||||
|
||||
Reference in new issue
Block a user