Bug #68566 [Com]: Operation timeouts contain misleading error description
| From: | marcus at synchromedia dot co dot uk | Date: | Mon, 08 Dec 2014 12:10:42 +0000 |
| Subject: | Bug #68566 [Com]: Operation timeouts contain misleading error description | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188959@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68566&edit=1
ID: 68566
Comment by: marcus at synchromedia dot co dot uk
Reported by: marcus at synchromedia dot co dot uk
Summary: Operation timeouts contain misleading error
description
Status: Open
Type: Bug
Package: HTTP related
PHP Version: 5.6.3
Block user comment: N
Private report: N
New Comment:
Note that this resport is against pecl_http 2.1.4, not the old 1.x version covered by PHP docs.
Previous Comments:
------------------------------------------------------------------------
[2014-12-08 12:08:01] marcus at synchromedia dot co dot uk
Description:
------------
Just a little thing! If you request a URL that takes longer than the allowed time to respond (as set
in client options), the response correctly sets a CURL error code of 28
(http://curl.haxx.se/libcurl/c/libcurl-errors.html; CURLE_OPERATION_TIMEDOUT), but the text of the
error is "Resolving timed out after <x> milliseconds". This is misleading because
it's not the resolving that is timing out, but the request.
I suppose you could argue that you can apply the term 'resolving' to the fetching of a
URL, but it would be unusual as that term is usually reserved for DNS lookups.
For a DNS resolution error, the curlerror would be 6 - an example error for that is:
6: Could not resolve host: <host name>
Test script:
---------------
Test target:
<?php
sleep(5);
echo 'ok';
Test script:
<?php
$request = new http\Client\Request("GET",
"http://localhost/slow.php"
);
$request->setOptions(["timeout" => 1]);
$client = new http\Client;
try {
$client->enqueue($request)->send();
} catch (Exception $e) {
$response = $client->getResponse();
$t = $response->getTransferInfo();
echo $t->curlcode . ': ' . $t->error;
}
Expected result:
----------------
28: Operation timed out after 1000 milliseconds
Actual result:
--------------
28: Resolving timed out after 1000 milliseconds
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68566&edit=1