From 0a916d2aca79bc6bbb38cc5ebcc1bb51de614b7c Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 10 Feb 2021 08:48:19 +0100 Subject: [PATCH] BUG/MINOR: mux-h1: Don't blindly skip EOT block for non-chunked messages In HTTP/2, we may have trailers for messages with a Content-length header. Thus, when the H2 mux receives a HEADERS frame at the end of a message, it always emits TLR and EOT HTX blocks. On the H1 mux, if this happens, these blocks are just skipped because we cannot emit trailers for a non-chunked message. But the EOT HTX block must not be blindly ignored. Indeed, there is no longer EOM HTX block to mark the end of the message. Thus the EOT block, when found, is the end of the message. So we must handle it to swith in MSG_DONE state. This fix is specific for 2.4. No backport needed. --- src/mux_h1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index ddafda6ac7..d94ae54d74 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2181,8 +2181,11 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun /* If the message is not chunked, ignore * trailers. It may happen with H2 messages. */ - if (!(h1m->flags & H1_MF_CHNK)) + if (!(h1m->flags & H1_MF_CHNK)) { + if (type == HTX_BLK_EOT) + goto done; break; + } if ((h1m->flags & H1_MF_RESP) && (h1s->flags & H1S_F_BODYLESS_RESP)) { TRACE_PROTO("Skip trailers for bodyless response", H1_EV_TX_DATA|H1_EV_TX_BODY, h1c->conn, h1s, chn_htx);