@@ -1852,14 +1852,6 @@ static void curl_free_post(void **post)
1852
1852
}
1853
1853
/* }}} */
1854
1854
1855
- /* {{{ curl_free_stream
1856
- */
1857
- static void curl_free_stream (void * * post )
1858
- {
1859
- php_stream_close ((php_stream * )* post );
1860
- }
1861
- /* }}} */
1862
-
1863
1855
/* {{{ curl_free_slist
1864
1856
*/
1865
1857
static void curl_free_slist (zval * el )
@@ -1951,7 +1943,6 @@ php_curl *alloc_curl_handle()
1951
1943
1952
1944
zend_llist_init (& ch -> to_free -> str , sizeof (char * ), (llist_dtor_func_t )curl_free_string , 0 );
1953
1945
zend_llist_init (& ch -> to_free -> post , sizeof (struct HttpPost * ), (llist_dtor_func_t )curl_free_post , 0 );
1954
- zend_llist_init (& ch -> to_free -> stream , sizeof (php_stream * ), (llist_dtor_func_t )curl_free_stream , 0 );
1955
1946
1956
1947
ch -> to_free -> slist = emalloc (sizeof (HashTable ));
1957
1948
zend_hash_init (ch -> to_free -> slist , 4 , NULL , curl_free_slist , 0 );
@@ -2179,32 +2170,6 @@ PHP_FUNCTION(curl_copy_handle)
2179
2170
}
2180
2171
/* }}} */
2181
2172
2182
- #if LIBCURL_VERSION_NUM >= 0x073800
2183
- static size_t read_cb (char * buffer , size_t size , size_t nitems , void * arg ) /* {{{ */
2184
- {
2185
- php_stream * stream = (php_stream * ) arg ;
2186
- size_t numread = php_stream_read (stream , buffer , nitems * size );
2187
-
2188
- if (numread == (size_t )-1 ) {
2189
- return CURL_READFUNC_ABORT ;
2190
- }
2191
- return numread ;
2192
- }
2193
- /* }}} */
2194
-
2195
- static int seek_cb (void * arg , curl_off_t offset , int origin ) /* {{{ */
2196
- {
2197
- php_stream * stream = (php_stream * ) arg ;
2198
- int res = php_stream_seek (stream , offset , origin );
2199
-
2200
- if (res ) {
2201
- return CURL_SEEKFUNC_CANTSEEK ;
2202
- }
2203
- return CURL_SEEKFUNC_OK ;
2204
- }
2205
- /* }}} */
2206
- #endif
2207
-
2208
2173
static int _php_curl_setopt (php_curl * ch , zend_long option , zval * zvalue ) /* {{{ */
2209
2174
{
2210
2175
CURLcode error = CURLE_OK ;
@@ -2842,9 +2807,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2842
2807
/* new-style file upload */
2843
2808
zval * prop , rv ;
2844
2809
char * type = NULL , * filename = NULL ;
2845
- #if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2846
- php_stream * stream ;
2847
- #endif
2848
2810
2849
2811
prop = zend_read_property (curl_CURLFile_class , current , "name" , sizeof ("name" )- 1 , 0 , & rv );
2850
2812
if (Z_TYPE_P (prop ) != IS_STRING ) {
@@ -2866,24 +2828,17 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2866
2828
}
2867
2829
2868
2830
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2869
- if (!(stream = php_stream_open_wrapper (ZSTR_VAL (postval ), "rb" , IGNORE_PATH , NULL ))) {
2870
- zend_string_release_ex (string_key , 0 );
2871
- return FAILURE ;
2872
- }
2873
2831
part = curl_mime_addpart (mime );
2874
2832
if (part == NULL ) {
2875
- php_stream_close (stream );
2876
2833
zend_string_release_ex (string_key , 0 );
2877
2834
return FAILURE ;
2878
2835
}
2879
2836
if ((form_error = curl_mime_name (part , ZSTR_VAL (string_key ))) != CURLE_OK
2880
- || (form_error = curl_mime_data_cb (part , -1 , read_cb , seek_cb , NULL , stream )) != CURLE_OK
2837
+ || (form_error = curl_mime_filedata (part , ZSTR_VAL ( postval ) )) != CURLE_OK
2881
2838
|| (form_error = curl_mime_filename (part , filename ? filename : ZSTR_VAL (postval ))) != CURLE_OK
2882
2839
|| (form_error = curl_mime_type (part , type ? type : "application/octet-stream" )) != CURLE_OK ) {
2883
- php_stream_close (stream );
2884
2840
error = form_error ;
2885
2841
}
2886
- zend_llist_add_element (& ch -> to_free -> stream , & stream );
2887
2842
#else
2888
2843
form_error = curl_formadd (& first , & last ,
2889
2844
CURLFORM_COPYNAME , ZSTR_VAL (string_key ),
@@ -3613,7 +3568,6 @@ static void _php_curl_close_ex(php_curl *ch)
3613
3568
if (-- (* ch -> clone ) == 0 ) {
3614
3569
zend_llist_clean (& ch -> to_free -> str );
3615
3570
zend_llist_clean (& ch -> to_free -> post );
3616
- zend_llist_clean (& ch -> to_free -> stream );
3617
3571
zend_hash_destroy (ch -> to_free -> slist );
3618
3572
efree (ch -> to_free -> slist );
3619
3573
efree (ch -> to_free );
0 commit comments