Update common.lua

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

@ -528,9 +528,9 @@ function _M.write_log(self, name, rule)
self:inc_log(name,rule)
end
function _M.split_bylog(self,str,reps )
function _M.split_bylog(self, str,reps)
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
end
@ -554,12 +554,12 @@ function _M.get_real_ip(self, server_name)
-- ipv6
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
end
-- 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
if client_ip == nil then
client_ip = "unknown"

Loading…
Cancel
Save