Skip to content

Commit

Permalink
Fix nginx not clearing body cache (caused by incomplete fix for owasp…
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhsv authored and zimmerle committed Jul 30, 2020
1 parent 6da95bb commit 11a35fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
v1.0.x - YYYY-MMM-DD (To be released)
-------------------------------------

- Fix nginx not clearing body cache (caused by incomplete fix for #187)
[Issue #216 - @krewi1, @martinhsv]
- Fix config setting not respected: client_body_in_file_only on
[Issue #187 - @martinhsv]
- Fix audit_log not generated for disruptive actions
Expand Down
7 changes: 7 additions & 0 deletions src/ngx_http_modsecurity_pre_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
*/
r->request_body_in_single_buf = 1;
r->request_body_in_persistent_file = 1;
if (!r->request_body_in_file_only) {
// If the above condition fails, then the flag below will have been
// set correctly elsewhere. We need to set the flag here for other
// conditions (client_body_in_file_only not used but
// client_body_buffer_size is)
r->request_body_in_clean_file = 1;
}

rc = ngx_http_read_client_request_body(r,
ngx_http_modsecurity_request_read);
Expand Down

0 comments on commit 11a35fb

Please sign in to comment.