Hi there,
I am a first time contributor, so please be gentle -- I most certainly
did something wrong. I tried to follow as much as possible of the
CONTRIBUTING file but I most likely CC'ed the wrong person or something
(if that is the case, I apologize in advance).
While playing with HAProxy I noticed that the status page currently does
not ever seem to show a backend as orange ("active DOWN, going up"). If
I read the code correctly this is due to a broken usage of strcmp which
tries to compare "DOWN 3/5" with "DOWN " (note the trailing blank). I
have adjusted it to strncmp and now backends that are down and going up
are displayed orange again. I have also done the same for the "NOLB " case.
I'll be happy to answer any questions you have or work further on the patch.
I am not subscribed to the list and would appreciate if you kept me in CC.
Cheers,
Florian
>From 07fc8dbcd996203fec6d78c550584306f6225ded Mon Sep 17 00:00:00 2001
From: Florian Apolloner <[email protected]>
Date: Tue, 30 Mar 2021 13:28:35 +0200
Subject: [PATCH] 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 UP, going
down"). This patches restyles the table rows to actually match the
legend.
---
src/stats.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stats.c b/src/stats.c
index e54d13adf..bfd05bbe2 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -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) {
--
2.30.2