@@ -77,15 +77,16 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
77
77
}
78
78
}
79
79
80
- rc = modsecurity_request_body_retrieve (msr , & chunk , (unsigned int )nbytes , & my_error_msg );
81
- if (rc == -1 ) {
80
+ do {
81
+ rc = modsecurity_request_body_retrieve (msr , & chunk , (unsigned int )nbytes , & my_error_msg );
82
+ if (rc == -1 ) {
82
83
if (my_error_msg != NULL ) {
83
84
msr_log (msr , 1 , "%s" , my_error_msg );
84
85
}
85
86
return APR_EGENERAL ;
86
- }
87
+ }
87
88
88
- if (chunk && (!msr -> txcfg -> stream_inbody_inspection || (msr -> txcfg -> stream_inbody_inspection && msr -> if_stream_changed == 0 ))) {
89
+ if (chunk && (!msr -> txcfg -> stream_inbody_inspection || (msr -> txcfg -> stream_inbody_inspection && msr -> if_stream_changed == 0 ))) {
89
90
/* Copy the data we received in the chunk */
90
91
bucket = apr_bucket_heap_create (chunk -> data , chunk -> length , NULL ,
91
92
f -> r -> connection -> bucket_alloc );
@@ -113,7 +114,7 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
113
114
if (msr -> txcfg -> debuglog_level >= 4 ) {
114
115
msr_log (msr , 4 , "Input filter: Forwarded %" APR_SIZE_T_FMT " bytes." , chunk -> length );
115
116
}
116
- } else if (msr -> stream_input_data != NULL ) {
117
+ } else if (msr -> stream_input_data != NULL ) {
117
118
118
119
msr -> if_stream_changed = 0 ;
119
120
@@ -127,35 +128,33 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
127
128
}
128
129
}
129
130
130
- if (bucket == NULL ) return APR_EGENERAL ;
131
- APR_BRIGADE_INSERT_TAIL (bb_out , bucket );
132
-
133
- if (msr -> txcfg -> debuglog_level >= 4 ) {
134
- msr_log (msr , 4 , "Input stream filter: Forwarded %" APR_SIZE_T_FMT " bytes." , msr -> stream_input_length );
135
- }
136
-
137
- }
138
-
139
- if (rc == 0 ) {
140
- modsecurity_request_body_retrieve_end (msr );
141
-
142
131
if (msr -> if_seen_eos ) {
143
- bucket = apr_bucket_eos_create (f -> r -> connection -> bucket_alloc );
144
132
if (bucket == NULL ) return APR_EGENERAL ;
145
133
APR_BRIGADE_INSERT_TAIL (bb_out , bucket );
146
134
147
135
if (msr -> txcfg -> debuglog_level >= 4 ) {
148
- msr_log (msr , 4 , "Input filter: Sent EOS." );
136
+ msr_log (msr , 4 , "Input stream filter: Forwarded %" APR_SIZE_T_FMT " bytes." , msr -> stream_input_length );
149
137
}
150
138
}
139
+ }
140
+ } while (rc != 0 );
151
141
152
- /* We're done */
153
- msr -> if_status = IF_STATUS_COMPLETE ;
154
- ap_remove_input_filter (f );
142
+ modsecurity_request_body_retrieve_end (msr );
155
143
156
- if (msr -> txcfg -> debuglog_level >= 4 ) {
157
- msr_log (msr , 4 , "Input filter: Input forwarding complete." );
158
- }
144
+ bucket = apr_bucket_eos_create (f -> r -> connection -> bucket_alloc );
145
+ if (bucket == NULL ) return APR_EGENERAL ;
146
+ APR_BRIGADE_INSERT_TAIL (bb_out , bucket );
147
+
148
+ if (msr -> txcfg -> debuglog_level >= 4 ) {
149
+ msr_log (msr , 4 , "Input filter: Sent EOS." );
150
+ }
151
+
152
+ /* We're done */
153
+ msr -> if_status = IF_STATUS_COMPLETE ;
154
+ ap_remove_input_filter (f );
155
+
156
+ if (msr -> txcfg -> debuglog_level >= 4 ) {
157
+ msr_log (msr , 4 , "Input filter: Input forwarding complete." );
159
158
}
160
159
161
160
return APR_SUCCESS ;
0 commit comments