From: Christopher Faulet Date: Mon, 25 Sep 2023 13:59:07 +0000 (+0200) Subject: MINOR: mux-h1: Use HTX extra field only for responses with known length X-Git-Tag: v2.9-dev8~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=117f9cc0170085446211a99316c5697fcaf7766c;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: Use HTX extra field only for responses with known length For now, it is not an issue, but it is safer to explicitly ignore HTX extra field for responses with unknown length. This will be mandatory to future fixes, to be able to re-chunk responses with an unknown length.. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index e34b45620d..a2261d356d 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2589,7 +2589,7 @@ static size_t h1_make_data(struct h1s *h1s, struct h1m *h1m, struct buffer *buf, /* If is a new chunk, prepend the chunk size */ if (!h1m->curr_len) { - h1m->curr_len = count + htx->extra; + h1m->curr_len = count + (htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH ? htx->extra : 0); h1_prepend_chunk_size(&h1c->obuf, h1m->curr_len); } h1m->curr_len -= count; @@ -2662,7 +2662,7 @@ static size_t h1_make_data(struct h1s *h1s, struct h1m *h1m, struct buffer *buf, if (h1m->flags & H1_MF_CHNK) { /* If is a new chunk, prepend the chunk size */ if (!h1m->curr_len) { - h1m->curr_len = (htx->extra ? htx->data + htx->extra : vlen); + h1m->curr_len = (htx->extra && htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH ? htx->data + htx->extra : vlen); if (!h1_append_chunk_size(&outbuf, h1m->curr_len)) { h1m->curr_len = 0; goto full;