]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h1: Don't shutw/shutr the connection if we have keepalive.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 19 Dec 2018 14:55:23 +0000 (15:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Dec 2018 15:59:13 +0000 (16:59 +0100)
In h1_shutw() and h1_shutr(), don't attempt to shutdown() the connection
if we're using keepalive and the connection has no error, or we will close
the connection too soon.

src/mux_h1.c

index 84d8ce5d6132b0562b59de72a865755dee5ba96f..bf9a723aa1f7efc09f3c55363cfb56b004a19247 100644 (file)
@@ -1994,7 +1994,8 @@ static void h1_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
        if (!h1s)
                return;
 
-       if ((h1s->flags & H1S_F_WANT_KAL) && !(cs->flags & (CS_FL_REOS|CS_FL_EOS)))
+       if ((h1s->flags & H1S_F_WANT_KAL) &&
+           !(cs->conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH)))
                return;
 
        /* NOTE: Be sure to handle abort (cf. h2_shutr) */
@@ -2018,7 +2019,8 @@ static void h1_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
        h1c = h1s->h1c;
 
        if ((h1s->flags & H1S_F_WANT_KAL) &&
-           !(cs->flags & (CS_FL_REOS|CS_FL_EOS)) &&
+           !(h1c->conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH)) &&
+
            h1s->req.state == H1_MSG_DONE && h1s->res.state == H1_MSG_DONE)
                return;