Adis,

Am 19.05.20 um 15:57 schrieb Adis Nezirovic:
> However, nothing in the code checks that variable name is formed
> correctly (with correct prefix, such as "txn."), or that the rest of the
> variable name is correct.
> 
> Lua code using set_var() with wrong name silently fails, the variable is
> not set, and nothing is logged
> .
> 
> 
> With your proposal set_var() now can return result, and we could even
> log warning for "variable name syntax error".
> 

Have a look at the reg-test in patch 5/6. I specifically added a test
that checks the return value for incorrect variable names.

> ---8<---
> 
> Now back on topic. Instead of adding more parameters to set_var(), I'd
> prefer a warning instead.
> 
> If someone is using set_var() from Lua, and that variable is never used
> or set in the rest of the config, we would know that. Additionally, one
> can set "zero-warning" option to prevent abuse by Lua scripts or to
> prevent bugs.

This would break my use case for haproxy-auth-request. The plan is that
the Lua script unconditionally sets are variable for all response
headers and that HAProxy with my patches applied drops the variables
that are never going to be read. I specifically want to avoid that the
administrator needs to configure the headers to expose. Details are in:
https://github.com/TimWolla/haproxy-auth-request/pull/13

> For your use case, maybe you could use maps from Lua? They should be
> backed by ebtree and be faster right?
> 

To my understanding Maps are not scoped per request and thus would not
be usable for haproxy-auth-request.

Best regards
Tim Düsterhus

Reply via email to