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.
(cherry picked from commit 5a0e7ca5d058f71b72ff296cd51f15eaddb3ad60)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit db06d9ddbbd0d98b6db2d6e70b903636191f75a7)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit a74257dd0f3b79a818f680ddbd8456a571c5d914)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stats.c b/src/stats.c
index ceb6bd8..67385a5 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -3607,7 +3607,7 @@
*/
static void stats_dump_json_end()
{
- chunk_strcat(&trash, "]");
+ chunk_strcat(&trash, "]\n");
}
/* Uses <appctx.ctx.stats.obj1> as a pointer to the current proxy and <obj2> as
@@ -4709,6 +4709,7 @@
chunk_appendf(out,
"{\"errorStr\":\"output buffer too short\"}");
}
+ chunk_appendf(out, "\n");
}
/* This function dumps the schema onto the stream interface's read buffer.