From d2e88c715d4880ef87f1f7dc4f851656937c6d75 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Wed, 19 Dec 2018 15:55:23 +0100 Subject: [PATCH] BUG/MEDIUM: h1: Don't shutw/shutr the connection if we have keepalive. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 84d8ce5d6..bf9a723aa 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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;