Bug #68566 [Opn->Nab]: Operation timeouts contain misleading error description

From: Date: Tue, 09 Dec 2014 17:15:26 +0000
Subject: Bug #68566 [Opn->Nab]: Operation timeouts contain misleading error description
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188979@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
 Updated by:         mike@php.net
 Reported by:        marcus at synchromedia dot co dot uk
 Summary:            Operation timeouts contain misleading error
                     description
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            HTTP related
 PHP Version:        5.6.3
 Block user comment: N
 Private report:     N

 New Comment:

Actually, both of this fields are filled by libcurl.

"Could not resolve host" would be thrown for a DNS lookup *failure*, but you actually
timed out *while* resolving the host name.


Previous Comments:
------------------------------------------------------------------------
[2014-12-08 12:10:41] marcus at synchromedia dot co dot uk

Note that this resport is against pecl_http 2.1.4, not the old 1.x version covered by PHP docs.

------------------------------------------------------------------------
[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


Thread (6 messages)

« previous php.bugs (#188979) next »