struct stream *stream = smp->strm;
const char *error;
const struct buffer msg = { };
+ unsigned int hflags = HLUA_TXN_NOTERM;
if (!stream)
return 0;
consistency_set(stream, smp->opt, &stream->hlua->cons);
+ if (stream->be->mode == PR_MODE_HTTP) {
+ if ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
+ hflags |= ((stream->txn->req.msg_state < HTTP_MSG_BODY) ? 0 : HLUA_TXN_HTTP_RDY);
+ else
+ hflags |= ((stream->txn->rsp.msg_state < HTTP_MSG_BODY) ? 0 : HLUA_TXN_HTTP_RDY);
+ }
+
/* If it is the first run, initialize the data for the call. */
if (!HLUA_IS_RUNNING(stream->hlua)) {
lua_rawgeti(stream->hlua->T, LUA_REGISTRYINDEX, fcn->function_ref);
/* push arguments in the stack. */
- if (!hlua_txn_new(stream->hlua->T, stream, smp->px, smp->opt & SMP_OPT_DIR,
- HLUA_TXN_NOTERM)) {
+ if (!hlua_txn_new(stream->hlua->T, stream, smp->px, smp->opt & SMP_OPT_DIR, hflags)) {
SEND_ERR(smp->px, "Lua sample-fetch '%s': full stack.\n", fcn->name);
RESET_SAFE_LJMP(stream->hlua->T);
return 0;
struct session *sess, struct stream *s, int flags)
{
char **arg;
- unsigned int analyzer;
+ unsigned int hflags = 0;
int dir;
const char *error;
const struct buffer msg = { };
switch (rule->from) {
- case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE ; dir = SMP_OPT_DIR_REQ; break;
- case ACT_F_TCP_RES_CNT: analyzer = AN_RES_INSPECT ; dir = SMP_OPT_DIR_RES; break;
- case ACT_F_HTTP_REQ: analyzer = AN_REQ_HTTP_PROCESS_FE; dir = SMP_OPT_DIR_REQ; break;
- case ACT_F_HTTP_RES: analyzer = AN_RES_HTTP_PROCESS_BE; dir = SMP_OPT_DIR_RES; break;
+ case ACT_F_TCP_REQ_CNT: ; dir = SMP_OPT_DIR_REQ; break;
+ case ACT_F_TCP_RES_CNT: ; dir = SMP_OPT_DIR_RES; break;
+ case ACT_F_HTTP_REQ: hflags = HLUA_TXN_HTTP_RDY ; dir = SMP_OPT_DIR_REQ; break;
+ case ACT_F_HTTP_RES: hflags = HLUA_TXN_HTTP_RDY ; dir = SMP_OPT_DIR_RES; break;
default:
SEND_ERR(px, "Lua: internal error while execute action.\n");
return ACT_RET_CONT;
lua_rawgeti(s->hlua->T, LUA_REGISTRYINDEX, rule->arg.hlua_rule->fcn.function_ref);
/* Create and and push object stream in the stack. */
- if (!hlua_txn_new(s->hlua->T, s, px, dir, 0)) {
+ if (!hlua_txn_new(s->hlua->T, s, px, dir, hflags)) {
SEND_ERR(px, "Lua function '%s': full stack.\n",
rule->arg.hlua_rule->fcn.name);
RESET_SAFE_LJMP(s->hlua->T);
case HLUA_E_AGAIN:
/* Set timeout in the required channel. */
if (s->hlua->wake_time != TICK_ETERNITY) {
- if (analyzer & (AN_REQ_INSPECT_FE|AN_REQ_HTTP_PROCESS_FE))
+ if (dir & SMP_OPT_DIR_REQ)
s->req.analyse_exp = s->hlua->wake_time;
- else if (analyzer & (AN_RES_INSPECT|AN_RES_HTTP_PROCESS_BE))
+ else
s->res.analyse_exp = s->hlua->wake_time;
}
/* Some actions can be wake up when a "write" event