From: Willy Tarreau Date: Thu, 31 Oct 2019 14:48:18 +0000 (+0100) Subject: BUG/MEDIUM: mux-h2: immediately report connection errors on streams X-Git-Tag: v2.1-dev4~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cab2295ae71150d6722505945463b3f1d4627e6e;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index c9b805bb3c..49e0a2fac3 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)