#31612 [Com]: No error message returned from curl_error() when connection fails by IP.
ID: 31612
Comment by: daniel at haxx dot se
Reported By: brian dot sanders at cometsystems dot com
Status: Open
Bug Type: cURL related
Operating System: Fedora Core 3
PHP Version: 5.0.2
New Comment:
This may in fact depend on what error message libcurl reports back, and
then this may change depending on what libcurl version you use. There
are/were in fact times when libcurl doesn't return an error message
(which is considered a bug).
Unless the PHP/curl binding is modified to use the curl_easy_strerror()
function.
Previous Comments:
------------------------------------------------------------------------
[2005-01-19 17:02:15] brian dot sanders at cometsystems dot com
Description:
------------
When requesting a file from a bad IP (in this case 127.0.0.1, with no
Web server running) cURL fails to retreive a page (as expected.)
curl_errno() returns an error code of 7, but curl_error returns NULL.
Reproduce code:
---------------
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1');
$result = curl_exec($ch);
print('Error code: '.curl_errno($ch)."\n");
print('Error message: '.curl_error($ch)."\n");
?>
Expected result:
----------------
7
Failed to connect (or some such error)
Actual result:
--------------
7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31612&edit=1
Thread (3 messages)