From: geozipp at excite dot com
Operating system: Windows
PHP version: 5.3.1
PHP Bug Type: cURL related
Bug description: curl_getinfo() retains old data when handle reused
Description:
------------
When the curl handle is reused, curl_getinfo() contains the previous
download_content_length value if the current url header contains no
Content-Length: header.
Reproduce code:
---------------
$url_list = array('http://example.com', 'http://php.net');
$ch = curl_init();
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
foreach ($url_list as $each) {
curl_setopt($ch, CURLOPT_URL, $each);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD) . "\n";
}
curl_close($ch);
Expected result:
----------------
"-1" as the last value, since the response from the second url
(http://php.net) contains no Content-Length: line.
Actual result:
--------------
HTTP/1.1 200 OK
...(header lines)
Content-Length: 438
438
HTTP/1.1 200 OK
...(header lines
438
--
Edit bug report at http://bugs.php.net/?id=50523&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50523&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50523&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50523&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50523&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50523&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50523&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50523&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50523&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50523&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50523&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50523&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50523&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50523&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50523&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50523&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50523&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50523&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50523&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50523&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50523&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50523&r=mysqlcfg