BUG/MINOR: http-ana: Reset request analysers on error when waiting for response
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Apr 2020 06:14:16 +0000 (08:14 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Apr 2020 06:29:41 +0000 (08:29 +0200)
This bug was supposed to be fixed by the commit f6df2b4a ("BUG/MINOR: http-ana:
Reset request analysers on a response side error"). It is a backported patch
from the 2.2. But, while it is enough on the 2.2, it is not on 2.1 and
lower. For these versions, the error handling is not grouped at the end of
analysers. At many places, when we are waiting for a response, several errors
are immediately returned. For all of these, the same fix must be applied.

The patch was directly introduced on 2.1, there is no upstream commit ID for
this patch. It must be backported everywhere the commit f6df2b4a is.

src/http_ana.c

index 93b7d5c..5705874 100644 (file)
@@ -1486,6 +1486,8 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                        }
 
                        rep->analysers &= AN_RES_FLT_END;
+                       s->req.analysers &= AN_REQ_FLT_END;
+                       rep->analyse_exp = TICK_ETERNITY;
                        txn->status = 502;
 
                        /* Check to see if the server refused the early data.
@@ -1531,6 +1533,8 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                        }
 
                        rep->analysers &= AN_RES_FLT_END;
+                       s->req.analysers &= AN_REQ_FLT_END;
+                       rep->analyse_exp = TICK_ETERNITY;
                        txn->status = 504;
                        s->si[1].flags |= SI_FL_NOLINGER;
                        http_reply_and_close(s, txn->status, http_error_message(s));
@@ -1552,6 +1556,8 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                                _HA_ATOMIC_ADD(&__objt_server(s->target)->counters.cli_aborts, 1);
 
                        rep->analysers &= AN_RES_FLT_END;
+                       s->req.analysers &= AN_REQ_FLT_END;
+                       rep->analyse_exp = TICK_ETERNITY;
                        txn->status = 400;
                        http_reply_and_close(s, txn->status, http_error_message(s));
 
@@ -1587,6 +1593,8 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                        }
 
                        rep->analysers &= AN_RES_FLT_END;
+                       s->req.analysers &= AN_REQ_FLT_END;
+                       rep->analyse_exp = TICK_ETERNITY;
                        txn->status = 502;
                        s->si[1].flags |= SI_FL_NOLINGER;
                        http_reply_and_close(s, txn->status, http_error_message(s));
@@ -1607,6 +1615,8 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
 
                        _HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
                        rep->analysers &= AN_RES_FLT_END;
+                       s->req.analysers &= AN_REQ_FLT_END;
+                       rep->analyse_exp = TICK_ETERNITY;
 
                        if (!(s->flags & SF_ERR_MASK))
                                s->flags |= SF_ERR_CLICL;