diff --git a/inc/ngx_http_waf_module_check.h b/inc/ngx_http_waf_module_check.h index e1c58b0f..49931ea2 100644 --- a/inc/ngx_http_waf_module_check.h +++ b/inc/ngx_http_waf_module_check.h @@ -918,13 +918,14 @@ static void ngx_http_waf_handler_check_black_post(ngx_http_request_t* r) { double end_clock = (double)clock(); ctx->spend += (end_clock - start_clock) / CLOCKS_PER_SEC * 1000; - if (ctx->blocked != NGX_HTTP_WAF_TRUE) { - ngx_http_finalize_request(r, NGX_DONE); - ngx_http_core_run_phases(r); - } else { - ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, "ngx_waf: [%s][%s]", ctx->rule_type, ctx->rule_deatils); - ngx_http_finalize_request(r, srv_conf->waf_http_status); - } + // if (ctx->blocked != NGX_HTTP_WAF_TRUE) { + // ngx_http_finalize_request(r, NGX_DECLINED); + // ngx_http_core_run_phases(r); + // } else { + // ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, "ngx_waf: [%s][%s]", ctx->rule_type, ctx->rule_deatils); + // ngx_http_finalize_request(r, srv_conf->waf_http_status); + // ngx_http_finalize_request(r, NGX_DECLINED); + // } } diff --git a/src/ngx_http_waf_module_core.c b/src/ngx_http_waf_module_core.c index 2a532046..13b561d5 100644 --- a/src/ngx_http_waf_module_core.c +++ b/src/ngx_http_waf_module_core.c @@ -403,7 +403,13 @@ static ngx_int_t check_all(ngx_http_request_t* r, ngx_int_t is_check_cc) { ctx->spend = ((double)clock() / CLOCKS_PER_SEC * 1000) - ctx->spend; http_status = ngx_http_read_client_request_body(r, ngx_http_waf_handler_check_black_post); if (http_status != NGX_ERROR && http_status < NGX_HTTP_SPECIAL_RESPONSE) { - http_status = NGX_DONE; + r->main->count--; + if (ctx->blocked == NGX_HTTP_WAF_TRUE) { + http_status = srv_conf->waf_http_status; + } else { + http_status = NGX_DECLINED; + } + // http_status = NGX_DONE; } } }