Skip to content

Commit

Permalink
🐛 Missing access logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADD-SP committed Jun 9, 2021
1 parent 6fd1329 commit 646c66d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
15 changes: 8 additions & 7 deletions inc/ngx_http_waf_module_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
}


Expand Down
8 changes: 7 additions & 1 deletion src/ngx_http_waf_module_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 646c66d

Please sign in to comment.