lua-ffi-zlib
lua-ffi-zlib copied to clipboard
INFLATE: data error
my code
function _M:inflategzip(is_zip, zip_total_size, body)
if is_zip and is_zip == true then
local chunk = 16384
local output_table = {}
local count = 0
local input = function(bufsize)
local start = count > 0 and bufsize*count or 1
local datas = body:sub(start, (bufsize*(count+1)-1) )
count = count + 1
return datas
end
local output_table = {}
local output = function(data)
table_insert(output_table, data)
end
local ok, err = zlib.inflateGzip(input, output, chunk)
if not ok then
ngx.log(ngx.ERR, "--> zlib error---- ", err)
end
body = table_concat(output_table,'')
if string_len(body) ~= zip_total_size then
ngx.log(ngx.ERR, "--> error 2---- ", err)
end
return body
end
return body
end
nginx_error.log 文件中出现
2018/10/26 19:11:16 [error] 6411#0: *2631471 [lua] soft.lua:179: inflategzip(): --> zlib error---- INFLATE: data error, client: 106.32.216.112, server: -, request: "GET /socket?order=23243 HTTP/1.1", host: "gamewaf.23af.com"