enum act_return {
ACT_RET_CONT, /* continue processing. */
+ ACT_RET_STOP, /* stop processing. */
ACT_RET_YIELD, /* call me again. */
ACT_RET_ERR, /* processing error. */
};
};
enum act_name {
- ACT_ACTION_CONT = 0,
- ACT_ACTION_STOP,
+ ACT_CUSTOM = 0,
/* common action */
ACT_ACTION_ALLOW,
/* TODO: later accept arguments. */
rule->arg.hlua_rule->args = NULL;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = hlua_action;
return ACT_RET_PRS_OK;
}
break;
}
- case ACT_ACTION_CONT:
+ case ACT_CUSTOM:
switch (rule->action_ptr(rule, px, s->sess, s)) {
case ACT_RET_ERR:
case ACT_RET_CONT:
break;
+ case ACT_RET_STOP:
+ return HTTP_RULE_RES_DONE;
case ACT_RET_YIELD:
s->current_rule = rule;
return HTTP_RULE_RES_YIELD;
}
break;
- case ACT_ACTION_STOP:
- switch (rule->action_ptr(rule, px, s->sess, s)) {
- case ACT_RET_YIELD:
- case ACT_RET_ERR:
- case ACT_RET_CONT:
- return HTTP_RULE_RES_DONE;
- }
- break;
-
case ACT_ACTION_TRK_SC0 ... ACT_ACTION_TRK_SCMAX:
/* Note: only the first valid tracking parameter of each
* applies.
return HTTP_RULE_RES_BADREQ;
return HTTP_RULE_RES_DONE;
- case ACT_ACTION_CONT:
+ case ACT_CUSTOM:
switch (rule->action_ptr(rule, px, s->sess, s)) {
case ACT_RET_ERR:
case ACT_RET_CONT:
break;
+ case ACT_RET_STOP:
+ return HTTP_RULE_RES_STOP;
case ACT_RET_YIELD:
s->current_rule = rule;
return HTTP_RULE_RES_YIELD;
}
break;
- case ACT_ACTION_STOP:
- rule->action_ptr(rule, px, s->sess, s);
- return HTTP_RULE_RES_STOP;
-
/* other flags exists, but normaly, they never be matched. */
default:
break;
{
int cur_arg = *orig_arg;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
switch (args[0][4]) {
case 'm' :
{
char *error;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = action_http_set_status;
/* Check if an argument is available */
px->req_cap = hdr;
px->to_log |= LW_REQHDR;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = http_action_req_capture;
rule->arg.cap.expr = expr;
rule->arg.cap.hdr = hdr;
proxy->conf.args.ctx = ARGC_CAP;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = http_action_req_capture_by_id;
rule->arg.capid.expr = expr;
rule->arg.capid.idx = id;
proxy->conf.args.ctx = ARGC_CAP;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = http_action_res_capture_by_id;
rule->arg.capid.expr = expr;
rule->arg.capid.idx = id;
}
else {
/* Custom keywords. */
- if (rule->action_ptr) {
- switch (rule->action_ptr(rule, s->be, s->sess, s)) {
- case ACT_RET_ERR:
- case ACT_RET_CONT:
- break;
- case ACT_RET_YIELD:
- s->current_rule = rule;
- goto missing_data;
- }
- }
-
- /* accept */
- if (rule->action == ACT_ACTION_STOP)
+ if (!rule->action_ptr)
+ continue;
+ switch (rule->action_ptr(rule, s->be, s->sess, s)) {
+ case ACT_RET_ERR:
+ case ACT_RET_CONT:
+ continue;
+ case ACT_RET_STOP:
break;
- /* otherwise continue */
+ case ACT_RET_YIELD:
+ s->current_rule = rule;
+ goto missing_data;
+ }
+ break; /* ACT_RET_STOP */
}
}
}
}
else {
/* Custom keywords. */
- if (rule->action_ptr) {
- switch (rule->action_ptr(rule, s->be, s->sess, s)) {
- case ACT_RET_ERR:
- case ACT_RET_CONT:
- break;
- case ACT_RET_YIELD:
- channel_dont_close(rep);
- s->current_rule = rule;
- return 0;
- }
- }
-
- /* accept */
- if (rule->action == ACT_ACTION_STOP)
+ if (!rule->action_ptr)
+ continue;
+ switch (rule->action_ptr(rule, s->be, s->sess, s)) {
+ case ACT_RET_ERR:
+ case ACT_RET_CONT:
+ continue;
+ case ACT_RET_STOP:
break;
- /* otherwise continue */
+ case ACT_RET_YIELD:
+ channel_dont_close(rep);
+ s->current_rule = rule;
+ return 0;
+ }
+ break; /* ACT_RET_STOP */
}
}
}
}
else {
/* Custom keywords. */
- if (rule->action_ptr) {
- switch (rule->action_ptr(rule, sess->fe, sess, NULL)) {
- case ACT_RET_YIELD:
- /* yield is not allowed at this point. If this return code is
- * used it is a bug, so I prefer to abort the process.
- */
- send_log(sess->fe, LOG_WARNING,
- "Internal error: yield not allowed with tcp-request connection actions.");
- case ACT_RET_CONT:
- break;
- case ACT_RET_ERR:
- result = 0;
- break;
- }
- if (rule->action == ACT_ACTION_CONT)
- continue;
+ if (rule->action_ptr)
+ break;
+ switch (rule->action_ptr(rule, sess->fe, sess, NULL)) {
+ case ACT_RET_YIELD:
+ /* yield is not allowed at this point. If this return code is
+ * used it is a bug, so I prefer to abort the process.
+ */
+ send_log(sess->fe, LOG_WARNING,
+ "Internal error: yield not allowed with tcp-request connection actions.");
+ case ACT_RET_STOP:
+ break;
+ case ACT_RET_CONT:
+ continue;
+ case ACT_RET_ERR:
+ result = 0;
+ break;
}
-
- /* otherwise it's an accept */
- break;
+ break; /* ACT_RET_STOP */
}
}
}
return ACT_RET_PRS_ERR;
}
}
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = action_inc_gpc0;
return ACT_RET_PRS_OK;
}
}
(*arg)++;
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = action_set_gpt0;
return ACT_RET_PRS_OK;
return ACT_RET_PRS_ERR;
}
- rule->action = ACT_ACTION_CONT;
+ rule->action = ACT_CUSTOM;
rule->action_ptr = action_store;
return ACT_RET_PRS_OK;
}