From bd99d5818d0beea8458189ba22989b0183cd6785 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 2 Sep 2015 10:40:43 +0200 Subject: [PATCH] BUG/MAJOR: http: don't manipulate the server connection if it's killed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jesse Hathaway reported a crash that Cyril Bonté diagnosed as being caused by the manipulation of srv_conn after setting it to NULL. This happens in http-server-close mode when the server returns either a 401 or a 407, because the connection was previously closed then it's being assigned the CO_FL_PRIVATE flag. This bug only affects 1.6-dev as it was introduced by connection reuse code with commit 387ebf8 ("MINOR: connection: add a new flag CO_FL_PRIVATE"). --- src/proto_http.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/proto_http.c b/src/proto_http.c index 0f18c0096..7887791ce 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -5246,7 +5246,8 @@ void http_end_txn_clean_session(struct stream *s) * it's better to do it (at least it helps with debugging). */ s->txn->flags |= TX_PREFER_LAST; - srv_conn->flags |= CO_FL_PRIVATE; + if (srv_conn) + srv_conn->flags |= CO_FL_PRIVATE; } if (fe->options2 & PR_O2_INDEPSTR)