From: Amaury Denoyelle Date: Fri, 13 Nov 2026 15:27:57 +0000 (+0100) Subject: BUG/MINOR: h3: prevent missing request FIN on empty trailers X-Git-Url: https://git.kaiwu.me/web/upload.html?a=commitdiff_plain;h=42daaf9575dc193872e54e9303b40d6e0735b555;p=haproxy.git BUG/MINOR: h3: prevent missing request FIN on empty trailers Since the following patch, HTTP/3 trailers are only decoded when the stream HTX buffer is empty, with previous data already consumed by the upper layer. This is the simplest reason to ensure there is always enough space for trailers decoding. 8020cefc30ceadf61b45130609b90fdbb0741840 BUG/MEDIUM: h3: prevent conn failure on trailers decoding without space However, this check is also performed for an empty trailers frame, which is unnecessary and thus suboptimal. Worse, QCS demux is blocked but when it is woken up there is nothing left to decode as the empty trailers frame header was already consumed and the demuxer starts on a new frame. The trailer frame and its FIN signal are thus dropped. To fix this, simply bypass the check on HTX buffer if the trailers frame is empty. EOM is then reported and the rest of the frame parsing is skipped. Note that h3_resp_headers_to_htx() has a similar check. However, an HTTP/3 headers frame cannot be empty as it must contain mandatory pseudo-headers, thus an empty headers frame is rejected earlier. This must be backported up to 2.8. --- diff --git a/src/h3.c b/src/h3.c index 32a7055c2..d45513730 100644 --- a/src/h3.c +++ b/src/h3.c @@ -1598,9 +1598,9 @@ static ssize_t h3_trailers_to_htx(struct qcs *qcs, const struct buffer *buf, htx = htx_from_buf(appbuf); data_ofs = htx->data; /* Do not decode trailers if there is remaining data left, for similar - * reasons as h3_resp_headers_to_htx(). + * reasons as h3_resp_headers_to_htx(), unless trailer frame is empty. */ - if (!htx_is_empty(htx)) { + if (len && !htx_is_empty(htx)) { qcs->flags |= QC_SF_DEM_FULL; len = 0; goto out;