using ffizlib in lua, android response 500 error , web browser none error

29 views
Skip to first unread message

fc1...@gmail.com

unread,
Nov 12, 2018, 5:23:41 AM11/12/18
to openresty-en
using ffizlib in lua, android response 500 error , web browser none error

the code:
local chunk =16384 --#resbody
ngx_log(ngx_INFO,"chunk:",chunk)
local count = 0  
local input = function(bufsize)
local start = count > 0 and bufsize*count or 1  
local data = body:sub(start, (bufsize*(count+1)-1))  
if data == "" then  
data = nil  
end
count = count + 1  
return data  
end
local output_table = {}
local output = function(data)
table_insert(output_table, data)
end
ngx_log(ngx_INFO,"ffizlib.deflateGzip start")
local ok, err = ffizlib.deflateGzip(input, output, chunk)


error:

attempt to call global 'table_insert' (a nil value), at the up code output function.

Max D. Bellasys

unread,
Nov 19, 2018, 8:22:29 PM11/19/18
to openresty-en
Just looking at your code and the error... table_insert isn’t defined in the code.

Did you mean table.insert(...) per Lua syntax?

I hand-rolled FFI + zlib + C++ application before, so I was not familiar with ffizlib module- maybe this is a standard method?

Please clarify
Reply all
Reply to author
Forward
Message has been deleted
0 new messages