mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Fixed: Nginx return 500 when request body is off
This commit is contained in:
parent
df383b9b80
commit
43162f52cf
@ -372,7 +372,7 @@ ngx_http_modsecurity_handler(ngx_http_request_t *r)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
ngx_http_set_ctx(r, ctx, ngx_http_modsecurity);
|
ngx_http_set_ctx(r, ctx, ngx_http_modsecurity);
|
||||||
|
|
||||||
/* processing request headers */
|
/* processing request headers */
|
||||||
rc = modsecProcessRequestHeaders(ctx->req);
|
rc = modsecProcessRequestHeaders(ctx->req);
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: modsecProcessRequestHeaders %d", rc);
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: modsecProcessRequestHeaders %d", rc);
|
||||||
@ -387,9 +387,11 @@ ngx_http_modsecurity_handler(ngx_http_request_t *r)
|
|||||||
return NGX_DONE;
|
return NGX_DONE;
|
||||||
}
|
}
|
||||||
/* other method */
|
/* other method */
|
||||||
rc = modsecProcessRequestBody(ctx->req);
|
if(modsecIsRequestBodyAccessEnabled(ctx->req)) {
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: modsecProcessRequestBody %d", rc);
|
rc = modsecProcessRequestBody(ctx->req);
|
||||||
}
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: modsecProcessRequestBody %d", rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rc != DECLINED) {
|
if (rc != DECLINED) {
|
||||||
|
|
||||||
@ -398,7 +400,7 @@ ngx_http_modsecurity_handler(ngx_http_request_t *r)
|
|||||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
@ -430,13 +432,15 @@ ngx_http_modsecurity_body_handler(ngx_http_request_t *r)
|
|||||||
return ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
return ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = DECLINED;
|
||||||
r->request_body = NULL;
|
r->request_body = NULL;
|
||||||
|
|
||||||
modsecSetBodyBrigade(ctx->req, ctx->brigade);
|
modsecSetBodyBrigade(ctx->req, ctx->brigade);
|
||||||
|
|
||||||
if(modsecIsRequestBodyAccessEnabled(ctx->req))
|
if(modsecIsRequestBodyAccessEnabled(ctx->req)) {
|
||||||
rc = modsecProcessRequestBody(ctx->req);
|
rc = modsecProcessRequestBody(ctx->req);
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: modsecProcessRequestBody %d", rc);
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: modsecProcessRequestBody %d", rc);
|
||||||
|
}
|
||||||
|
|
||||||
if (rc != DECLINED) {
|
if (rc != DECLINED) {
|
||||||
/* Nginx and Apache share same response code */
|
/* Nginx and Apache share same response code */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user