BUG/MINOR: mux-h1: Immediately report H1C errors from h1_snd_buf()
In case an H1 stream tries to send while on error occurred on its underlying
H1 connection, we must report the error. The way the stream-interface is
synchronously notified of the error. It seems to only be a problem on the
2.0. Probably because the scheduling has changed in upper versions. On the
2.0, it prevent the stream to be notified of errors, when for instance, a
payload is found in a response to a HEAD request. Not always though.
This patch must be backported as far as 2.0 because, on 2.0, it should fix the
issue #1101. There is no upstream ID for this commit because on the 2.4, this
fix already exists, it is part of non-backportable commit.
(cherry picked from commit 4099f99004dbbc8a5c116f1024623bac0d723be4)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 25435eb38e2245bf15d86eb5aae1d6ebb4ea26b8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b61e152f6951be7f5b1125e83f07d662fb5b6038)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/mux_h1.c b/src/mux_h1.c
index b34fe5f..21f6e6f 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -2534,6 +2534,11 @@
if (h1c->flags & H1C_F_CS_WAIT_CONN)
return 0;
+ if (h1c->flags & H1C_F_CS_ERROR) {
+ cs->flags |= CS_FL_ERROR;
+ return 0;
+ }
+
while (count) {
size_t ret = 0;
@@ -2546,6 +2551,10 @@
if ((h1c->wait_event.events & SUB_RETRY_SEND) || !h1_send(h1c))
break;
}
+
+ if (h1c->flags & H1C_F_CS_ERROR)
+ cs->flags |= CS_FL_ERROR;
+
h1_refresh_timeout(h1c);
return total;
}