From cab2295ae71150d6722505945463b3f1d4627e6e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 31 Oct 2019 15:48:18 +0100 Subject: [PATCH] BUG/MEDIUM: mux-h2: immediately report connection errors on streams In case a stream tries to send on a connection error, we must report the error so that the stream interface keeps the data available and may safely retry on another connection. Till now this would happen only before the connection was established, not in case of a failed handshake or an early GOAWAY for example. This should be backported to 2.0 and 1.9. --- src/mux_h2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mux_h2.c b/src/mux_h2.c index c9b805bb3..49e0a2fac 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -5838,6 +5838,12 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun return 0; } + if (h2s->h2c->st0 >= H2_CS_ERROR) { + cs->flags |= CS_FL_ERROR; + TRACE_DEVEL("connection is in error, leaving in error", H2_EV_H2S_SEND|H2_EV_H2S_BLK|H2_EV_H2S_ERR|H2_EV_STRM_ERR, h2s->h2c->conn, h2s); + return 0; + } + htx = htx_from_buf(buf); if (!(h2s->flags & H2_SF_OUTGOING_DATA) && count)