BUG/MEDIUM: h2: fix handling of end of stream again

Commit 9470d2c ("BUG/MINOR: h2: try to abort closed streams as
soon as possible") tried to address the situations where a stream
is closed by the client, but caused a side effect which is that in
some cases, a regularly closed stream reports an error to the stream
layer. The reason is that we purposely matched H2_SS_CLOSED in the
test for H2_SS_ERROR to report this so that we can check for RST,
but it accidently catches certain end of transfers as well. This
results in valid requests to report flags "CD" in the logs.

Instead, let's roll back to detecting H2_SS_ERROR and explicitly check
for a received RST. This way we can correctly abort transfers without
mistakenly reporting errors in normal situations.

This fix needs to be backported to 1.8 as the fix above was merged into
1.8.1.
This commit is contained in:
Willy Tarreau 2017-12-07 15:59:29 +01:00
parent dbd026792a
commit 0249219be8

View File

@ -3164,7 +3164,7 @@ static int h2_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
}
/* RST are sent similarly to frame acks */
if (h2s->st >= H2_SS_ERROR) {
if (h2s->st == H2_SS_ERROR || h2s->flags & H2_SF_RST_RCVD) {
cs->flags |= CS_FL_ERROR;
if (h2s_send_rst_stream(h2s->h2c, h2s) > 0)
h2s->st = H2_SS_CLOSED;