ID:               38637
 Updated by:       [EMAIL PROTECTED]
 Reported By:      waax at yahoo dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         cURL related
 Operating System: Windows XP SP2
 PHP Version:      5.1.5
-Assigned To:      
+Assigned To:      iliaa
 New Comment:

Ilia, please take a look at it.
This patch fixes it: http://tony2001.phpclub.net/dev/tmp/bug38637.diff
But the problem is that it re-sets options that could be changed by the
user, so we something smarter here..
So, the idea is that currently all buffers point to the original
handle, even though we're executing the copy.


Previous Comments:
------------------------------------------------------------------------

[2006-08-29 01:06:50] waax at yahoo dot com

Description:
------------
My script create a default curl handle with some default option along
CURLOPT_RETURNTRANSFER that is used as a "template". This default curl
handle is then copied with curl_copy_handle for all connections i need
to create.

I expected each call of curl_exec to return the content downloaded. 

Instead, each call return bool(true).

libcurl/7.14.0 OpenSSL/0.9.8a zlib/1.2.3



Reproduce code:
---------------
<?php
// Creating default Curl Handler
$ch_default = curl_init();

// Setting some options
curl_setopt($ch_default, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch_default, CURLOPT_AUTOREFERER, true);
curl_setopt($ch_default, CURLOPT_RETURNTRANSFER, true);

$ch2 = curl_copy_handle($ch_default);
// Uncomment to see the difference
// $ch2 = curl_init();
// curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch2, CURLOPT_URL, "http://yahoo.com";);

$res = curl_exec($ch2);

var_dump($res);
?>

Expected result:
----------------
string(10074) "<html><head>
<title>Yahoo!</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="PICS-Label" content='(PICS-1.1
"http://www.icra.org/ratingsv02.html"; l r (cz 1 lz 1 nz 1 oz 1 vz 1)
gen true for "http://www.yahoo.com"; r (cz1 lz 1 nz 1 oz 1 vz 1)
"http://www.rsac.org/ratingsv01.html"; l r (n 0 s 0 v 0 l0) gen true for
"http://www.yahoo.com"; r (n 0 s 0 v 0 l 0))'>
[TRUNCATED]

Actual result:
--------------
bool(true)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38637&edit=1

Reply via email to