From: Christopher Faulet Date: Wed, 26 May 2021 08:31:06 +0000 (+0200) Subject: BUG/MINOR: http-ana: Send the right error if max retries is reached on L7 retry X-Git-Tag: v2.5-dev1~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=552601d5fd924f609dfc397baae8f5d96104d89d;p=thirdparty%2Fhaproxy.git BUG/MINOR: http-ana: Send the right error if max retries is reached on L7 retry This bug was introduced by the previous commit (9f5382e45 Revert "MEDIUM: http-ana: Deal with L7 retries in HTTP analysers") because I failed the revert. On L7 retry, if the maximum connection retries is reached, an error must be return to the client. Depending the situation, it may be a 502-Bad-Gateway (empty-response or junk-response), a 504-Gateway-Timeout (response-timeout) or a 425-Too-Early (0rtt-rejected). But contrary to what the comment says, the do_l7_retry() function always returns a success. Note it is not a problem for L7 retries on the response status code because the stream-interface already takes care to have not reached the maximum connection retries counter to trigger a L7 retry. This patch must be backported to 2.4 because the commit must also be backported to 2.4. --- diff --git a/src/http_ana.c b/src/http_ana.c index ef9ee65817..ee0422e7c0 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1269,7 +1269,7 @@ static __inline int do_l7_retry(struct stream *s, struct stream_interface *si) si->conn_retries--; if (si->conn_retries < 0) - goto no_retry; + return -1; if (objt_server(s->target)) { if (s->flags & SF_CURR_SESS) { @@ -1307,7 +1307,6 @@ static __inline int do_l7_retry(struct stream *s, struct stream_interface *si) DBG_TRACE_DEVEL("perform a L7 retry", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, s->txn); - no_retry: b_reset(&res->buf); co_set_data(res, 0); return 0;