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.
diff --git a/src/sample.c b/src/sample.c
index 433a7ad..fdf5400 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -770,14 +770,15 @@
{
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) {