BUG/MINOR: rhttp: prevent listener suspend

Ensure "disable frontend" on a reverse HTTP listener is forbidden by
returing -1 on suspend callback. Suspending such a listener has unknown
effect and so is not properly implemented for now.

This should be backported up to 2.9.
This commit is contained in:
Amaury Denoyelle 2024-05-16 17:35:31 +02:00
parent ceebb09744
commit 2770ef352e
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,7 @@ int rhttp_bind_receiver(struct receiver *rx, char **errmsg);
int rhttp_bind_listener(struct listener *listener, char *errmsg, int errlen);
void rhttp_enable_listener(struct listener *l);
void rhttp_disable_listener(struct listener *l);
int rhttp_suspend_listener(struct listener *l);
struct connection *rhttp_accept_conn(struct listener *l, int *status);
void rhttp_unbind_receiver(struct listener *l);
int rhttp_set_affinity(struct connection *conn, int new_tid);

View File

@ -33,6 +33,7 @@ struct protocol proto_rhttp = {
.listen = rhttp_bind_listener,
.enable = rhttp_enable_listener,
.disable = rhttp_disable_listener,
.suspend = rhttp_suspend_listener,
.add = default_add_listener,
.unbind = rhttp_unbind_receiver,
.resume = default_resume_listener,
@ -370,6 +371,13 @@ int rhttp_bind_listener(struct listener *listener, char *errmsg, int errlen)
return ERR_ALERT | ERR_FATAL;
}
/* Do not support "disable frontend" for rhttp protocol. */
int rhttp_suspend_listener(struct listener *l)
{
send_log(l->bind_conf->frontend, LOG_ERR, "cannot disable a reverse-HTTP listener.\n");
return -1;
}
void rhttp_enable_listener(struct listener *l)
{
if (l->rx.rhttp.state < LI_PRECONN_ST_INIT) {