MHD_request_get_value(): use case-insensitive match

This commit is contained in:
Evgeny Grin (Karlson2k)
2024-12-18 15:20:44 +01:00
parent a6b69c4ea4
commit 7c5e27070a
3 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -5244,8 +5244,8 @@ MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_OUT_SIZE_ (4,3);
*
* @param request request to get values from
* @param kind what kind of value are we looking for
* @param key the header to look for, empty to lookup 'trailing' value
* without a key
* @param key the name of the value looking for (used for case-insensetive
match), empty to lookup 'trailing' value without a key
* @return NULL if no such item was found
* @ingroup request
*/
+2 -2
View File
@@ -685,8 +685,8 @@ MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_OUT_SIZE_ (4,3);
*
* @param request request to get values from
* @param kind what kind of value are we looking for
* @param key the header to look for, empty to lookup 'trailing' value
* without a key
* @param key the name of the value looking for (used for case-insensetive
match), empty to lookup 'trailing' value without a key
* @return NULL if no such item was found
* @ingroup request
*/
+6 -2
View File
@@ -61,7 +61,9 @@ mhd_request_get_value_n (struct MHD_Request *restrict request,
{
if ((key_len == f->field.nv.name.len) &&
(0 != (kind & f->field.kind)) &&
(0 == memcmp (key, f->field.nv.name.cstr, key_len)))
(0 == mhd_str_equal_caseless_bin_n (key,
f->field.nv.name.cstr,
key_len)))
return &(f->field.nv.value);
}
}
@@ -75,7 +77,9 @@ mhd_request_get_value_n (struct MHD_Request *restrict request,
f = mhd_DLINKEDL_GET_NEXT (f, post_fields))
{
if ((key_len == f->field.name.len) &&
(0 == memcmp (key, buf + f->field.name.pos, key_len)))
(0 == mhd_str_equal_caseless_bin_n (key,
buf + f->field.name.pos,
key_len)))
{
f->field_for_app.value.cstr =
(0 == f->field.value.pos) ?