Skip to content

Commit 9d96617

Browse files
committed
modsecurity: remove body filter
Origin response is trusted and any modsecurity inteventions do not work anyway.
1 parent b0c71bd commit 9d96617

File tree

5 files changed

+0
-131
lines changed

5 files changed

+0
-131
lines changed

config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ if test -n "$ngx_module_link"; then
112112
ngx_module_srcs="$ngx_addon_dir/src/ngx_http_modsecurity_module.c \
113113
$ngx_addon_dir/src/ngx_http_modsecurity_pre_access.c \
114114
$ngx_addon_dir/src/ngx_http_modsecurity_header_filter.c \
115-
$ngx_addon_dir/src/ngx_http_modsecurity_body_filter.c \
116115
$ngx_addon_dir/src/ngx_http_modsecurity_log.c \
117116
$ngx_addon_dir/src/ngx_http_modsecurity_rewrite.c \
118117
"
@@ -143,7 +142,6 @@ else
143142
$ngx_addon_dir/src/ngx_http_modsecurity_module.c \
144143
$ngx_addon_dir/src/ngx_http_modsecurity_pre_access.c \
145144
$ngx_addon_dir/src/ngx_http_modsecurity_header_filter.c \
146-
$ngx_addon_dir/src/ngx_http_modsecurity_body_filter.c \
147145
$ngx_addon_dir/src/ngx_http_modsecurity_log.c \
148146
$ngx_addon_dir/src/ngx_http_modsecurity_rewrite.c \
149147
"

src/ngx_http_modsecurity_body_filter.c

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/ngx_http_modsecurity_common.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ ngx_pool_t *ngx_http_modsecurity_pcre_malloc_init(ngx_pool_t *pool);
122122
void ngx_http_modsecurity_pcre_malloc_done(ngx_pool_t *old_pool);
123123
#endif
124124

125-
/* ngx_http_modsecurity_body_filter.c */
126-
void ngx_http_modsecurity_body_filter_init(void);
127-
ngx_int_t ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in);
128-
129125
/* ngx_http_modsecurity_header_filter.c */
130126
void ngx_http_modsecurity_header_filter_init(void);
131127

src/ngx_http_modsecurity_header_filter.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,6 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
353353
return ngx_http_next_header_filter(r);
354354
}
355355

356-
/*
357-
* Lets ask nginx to keep the response body in memory
358-
*
359-
* FIXME: I don't see a reason to keep it `1' when SecResponseBody is disabled.
360-
*/
361-
r->filter_need_in_memory = 1;
362-
363356
ctx->processed = 1;
364357
/*
365358
*
@@ -437,25 +430,5 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
437430
return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity_module, ret);
438431
}
439432

440-
/*
441-
* Proxies will not like this... but it is necessary to unset
442-
* the content length in order to manipulate the content of
443-
* response body in ModSecurity.
444-
*
445-
* This header may arrive at the client before ModSecurity had
446-
* a change to make any modification. That is why it is necessary
447-
* to set this to -1 here.
448-
*
449-
* We need to have some kind of flag the decide if ModSecurity
450-
* will make a modification or not. If not, keep the content and
451-
* make the proxy servers happy.
452-
*
453-
*/
454-
455-
/*
456-
* The line below is commented to make the spdy test to work
457-
*/
458-
//r->headers_out.content_length_n = -1;
459-
460433
return ngx_http_next_header_filter(r);
461434
}

src/ngx_http_modsecurity_module.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@ ngx_http_modsecurity_init(ngx_conf_t *cf)
555555
*h = ngx_http_modsecurity_log_handler;
556556

557557
ngx_http_modsecurity_header_filter_init();
558-
ngx_http_modsecurity_body_filter_init();
559558

560559
return NGX_OK;
561560
}

0 commit comments

Comments
 (0)