Skip to content

Commit

Permalink
Fix clearing the body when no body was read
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-treitos committed Jul 17, 2018
1 parent ba7ca62 commit 01c865c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion waf/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ function block( rule_type, rule_id, text_to_check )
log_blocked( rule_type, rule_id, text_to_check )
-- clean the request to avoid rechecking it
ngx.req.set_method( ngx.HTTP_GET )
ngx.req.set_body_data( '' )
if ngx.header.content_length ~= nil then
ngx.req.set_body_data( '' )
ngx.req.clear_header( 'Content-Length' )
end
ngx.req.clear_header( 'User-Agent' )
ngx.req.clear_header( 'Cookie' )
-- block the request (also changes the url and clears the args)
Expand Down

0 comments on commit 01c865c

Please sign in to comment.