Update common.lua

pull/216/head
midoks 3 years ago
parent 8864e91f21
commit fab4e68d8d
  1. 6
      plugins/op_waf/waf/lua/common.lua

@ -530,7 +530,7 @@ end
function _M.split_bylog(self, str,reps) function _M.split_bylog(self, str,reps)
local resultStrList = {} local resultStrList = {}
string.gsub(str,'[^'..reps..']+',function(w) table.insert(resultStrList,w) end) ngx.re.gsub(str,'[^'..reps..']+',function(w) table.insert(resultStrList,w) end)
return resultStrList return resultStrList
end end
@ -554,12 +554,12 @@ function _M.get_real_ip(self, server_name)
-- ipv6 -- ipv6
if type(client_ip) == 'table' then client_ip = "" end if type(client_ip) == 'table' then client_ip = "" end
if client_ip ~= "unknown" and string.match(client_ip,"^[%w:]+$") then if client_ip ~= "unknown" and ngx.re.match(client_ip,"^[%w:]+$") then
return client_ip return client_ip
end end
-- ipv4 -- ipv4
if string.match(client_ip,"%d+%.%d+%.%d+%.%d+") == nil or not self:is_ipaddr(client_ip) then if ngx.re.match(client_ip,"%d+%.%d+%.%d+%.%d+") == nil or not self:is_ipaddr(client_ip) then
client_ip = ngx.var.remote_addr client_ip = ngx.var.remote_addr
if client_ip == nil then if client_ip == nil then
client_ip = "unknown" client_ip = "unknown"

Loading…
Cancel
Save