hsmp->s = txn->s;
hsmp->p = txn->p;
+ hsmp->dir = txn->dir;
hsmp->stringsafe = stringsafe;
/* Pop a class sesison metatable and affect it to the userdata. */
smp.px = hsmp->p;
smp.sess = hsmp->s->sess;
smp.strm = hsmp->s;
- smp.opt = 0;
+ smp.opt = hsmp->dir & SMP_OPT_DIR;
if (!f->process(args, &smp, f->kw, f->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");
hsmp->s = txn->s;
hsmp->p = txn->p;
+ hsmp->dir = txn->dir;
hsmp->stringsafe = stringsafe;
/* Pop a class stream metatable and affect it to the table. */
smp.px = hsmp->p;
smp.sess = hsmp->s->sess;
smp.strm = hsmp->s;
- smp.opt = 0;
+ smp.opt = hsmp->dir & SMP_OPT_DIR;
if (!conv->process(args, &smp, conv->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");
* return 0 if the stack does not contains free slots,
* otherwise it returns 1.
*/
-static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p)
+static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p, int dir)
{
struct hlua_txn *htxn;
htxn->s = s;
htxn->p = p;
+ htxn->dir = dir;
/* Create the "f" field that contains a list of fetches. */
lua_pushstring(L, "f");
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)) {
+ if (!hlua_txn_new(stream->hlua.T, stream, smp->px, smp->opt & SMP_OPT_DIR)) {
SEND_ERR(smp->px, "Lua sample-fetch '%s': full stack.\n", fcn->name);
RESET_SAFE_LJMP(stream->hlua.T);
return 0;
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)) {
+ if (!hlua_txn_new(s->hlua.T, s, px, dir)) {
SEND_ERR(px, "Lua function '%s': full stack.\n",
rule->arg.hlua_rule->fcn.name);
RESET_SAFE_LJMP(s->hlua.T);