From: Willy Tarreau Date: Fri, 10 Jun 2022 07:21:22 +0000 (+0200) Subject: BUG/MINOR: cli/stats: add missing trailing LF after JSON outputs X-Git-Tag: v2.7-dev1~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a0e7ca5d;p=thirdparty%2Fhaproxy.git BUG/MINOR: cli/stats: add missing trailing LF after JSON outputs Patrick Hemmer reported that we have a bug in the CLI commands "show stat json" and "show schema json" in that they forget the trailing LF that's required to mark the end of the response. This has been the case since the introduction of the feature in 1.8-dev1 by commit 6f6bb380e ("MEDIUM: stats: Add show json schema"), so this fix may be backported to all versions. --- diff --git a/src/stats.c b/src/stats.c index dc9b040ffa..f9a520a868 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3667,7 +3667,7 @@ static void stats_dump_json_header() */ static void stats_dump_json_end() { - chunk_strcat(&trash, "]"); + chunk_strcat(&trash, "]\n"); } /* Uses as a pointer to the current proxy and as @@ -4779,6 +4779,7 @@ static void stats_dump_json_schema(struct buffer *out) chunk_appendf(out, "{\"errorStr\":\"output buffer too short\"}"); } + chunk_appendf(out, "\n"); } /* This function dumps the schema onto the stream connector's read buffer.