BUG/MINOR: http-ana: Report internal error if an action yields on a final eval
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 29 Oct 2024 17:09:51 +0000 (18:09 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Nov 2024 14:48:34 +0000 (15:48 +0100)
This was already performed for tcp actions at content level, but not for
HTTP actions. It is always a bug, so it must be reported accordingly.

This patch may be backported to all stable versions.

(cherry picked from commit 65ea29dcf85c6553e6dd0613a9c6c506fe22b9ac)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/http_ana.c

index 6af8fdb..0c62131 100644 (file)
@@ -2704,6 +2704,13 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
                                        goto end;
                                case ACT_RET_YIELD:
                                        s->current_rule = rule;
+                                       if (act_opts & ACT_OPT_FINAL) {
+                                               send_log(s->be, LOG_WARNING,
+                                                        "Internal error: action yields while it is  no long allowed "
+                                                        "for the http-request actions.");
+                                               rule_ret = HTTP_RULE_RES_ERROR;
+                                               goto end;
+                                       }
                                        rule_ret = HTTP_RULE_RES_YIELD;
                                        goto end;
                                case ACT_RET_ERR:
@@ -2869,6 +2876,13 @@ resume_execution:
                                        goto end;
                                case ACT_RET_YIELD:
                                        s->current_rule = rule;
+                                       if (act_opts & ACT_OPT_FINAL) {
+                                               send_log(s->be, LOG_WARNING,
+                                                        "Internal error: action yields while it is no long allowed "
+                                                        "for the http-response/http-after-response actions.");
+                                               rule_ret = HTTP_RULE_RES_ERROR;
+                                               goto end;
+                                       }
                                        rule_ret = HTTP_RULE_RES_YIELD;
                                        goto end;
                                case ACT_RET_ERR: