upnpsoap: Work around some bad SearchCriteria
The Control4 app apparently sends us badly-formatted SearchCriteria, where they don't quote the upnp:class value. So we'll add it in for them if we detect that situation. Fixes: SF Patches #173 (DLNA search query not as minidlna expects)
This commit is contained in:
parent
f2294ebea8
commit
fa20ca8526
38
upnpsoap.c
38
upnpsoap.c
@ -1035,6 +1035,7 @@ callback(void *args, int argc, char **argv, char **azColName)
|
||||
sql_get_int_field(db, "SELECT WATCH_COUNT from BOOKMARKS where ID = '%s'", detailID));
|
||||
}
|
||||
}
|
||||
free(alt_title);
|
||||
if( artist ) {
|
||||
if( (*mime == 'v') && (passed_args->filter & FILTER_UPNP_ACTOR) ) {
|
||||
ret = strcatf(str, "<upnp:actor>%s</upnp:actor>", artist);
|
||||
@ -1172,7 +1173,6 @@ callback(void *args, int argc, char **argv, char **azColName)
|
||||
"</sec:CaptionInfoEx>",
|
||||
lan_addr[passed_args->iface].str, runtime_vars.port, detailID);
|
||||
}
|
||||
free(alt_title);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1522,7 +1522,7 @@ parse_search_criteria(const char *str, char *sep)
|
||||
{
|
||||
struct string_s criteria;
|
||||
int len;
|
||||
int literal = 0, like = 0;
|
||||
int literal = 0, like = 0, class = 0;
|
||||
const char *s;
|
||||
|
||||
if (!str)
|
||||
@ -1572,13 +1572,17 @@ parse_search_criteria(const char *str, char *sep)
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
if (strncmp(s, "object.", 7) == 0)
|
||||
s += 7;
|
||||
else if (strncmp(s, "object\"", 7) == 0 ||
|
||||
strncmp(s, "object"", 12) == 0)
|
||||
if (class)
|
||||
{
|
||||
s += 6;
|
||||
continue;
|
||||
class = 0;
|
||||
if (strncmp(s, "object.", 7) == 0)
|
||||
s += 7;
|
||||
else if (strncmp(s, "object\"", 7) == 0 ||
|
||||
strncmp(s, "object"", 12) == 0)
|
||||
{
|
||||
s += 6;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
default:
|
||||
charcat(&criteria, *s);
|
||||
@ -1720,11 +1724,29 @@ parse_search_criteria(const char *str, char *sep)
|
||||
else
|
||||
charcat(&criteria, *s);
|
||||
break;
|
||||
case 'o':
|
||||
if (class)
|
||||
{
|
||||
if (strncmp(s, "object.", 7) == 0)
|
||||
{
|
||||
s += 7;
|
||||
charcat(&criteria, '"');
|
||||
while (*s && !isspace(*s))
|
||||
{
|
||||
charcat(&criteria, *s);
|
||||
s++;
|
||||
}
|
||||
charcat(&criteria, '"');
|
||||
}
|
||||
class = 0;
|
||||
continue;
|
||||
}
|
||||
case 'u':
|
||||
if (strncmp(s, "upnp:class", 10) == 0)
|
||||
{
|
||||
strcatf(&criteria, "o.CLASS");
|
||||
s += 10;
|
||||
class = 1;
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(s, "upnp:actor", 10) == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user