From: Christopher Faulet Date: Mon, 4 Oct 2021 12:16:46 +0000 (+0200) Subject: BUG/MEDIUM: http-ana: Clear request analyzers when applying redirect rule X-Git-Tag: v2.5-dev9~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d34758849e1f7e070a25022fcfe38e4fc82e22c6;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: http-ana: Clear request analyzers when applying redirect rule A bug was introduced by the commit 2d5650082 ("BUG/MEDIUM: http-ana: Reset channels analysers when returning an error"). The request analyzers must be cleared when a redirect rule is applied. It is not a problem if the redirect rule is inside an http-request ruleset because the analyzer takes care to clear it. However, when it comes from a redirect ruleset (via the "redirect ..." directive), because of the above commit, the request analyzers are no longer cleared. It means some HTTP request analyzers may be called while the request channel was already flushed. It is totally unexpected and may lead to crash. Thanks to Yves Lafon for reporting the problem. This patch must be backported everywhere the above commit was backported. --- diff --git a/src/http_ana.c b/src/http_ana.c index 0e3d0600fb..7e32fb8ead 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2542,6 +2542,7 @@ int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struc if (rule->flags & REDIRECT_FLAG_FROM_REQ) { /* let's log the request time */ s->logs.tv_request = now; + req->analysers &= AN_REQ_FLT_END; if (s->sess->fe == s->be) /* report it if the request was intercepted by the frontend */ _HA_ATOMIC_INC(&s->sess->fe->fe_counters.intercepted_req);