附上相关代码
local args = ngx.req.get_uri_args()
if ngx.var.request_method == "POST" then
ngx.req.read_body() <<< 这里报错
for key, val in pairs(ngx.req.get_post_args()) do
args[key] = val
end
end
在 2012年12月17日星期一UTC+8下午2时53分41秒,laowang写道:
一个接收post数据的脚本,最初是用php写了,从来没有报错过,现在出于性能的考虑,改成了ngx lua,多数时候都正常,但有时候会报错:
2012/12/17 14:47:07 [error] 10098#0: *922796 lua entry thread aborted: runtime error: ...r/xxx.lua:144: failed to read request body
stack traceback:
coroutine 0:
[C]: in function 'read_body'
...r/xxx.lua:144: in function <...r/xxx.lua:1>, client: 112.96.30.55, server:
..., request: "POST /aaa/xxx HTTP/1.1", host: "
..."