]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: immediately report connection errors on streams
authorWilly Tarreau <w@1wt.eu>
Thu, 31 Oct 2019 14:48:18 +0000 (15:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 Oct 2019 14:48:18 +0000 (15:48 +0100)
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

index c9b805bb3cb511da6c03c528c725968b3ce8b12f..49e0a2fac3efdb164fe1ef4330290eb5731f7876 100644 (file)
@@ -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)