]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Check h1m flags to set the server conn_mode on request path
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Dec 2018 12:50:11 +0000 (13:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 5 Dec 2018 15:46:44 +0000 (16:46 +0100)
On the server side, we must test the request headers to deduce if we able to do
keepalive or not. Otherwise, by default, the keepalive will be enabled on the
server's connection, whatever the client said.

src/mux_h1.c

index db6389055f42e46932e3313c84b4bf0ad0cb4260..46468121262c86f53c10eb415bfee0f2585e02f8 100644 (file)
@@ -653,6 +653,12 @@ static void h1_set_srv_conn_mode(struct h1s *h1s, struct h1m *h1m)
                          h1m->flags & H1_MF_CONN_CLO))                    /* explicit close */
                        h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
        }
+       else {
+               if (h1s->flags & H1S_F_WANT_KAL &&
+                   (!(h1m->flags & (H1_MF_VER_11|H1_MF_CONN_KAL)) || /* no KA in HTTP/1.0 */
+                    h1m->flags & H1_MF_CONN_CLO))                    /* explicit close */
+                       h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
+       }
 
        /* If KAL, check if the backend is stopping. If yes, switch in CLO mode */
        if (h1s->flags & H1S_F_WANT_KAL && be->state == PR_STSTOPPED)