BUG/MEDIUM: vars: do not freeze the connection when the expression cannot be fetched

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.
This commit is contained in:
Willy Tarreau 2015-06-23 15:17:33 +02:00
parent ebcd4844e8
commit e44136fe69

View 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);