From 18387e2e486fb3d6c1623c1911752639622288d2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 25 Jul 2013 12:02:38 +0200 Subject: [PATCH] MINOR: sample: fix sample_process handling of unstable data sample_process() used to return NULL on changing data, regardless of the SMP_OPT_FINAL flag. Let's change this so that it is now possible to include such data in logs or HTTP headers. Also, one unconvenient thing was that it used to always set the sample flags to zero, making it incompatible with ACLs which may need to call it multiple times. Only do this for locally-allocated samples. --- src/sample.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sample.c b/src/sample.c index 433a7ad35..fdf540091 100644 --- a/src/sample.c +++ b/src/sample.c @@ -770,14 +770,15 @@ struct sample *sample_process(struct proxy *px, struct session *l4, void *l7, { struct sample_conv_expr *conv_expr; - if (p == NULL) + if (p == NULL) { p = &temp_smp; + p->flags = 0; + } - p->flags = 0; if (!expr->fetch->process(px, l4, l7, opt, expr->arg_p, p)) return NULL; - if (p->flags & SMP_F_MAY_CHANGE) + if ((p->flags & SMP_F_MAY_CHANGE) && !(opt & SMP_OPT_FINAL)) return NULL; /* we can only use stable samples */ list_for_each_entry(conv_expr, &expr->conv_exprs, list) {