BUG/MEDIUM: mux-fcgi: Properly handle read0 on partial records
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Jan 2025 14:18:14 +0000 (15:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Feb 2025 10:41:44 +0000 (11:41 +0100)
commite20714440249497e99ef7b45c47ac4439d5af803
tree7699758155a5a9b1309f1606e5704a0b56ea6fe3
parent338edaa1e9aeb0ee87a58fc9d62e75548f11566f
BUG/MEDIUM: mux-fcgi: Properly handle read0 on partial records

A Read0 event could be ignored by the FCGI multiplexer if it is blocked on a
partial record. Instead of handling the event, it remained blocked, waiting
for the end of the record.

To fix the issue, the same solution than the H2 multiplexer is used. Two
flags are introduced. The first one, FCGI_CF_END_REACHED, is used to
acknowledge a read0. This flag is set when a read0 was received AND the FCGI
multiplexer must handle it. The second one, FCGI_CF_DEM_SHORT_READ, is set
when the demux is interrupted on a partial record. A short read and a read0
lead to set the FCGI_CF_END_REACHED flag.

With these changes, the FCGI mux should be able to properly handle read0 on
partial records.

This patch should be backported to all stable versions after a period of
observation.

(cherry picked from commit 5f927f603aae4614f82c73ff6c2e3324ecfdf506)
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/haproxy/mux_fcgi-t.h
src/mux_fcgi.c