mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-05 22:09:25 +03:00
Allow disabling processing of request body size limit in phase 1. See #518.
This commit is contained in:
@@ -570,19 +570,21 @@ static int hook_request_early(request_rec *r) {
|
|||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check request body limit (should only trigger on non-chunked requests). */
|
|
||||||
if (msr->request_content_length > msr->txcfg->reqbody_limit) {
|
|
||||||
msr_log(msr, 1, "Request body is larger than the "
|
|
||||||
"configured limit (%ld).", msr->txcfg->reqbody_limit);
|
|
||||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process phase REQUEST_HEADERS */
|
/* Process phase REQUEST_HEADERS */
|
||||||
rc = DECLINED;
|
rc = DECLINED;
|
||||||
if (modsecurity_process_phase(msr, PHASE_REQUEST_HEADERS) > 0) {
|
if (modsecurity_process_phase(msr, PHASE_REQUEST_HEADERS) > 0) {
|
||||||
rc = perform_interception(msr);
|
rc = perform_interception(msr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((msr->txcfg->is_enabled != MODSEC_DISABLED) && (rc == DECLINED)) {
|
||||||
|
/* Check request body limit (non-chunked requests only). */
|
||||||
|
if (msr->request_content_length > msr->txcfg->reqbody_limit) {
|
||||||
|
msr_log(msr, 1, "Request body (Content-Length) is larger than the "
|
||||||
|
"configured limit (%ld).", msr->txcfg->reqbody_limit);
|
||||||
|
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user