Probe: Additional checks for connection problems

This commit is contained in:
Michael 2019-12-29 03:27:54 +00:00
parent 5c4184c03a
commit 60df79ad2a

View File

@ -115,6 +115,7 @@ class Probe
$xrd = null;
$curlResult = Network::curl($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
$ssl_connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isSuccess()) {
$xml = $curlResult->getBody();
$xrd = XML::parseString($xml, false);
@ -127,11 +128,16 @@ class Probe
if (!is_object($xrd)) {
$curlResult = Network::curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
$connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isTimeout()) {
Logger::info('Probing timeout', ['url' => $url], Logger::DEBUG);
self::$istimeout = true;
return false;
} elseif ($connection_error && $ssl_connection_error) {
self::$istimeout = true;
return false;
}
$xml = $curlResult->getBody();
$xrd = XML::parseString($xml, false);
$host_url = 'http://'.$host;