File tree 2 files changed +45
-0
lines changed
2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1965,6 +1965,26 @@ PHP_FUNCTION(curl_copy_handle)
1965
1965
curl_easy_setopt (dupch -> cp , CURLOPT_INFILE , (void * ) dupch );
1966
1966
curl_easy_setopt (dupch -> cp , CURLOPT_WRITEHEADER , (void * ) dupch );
1967
1967
1968
+ if (ch -> handlers -> progress ) {
1969
+ dupch -> handlers -> progress = ecalloc (1 , sizeof (php_curl_progress ));
1970
+ if (ch -> handlers -> progress -> func_name ) {
1971
+ zval_add_ref (& ch -> handlers -> progress -> func_name );
1972
+ dupch -> handlers -> progress -> func_name = ch -> handlers -> progress -> func_name ;
1973
+ }
1974
+ dupch -> handlers -> progress -> method = ch -> handlers -> progress -> method ;
1975
+ curl_easy_setopt (dupch -> cp , CURLOPT_PROGRESSDATA , (void * ) dupch );
1976
+ }
1977
+
1978
+ if (ch -> handlers -> fnmatch ) {
1979
+ dupch -> handlers -> fnmatch = ecalloc (1 , sizeof (php_curl_fnmatch ));
1980
+ if (ch -> handlers -> fnmatch -> func_name ) {
1981
+ zval_add_ref (& ch -> handlers -> fnmatch -> func_name );
1982
+ dupch -> handlers -> fnmatch -> func_name = ch -> handlers -> fnmatch -> func_name ;
1983
+ }
1984
+ dupch -> handlers -> fnmatch -> method = ch -> handlers -> fnmatch -> method ;
1985
+ curl_easy_setopt (dupch -> cp , CURLOPT_FNMATCH_DATA , (void * ) dupch );
1986
+ }
1987
+
1968
1988
efree (dupch -> to_free );
1969
1989
dupch -> to_free = ch -> to_free ;
1970
1990
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test curl_copy_handle() with CURLOPT_PROGRESSFUNCTION
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded ("curl " ) || false === getenv ('PHP_CURL_HTTP_REMOTE_SERVER ' )) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable " ; ?>
5
+ --FILE--
6
+ <?php
7
+ $ host = getenv ('PHP_CURL_HTTP_REMOTE_SERVER ' );
8
+
9
+ $ url = "{$ host }/get.php " ;
10
+ $ ch = curl_init ($ url );
11
+
12
+ curl_setopt ($ ch , CURLOPT_NOPROGRESS , 0 );
13
+ curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , 1 );
14
+ curl_setopt ($ ch , CURLOPT_PROGRESSFUNCTION , function () { });
15
+ $ ch2 = curl_copy_handle ($ ch );
16
+ echo curl_exec ($ ch ), PHP_EOL ;
17
+ unset($ ch );
18
+ echo curl_exec ($ ch2 );
19
+
20
+ ?>
21
+ --EXPECTF--
22
+ Hello World!
23
+ Hello World!
24
+ Hello World!
25
+ Hello World!
You can’t perform that action at this time.
0 commit comments