From: Christopher Faulet Date: Fri, 13 Dec 2019 08:36:11 +0000 (+0100) Subject: MINOR: http-rules: Return an error when custom actions return ACT_RET_ERR X-Git-Tag: v2.2-dev1~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28160e73ddd5ae2b04065aec29ccbceb074e9929;p=thirdparty%2Fhaproxy.git MINOR: http-rules: Return an error when custom actions return ACT_RET_ERR Thanks to the commit "MINOR: actions: Use ACT_RET_CONT code to ignore an error from a custom action", it is now possible to trigger an error from a custom action in http rules. Now, when a custom action returns the ACT_RET_ERR code from an http-request rule, an error 400 is returned. And from an http-response rule, an error 502 is returned. Be careful if this patch is backported. The other mentioned patch must be backported first. --- diff --git a/src/http_ana.c b/src/http_ana.c index 047ed813a5..f5cdd05c29 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -3100,6 +3100,8 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis switch (rule->action_ptr(rule, px, s->sess, s, act_flags)) { case ACT_RET_ERR: + rule_ret = HTTP_RULE_RES_BADREQ; + goto end; case ACT_RET_CONT: break; case ACT_RET_STOP: @@ -3493,6 +3495,8 @@ resume_execution: switch (rule->action_ptr(rule, px, s->sess, s, act_flags)) { case ACT_RET_ERR: + rule_ret = HTTP_RULE_RES_BADREQ; + goto end; case ACT_RET_CONT: break; case ACT_RET_STOP: