From: Amaury Denoyelle Date: Tue, 15 Feb 2022 09:57:16 +0000 (+0100) Subject: BUG/MINOR: quic: fix FIN stream signaling X-Git-Tag: v2.6-dev2~151 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a2c2f4910f7225a808649dacdd3ec8b3d7f409b;p=thirdparty%2Fhaproxy.git BUG/MINOR: quic: fix FIN stream signaling If the last frame is not entirely copied and must be buffered, FIN must not be signaled to the upper layer. This might fix a rare bug which could cause the request channel to be closed too early leading to an incomplete request. --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index b71e427220..dc487b2c8b 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2054,6 +2054,7 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt, struct qcs *strm; struct eb64_node *strm_node; struct quic_rx_strm_frm *frm; + char fin = 0; strm_node = qcc_get_qcs(qc->qcc, strm_frm->id); if (!strm_node) { @@ -2092,7 +2093,9 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt, } total += qc_treat_rx_strm_frms(strm); - if (total && qc->qcc->app_ops->decode_qcs(strm, strm_frm->fin, qc->qcc->ctx) < 0) { + /* FIN is set only if all data were copied. */ + fin = strm_frm->fin && !strm_frm->len; + if (total && qc->qcc->app_ops->decode_qcs(strm, fin, qc->qcc->ctx) < 0) { TRACE_PROTO("Decoding error", QUIC_EV_CONN_PSTRM, qc); return 0; }