]> git.ipfire.org Git - thirdparty/knot-resolver.git/commit
daemon: allow per-request variables in Lua
authorMarek Vavruša <mvavrusa@cloudflare.com>
Wed, 28 Mar 2018 05:43:53 +0000 (22:43 -0700)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Wed, 30 May 2018 18:59:40 +0000 (11:59 -0700)
commit14de9110d4b675c7daf110fc510bd6f30e203443
treea70cdbaac6090369a7bfe9f51f86111b46efd7b5
parentd316da92dcd402002fd0ad43563de7a6f19e4970
daemon: allow per-request variables in Lua

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.

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.
daemon/engine.c
daemon/lua/kres-gen.lua
daemon/lua/kres.lua
daemon/worker.c
daemon/worker.h
lib/resolve.h
modules/dns64/dns64.lua
modules/dns64/dns64.test.lua [new file with mode: 0644]
modules/hints/README.rst
modules/hints/hints.c