]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http: disable keep-alive when process is going down
authorWilly Tarreau <w@1wt.eu>
Thu, 28 Jan 2010 14:01:20 +0000 (15:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Jan 2010 14:01:20 +0000 (15:01 +0100)
Krzysztof Oledzki suggested to disable keep-alive when a process
is going down due to a reload, in order to avoid ever-lasting
sessions. This is a simple and very efficient solution as it
ensures that at most one more request will be handled on a
keep-alive connection after the process has received a SIGUSR1
signal.

src/proto_http.c

index 44c082d67dae5abdf085cebf0acbfed9650e9264..d3c2b52f86f2bf1ede8008a1995154bdf6235a35 100644 (file)
@@ -2844,7 +2844,8 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
                    ((txn->flags & TX_HDR_CONN_CLO) ||                         /* "connection: close" */
                     (txn->flags & (TX_REQ_VER_11|TX_HDR_CONN_KAL)) == 0 ||    /* no "connection: k-a" in 1.0 */
                     ((s->fe->options|s->be->options) & PR_O_HTTP_CLOSE) ||    /* httpclose + any = forceclose */
-                    !(txn->flags & TX_REQ_XFER_LEN)))                         /* no length known => close */
+                    !(txn->flags & TX_REQ_XFER_LEN) ||                        /* no length known => close */
+                    s->fe->state == PR_STSTOPPED))                            /* frontend is stopping */
                    txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_CLO;
        }