]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h2: fix handling of end of stream again
authorWilly Tarreau <w@1wt.eu>
Thu, 7 Dec 2017 14:59:29 +0000 (15:59 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Dec 2017 18:20:35 +0000 (19:20 +0100)
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.

src/mux_h2.c

index 2e4ffbf0fb2486ba84faea0e701e07807f9fd869..c961c015d4c600afae9a6796f416d68a61c1363f 100644 (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;