fix empty rules error

pull/13/head
kindle 2013-11-07 12:44:31 +08:00
parent 4b99b0de33
commit df45c9884a
1 changed files with 5 additions and 5 deletions

View File

@ -95,7 +95,7 @@ function args()
else
data=val
end
if data and type(data) ~= "boolean" and ngxmatch(unescape(data),rule,"isjo") then
if data and type(data) ~= "boolean" and rule ~="" and ngxmatch(unescape(data),rule,"isjo") then
log('GET',ngx.var.request_uri,"-",rule)
say_html()
return true
@ -109,7 +109,7 @@ end
function url()
if UrlDeny then
for _,rule in pairs(urlrules) do
if ngxmatch(ngx.var.request_uri,rule,"isjo") then
if rule ~="" and ngxmatch(ngx.var.request_uri,rule,"isjo") then
log('GET',ngx.var.request_uri,"-",rule)
say_html()
return true
@ -122,7 +122,7 @@ end
function ua()
local ua = ngx.var.http_user_agent
for _,rule in pairs(uarules) do
if ngxmatch(ua,rule,"isjo") then
if rule ~="" and ngxmatch(ua,rule,"isjo") then
log('UA',ngx.var.request_uri,"-",rule)
return true
end
@ -131,7 +131,7 @@ function ua()
end
function body(data)
for _,rule in pairs(postrules) do
if ngxmatch(unescape(data),rule,"isjo") then
if rule ~="" and ngxmatch(unescape(data),rule,"isjo") then
log('POST',ngx.var.request_uri,data,rule)
say_html()
return true
@ -143,7 +143,7 @@ function cookie()
local ck = ngx.var.http_cookie
if CookieCheck and ck then
for _,rule in pairs(ckrules) do
if ngxmatch(ck,rule,"isjo") then
if rule ~="" and ngxmatch(ck,rule,"isjo") then
log('Cookie',ngx.var.request_uri,"-",rule)
say_html()
return true