@@ -767,7 +767,7 @@ static int multipart_body_on_data_end(multipart_parser* p)
767
767
zend_update_property (swoole_http_request_class_entry_ptr , client -> request .zrequest_object , ZEND_STRL ("post" ), zpost TSRMLS_CC );
768
768
}
769
769
770
- sw_add_assoc_stringl_ex (zpost , client -> current_form_data_name , client -> current_form_data_name_len + 1 ,
770
+ sw_add_assoc_stringl_ex (zpost , client -> current_form_data_name , client -> current_form_data_name_len + 1 ,
771
771
swoole_http_form_data_buffer -> str , swoole_http_form_data_buffer -> length , 1 );
772
772
773
773
efree (client -> current_form_data_name );
@@ -826,14 +826,14 @@ static int http_request_on_body(php_http_parser *parser, const char *at, size_t
826
826
827
827
if (SwooleG .serv -> http_parse_post && client -> request .post_form_urlencoded )
828
828
{
829
- zval * post ;
830
- SW_MAKE_STD_ZVAL ( post );
831
- array_init (post );
829
+ zval * zpost ;
830
+ http_alloc_zval ( client , request , zpost );
831
+ array_init (zpost );
832
832
833
833
body = estrndup (at , length );
834
- zend_update_property (swoole_http_request_class_entry_ptr , client -> request .zrequest_object , ZEND_STRL ("post" ), post TSRMLS_CC );
835
- sapi_module .treat_data (PARSE_STRING , body , post TSRMLS_CC );
836
- http_merge_php_global (post , client -> request .zrequest_object , HTTP_GLOBAL_POST );
834
+ zend_update_property (swoole_http_request_class_entry_ptr , client -> request .zrequest_object , ZEND_STRL ("post" ), zpost TSRMLS_CC );
835
+ sapi_module .treat_data (PARSE_STRING , body , zpost TSRMLS_CC );
836
+ http_merge_php_global (zpost , client -> request .zrequest_object , HTTP_GLOBAL_POST );
837
837
}
838
838
else if (client -> mt_parser != NULL )
839
839
{
@@ -1195,6 +1195,11 @@ void swoole_http_request_free(swoole_http_client *client TSRMLS_DC)
1195
1195
{
1196
1196
sw_zval_ptr_dtor (& req -> zcookie );
1197
1197
}
1198
+ //request data
1199
+ if (req -> zdata )
1200
+ {
1201
+ sw_zval_ptr_dtor (& req -> zdata );
1202
+ }
1198
1203
//upload files
1199
1204
if (req -> zfiles )
1200
1205
{
@@ -1213,11 +1218,11 @@ void swoole_http_request_free(swoole_http_client *client TSRMLS_DC)
1213
1218
continue ;
1214
1219
}
1215
1220
zval * file_path ;
1216
- if (sw_zend_hash_find (Z_ARRVAL_P (value ), ZEND_STRS ("tmp_name" ), (void * * ) & file_path )
1217
- == SUCCESS )
1221
+ if (sw_zend_hash_find (Z_ARRVAL_P (value ), ZEND_STRS ("tmp_name" ), (void * * ) & file_path ) == SUCCESS )
1218
1222
{
1219
1223
unlink (Z_STRVAL_P (file_path ));
1220
- } sw_zval_ptr_dtor (& value );
1224
+ }
1225
+ sw_zval_ptr_dtor (& value );
1221
1226
}
1222
1227
SW_HASHTABLE_FOREACH_END ();
1223
1228
@@ -1254,11 +1259,6 @@ void swoole_http_request_free(swoole_http_client *client TSRMLS_DC)
1254
1259
sw_zval_ptr_dtor (& client -> response .zresponse_object );
1255
1260
client -> response .zresponse_object = NULL ;
1256
1261
}
1257
- //request data
1258
- if (req -> zdata )
1259
- {
1260
- sw_zval_ptr_dtor (& req -> zdata );
1261
- }
1262
1262
1263
1263
client -> end = 1 ;
1264
1264
client -> send_header = 0 ;
0 commit comments