]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Don't send more data than expected
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 4 Jun 2019 20:09:36 +0000 (22:09 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Jun 2019 08:12:11 +0000 (10:12 +0200)
In h1_snd_buf(), we try to consume as much data as possible in a loop. In this
loop, we first format the raw HTTP message from the HTX message, then we try to
send it. But we must be carefull to never send more data than specified by the
stream-interface.

This patch must be backported to 1.9.

src/mux_h1.c

index 47a4071de057547f7ad1d0e5ed380ba817c65ebb..c9c8f84cafc8196b55160c146dfce7c01de627a3 100644 (file)
@@ -2347,7 +2347,7 @@ static size_t h1_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
        if (h1c->flags & H1C_F_CS_WAIT_CONN)
                return 0;
 
-       while (total != count) {
+       while (count) {
                size_t ret = 0;
 
                if (!(h1c->flags & (H1C_F_OUT_FULL|H1C_F_OUT_ALLOC)))
@@ -2355,6 +2355,7 @@ static size_t h1_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
                if (!ret)
                        break;
                total += ret;
+               count -= ret;
                if (!h1_send(h1c))
                        break;
        }