mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Nginx: Fixed internal request finalized after rewrite with regex
This commit is contained in:
@@ -950,21 +950,22 @@ ngx_http_modsecurity_handler(ngx_http_request_t *r)
|
|||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r->internal) {
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: handler");
|
||||||
|
|
||||||
|
if (r->internal) {
|
||||||
|
/* we have already processed the request headers with previous loc conf */
|
||||||
|
|
||||||
|
/* TODO: do we need update ctx and process headers again? */
|
||||||
ctx = ngx_http_get_module_pool_ctx(r, ngx_http_modsecurity);
|
ctx = ngx_http_get_module_pool_ctx(r, ngx_http_modsecurity);
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (ctx) {
|
||||||
return NGX_ERROR;
|
ngx_http_set_ctx(r, ctx, ngx_http_modsecurity);
|
||||||
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_http_set_ctx(r, ctx, ngx_http_modsecurity);
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: get internel request ctx failed");
|
||||||
|
|
||||||
return NGX_DECLINED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: handler");
|
|
||||||
|
|
||||||
ctx = ngx_http_modsecurity_create_ctx(r);
|
ctx = ngx_http_modsecurity_create_ctx(r);
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
|
|
||||||
@@ -1084,8 +1085,6 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r) {
|
|||||||
|
|
||||||
ctx->complete = 1;
|
ctx->complete = 1;
|
||||||
|
|
||||||
// TODO: do we need reload headers_in ?
|
|
||||||
|
|
||||||
if (ngx_http_modsecurity_load_headers_in(r) != NGX_OK
|
if (ngx_http_modsecurity_load_headers_in(r) != NGX_OK
|
||||||
|| ngx_http_modsecurity_load_headers_out(r) != NGX_OK) {
|
|| ngx_http_modsecurity_load_headers_out(r) != NGX_OK) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user