diff --git a/include/types/action.h b/include/types/action.h index 5a581c7ba..b1e19e7fa 100644 --- a/include/types/action.h +++ b/include/types/action.h @@ -49,6 +49,7 @@ enum act_parse_ret { /* flags passed to custom actions */ enum act_flag { ACT_FLAG_NONE = 0x00000000, /* no flag */ + ACT_FLAG_FINAL = 0x00000001, /* last call, cannot yield */ }; enum act_name { diff --git a/src/proto_tcp.c b/src/proto_tcp.c index baac91a6c..825f32085 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1165,7 +1165,8 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit) /* Custom keywords. */ if (!rule->action_ptr) continue; - switch (rule->action_ptr(rule, s->be, s->sess, s, 0)) { + + switch (rule->action_ptr(rule, s->be, s->sess, s, (partial & SMP_OPT_FINAL) ? ACT_FLAG_FINAL : 0)) { case ACT_RET_ERR: case ACT_RET_CONT: continue; @@ -1294,7 +1295,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit) /* Custom keywords. */ if (!rule->action_ptr) continue; - switch (rule->action_ptr(rule, s->be, s->sess, s, 0)) { + switch (rule->action_ptr(rule, s->be, s->sess, s, (partial & SMP_OPT_FINAL) ? ACT_FLAG_FINAL : 0)) { case ACT_RET_ERR: case ACT_RET_CONT: continue; @@ -1382,7 +1383,7 @@ int tcp_exec_req_rules(struct session *sess) /* Custom keywords. */ if (rule->action_ptr) break; - switch (rule->action_ptr(rule, sess->fe, sess, NULL, 0)) { + switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_FLAG_FINAL)) { 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.