]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-h1: Handle MUX_SUBS_RECV flag in h1_ctl() and susbscribe for reads
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 14 Nov 2023 06:45:43 +0000 (07:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 14 Nov 2023 10:01:51 +0000 (11:01 +0100)
The H1 mux now handle MUX_SUBS_RECV flag in h1_ctl(). If it is not already
subscribed for reads, it does so. This patch will be mandatory to properly
handle abortonclose option.

src/mux_h1.c

index ab777a701b420abf2af00bbfe2d8743334f57c63..8980fa11c0155453e16de4ff992046f9f95cea59 100644 (file)
@@ -4805,7 +4805,7 @@ static int h1_resume_fastfwd(struct stconn *sc, unsigned int flags)
 
 static int h1_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *output)
 {
-       const struct h1c *h1c = conn->ctx;
+       struct h1c *h1c = conn->ctx;
        int ret = 0;
 
        switch (mux_ctl) {
@@ -4822,6 +4822,10 @@ static int h1_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *outp
                         ((h1c->errcode >= 400 && h1c->errcode <= 499) ? MUX_ES_INVALID_ERR :
                          MUX_ES_SUCCESS))));
                return ret;
+       case MUX_SUBS_RECV:
+               if (!(h1c->wait_event.events & SUB_RETRY_RECV))
+                       h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
+               return 0;
        default:
                return -1;
        }