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.
This commit is contained in:
Willy Tarreau 2013-07-25 12:02:38 +02:00
parent 833cc79434
commit 18387e2e48

View File

@ -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) {