fixed: 多参数以及无参数处理

This commit is contained in:
potatso 2023-08-08 13:56:46 +08:00
parent a61b5e806a
commit e23694e209

View File

@ -34,6 +34,7 @@ function _M.build_and_process_header(transaction)
end end
function _M.build_and_process_body(transaction) function _M.build_and_process_body(transaction)
ngx.req.read_body()
local req_body = ngx.req.get_body_data() local req_body = ngx.req.get_body_data()
if req_body then if req_body then
-- TODO: fix code to process multipart/formdata -- TODO: fix code to process multipart/formdata
@ -49,19 +50,20 @@ end
function _M.build_and_process_get_args(transaction) function _M.build_and_process_get_args(transaction)
-- process http get args if has -- process http get args if has
local arg = ngx.req.get_uri_args() local arg = ngx.req.get_uri_args()
for k,v in pairs(arg) do for k, v in pairs(arg) do
if type(v) == "table" then if type(v) == "table" then
nlog(warn_fmt("http get args potentially has HPP!")) nlog(warn_fmt("http get args potentially has HPP!"))
for _, value in ipairs(v) do for _, value in ipairs(v) do
if type(value) == "string" then
-- 类似于 test.com?test 有key无value,value为boolean
coraza.add_get_args(transaction, k, value) coraza.add_get_args(transaction, k, value)
end end
else end
elseif type(v) == "string" then
-- 类似于 test.com?test 有key无value,value为boolean
coraza.add_get_args(transaction, k, v) coraza.add_get_args(transaction, k, v)
end end
end end
end end
return _M return _M