]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stats: Apply proper styles in HTML status page.
authorFlorian Apolloner <florian@apolloner.eu>
Tue, 30 Mar 2021 11:28:35 +0000 (13:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Mar 2021 14:57:22 +0000 (16:57 +0200)
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").

src/stats.c

index e54d13adffbeb5a55d10b6f68612ae1b0e5a1a7e..bfd05bbe2b4a314582fcfb8806b2c5f9c68f702b 100644 (file)
@@ -1079,13 +1079,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) {