Christopher, Thierry, this patch series implements the solution discussed in GitHub issue #624:
https://github.com/haproxy/haproxy/issues/624#issuecomment-630590470 I felt pretty dirty having to copy and paste my changes to all three versions of `set_var` and `unset_var`. This should be refactored one day to use a single generic implementation. All three versions only differ slightly with regard to where they take their `appctx` from. I did not refactor that, because I don't really feel confident doing that large changes within Lua, yet :-) I hope I didn't miss anything to adjust. I've added a new reg-test that verifies the intended behavior and made sure that all the Lua reg-tests still pass. Best regards Tim Düsterhus (6): REGTESTS: Add missing OPENSSL to REQUIRE_OPTIONS for lua/txn_get_priv MINOR: lua: Use vars_unset_by_name_ifexist() CLEANUP: vars: Remove void vars_unset_by_name(const char*, size_t, struct sample*) MINOR: vars: Make vars_(un|)set_by_name(_ifexist|) return a success value MINOR: lua: Make `set_var()` and `unset_var()` return success MEDIUM: lua: Add `ifexist` parameter to `set_var` doc/lua-api/index.rst | 18 ++++++++++-- include/proto/vars.h | 7 ++--- reg-tests/lua/set_var.lua | 25 +++++++++++++++++ reg-tests/lua/set_var.vtc | 51 ++++++++++++++++++++++++++++++++++ reg-tests/lua/txn_get_priv.vtc | 2 +- src/hlua.c | 48 ++++++++++++++++++++++---------- src/vars.c | 40 +++++++++----------------- 7 files changed, 141 insertions(+), 50 deletions(-) create mode 100644 reg-tests/lua/set_var.lua create mode 100644 reg-tests/lua/set_var.vtc -- 2.26.2