]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2: make h2c_send_rst_stream() use the dummy stream's error code
authorWilly Tarreau <w@1wt.eu>
Sun, 23 Dec 2018 17:26:26 +0000 (18:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 24 Dec 2018 10:45:00 +0000 (11:45 +0100)
We currently have 2 dummy streams allowing us to send an RST_STREAM
message with an error code matching this one. However h2c_send_rst_stream()
still enforces the STREAM_CLOSED error code for these dummy streams,
ignoring their respective errcode fields which however are properly
set.

Let's make the function always use the stream's error code. This will
allow to create other dummy streams for different codes.

src/mux_h2.c

index 54e823dc1ecb37aaef29f808fc28b0418ea91bd0..02890e0e55a1429f899612266500592c7248fdf9 100644 (file)
@@ -1176,9 +1176,8 @@ static int h2s_send_rst_stream(struct h2c *h2c, struct h2s *h2s)
 
 /* Try to send an RST_STREAM frame on the connection for the stream being
  * demuxed using h2c->dsi for the stream ID. It will use h2s->errcode as the
- * error code unless the stream's state already is IDLE or CLOSED in which
- * case STREAM_CLOSED will be used, and will update h2s->st to H2_SS_CLOSED if
- * it was not yet.
+ * error code, even if the stream is one of the dummy ones, and will update
+ * h2s->st to H2_SS_CLOSED if it was not yet.
  *
  * Returns > 0 on success or zero if nothing was done. In case of lack of room
  * to write the message, it blocks the demuxer and subscribes it to future
@@ -1215,7 +1214,7 @@ static int h2c_send_rst_stream(struct h2c *h2c, struct h2s *h2s)
        memcpy(str, "\x00\x00\x04\x03\x00", 5);
 
        write_n32(str + 5, h2c->dsi);
-       write_n32(str + 9, h2s->id ? h2s->errcode : H2_ERR_STREAM_CLOSED);
+       write_n32(str + 9, h2s->errcode);
        ret = b_istput(res, ist2(str, 13));
 
        if (unlikely(ret <= 0)) {