From df45c9884a794338d719f69a7a5b2dd8a0936d39 Mon Sep 17 00:00:00 2001 From: kindle <82163261@qq.com> Date: Thu, 7 Nov 2013 12:44:31 +0800 Subject: [PATCH] fix empty rules error --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index f9d693e..468cede 100644 --- a/init.lua +++ b/init.lua @@ -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