1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Feature: Workaround for xmlns set as property

This commit is contained in:
Philipp Schafft 2020-10-07 19:23:12 +00:00
parent 30f9e89e26
commit b9652444ff

View File

@ -502,8 +502,9 @@ static void render_node_generic(json_renderer_t *renderer, xmlDocPtr doc, xmlNod
static void render_node(json_renderer_t *renderer, xmlDocPtr doc, xmlNodePtr node, xmlNodePtr parent, struct xml2json_cache *cache)
{
void (*render)(json_renderer_t *renderer, xmlDocPtr doc, xmlNodePtr node, xmlNodePtr parent, struct xml2json_cache *cache) = NULL;
xmlChar * workaroundProp = xmlGetProp(node, XMLSTR("xmlns"));
if (node->ns == cache->ns)
if (node->ns == cache->ns && !workaroundProp)
render = cache->render;
if (render == NULL) {
@ -512,6 +513,10 @@ static void render_node(json_renderer_t *renderer, xmlDocPtr doc, xmlNodePtr nod
if (node->ns && node->ns->href)
href = (const char *)node->ns->href;
if (!href) {
href = (const char *)workaroundProp;
}
if (href) {
if (strcmp(href, "http://icecast.org/specs/legacyresponse-0.0.1") == 0) {
render = render_node_legacyresponse;
@ -527,6 +532,9 @@ static void render_node(json_renderer_t *renderer, xmlDocPtr doc, xmlNodePtr nod
cache->render = render;
}
if (workaroundProp)
xmlFree(workaroundProp);
render(renderer, doc, node, parent, cache);
}