@@ -383,7 +383,8 @@ static ngx_int_t ngx_http_waf_handler_check_white_url(ngx_http_request_t* r, ngx
383
383
"ngx_waf_debug: The Inspection is skipped because the URL is empty." );
384
384
ret_value = NOT_MATCHED ;
385
385
} else {
386
- for (size_t i = 0 ; i < srv_conf -> white_url -> nelts ; i ++ , p ++ ) {
386
+ size_t i ;
387
+ for (i = 0 ; i < srv_conf -> white_url -> nelts ; i ++ , p ++ ) {
387
388
ngx_int_t rc = ngx_regex_exec (p -> regex , p_uri , NULL , 0 );
388
389
if (rc >= 0 ) {
389
390
ctx -> blocked = FALSE;
@@ -436,7 +437,8 @@ static ngx_int_t ngx_http_waf_handler_check_black_url(ngx_http_request_t* r, ngx
436
437
"ngx_waf_debug: The Inspection is skipped because the URL is empty." );
437
438
ret_value = NOT_MATCHED ;
438
439
} else {
439
- for (size_t i = 0 ; i < srv_conf -> black_url -> nelts ; i ++ , p ++ ) {
440
+ size_t i ;
441
+ for (i = 0 ; i < srv_conf -> black_url -> nelts ; i ++ , p ++ ) {
440
442
ngx_int_t rc = ngx_regex_exec (p -> regex , p_uri , NULL , 0 );
441
443
if (rc >= 0 ) {
442
444
ctx -> blocked = TRUE;
@@ -493,7 +495,8 @@ static ngx_int_t ngx_http_waf_handler_check_black_args(ngx_http_request_t* r, ng
493
495
"ngx_waf_debug: The Inspection is skipped because the ARGS is empty." );
494
496
ret_value = NOT_MATCHED ;
495
497
} else {
496
- for (size_t i = 0 ; i < srv_conf -> black_args -> nelts ; i ++ , p ++ ) {
498
+ size_t i ;
499
+ for (i = 0 ; i < srv_conf -> black_args -> nelts ; i ++ , p ++ ) {
497
500
ngx_int_t rc = ngx_regex_exec (p -> regex , p_args , NULL , 0 );
498
501
if (rc >= 0 ) {
499
502
ctx -> blocked = TRUE;
@@ -550,7 +553,8 @@ static ngx_int_t ngx_http_waf_handler_check_black_user_agent(ngx_http_request_t*
550
553
"ngx_waf_debug: The Inspection is skipped because the User-Agent is empty." );
551
554
ret_value = NOT_MATCHED ;
552
555
} else {
553
- for (size_t i = 0 ; i < srv_conf -> black_ua -> nelts ; i ++ , p ++ ) {
556
+ size_t i ;
557
+ for (i = 0 ; i < srv_conf -> black_ua -> nelts ; i ++ , p ++ ) {
554
558
ngx_int_t rc = ngx_regex_exec (p -> regex , p_ua , NULL , 0 );
555
559
if (rc >= 0 ) {
556
560
ctx -> blocked = TRUE;
@@ -607,7 +611,8 @@ static ngx_int_t ngx_http_waf_handler_check_white_referer(ngx_http_request_t* r,
607
611
"ngx_waf_debug: The Inspection is skipped because the Referer is empty." );
608
612
ret_value = NOT_MATCHED ;
609
613
} else {
610
- for (size_t i = 0 ; i < srv_conf -> white_referer -> nelts ; i ++ , p ++ ) {
614
+ size_t i ;
615
+ for (i = 0 ; i < srv_conf -> white_referer -> nelts ; i ++ , p ++ ) {
611
616
ngx_int_t rc = ngx_regex_exec (p -> regex , p_referer , NULL , 0 );
612
617
if (rc >= 0 ) {
613
618
ctx -> blocked = FALSE;
@@ -664,7 +669,8 @@ static ngx_int_t ngx_http_waf_handler_check_black_referer(ngx_http_request_t* r,
664
669
"ngx_waf_debug: The Inspection is skipped because the Referer is empty." );
665
670
ret_value = NOT_MATCHED ;
666
671
} else {
667
- for (size_t i = 0 ; i < srv_conf -> black_referer -> nelts ; i ++ , p ++ ) {
672
+ size_t i ;
673
+ for (i = 0 ; i < srv_conf -> black_referer -> nelts ; i ++ , p ++ ) {
668
674
ngx_int_t rc = ngx_regex_exec (p -> regex , p_referer , NULL , 0 );
669
675
if (rc >= 0 ) {
670
676
ctx -> blocked = FALSE;
@@ -710,9 +716,11 @@ static ngx_int_t ngx_http_waf_handler_check_black_cookie(ngx_http_request_t* r,
710
716
"ngx_waf_debug: Inspection has begun." );
711
717
712
718
ngx_table_elt_t * * ppcookie = r -> headers_in .cookies .elts ;
713
- for (size_t i = 0 ; i < r -> headers_in .cookies .nelts ; i ++ , ppcookie ++ ) {
719
+ size_t i ;
720
+ for (i = 0 ; i < r -> headers_in .cookies .nelts ; i ++ , ppcookie ++ ) {
714
721
ngx_regex_elt_t * p = srv_conf -> black_cookie -> elts ;
715
- for (size_t j = 0 ; j < srv_conf -> black_cookie -> nelts ; j ++ , p ++ ) {
722
+ size_t j ;
723
+ for (j = 0 ; j < srv_conf -> black_cookie -> nelts ; j ++ , p ++ ) {
716
724
if ((* * ppcookie ).value .data == NULL || (* * ppcookie ).value .len == 0 ) {
717
725
ngx_log_debug (NGX_LOG_DEBUG_CORE , r -> connection -> log , 0 ,
718
726
"ngx_waf_debug: The Inspection is skipped because the Cookie.value is empty." );
@@ -800,7 +808,8 @@ static void check_post(ngx_http_request_t* r) {
800
808
801
809
ngx_regex_elt_t * p = srv_conf -> black_post -> elts ;
802
810
ngx_int_t rc ;
803
- for (size_t i = 0 ; i < srv_conf -> black_post -> nelts ; i ++ , p ++ ) {
811
+ size_t i ;
812
+ for (i = 0 ; i < srv_conf -> black_post -> nelts ; i ++ , p ++ ) {
804
813
rc = ngx_regex_exec (p -> regex , & body_str , NULL , 0 );
805
814
if (rc >= 0 ) {
806
815
ctx -> blocked = TRUE;
0 commit comments