MINOR: mux: Add a ctl parameter to get the exit status of the multiplexers
The ctl param MUX_EXIT_STATUS can be request to get the exit status of a
multiplexer. For instance, it may be an HTTP status code or an H2 error. For
now, 0 is always returned. When the mux h1 will be able to return HTTP
errors itself, this ctl param will be used to get the HTTP status code from
the logs.
the mux_exit_status enum has been created to map internal mux exist status
to generic one. Thus there is 5 possible status for now: success, invalid
error, timeout error, internal error and unknown.
diff --git a/include/haproxy/connection-t.h b/include/haproxy/connection-t.h
index 61602e7..c79f850 100644
--- a/include/haproxy/connection-t.h
+++ b/include/haproxy/connection-t.h
@@ -312,11 +312,20 @@
/* ctl command used by mux->ctl() */
enum mux_ctl_type {
MUX_STATUS, /* Expects an int as output, sets it to a combinaison of MUX_STATUS flags */
+ MUX_EXIT_STATUS, /* Expects an int as output, sets the mux exist/error/http status, if known or 0 */
};
/* response for ctl MUX_STATUS */
#define MUX_STATUS_READY (1 << 0)
+enum mux_exit_status {
+ MUX_ES_SUCCESS, /* Success */
+ MUX_ES_INVALID_ERR, /* invalid input */
+ MUX_ES_TOUT_ERR, /* timeout */
+ MUX_ES_INTERNAL_ERR, /* internal error */
+ MUX_ES_UNKNOWN /* unknown status (must be the last) */
+};
+
/* socks4 response length */
#define SOCKS4_HS_RSP_LEN 8
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 46c77cb..2c2611b 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -3083,6 +3083,8 @@
if (!(conn->flags & CO_FL_WAIT_XPRT))
ret |= MUX_STATUS_READY;
return ret;
+ case MUX_EXIT_STATUS:
+ return MUX_ES_UNKNOWN;
default:
return -1;
}
diff --git a/src/mux_h1.c b/src/mux_h1.c
index ad9eb51..d2bafff 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -2922,6 +2922,8 @@
if (!(conn->flags & CO_FL_WAIT_XPRT))
ret |= MUX_STATUS_READY;
return ret;
+ case MUX_EXIT_STATUS:
+ return MUX_ES_UNKNOWN;
default:
return -1;
}
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 75874a3..b90c0a1 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -4048,6 +4048,8 @@
if (h2c->st0 >= H2_CS_FRAME_H && h2c->st0 < H2_CS_ERROR)
ret |= MUX_STATUS_READY;
return ret;
+ case MUX_EXIT_STATUS:
+ return MUX_ES_UNKNOWN;
default:
return -1;
}
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 3161d16..b9ad8dc 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -347,6 +347,8 @@
if (!(conn->flags & CO_FL_WAIT_XPRT))
ret |= MUX_STATUS_READY;
return ret;
+ case MUX_EXIT_STATUS:
+ return MUX_ES_UNKNOWN;
default:
return -1;
}