]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-fcgi: Never set SE_FL_EOS without SE_FL_EOI or SE_FL_ERROR
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 11 May 2023 09:16:59 +0000 (11:16 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 11 May 2023 13:37:04 +0000 (15:37 +0200)
When end-of-stream is reported by a FCGI stream, we must take care to also
report an error if 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_fcgi.c

index 5ccf2aed3822762b946b67f3f738dcda1bf65a5a..f41578c76b9de724edfc2fba46494524254b1ec1 100644 (file)
@@ -3883,8 +3883,11 @@ static size_t fcgi_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count,
                        if (!(fstrm->h1m.flags & (H1_MF_VER_11|H1_MF_XFER_LEN)))
                                se_fl_set(fstrm->sd, SE_FL_EOS);
                }
-               if (fcgi_conn_read0_pending(fconn))
+               if (fcgi_conn_read0_pending(fconn)) {
                        se_fl_set(fstrm->sd, SE_FL_EOS);
+                       if (!se_fl_test(fstrm->sd, SE_FL_EOI))
+                               se_fl_set(fstrm->sd, SE_FL_ERROR);
+               }
                if (se_fl_test(fstrm->sd, SE_FL_ERR_PENDING))
                        se_fl_set(fstrm->sd, SE_FL_ERROR);
                fcgi_release_buf(fconn, &fstrm->rxbuf);