From: Olivier Houchard Date: Wed, 19 Dec 2018 13:49:39 +0000 (+0100) Subject: BUG/MEDIUM: h2: Make sure we don't set CS_FL_ERROR if there's still data. X-Git-Tag: v1.9.0~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=251064b02dd3d0ce70f00accbfbc481f95661512;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: h2: Make sure we don't set CS_FL_ERROR if there's still data. In the mux h2, make sure we set CS_FL_ERR_PENDING and wake the recv task, instead of setting CS_FL_ERROR, if CS_FL_EOS is not set, so if there's potentially still some data to be sent. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index d61205f681..3e120d78c0 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -588,8 +588,13 @@ static inline __maybe_unused void h2s_error(struct h2s *h2s, enum h2_err err) if (h2s->id && h2s->st < H2_SS_ERROR) { h2s->errcode = err; h2s->st = H2_SS_ERROR; - if (h2s->cs) - h2s->cs->flags |= CS_FL_ERROR; + if (h2s->cs) { + if (h2s->cs->flags & CS_FL_EOS) + h2s->cs->flags |= CS_FL_ERROR; + else { + h2s->cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING; + } + } } } @@ -4795,7 +4800,11 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun break; } else { - cs->flags |= CS_FL_ERROR; + if (cs->flags & CS_FL_EOS) + cs->flags |= CS_FL_ERROR; + else + cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING; + break; } @@ -4820,7 +4829,11 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun /* RST are sent similarly to frame acks */ if (h2s->st == H2_SS_ERROR || h2s->flags & H2_SF_RST_RCVD) { - cs->flags |= CS_FL_ERROR; + if (cs->flags & CS_FL_EOS) + cs->flags |= CS_FL_ERROR; + else + cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING; + if (h2s_send_rst_stream(h2s->h2c, h2s) > 0) h2s_close(h2s); }