Introducing new return value (-8) in modsecurity_request_body_end when failing to parse JSON bodies; which in turn results in a 400 Bad Request resposne status code in nginx

This commit is contained in:
Alex Z. Yang 2020-03-27 13:36:22 -07:00
Родитель e0e3c52581
Коммит 65e7edc76e
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -1084,6 +1084,13 @@ static int hook_request_late(request_rec *r) {
r->connection->keepalive = AP_CONN_CLOSE;
return HTTP_BAD_REQUEST;
break;
case -8 : /* JSON body does not parse */
if (my_error_msg != NULL) {
msr_log(msr, 4, "%s", my_error_msg);
}
r->connection->keepalive = AP_CONN_CLOSE;
return HTTP_BAD_REQUEST;
break;
default :
/* allow through */
break;

Просмотреть файл

@ -715,7 +715,7 @@ apr_status_t modsecurity_request_body_end(modsec_rec *msr, char **error_msg) {
msr->msc_reqbody_error = 1;
msr->msc_reqbody_error_msg = *error_msg;
msr_log(msr, 2, "%s", *error_msg);
return -1;
return -8;
}
#else
*error_msg = apr_psprintf(msr->mp, "JSON support was not enabled");