Skip to content

Commit 4b96845

Browse files
committed
BUG/MEDIUM: mux-h1: Skip UNUSED htx block when formating the start line
UNUSED blocks were not properly handled when the H1 multiplexer was formatting the start line of a request or a response. UNUSED was ignored but not removed from HTX message. So the mux can loop infinitly on such block. It could be seen a a major issue but in fact it happens only if a very specific case on the reponse processing (at least I think so): the server must send an interim message (a 100-continue for intance) with the final response. HAProxy must receive both in same time and the final reponse must be intercepted (via a http-response return action for instance), In that case, the interim message is fowarded and the server final reponse is removed and replaced by a proxy error message. Now UNUSED htx blocks are properly skipped and removed. This patch must be backported as far as 3.0. (cherry picked from commit a3e9a04) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com> (cherry picked from commit 53b7d7a) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com> (cherry picked from commit 1b8806e) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com> (cherry picked from commit f64d86d) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 parent 1847c0b commit 4b96845

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/mux_h1.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,8 +2302,10 @@ static size_t h1_make_reqline(struct h1s *h1s, struct h1m *h1m, struct htx *htx,
23022302
goto end;
23032303
type = htx_get_blk_type(blk);
23042304
sz = htx_get_blksz(blk);
2305-
if (type == HTX_BLK_UNUSED)
2305+
if (type == HTX_BLK_UNUSED) {
2306+
htx_remove_blk(htx, blk);
23062307
continue;
2308+
}
23072309
if (type != HTX_BLK_REQ_SL || sz > count)
23082310
goto error;
23092311
break;
@@ -2391,8 +2393,10 @@ static size_t h1_make_stline(struct h1s *h1s, struct h1m *h1m, struct htx *htx,
23912393
type = htx_get_blk_type(blk);
23922394
sz = htx_get_blksz(blk);
23932395

2394-
if (type == HTX_BLK_UNUSED)
2396+
if (type == HTX_BLK_UNUSED) {
2397+
htx_remove_blk(htx, blk);
23952398
continue;
2399+
}
23962400
if (type != HTX_BLK_RES_SL || sz > count)
23972401
goto error;
23982402
break;

0 commit comments

Comments
 (0)