From cc29da83d35106c11178de9a66eb532512a3b33e Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Tue, 30 Mar 2021 13:28:35 +0200 Subject: [PATCH] BUG/MINOR: stats: Apply proper styles in HTML status page. When a backend is in status DOWN and going UP it is currently displayed as yellow ("active UP, going down") instead of orange ("active DOWN, going UP"). This patches restyles the table rows to actually match the legend. This may be backported to any version, the issue appeared in 1.7-dev2 with commit 0c378efe8 ("MEDIUM: stats: compute the color code only in the HTML form"). (cherry picked from commit 39272c28bffcf57c050703b356c9381df454dea7) Signed-off-by: Willy Tarreau (cherry picked from commit 4253ce683402dfbcc6f08b60e42803aafe13147b) Signed-off-by: Willy Tarreau (cherry picked from commit 001d8345357d245f93cad0477116a242acd82ec8) Signed-off-by: Willy Tarreau --- src/stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stats.c b/src/stats.c index 6786965..a3720f2 100644 --- a/src/stats.c +++ b/src/stats.c @@ -907,13 +907,13 @@ static int stats_dump_fields_html(struct buffer *out, strcmp(field_str(stats, ST_F_STATUS), "DOWN (agent)") == 0) { style = "down"; } - else if (strcmp(field_str(stats, ST_F_STATUS), "DOWN ") == 0) { + else if (strncmp(field_str(stats, ST_F_STATUS), "DOWN ", strlen("DOWN ")) == 0) { style = "going_up"; } else if (strcmp(field_str(stats, ST_F_STATUS), "DRAIN") == 0) { style = "draining"; } - else if (strcmp(field_str(stats, ST_F_STATUS), "NOLB ") == 0) { + else if (strncmp(field_str(stats, ST_F_STATUS), "NOLB ", strlen("NOLB ")) == 0) { style = "going_down"; } else if (strcmp(field_str(stats, ST_F_STATUS), "NOLB") == 0) { -- 1.7.10.4