mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-27 20:58:28 +00:00
Match Content-Disposition parameter names case-insensitively (#2698)
parse_disposition_params stored parameter names as they arrived, while FormDataParser looks up "name", "filename" and "filename*" in lower case. A part with NAME= was rejected with 400, and one with FILENAME*= was silently treated as a plain field. Parameter names are case-insensitive (RFC 2045 section 5.1), so the names are now lowercased when stored, as extract_media_type already does for Content-Type. Values keep their case.
This commit is contained in:
1 parent
bb00fece7c
commit
d5befb4326
2 files changed
+6
-1
No files matched your search
@@ -10180,8 +10180,10 @@ inline void parse_disposition_params(const std::string &s, Params ¶ms) {
|
||||
std::string val;
|
||||
divide_param_pair(b, e, key, val);
|
||||
|
||||
// Parameter names are case-insensitive (RFC 2045 §5.1)
|
||||
if (!key.empty()) {
|
||||
params.emplace(trim_double_quotes_copy(key), unquote_param(val));
|
||||
params.emplace(case_ignore::to_lower(trim_double_quotes_copy(key)),
|
||||
unquote_param(val));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user