From: Christopher Faulet Date: Wed, 15 Jul 2020 13:46:30 +0000 (+0200) Subject: BUG/MINOR: mux-fcgi: Handle empty STDERR record X-Git-Tag: v2.3-dev1~17 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=7f85433a912529c5cda1629001b34fd2b2e54758;p=haproxy-2.5.git BUG/MINOR: mux-fcgi: Handle empty STDERR record As mentionned in the FastCGI specification, FCGI "streams" are series of non-empty stream records (length != 0), followed by an empty one. It is properly handled for FCGI_STDOUT records, but not for FCGI_STDERR ones. If an empty FCGI_STDERR record is received, the connection is blocked waiting for data which will never come. To fix the bug, when an empty FCGI_STDERR record is received, we drop it, eating the padding if any. This patch should fix the issue #743. It must be backported as far as 2.1. --- diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 58d4923..d1094d9 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -2355,7 +2355,7 @@ static int fcgi_strm_handle_stderr(struct fcgi_conn *fconn, struct fcgi_strm *fs dbuf = &fconn->dbuf; /* Only padding remains */ - if (fconn->state == FCGI_CS_RECORD_P) + if (fconn->state == FCGI_CS_RECORD_P || !fconn->drl) goto end_transfer; if (b_data(dbuf) < (fconn->drl + fconn->drp) &&