]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: factorize QC_SF_UNKNOWN_PL_LENGTH set
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 8 Dec 2023 14:47:06 +0000 (15:47 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 12 Dec 2023 09:14:22 +0000 (10:14 +0100)
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.

src/h3.c
src/hq_interop.c
src/qmux_http.c

index e7cbac445d8a609ffba1140ce49f6013a6f7a6e0..7b6961be62a48bf18a5ab859c4a7141c15100529 100644 (file)
--- 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);
index 14f83b79df81bee1c984d86864ee76ed1989a7c2..0bbf44c5adcfaf8fd7ad9e7a9e37ba41ae85153f 100644 (file)
@@ -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);
index edf26b1418f1592b14c905b2db33148773950744..3c5f3917cb9b2fcfc5a28a5efbe10f2d4e113d78 100644 (file)
@@ -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));