#50523 [Com]: curl_getinfo() retains old data when handle reused
ID: 50523
Comment by: geozipp at excite dot com
Reported By: geozipp at excite dot com
Status: Feedback
Bug Type: cURL related
Operating System: Windows
PHP Version: 5.3.1
New Comment:
The behavior is the same with that snapshot (5.3.2-dev), as well as
with 6.0.0-dev.
Previous Comments:
------------------------------------------------------------------------
[2009-12-18 19:13:58] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-12-18 18:51:59] geozipp at excite dot com
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 this bug report at http://bugs.php.net/?id=50523&edit=1
Thread (4 messages)