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.
This commit is contained in:
Olivier Houchard 2018-12-19 14:49:39 +01:00 committed by Willy Tarreau
parent bddf7fc417
commit 251064b02d

View File

@ -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);
}