]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: vars: do not freeze the connection when the expression cannot be fetched
authorWilly Tarreau <w@1wt.eu>
Tue, 23 Jun 2015 13:17:33 +0000 (15:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 23 Jun 2015 13:17:33 +0000 (15:17 +0200)
Commit 4834bc7 ("MEDIUM: vars: adds support of variables") brought a bug.
Setting a variable from an expression that doesn't resolve infinitely
blocks the processing.

The internal actions API must be changed to let the caller pass the various
flags regarding the state of the analysis (SMP_OPT_FINAL).

For now we only fix the issue by making the action_store() function always
return 1 to prevent any blocking.

No backport is needed.

src/vars.c

index fa521f35e1879a6ab17c568467be0e0207522bb2..74a6ec8ffb629f3239b6f77ed0bed84dd8da7b03 100644 (file)
@@ -449,7 +449,9 @@ int vars_get_by_name(const char *name, size_t len, struct stream *strm, struct s
        return 1;
 }
 
-/* Returns 0 if miss data, else returns 1. */
+/* Returns 0 if we need to come back later to complete the sample's retrieval,
+ * otherwise 1. For now all processing is considered final so we only return 1.
+ */
 static inline int action_store(struct sample_expr *expr, const char *name,
                                enum vars_scope scope, struct proxy *px,
                                struct stream *s, int sens)
@@ -459,7 +461,7 @@ static inline int action_store(struct sample_expr *expr, const char *name,
        /* Process the expression. */
        memset(&smp, 0, sizeof(smp));
        if (!sample_process(px, s->sess, s, sens|SMP_OPT_FINAL, expr, &smp))
-               return 0;
+               return 1;
 
        /* Store the sample, and ignore errors. */
        sample_store_stream(name, scope, s, &smp);