]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1702-detect-server
authorMichael <heluecht@pirati.ca>
Sun, 12 Mar 2017 20:49:48 +0000 (20:49 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 12 Mar 2017 20:49:48 +0000 (20:49 +0000)
1  2 
include/socgraph.php

index 2d27c863b2113c72840dc22bc36ca7f8456dfeae,01d2cff019f34cbf0e859b19f1284d4b5c96a6be..dee3bfc198ff14c48c0dd2d0f816e427b6a83c95
@@@ -876,13 -729,22 +876,24 @@@ function poco_check_server($server_url
        logger("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$servers[0]["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG);
  
        $failure = false;
 +      $possible_failure = false;
        $orig_last_failure = $last_failure;
 +      $orig_last_contact = $last_contact;
  
        // Check if the page is accessible via SSL.
+       $orig_server_url = $server_url;
        $server_url = str_replace("http://", "https://", $server_url);
-       $serverret = z_fetch_url($server_url."/.well-known/host-meta");
+       // We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
+       $serverret = z_fetch_url($server_url."/.well-known/host-meta", false, $redirects, array('timeout' => 20));
+       // Quit if there is a timeout.
+       // But we want to make sure to only quit if we are mostly sure that this server url fits.
+       if (dbm::is_result($servers) AND ($orig_server_url == $server_url) AND
+               ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+               logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
+               return false;
+       }
  
        // Maybe the page is unencrypted only?
        $xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");