Skip to content

daemon: allow per-request variables in Lua

Marek Vavrusa requested to merge lua-add-per-request-variables into master

The handlers in Lua can now store per-request variables that are automatically GC'd when the request is finished. This is useful for stateful modules, such as DNS64 that uses internal option flags for state tracking, or stats that previously couldn't be implemented in Lua

The layers can now get a variable table like so:

local vars = kres.request_t(r):vars()
vars.hello = true

The variables are persisted between different layers for each request.

TODO:

  • Add to to basic resolve tests
  • Update DNS64 module
  • Add to library documentation
Edited by Marek Vavrusa

Merge request reports