From c7055d1e992bb89af60e2610709b694563fa96ff Mon Sep 17 00:00:00 2001 From: potatso Date: Tue, 11 Jul 2023 16:46:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0deny=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E5=90=8C=E6=A0=B7=E4=B8=BAblock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/resty/coraza.lua | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/resty/coraza.lua b/lib/resty/coraza.lua index 13925ec..1ba3b79 100644 --- a/lib/resty/coraza.lua +++ b/lib/resty/coraza.lua @@ -75,16 +75,9 @@ function _M.do_handle() -- Response which was disrupted doesn't make sense. if ngx_ctx.action ~= nil and ngx_ctx.transaction ~= nil then nlog(warn_fmt([[Transaction %s request: "%s" is interrupted by policy. Action is %s]], ngx_ctx.request_id, ngx_var.request, ngx_ctx.action)) - if ngx_ctx.action == "drop" then + if ngx_ctx.action == "drop" or ngx_ctx.action == "deny" then ngx_ctx.is_disrupted = true return ngx_ctx.status_code, fmt(consts.BLOCK_CONTENT_FORMAT, ngx_ctx.status_code) - -- TODO: disrupted by more action - --elseif ngx_ctx.action == "deny" then - -- ngx.status = ngx_ctx.status_code - -- -- NYI: cannot call this C function (yet) - -- -- ngx.header.content_type = consts.BLOCK_CONTENT_TYPE - -- ngx.say(fmt(consts.BLOCK_CONTENT_FORMAT, ngx_ctx.status_code)) - -- return ngx.exit(ngx.status) end end end @@ -106,13 +99,6 @@ function _M.do_interrupt() nlog(err_fmt(msg)) end return ngx.exit(ngx.status) - -- TODO: disrupted by more action - -- elseif ngx_ctx.action == "deny" then - -- ngx.status = ngx_ctx.status_code - ---- NYI: cannot call this C function (yet) - ---- ngx.header.content_type = consts.BLOCK_CONTENT_TYPE - -- ngx.say(fmt(consts.BLOCK_CONTENT_FORMAT, ngx_ctx.status_code)) - -- eturn ngx.exit(ngx.status) end end