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.
This commit is contained in:
Christopher Faulet 2021-02-10 08:48:19 +01:00
parent 0d7e634631
commit 0a916d2aca
1 changed files with 4 additions and 1 deletions

View File

@ -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);