From: Amaury Denoyelle Date: Fri, 8 Dec 2023 14:47:06 +0000 (+0100) Subject: MINOR: mux-quic: factorize QC_SF_UNKNOWN_PL_LENGTH set X-Git-Tag: v3.0-dev1~104 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1adadc4d3f2155f4d8078a596db9d92ebaf9a790;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: factorize QC_SF_UNKNOWN_PL_LENGTH set When dealing with HTTP/1 responses without Content-Length nor chunked encoding, flag QC_SF_UNKNOWN_PL_LENGTH is set on QCS. This prevent the emission of a RESET_STREAM on shutw, instead resorting to a proper FIN emission. This code was duplicated both in H3 and hq-interop. Move it in common qcs_http_snd_buf() to factorize it. --- diff --git a/src/h3.c b/src/h3.c index e7cbac445d..7b6961be62 100644 --- a/src/h3.c +++ b/src/h3.c @@ -1847,9 +1847,6 @@ static size_t h3_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count) htx = htx_from_buf(buf); - if (htx->extra && htx->extra == HTX_UNKOWN_PAYLOAD_LENGTH) - qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; - while (count && !htx_is_empty(htx) && !(qcs->flags & QC_SF_BLK_MROOM)) { idx = htx_get_head(htx); blk = htx_get_blk(htx, idx); diff --git a/src/hq_interop.c b/src/hq_interop.c index 14f83b79df..0bbf44c5ad 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -99,9 +99,6 @@ static size_t hq_interop_snd_buf(struct qcs *qcs, struct buffer *buf, htx = htx_from_buf(buf); - if (htx->extra && htx->extra == HTX_UNKOWN_PAYLOAD_LENGTH) - qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; - while (count && !htx_is_empty(htx) && !(qcs->flags & QC_SF_BLK_MROOM)) { /* Not implemented : QUIC on backend side */ idx = htx_get_head(htx); diff --git a/src/qmux_http.c b/src/qmux_http.c index edf26b1418..3c5f3917cb 100644 --- a/src/qmux_http.c +++ b/src/qmux_http.c @@ -78,6 +78,15 @@ size_t qcs_http_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count, TRACE_ENTER(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs); htx = htxbuf(buf); + + /* Extra care required for HTTP/1 responses without Content-Length nor + * chunked encoding. In this case, shutw callback will be use to signal + * the end of the message. QC_SF_UNKNOWN_PL_LENGTH is set to prevent a + * RESET_STREAM emission in this case. + */ + if (htx->extra && htx->extra == HTX_UNKOWN_PAYLOAD_LENGTH) + qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; + eom = (htx->flags & HTX_FL_EOM); ret = qcs->qcc->app_ops->snd_buf(qcs, buf, count); *fin = (eom && !b_data(buf));