]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: Report RST/error to app-layer stream during 0-copy fwding
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 9 Sep 2025 13:52:34 +0000 (15:52 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 9 Sep 2025 14:30:21 +0000 (16:30 +0200)
In h2_nego_ff(), it is important to report reset and error to app-layer
stream and to send the RST-STREAM frame accordingly. It is not clear if it
is an issue or not. But it is clearly a difference with the classical
forwarding via h2_snd_buf. And it is mandatory for the next fix.

This patch should be backported to 3.2. But is is probably a good idea to
not backport it on older versions, except if a bug is reported in this area.

src/mux_h2.c

index f6a6533969a612df33ed1afa846a80641a41bb81..cfb3d36bd599f0a906644bdc31ed032954727158 100644 (file)
@@ -8122,6 +8122,16 @@ static size_t h2_nego_ff(struct stconn *sc, struct buffer *input, size_t count,
  end:
        if (h2s->sd->iobuf.flags & IOBUF_FL_FF_BLOCKED)
                h2s->flags &= ~H2_SF_NOTIFIED;
+
+       /* RST are sent similarly to frame acks */
+       if (h2s->st == H2_SS_ERROR || h2s->flags & H2_SF_RST_RCVD) {
+               TRACE_DEVEL("reporting RST/error to the app-layer stream", H2_EV_H2S_SEND|H2_EV_H2S_ERR|H2_EV_STRM_ERR, h2s->h2c->conn, h2s);
+               se_fl_set_error(h2s->sd);
+               se_report_term_evt(h2s->sd, se_tevt_type_snd_err);
+               if (h2s_send_rst_stream(h2s->h2c, h2s) > 0)
+                       h2s_close(h2s);
+       }
+
        TRACE_LEAVE(H2_EV_H2S_SEND|H2_EV_STRM_SEND, h2s->h2c->conn, h2s);
        return ret;
 }