1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

Update: Use different xmlns depending on root node

This commit is contained in:
Philipp Schafft 2020-10-09 08:10:39 +00:00
parent 2a4ed04671
commit 6ba8ab1db5

View File

@ -449,7 +449,17 @@ void admin_send_response(xmlDocPtr doc,
xmlDocDumpMemory(doc, &buff, &len);
content_type = "text/xml";
} else {
char *json = xml2json_render_doc_simple(doc, "http://icecast.org/specs/legacyresponse-0.0.1");
xmlNodePtr xmlroot = xmlDocGetRootElement(doc);
const char *ns;
char *json;
if (strcmp((const char *)xmlroot->name, "iceresponse") == 0) {
ns = "http://icecast.org/specs/legacyresponse-0.0.1";
} else {
ns = "http://icecast.org/specs/legacystats-0.0.1";
}
json = xml2json_render_doc_simple(doc, ns);
buff = xmlStrdup(XMLSTR(json));
len = strlen(json);
free(json);