From 6716cc2b934d00eb4a91caaf9971348141951a13 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 20 Dec 2019 17:33:24 +0100 Subject: [PATCH] BUG/MAJOR: mux-h1: Don't pretend the input channel's buffer is full if empty A regression was introduced by the commit 76014fd1 ("MEDIUM: h1-htx: Add HTX EOM block when the message is in H1_MSG_DONE state"). When nothing is copied in the channel's buffer when the input message is parsed, we erroneously pretend it is because there is not enough room by setting the CS_FL_WANT_ROOM flag on the conn-stream. This happens when a partial request is parsed. Because of this flag, we never try anymore to get input data from the mux because we first wait for more room in the channel's buffer, which is empty. Because of this bug, it is pretty easy to freeze a h1 connection. To fix the bug, we must obsiously set the CS_FL_WANT_ROOM flag only when there are still data to transfer while the channel's buffer is not empty. This patch must be backported if the patch 76014fd1 is backported too. So for now, no backport needed. --- src/mux_h1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 3a0af224f..e68b50c92 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1483,7 +1483,7 @@ static size_t h1_process_input(struct h1c *h1c, struct buffer *buf, size_t count if (!b_data(&h1c->ibuf)) h1_release_buf(h1c, &h1c->ibuf); - if (h1s_data_pending(h1s)) + if (h1s_data_pending(h1s) && !htx_is_empty(htx)) h1s->cs->flags |= CS_FL_RCV_MORE | CS_FL_WANT_ROOM; else if (h1s->flags & H1S_F_REOS) { h1s->cs->flags |= CS_FL_EOS;