tcpclient : return the error codes of exception with codes :
521 Server Is Down
Origin server refuse the connection
522 Connection Timed Out
Could not negotiate a TCP handshake with the origin server.
523 Origin Is Unreachable
Could not reach the origin server; for example, if the DNS records for the
origin server are incorrect, or No route to host
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5441 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -74,7 +74,7 @@ class tcpclient
|
|||||||
$nsRecords = @dns_get_record ($ipOrName, DNS_CNAME);
|
$nsRecords = @dns_get_record ($ipOrName, DNS_CNAME);
|
||||||
if ($nsRecords === false || $nsRecords == array ())
|
if ($nsRecords === false || $nsRecords == array ())
|
||||||
throw new \Exception ("Can not find the IP for $ipOrName : ".
|
throw new \Exception ("Can not find the IP for $ipOrName : ".
|
||||||
"DNS Error (No A, AAAA, CNAME entries)", 404);
|
"DNS Error (No A, AAAA, CNAME entries)", 523);
|
||||||
}
|
}
|
||||||
foreach ($nsRecords as $val)
|
foreach ($nsRecords as $val)
|
||||||
{
|
{
|
||||||
@@ -172,6 +172,15 @@ class tcpclient
|
|||||||
$this->socket = $socket;
|
$this->socket = $socket;
|
||||||
return $this->socket;
|
return $this->socket;
|
||||||
}
|
}
|
||||||
|
if ($errno === 110)
|
||||||
|
throw new \Exception ("Can not connect to server $this->ipOrName : ".
|
||||||
|
"Connection timed out", 522);
|
||||||
|
if ($errno === 111)
|
||||||
|
throw new \Exception ("Can not connect to server $this->ipOrName : ".
|
||||||
|
"Connection refused", 521);
|
||||||
|
if ($errno === 113)
|
||||||
|
throw new \Exception ("Can not connect to server $this->ipOrName : ".
|
||||||
|
"No route to host", 523);
|
||||||
throw new \Exception ("Can not connect to server $this->ipOrName : ".
|
throw new \Exception ("Can not connect to server $this->ipOrName : ".
|
||||||
$errstr, 500);
|
$errstr, 500);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user