Skip to content

Commit f9c2539

Browse files
rootzimmerle
root
authored andcommitted
This is fix for reborn of #334 This bug has been reborn, because Apache (at least in RedHat/CentOS) since version 2.2.15-47 returns in same case APR_INCOMPLETE (not APR_EOF). Based on same patch I have added handler for APR_INCOMPLETE.
1 parent 88bffb1 commit f9c2539

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

apache2/apache2_io.c

+3
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ apr_status_t read_request_body(modsec_rec *msr, char **error_msg) {
208208
* too large and APR_EGENERAL when the client disconnects.
209209
*/
210210
switch(rc) {
211+
case APR_INCOMPLETE :
212+
*error_msg = apr_psprintf(msr->mp, "Error reading request body: %s", get_apr_error(msr->mp, rc));
213+
return -7;
211214
case APR_EOF :
212215
*error_msg = apr_psprintf(msr->mp, "Error reading request body: %s", get_apr_error(msr->mp, rc));
213216
return -6;

apache2/mod_security2.c

+7
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,13 @@ static int hook_request_late(request_rec *r) {
10301030
r->connection->keepalive = AP_CONN_CLOSE;
10311031
return HTTP_BAD_REQUEST;
10321032
break;
1033+
case -7 : /* Partial recieved */
1034+
if (my_error_msg != NULL) {
1035+
msr_log(msr, 4, "%s", my_error_msg);
1036+
}
1037+
r->connection->keepalive = AP_CONN_CLOSE;
1038+
return HTTP_BAD_REQUEST;
1039+
break;
10331040
default :
10341041
/* allow through */
10351042
break;

0 commit comments

Comments
 (0)