最小示例如下:
1 local resty_sha384 = require "resty.sha384"
2 local str = require "resty.string"
3 local sha384 = resty_sha384:new()
4 ngx.say(type(sha384))
5
6 ngx.say(sha384:update("hel"))
7 ngx.say(sha384:update("lo"))
8 local digest = sha384:final()
9 ngx.say("sha384: ", str.to_hex(digest))
出错信息:
831#0: *38 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/cry.lua:6: attempt to index local 'sha384' (a nil value)
stack traceback:
coroutine 0:
/usr/local/openresty/nginx/conf/cry.lua: in function </usr/local/openresty/nginx/conf/cry.lua:1>, client: 10.68.143.131, server: 10.68.150.6, request: "GET /cry HTTP/1.1", host: "10.68.150.6"
2014/04/09 17:10:27 [error] 831#0: *39 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/cry.lua:6: attempt to index local 'sha384' (a nil value)
这个与操作系统有关吗?
在FreeBSD下就没有问题的说。
使用的为ngx_openresty-1.5.12.1rc1