Merge pull request #8028 from annando/probe-timeout
Probe: Additional checks for connection problems
This commit is contained in:
commit
61fccaeb30
|
@ -115,6 +115,7 @@ class Probe
|
||||||
$xrd = null;
|
$xrd = null;
|
||||||
|
|
||||||
$curlResult = Network::curl($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
|
$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()) {
|
if ($curlResult->isSuccess()) {
|
||||||
$xml = $curlResult->getBody();
|
$xml = $curlResult->getBody();
|
||||||
$xrd = XML::parseString($xml, false);
|
$xrd = XML::parseString($xml, false);
|
||||||
|
@ -127,11 +128,16 @@ class Probe
|
||||||
|
|
||||||
if (!is_object($xrd)) {
|
if (!is_object($xrd)) {
|
||||||
$curlResult = Network::curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
|
$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()) {
|
if ($curlResult->isTimeout()) {
|
||||||
Logger::info('Probing timeout', ['url' => $url], Logger::DEBUG);
|
Logger::info('Probing timeout', ['url' => $url], Logger::DEBUG);
|
||||||
self::$istimeout = true;
|
self::$istimeout = true;
|
||||||
return false;
|
return false;
|
||||||
|
} elseif ($connection_error && $ssl_connection_error) {
|
||||||
|
self::$istimeout = true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml = $curlResult->getBody();
|
$xml = $curlResult->getBody();
|
||||||
$xrd = XML::parseString($xml, false);
|
$xrd = XML::parseString($xml, false);
|
||||||
$host_url = 'http://'.$host;
|
$host_url = 'http://'.$host;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user