]> git.mxchange.org Git - friendica.git/commitdiff
Probing sometimes failed / problems with some web servers
authorMichael <heluecht@pirati.ca>
Thu, 24 Aug 2017 07:56:46 +0000 (07:56 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 24 Aug 2017 07:56:46 +0000 (07:56 +0000)
include/network.php
src/Network/Probe.php

index 4fc04b81942d816e6a0da345989f585331a44df2..5f2c120bce137d22635d74926b7a9e800dcfc944 100644 (file)
@@ -107,6 +107,11 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array()) {
                @curl_setopt($ch, CURLOPT_RANGE, '0-' . $range);
        }
 
+       // Without this setting it seems as if some webservers send compressed content
+       // This seems to confuse curl so that it shows this uncompressed.
+       /// @todo  We could possibly set this value to "gzip" or something similar
+       curl_setopt($ch, CURLOPT_ENCODING, '');
+
        if (x($opts, 'headers')) {
                @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
        }
index 17b44eadb3cacb3586984d8b0112f6b4f099fba6..5168e4c2626eaad52ca69dcbe9c661805338edb7 100644 (file)
@@ -104,13 +104,10 @@ class Probe {
                logger("Probing for ".$host, LOGGER_DEBUG);
 
                $ret = z_fetch_url($ssl_url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));
-               if (($ret['errno'] == CURLE_OPERATION_TIMEDOUT) && !self::ownHost($ssl_url)) {
-                       logger("Probing timeout for ".$ssl_url, LOGGER_DEBUG);
-                       return false;
+               if ($ret['success']) {
+                       $xml = $ret['body'];
+                       $xrd = parse_xml_string($xml, false);
                }
-               $xml = $ret['body'];
-
-               $xrd = parse_xml_string($xml, false);
 
                if (!is_object($xrd)) {
                        $ret = z_fetch_url($url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));