]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2: make streams know if they need to send more data
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Aug 2022 14:03:51 +0000 (16:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Aug 2022 06:03:53 +0000 (08:03 +0200)
H2 streams do not even know if they are expected to send more data or
not, which is problematic when closing because we don't know if we're
closing too early or not. Let's start by adding a new stream flag
"H2_SF_MORE_HTX_DATA" to indicate this on the tx path.

src/mux_h2.c

index e45e8f916b08266f79957c93ccf14801ad6c7ad2..611fc2105ccdda345983912cb3ef316b08eb4b4d 100644 (file)
@@ -208,6 +208,7 @@ enum h2_ss {
 #define H2_SF_EXT_CONNECT_RCVD  0x00080000  // rfc 8441 an Extended CONNECT has been received and parsed
 
 #define H2_SF_TUNNEL_ABRT       0x00100000  // A tunnel attempt was aborted
+#define H2_SF_MORE_HTX_DATA     0x00200000  // more data expected from HTX
 
 /* H2 stream descriptor, describing the stream as it appears in the H2C, and as
  * it is being processed in the internal HTTP representation (HTX).
@@ -6590,6 +6591,11 @@ static size_t h2_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, in
        if (!(h2s->flags & H2_SF_OUTGOING_DATA) && count)
                h2s->flags |= H2_SF_OUTGOING_DATA;
 
+       if (htx->extra)
+               h2s->flags |= H2_SF_MORE_HTX_DATA;
+       else
+               h2s->flags &= ~H2_SF_MORE_HTX_DATA;
+
        if (h2s->id == 0) {
                int32_t id = h2c_get_next_sid(h2s->h2c);