diff options
| author | 2020-07-31 16:33:45 +0200 | |
|---|---|---|
| committer | 2020-07-31 16:33:45 +0200 | |
| commit | c523f5a4e7d346a02528c9143767d0505664d0da (patch) | |
| tree | 1e8f5e99918eab3ebce79b2cb2a63503fafa5612 /lib/favicons.php | |
| parent | 48da9cb5b325377fa7c1fdb771fe44415dbcbb97 (diff) | |
Relaxed to allow underscore _ in URL hostnames (#3133)
* Relaxed to allow underscore _ in URL hostnames
#fix https://github.com/FreshRSS/FreshRSS/issues/3132
https://bugs.php.net/bug.php?id=64948
* Minor fix in favicons redirect
* Minor fix in relative HREF for favicons
Diffstat (limited to 'lib/favicons.php')
| -rw-r--r-- | lib/favicons.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/favicons.php b/lib/favicons.php index 6cb3d373e..fd03f61c8 100644 --- a/lib/favicons.php +++ b/lib/favicons.php @@ -23,10 +23,8 @@ function isImgMime($content) { function downloadHttp(&$url, $curlOptions = array()) { syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url); - if (substr($url, 0, 2) === '//') { - $url = 'https:' . $url; - } - if ($url == '' || filter_var($url, FILTER_VALIDATE_URL) === false) { + $url = checkUrl($url); + if (!$url) { return ''; } $ch = curl_init($url); @@ -42,8 +40,11 @@ function downloadHttp(&$url, $curlOptions = array()) { $response = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); - if (!empty($info['url']) && (filter_var($info['url'], FILTER_VALIDATE_URL) !== false)) { - $url = $info['url']; //Possible redirect + if (!empty($info['url'])) { + $url2 = checkUrl($info['url']); + if ($url2 != '') { + $url = $url2; //Possible redirect + } } return $info['http_code'] == 200 ? $response : ''; } @@ -67,7 +68,7 @@ function searchFavicon(&$url) { $href = 'https:' . $href; } } - if (filter_var($href, FILTER_VALIDATE_URL) === false) { + if (!checkUrl($href, false)) { $href = SimplePie_IRI::absolutize($url, $href); } $favicon = downloadHttp($href, array( |
