From: Christopher Faulet Date: Thu, 11 May 2023 09:16:59 +0000 (+0200) Subject: BUG/MEDIUM: mux-fcgi: Never set SE_FL_EOS without SE_FL_EOI or SE_FL_ERROR X-Git-Tag: v2.8-dev12~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a272c39330f729e37a5e2b9447d421bfa12c2d92;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mux-fcgi: Never set SE_FL_EOS without SE_FL_EOI or SE_FL_ERROR 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. --- diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 5ccf2aed38..f41578c76b 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -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);