From 4877045f1dcbfbc3c7f49e90eb32dd03c070616d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 18 Aug 2022 16:03:51 +0200 Subject: [PATCH] MINOR: mux-h2: make streams know if they need to send more data 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mux_h2.c b/src/mux_h2.c index e45e8f916b..611fc2105c 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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); -- 2.39.5