Ignore duplicate tags in DAAP requests

This commit is contained in:
ejurgensen 2013-12-16 22:09:18 +01:00
parent b5247aab1d
commit e79e11108e

View File

@ -580,6 +580,7 @@ parse_meta(struct evhttp_request *req, char *tag, const char *param, const struc
int nmeta;
int i;
int n;
metastr = strdup(param);
if (!metastr)
@ -611,6 +612,10 @@ parse_meta(struct evhttp_request *req, char *tag, const char *param, const struc
field = strtok_r(metastr, ",", &ptr);
for (i = 0; i < nmeta; i++)
{
for (n = 0; (n < i) && (strcmp(field, meta[n]->desc) != 0); n++);
if (n == i)
{
meta[i] = dmap_find_field(field, strlen(field));
@ -618,6 +623,14 @@ parse_meta(struct evhttp_request *req, char *tag, const char *param, const struc
{
DPRINTF(E_WARN, L_DAAP, "Could not find requested meta field '%s'\n", field);
i--;
nmeta--;
}
}
else
{
DPRINTF(E_WARN, L_DAAP, "Parser will ignore duplicate occurrence of meta field '%s'\n", field);
i--;
nmeta--;
}