diff --git a/src/admin.c b/src/admin.c index 6254e06d..d0c16fe3 100644 --- a/src/admin.c +++ b/src/admin.c @@ -568,7 +568,7 @@ void admin_send_response(xmlDocPtr doc, } json = xml2json_render_doc_simple(doc, ns); - client_send_buffer(client, 200, "application/json", "utf-8", json, -1, NULL); + client_send_buffer(client, 200, "application/json", "utf-8", json, -1, "Warning: 299 - \"JSON rendering is experimental\"\r\n"); free(json); } } else if (response == ADMIN_FORMAT_HTML) { diff --git a/src/client.c b/src/client.c index 9239a4ac..2043fc2a 100644 --- a/src/client.c +++ b/src/client.c @@ -704,14 +704,18 @@ void client_send_reportxml(client_t *client, reportxml_t *report, document_domai } if (admin_format == ADMIN_FORMAT_RAW || admin_format == ADMIN_FORMAT_JSON) { - char extra_header[512] = ""; + static const char json_warning[] = "Warning: 299 - \"JSON rendering is experimental\"\r\n"; + char extra_header_buffer[512] = ""; + const char *extra_header = extra_header_buffer; if (location) { - int res = snprintf(extra_header, sizeof(extra_header), "Location: %s\r\n", location); - if (res < 0 || res >= (ssize_t)sizeof(extra_header)) { + int res = snprintf(extra_header_buffer, sizeof(extra_header_buffer), "Location: %s\r\n%s", location, admin_format == ADMIN_FORMAT_JSON ? json_warning : ""); + if (res < 0 || res >= (ssize_t)sizeof(extra_header_buffer)) { client_send_error_by_id(client, ICECAST_ERROR_GEN_HEADER_GEN_FAILED); return; } + } else if (admin_format == ADMIN_FORMAT_JSON) { + extra_header = json_warning; } if (admin_format == ADMIN_FORMAT_RAW) {