summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faulet <cfaulet@haproxy.com>2023-05-11 11:33:05 +0200
committerChristopher Faulet <cfaulet@haproxy.com>2023-05-11 15:37:04 +0200
commitefebff35bb958ba72850323696f88b2b4f6592f4 (patch)
tree524951f123cf10a09d5f16fa657c42e4db99c5d1
parenta272c39330f729e37a5e2b9447d421bfa12c2d92 (diff)
downloadhaproxy-efebff35bb958ba72850323696f88b2b4f6592f4.tar.gz
BUG/MEDIUM: mux-fcgi: Don't request more room if mux is waiting for more data
A mux must never report it is waiting for room in the channel buffer if this buffer is empty. Because there is nothing the application layer can do to unblock the situation. Indeed, when this happens, it means the mux is waiting for data to progress. It typically happens when all headers are not received. In the FCGI mux, if some data remain in the RX buffer but the channel buffer is empty, it does no longer report it is waiting for room. This patch should fix the issue #2150. It must be backported as far as 2.6.
-rw-r--r--src/mux_fcgi.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index f41578c76..a5a192402 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -3874,8 +3874,15 @@ static size_t fcgi_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count,
else
TRACE_STATE("fstrm rxbuf not allocated", FCGI_EV_STRM_RECV|FCGI_EV_FSTRM_BLK, fconn->conn, fstrm);
- if (b_data(&fstrm->rxbuf))
- se_fl_set(fstrm->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
+ if (b_data(&fstrm->rxbuf)) {
+ /* If the channel buffer is not empty, consider the mux is
+ * blocked because it needs more room. But if the channel buffer
+ * is empty, it means partial data were received and the mux
+ * needs to receive more data to be able to parse it.
+ */
+ if (b_data(buf))
+ se_fl_set(fstrm->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
+ }
else {
se_fl_clr(fstrm->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
if (fstrm->state == FCGI_SS_ERROR || (fstrm->h1m.state == H1_MSG_DONE)) {