VeryNginx
VeryNginx copied to clipboard
Matcher中設置的cookies匹配規則value中!≈、!=與Not Existed無法生效。
Matcher中設置的cookies匹配規則value中!≈、!=與Not Existed無法正常匹配。 經測試,≈、=、和Existed都正常。
这个是由于作者的逻辑问题,他循环的是外部传入的变量,但是不存在的话是怎么都无法触发的
!Exist
规则可以暂时在module/request_tester.lua
内增加和替换以下方法修复:
(有点想重构这个部分)
function _M.test_cookie( condition )
local cookie_obj, err = cookie:new()
local cookie_table = cookie_obj:get_all()
if cookie_table == nil then
cookie_table = {}
end
if condition['name_operator'] == '!Exist' then
if _M.key_does_not_exist(cookie_table, condition['name_value']) then
return true
else
return false
end
end
return _M.test_many_var( cookie_table, condition )
end
function _M.key_does_not_exist( var_table, key )
if var_table[key] == nil then
return true
else
return false
end
end