@@ -222,12 +222,18 @@ static int fill_buffer(multipart_buffer *self)
222
222
/* calculate the free space in the buffer */
223
223
bytes_to_read = self -> bufsize - self -> bytes_in_buffer ;
224
224
225
+ php_stream * input_stream = SG (rfc1867_input_stream );
226
+
225
227
/* read the required number of bytes */
226
228
while (bytes_to_read > 0 ) {
227
229
228
230
char * buf = self -> buffer + self -> bytes_in_buffer ;
229
231
230
- actual_read = (int )sapi_module .read_post (buf , bytes_to_read );
232
+ if (EXPECTED (input_stream == NULL )) {
233
+ actual_read = (int )sapi_module .read_post (buf , bytes_to_read );
234
+ } else {
235
+ actual_read = php_stream_read (input_stream , buf , bytes_to_read );
236
+ }
231
237
232
238
/* update the buffer length */
233
239
if (actual_read > 0 ) {
@@ -646,7 +652,7 @@ static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len)
646
652
*
647
653
*/
648
654
649
- SAPI_API SAPI_POST_HANDLER_FUNC ( rfc1867_post_handler ) /* {{{ */
655
+ static void rfc1867_post_handler_ex ( char * content_type_dup , zval * arg , zval * files )
650
656
{
651
657
char * boundary , * s = NULL , * boundary_end = NULL , * start_arr = NULL , * array_index = NULL ;
652
658
char * lbuf = NULL , * abuf = NULL ;
@@ -1269,6 +1275,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
1269
1275
}
1270
1276
/* }}} */
1271
1277
1278
+ SAPI_API SAPI_POST_HANDLER_FUNC (rfc1867_post_handler )
1279
+ {
1280
+ rfc1867_post_handler_ex (content_type_dup , arg , files );
1281
+ SG (rfc1867_input_stream ) = NULL ;
1282
+ }
1283
+
1272
1284
SAPI_API void php_rfc1867_set_multibyte_callbacks (
1273
1285
php_rfc1867_encoding_translation_t encoding_translation ,
1274
1286
php_rfc1867_get_detect_order_t get_detect_order ,
0 commit comments