]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http-rules: Handle denied/aborted/invalid connections from HTTP rules
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 16 Dec 2019 12:07:14 +0000 (13:07 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 20 Jan 2020 14:18:45 +0000 (15:18 +0100)
The new possible results for a custom action (deny/abort/invalid) are now handled
during HTTP rules evaluation. These codes are mapped on HTTP rules ones :

  * ACT_RET_DENY => HTTP_RULE_RES_DENY
  * ACT_RET_ABRT => HTTP_RULE_RES_ABRT
  * ACT_RET_INV  => HTTP_RULE_RES_BADREQ

For now, no custom action uses these new codes.

src/http_ana.c

index 983c5eb093641c436451e047c5993fb8549f1dfd..14a86a1b215eb3100b8eab1ee3a63f2b2624e446 100644 (file)
@@ -3176,21 +3176,30 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
                                        act_flags |= ACT_FLAG_FINAL;
 
                                switch (rule->action_ptr(rule, px, s->sess, s, act_flags)) {
-                                       case ACT_RET_ERR:
-                                               rule_ret = HTTP_RULE_RES_ERROR;
-                                               goto end;
                                        case ACT_RET_CONT:
                                                break;
                                        case ACT_RET_STOP:
                                                rule_ret = HTTP_RULE_RES_STOP;
                                                goto end;
-                                       case ACT_RET_DONE:
-                                               rule_ret = HTTP_RULE_RES_DONE;
-                                               goto end;
                                        case ACT_RET_YIELD:
                                                s->current_rule = rule;
                                                rule_ret = HTTP_RULE_RES_YIELD;
                                                goto end;
+                                       case ACT_RET_ERR:
+                                               rule_ret = HTTP_RULE_RES_ERROR;
+                                               goto end;
+                                       case ACT_RET_DONE:
+                                               rule_ret = HTTP_RULE_RES_DONE;
+                                               goto end;
+                                       case ACT_RET_DENY:
+                                               rule_ret = HTTP_RULE_RES_DENY;
+                                               goto end;
+                                       case ACT_RET_ABRT:
+                                               rule_ret = HTTP_RULE_RES_ABRT;
+                                               goto end;
+                                       case ACT_RET_INV:
+                                               rule_ret = HTTP_RULE_RES_BADREQ;
+                                               goto end;
                                }
                                break;
 
@@ -3580,21 +3589,30 @@ resume_execution:
                                        act_flags |= ACT_FLAG_FINAL;
 
                                switch (rule->action_ptr(rule, px, s->sess, s, act_flags)) {
-                                       case ACT_RET_ERR:
-                                               rule_ret = HTTP_RULE_RES_ERROR;
-                                               goto end;
                                        case ACT_RET_CONT:
                                                break;
                                        case ACT_RET_STOP:
                                                rule_ret = HTTP_RULE_RES_STOP;
                                                goto end;
-                                       case ACT_RET_DONE:
-                                               rule_ret = HTTP_RULE_RES_DONE;
-                                               goto end;
                                        case ACT_RET_YIELD:
                                                s->current_rule = rule;
                                                rule_ret = HTTP_RULE_RES_YIELD;
                                                goto end;
+                                       case ACT_RET_ERR:
+                                               rule_ret = HTTP_RULE_RES_ERROR;
+                                               goto end;
+                                       case ACT_RET_DONE:
+                                               rule_ret = HTTP_RULE_RES_DONE;
+                                               goto end;
+                                       case ACT_RET_DENY:
+                                               rule_ret = HTTP_RULE_RES_DENY;
+                                               goto end;
+                                       case ACT_RET_ABRT:
+                                               rule_ret = HTTP_RULE_RES_ABRT;
+                                               goto end;
+                                       case ACT_RET_INV:
+                                               rule_ret = HTTP_RULE_RES_BADREQ;
+                                               goto end;
                                }
                                break;