]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Set EOI on SE during demux when both side are in DONE state
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Sep 2024 06:46:04 +0000 (08:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Sep 2024 07:00:13 +0000 (09:00 +0200)
For now, this case is already handled for all requests except for those
waiting for a tunnel establishment (CONNECT and protocol upgrades). It is
not an issue because only bodyless requests are supported in these cases. So
the request is always finished at the end of headers and therefore before
the response.

However, to relax conditions for full H1 protocol upgrades (H1 client and
server), this case will be necessary. Indeed, the idea is to be able to
perform protocol upgrades for requests with a payload. Today, the "Upgrade:"
header is removed before sending the request to the server. But to support
this case, this patch is required to properly finish transaction when the
server does not perform the upgrade.

src/mux_h1.c

index 13066ced6e23928cde8599cf2499357487440d51..88523a991fc2a0b73fcfca3cdeec85fdfa01334a 100644 (file)
@@ -2228,13 +2228,15 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
 
        /* Set EOI on stream connector in DONE state iff:
         *  - it is a response
+        *  - it is a request and the response is DONE too
         *  - it is a request but no a protocol upgrade nor a CONNECT
         *
         * If not set, Wait the response to do so or not depending on the status
         * code.
         */
-       if (((h1m->state == H1_MSG_DONE) && (h1m->flags & H1_MF_RESP)) ||
-           ((h1m->state == H1_MSG_DONE) && (h1s->meth != HTTP_METH_CONNECT) && !(h1m->flags & H1_MF_CONN_UPG)))
+       if ((h1m->state == H1_MSG_DONE) && ((h1m->flags & H1_MF_RESP) ||
+                                           (h1s->res.state == H1_MSG_DONE) ||
+                                           ((h1s->meth != HTTP_METH_CONNECT) && !(h1m->flags & H1_MF_CONN_UPG))))
                se_fl_set(h1s->sd, SE_FL_EOI);
 
   out: