Skip to content

Commit 979c336

Browse files
committed
Update: Added warning about JSON rendering
1 parent 29dd621 commit 979c336

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/admin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ void admin_send_response(xmlDocPtr doc,
568568
}
569569

570570
json = xml2json_render_doc_simple(doc, ns);
571-
client_send_buffer(client, 200, "application/json", "utf-8", json, -1, NULL);
571+
client_send_buffer(client, 200, "application/json", "utf-8", json, -1, "Warning: 299 - \"JSON rendering is experimental\"\r\n");
572572
free(json);
573573
}
574574
} else if (response == ADMIN_FORMAT_HTML) {

src/client.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,14 +704,18 @@ void client_send_reportxml(client_t *client, reportxml_t *report, document_domai
704704
}
705705

706706
if (admin_format == ADMIN_FORMAT_RAW || admin_format == ADMIN_FORMAT_JSON) {
707-
char extra_header[512] = "";
707+
static const char json_warning[] = "Warning: 299 - \"JSON rendering is experimental\"\r\n";
708+
char extra_header_buffer[512] = "";
709+
const char *extra_header = extra_header_buffer;
708710

709711
if (location) {
710-
int res = snprintf(extra_header, sizeof(extra_header), "Location: %s\r\n", location);
711-
if (res < 0 || res >= (ssize_t)sizeof(extra_header)) {
712+
int res = snprintf(extra_header_buffer, sizeof(extra_header_buffer), "Location: %s\r\n%s", location, admin_format == ADMIN_FORMAT_JSON ? json_warning : "");
713+
if (res < 0 || res >= (ssize_t)sizeof(extra_header_buffer)) {
712714
client_send_error_by_id(client, ICECAST_ERROR_GEN_HEADER_GEN_FAILED);
713715
return;
714716
}
717+
} else if (admin_format == ADMIN_FORMAT_JSON) {
718+
extra_header = json_warning;
715719
}
716720

717721
if (admin_format == ADMIN_FORMAT_RAW) {

0 commit comments

Comments
 (0)