BUG/MINOR: mux-fcgi: Be sure to send empty STDING record in case of zero-copy

When the last HTX DATA block was copied in zero-copy, the empty STDIN
record, marking the end of the request data was never sent. Thanks to this
patch, it is now sent.

This patch must be backported as far as 2.4.

(cherry picked from commit e8c7fb35882c453c7d1c2e923a3782a9348d8c5b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit df5fcf4146fe6284d359d1b33d4ca86edbeb16e2)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b23d243b9978cf54546b815b102cc303434747c3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 83c57a4..f7b666d 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -2188,9 +2188,10 @@
 	size = htx_get_blksz(blk);
 	if (unlikely(size == count && htx_nbblks(htx) == 1 && type == HTX_BLK_DATA)) {
 		void *old_area = mbuf->area;
+		int eom = (htx->flags & HTX_FL_EOM);
 
 		 /* Last block of the message: Reserve the size for the empty stdin record */
-		if (htx->flags & HTX_FL_EOM)
+		if (eom)
 			extra_bytes = FCGI_RECORD_HEADER_SZ;
 
 		if (b_data(mbuf)) {
@@ -2226,6 +2227,8 @@
 
 		htx = (struct htx *)buf->area;
 		htx_reset(htx);
+		if (eom)
+			goto empty_stdin;
 		goto end;
 	}
 
@@ -2306,6 +2309,7 @@
 
 	/* Send the empty stding here to finish the message */
 	if (htx_is_empty(htx) && (htx->flags & HTX_FL_EOM)) {
+	  empty_stdin:
 		TRACE_PROTO("sending FCGI STDIN record", FCGI_EV_TX_RECORD|FCGI_EV_TX_STDIN, fconn->conn, fstrm, htx);
 		if (!fcgi_strm_send_empty_stdin(fconn, fstrm)) {
 			/* bytes already reserved for this record. It should not fail */