Skip to content

Commit 01c865c

Browse files
committed
Fix clearing the body when no body was read
1 parent ba7ca62 commit 01c865c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

waf/init.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ function block( rule_type, rule_id, text_to_check )
7575
log_blocked( rule_type, rule_id, text_to_check )
7676
-- clean the request to avoid rechecking it
7777
ngx.req.set_method( ngx.HTTP_GET )
78-
ngx.req.set_body_data( '' )
78+
if ngx.header.content_length ~= nil then
79+
ngx.req.set_body_data( '' )
80+
ngx.req.clear_header( 'Content-Length' )
81+
end
7982
ngx.req.clear_header( 'User-Agent' )
8083
ngx.req.clear_header( 'Cookie' )
8184
-- block the request (also changes the url and clears the args)

0 commit comments

Comments
 (0)