Merge pull request #8028 from annando/probe-timeout
Probe: Additional checks for connection problems
This commit is contained in:
commit
61fccaeb30
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue