]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: pattern: centralize handling of unstable data in pattern_process()
authorWilly Tarreau <w@1wt.eu>
Thu, 26 Apr 2012 09:05:50 +0000 (11:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 8 May 2012 18:57:18 +0000 (20:57 +0200)
Pattern fetch functions currently check for unstable data and return 0
when SMP_F_MAY_CHANGE is set. Instead of doing this everywhere and having
to support specific fetch functions, better do that in pattern_process()
which is the one interested in having stable data.

src/pattern.c

index 2820cf60d65a336a45f919f555b30c79c2904b3e..66ebc62de65ea2224e4ee8cce159024fc62c41a7 100644 (file)
@@ -486,6 +486,9 @@ struct sample *pattern_process(struct proxy *px, struct session *l4, void *l7,
        if (!expr->fetch->process(px, l4, l7, opt, expr->arg_p, p))
                return NULL;
 
+       if (p->flags & SMP_F_MAY_CHANGE)
+               return NULL; /* we can only use stable patterns */
+
        list_for_each_entry(conv_expr, &expr->conv_exprs, list) {
                /* we want to ensure that p->type can be casted into
                 * conv_expr->conv->in_type. We have 3 possibilities :