@@ -639,9 +639,23 @@ ngx_http_modsecurity_save_request_body(ngx_http_request_t *r)
639
639
apr_brigade_cleanup (ctx -> brigade );
640
640
#endif
641
641
642
+ if (r -> headers_in .content_length ) {
643
+ ngx_str_t * str = NULL ;
644
+
645
+ str = & r -> headers_in .content_length -> value ;
646
+ str -> data = ngx_palloc (r -> pool , NGX_OFF_T_LEN );
647
+ if (str -> data == NULL ) {
648
+ ngx_http_finalize_request (r , NGX_HTTP_INTERNAL_SERVER_ERROR );
649
+ return NGX_OK ;
650
+ }
651
+ str -> len = ngx_snprintf (str -> data , NGX_OFF_T_LEN , "%O" , content_length ) - str -> data ;
652
+
653
+ }
654
+
655
+
642
656
r -> headers_in .content_length_n = content_length ;
643
657
644
- ngx_log_debug (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 , "ModSec: Content length: %O, Content length n: %O" , content_length , r -> headers_in .content_length_n );
658
+ ngx_log_debug (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 , "ModSec: Content length: %O, Content length n: %O" , content_length , r -> headers_in .content_length_n );
645
659
return NGX_OK ;
646
660
}
647
661
@@ -1221,8 +1235,11 @@ ngx_http_modsecurity_handler(ngx_http_request_t *r) {
1221
1235
}
1222
1236
1223
1237
if (ctx -> waiting_more_body == 0 && ctx -> request_processed == 0 ) {
1238
+
1224
1239
ngx_log_debug0 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
1225
1240
"ModSec: request is ready to be processed." );
1241
+ ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
1242
+ "ModSec: chuncked? %d" , r -> chunked );
1226
1243
ngx_http_modsecurity_process_request (r );
1227
1244
ctx -> request_processed = 1 ;
1228
1245
}
0 commit comments