diff -r ff311b63c3af -r 55298bc9ed28 src/server/daemon/httprequest.c --- a/src/server/daemon/httprequest.c Fri Dec 30 14:15:52 2016 +0100 +++ b/src/server/daemon/httprequest.c Fri Dec 30 18:47:26 2016 +0100 @@ -799,7 +799,7 @@ rq->rq.srvhdrs); } // compare types - if(strcmp(dtp, content_type) != 0) { + if(!contenttype_match(sstr(dtp), sstr(content_type))) { continue; } } @@ -1060,7 +1060,10 @@ return 1; } } else if(cmp[0] == 0) { - /* empty string */ + // empty string + log_ereport( + LOG_WARN, + "Skipped service saf with empty method parameter"); return 0; } @@ -1085,6 +1088,43 @@ } /* + * checks if the content type matches the cmp string + * the format of cmp is a single string with wildcards or a list + * of types (also with wildcard support) + * (type1|type2*) + */ +int contenttype_match(sstr_t cmp, sstr_t ctype) { + if(cmp.ptr[0] != '(') { + if(cmp.ptr[0] == '*') { + cmp.ptr++; + cmp.length--; + return sstrsuffix(ctype, cmp); + } else if(cmp.ptr[cmp.length-1] == '*') { + cmp.length--; + return sstrprefix(ctype, cmp); + } else { + return !sstrcmp(cmp, ctype); + } + } else if(cmp.ptr[0] == 0) { + log_ereport(LOG_WARN, "Skipped service saf with empty type parameter"); + return 0; + } + + cmp = sstrsubsl(cmp, 1, cmp.length - 2); + + int begin = 0; + for(int i=0;i