]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: mux-fcgi: don't send the empty STDIN record twice
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 2 Dec 2026 14:26:27 +0000 (15:26 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 2 Dec 2026 14:54:41 +0000 (15:54 +0100)
In fcgi_snd_buf(), when an EOT block carrying the EOM flag was found, an
empty STDIN record was sent to signal the end of the request. Then, the
NOOP case was also executed because of a fallthrough. The EOM flag was
tested again and a second empty STDIN record was sent. It happened when
the EOT block was processed separately from the request body. The
FastCGI application could then handle the second record as a protocol
error.

Now, EOT and NOOP blocks are handled the same way, and only one empty
STDIN record is sent.

No backport needed.

src/mux_fcgi.c

index 6d7608db434efb314ec423b338e5a479b7d2a7cf..523c0877e288ca1af71d596759dcb7d13e7394c2 100644 (file)
@@ -4362,16 +4362,9 @@ static size_t fcgi_snd_buf(struct stconn *sc, struct buffer *buf, size_t count,
                                break;
 
                        case HTX_BLK_EOT:
-                               if (blk->flags & HTX_BLK_FL_EOM) {
-                                       TRACE_PROTO("sending FCGI STDIN record", FCGI_EV_TX_RECORD|FCGI_EV_TX_STDIN, fconn->conn, fstrm, htx);
-                                       ret = fcgi_strm_send_empty_stdin(fconn, fstrm);
-                                       if (!ret)
-                                               goto done;
-                               }
-                               __fallthrough;
-
                        case HTX_BLK_NOOP:
-                               /* Nothing is emitted for a NOOP block. But if it
+                               /* Nothing is emitted for EOT and NOOP blocks
+                                * (trailers are not supported). But if it
                                 * carries the EOM flag, an empty STDIN record
                                 * is sent to signal the end of the request.
                                 */