diff options
Diffstat (limited to 'src/mhd')
| -rw-r--r-- | src/mhd/mhd_legal.c | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c index 2c412711..dfda58ac 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))  | 
