aboutsummaryrefslogtreecommitdiff
path: root/src/mhd
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-07-05 18:18:23 +0200
committerChristian Grothoff <christian@grothoff.org>2023-07-05 18:18:23 +0200
commit40dfb94e0f16928cc79147671492e58b827e2251 (patch)
treef9b3809960e52ca34c340624fbdb9519cdc01bab /src/mhd
parent1db17d43bd9256ec86508bf9e282263e35fd9e01 (diff)
fix mime-type matching (#7882)
Diffstat (limited to 'src/mhd')
-rw-r--r--src/mhd/mhd_legal.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index 2c4127117..bec33cd48 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -126,10 +126,14 @@ mime_matches (const char *accept_pattern,
{
const char *da = strchr (accept_pattern, '/');
const char *dm = strchr (mime, '/');
+ const char *end;
if ( (NULL == da) ||
(NULL == dm) )
return (0 == strcmp ("*", accept_pattern));
+ end = strchr (da, ';');
+ if (NULL == end)
+ end = &da[strlen (da)];
return
( ( (1 == da - accept_pattern) &&
('*' == *accept_pattern) ) ||
@@ -138,8 +142,9 @@ mime_matches (const char *accept_pattern,
mime,
da - accept_pattern)) ) ) &&
( (0 == strcmp (da, "/*")) ||
- (0 == strcasecmp (da,
- dm)) );
+ (0 == strncasecmp (da,
+ dm,
+ end - da)) );
}
@@ -150,7 +155,7 @@ TALER_MHD_xmime_matches (const char *accept_pattern,
char *ap = GNUNET_strdup (accept_pattern);
char *sptr;
- for (const char *tok = strtok_r (ap, ";", &sptr);
+ for (const char *tok = strtok_r (ap, ",", &sptr);
NULL != tok;
tok = strtok_r (NULL, ";", &sptr))
{