Merge pull request #3650 from annando/feed-probing

Probing sometimes failed / problems with some web servers
This commit is contained in:
Tobias Diekershoff 2017-08-24 10:16:24 +02:00 committed by GitHub
commit 417ea99ba5
2 changed files with 8 additions and 6 deletions

View file

@ -107,6 +107,11 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_RANGE, '0-' . $range); @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')) { if (x($opts, 'headers')) {
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
} }

View file

@ -104,13 +104,10 @@ class Probe {
logger("Probing for ".$host, LOGGER_DEBUG); logger("Probing for ".$host, LOGGER_DEBUG);
$ret = z_fetch_url($ssl_url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml')); $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)) { if ($ret['success']) {
logger("Probing timeout for ".$ssl_url, LOGGER_DEBUG);
return false;
}
$xml = $ret['body']; $xml = $ret['body'];
$xrd = parse_xml_string($xml, false); $xrd = parse_xml_string($xml, false);
}
if (!is_object($xrd)) { if (!is_object($xrd)) {
$ret = z_fetch_url($url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml')); $ret = z_fetch_url($url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));