Fix issues with uploading files over 8K : #142, #582 and #830

This commit is contained in:
Andrey Kolganov
2015-06-24 16:11:05 +01:00
committed by Felipe Zimmerle
parent d135f88254
commit 06ba734542

View File

@@ -77,6 +77,7 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
} }
} }
do{
rc = modsecurity_request_body_retrieve(msr, &chunk, (unsigned int)nbytes, &my_error_msg); rc = modsecurity_request_body_retrieve(msr, &chunk, (unsigned int)nbytes, &my_error_msg);
if (rc == -1) { if (rc == -1) {
if (my_error_msg != NULL) { if (my_error_msg != NULL) {
@@ -127,19 +128,19 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
} }
} }
if (msr->if_seen_eos) {
if (bucket == NULL) return APR_EGENERAL; if (bucket == NULL) return APR_EGENERAL;
APR_BRIGADE_INSERT_TAIL(bb_out, bucket); APR_BRIGADE_INSERT_TAIL(bb_out, bucket);
if (msr->txcfg->debuglog_level >= 4) { if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "Input stream filter: Forwarded %" APR_SIZE_T_FMT " bytes.", msr->stream_input_length); msr_log(msr, 4, "Input stream filter: Forwarded %" APR_SIZE_T_FMT " bytes.", msr->stream_input_length);
} }
} }
}
} while (rc != 0);
if (rc == 0) {
modsecurity_request_body_retrieve_end(msr); modsecurity_request_body_retrieve_end(msr);
if (msr->if_seen_eos) {
bucket = apr_bucket_eos_create(f->r->connection->bucket_alloc); bucket = apr_bucket_eos_create(f->r->connection->bucket_alloc);
if (bucket == NULL) return APR_EGENERAL; if (bucket == NULL) return APR_EGENERAL;
APR_BRIGADE_INSERT_TAIL(bb_out, bucket); APR_BRIGADE_INSERT_TAIL(bb_out, bucket);
@@ -147,7 +148,6 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
if (msr->txcfg->debuglog_level >= 4) { if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "Input filter: Sent EOS."); msr_log(msr, 4, "Input filter: Sent EOS.");
} }
}
/* We're done */ /* We're done */
msr->if_status = IF_STATUS_COMPLETE; msr->if_status = IF_STATUS_COMPLETE;
@@ -156,7 +156,6 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
if (msr->txcfg->debuglog_level >= 4) { if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "Input filter: Input forwarding complete."); msr_log(msr, 4, "Input filter: Input forwarding complete.");
} }
}
return APR_SUCCESS; return APR_SUCCESS;
} }