summaryrefslogtreecommitdiff
path: root/src/mhd/mhd_legal.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-07-10 10:25:29 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-07-10 10:25:29 +0200
commit6107e995595d4057afaa0431f3af9afdce32feea (patch)
tree80879300924d0f7d574741bb4059d4b7645fbe6d /src/mhd/mhd_legal.c
parent3024dc9fa54e8677b4816e56f8d215556a7d5561 (diff)
parentc05f832048f06dfcd0a7fd003c0b7033df07c3c4 (diff)
downloadexchange-6107e995595d4057afaa0431f3af9afdce32feea.tar.gz
exchange-6107e995595d4057afaa0431f3af9afdce32feea.tar.bz2
exchange-6107e995595d4057afaa0431f3af9afdce32feea.zip
Merge branch 'master' of ssh://git.taler.net/exchange
Diffstat (limited to 'src/mhd/mhd_legal.c')
-rw-r--r--src/mhd/mhd_legal.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index 2c4127117..dfda58ac9 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -126,10 +126,17 @@ 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));
+ /* FIXME: eventually, we might want to parse the "q=$FLOAT"
+ part after the ';' and figure out which one is the
+ best/preferred match instead of returning a boolean... */
+ end = strchr (da, ';');
+ if (NULL == end)
+ end = &da[strlen (da)];
return
( ( (1 == da - accept_pattern) &&
('*' == *accept_pattern) ) ||
@@ -138,8 +145,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,9 +158,9 @@ 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))
+ tok = strtok_r (NULL, ",", &sptr))
{
if (mime_matches (tok,
mime))