mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Update: Use different xmlns depending on root node
This commit is contained in:
parent
2a4ed04671
commit
6ba8ab1db5
12
src/admin.c
12
src/admin.c
@ -449,7 +449,17 @@ void admin_send_response(xmlDocPtr doc,
|
|||||||
xmlDocDumpMemory(doc, &buff, &len);
|
xmlDocDumpMemory(doc, &buff, &len);
|
||||||
content_type = "text/xml";
|
content_type = "text/xml";
|
||||||
} else {
|
} 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));
|
buff = xmlStrdup(XMLSTR(json));
|
||||||
len = strlen(json);
|
len = strlen(json);
|
||||||
free(json);
|
free(json);
|
||||||
|
Loading…
Reference in New Issue
Block a user