]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample: fill the struct sample with the options.
authorThierry FOURNIER <tfournier@haproxy.com>
Mon, 11 May 2015 13:25:29 +0000 (15:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2015 18:02:11 +0000 (20:02 +0200)
Options are relative to the sample. Each sample fetched is associated with
fetch options or fetch flags.

This patch adds the 'opt' vaue in the sample struct. This permits to reduce
the sample-fetch function prototype. In other way, the converters will have
more detail about the origin of the sample.

include/types/sample.h
src/hlua.c
src/sample.c

index 07b12f3d9617ceb6fc8184553e85f4fb46313bdf..117b06019c40ee96253490f183975792b556a285 100644 (file)
@@ -252,6 +252,7 @@ struct sample {
        struct proxy *px;
        struct session *sess;
        struct stream *strm;
+       unsigned int opt; /* fetch options (SMP_OPT_*) */
 };
 
 /* Used to store sample constant */
index d45cac9859f1a1e04bf994bb0162470d118b1c7a..262163035303efa6de0ad27bb5e71481f698dd14 100644 (file)
@@ -2773,6 +2773,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
        smp.px = hsmp->p;
        smp.sess = hsmp->s->sess;
        smp.strm = hsmp->s;
+       smp.opt = 0;
        if (!f->process(0, args, &smp, f->kw, f->private)) {
                if (hsmp->stringsafe)
                        lua_pushstring(L, "");
@@ -2894,6 +2895,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L)
        smp.px = hsmp->p;
        smp.sess = hsmp->s->sess;
        smp.strm = hsmp->s;
+       smp.opt = 0;
        if (!conv->process(args, &smp, conv->private)) {
                if (hsmp->stringsafe)
                        lua_pushstring(L, "");
index 8cc2234cccb2a4984b98f2b91f07fd3d198bb8cb..353d6bbc2e4e22c094be45597896715a3772f432 100644 (file)
@@ -1036,6 +1036,7 @@ struct sample *sample_process(struct proxy *px, struct session *sess,
        p->px   = px;
        p->sess = sess;
        p->strm = strm;
+       p->opt  = opt;
        if (!expr->fetch->process(opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
                return NULL;