]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: Never set SE_FL_EOS without SE_FL_EOI or SE_FL_ERROR
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Apr 2023 06:59:08 +0000 (08:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Apr 2023 06:59:10 +0000 (08:59 +0200)
When end-of-stream is reported by a H2 stream, we must take care to also
report an error is end-of-input was not reported. Indeed, it is now
mandatory to set SE_FL_EOI or SE_FL_ERROR flags when SE_FL_EOS is set.

It is a 2.8-specific issue. No backport needed.

src/mux_h2.c

index 7c553ad8274064daf9bdcc719d77fd57e9368489..2f06db8dcb8696004d8aa500334d4cddd92c7ca5 100644 (file)
@@ -6450,8 +6450,11 @@ static size_t h2_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in
                        if (h2s->flags & H2_SF_BODY_TUNNEL)
                                se_fl_set(h2s->sd, SE_FL_EOS);
                }
-               if (h2c_read0_pending(h2c) || h2s->st == H2_SS_CLOSED)
+               if (h2c_read0_pending(h2c) || h2s->st == H2_SS_CLOSED) {
                        se_fl_set(h2s->sd, SE_FL_EOS);
+                       if (!se_fl_test(h2s->sd, SE_FL_EOI))
+                               se_fl_set(h2s->sd, SE_FL_ERROR);
+               }
                if (se_fl_test(h2s->sd, SE_FL_ERR_PENDING))
                        se_fl_set(h2s->sd, SE_FL_ERROR);
                if (b_size(&h2s->rxbuf)) {