getting hmac-sha256 defined in set-misc-nginx-module from content_by_lua_block

17 views
Skip to first unread message

Vitaly Zuevsky

unread,
Oct 26, 2022, 9:05:48 AM10/26/22
to openre...@googlegroups.com

Hi all,

 

I am new to lua and I need to get hmac-sha256 (that I used to do with misc module) in content_by_lua_block. I do not want require additional modules because the functionality is already there, so I’d like to use it, while I couldn’t find in any documentation how to get there.

 

On a side note, how do I enumerate/print all properties (variables and functions) of an object? I want to inspect ngx, but whatever I do I have 500 with “bad argument #1 to 'print' (non-array table found)”.

 

Thank you.


Virus-free.www.avg.com

Junlong li

unread,
Oct 27, 2022, 9:11:07 AM10/27/22
to openresty-en
For the first, I think you can get the var by ngx.var.VAR_NAME
For the second, you can use pairs to iterate the object if the object is a table.
```
local obj
local t = type(obj)
if t == "table" then
elseif t == "string" then
....
end
```
Reply all
Reply to author
Forward
0 new messages