diff options
| author | 2020-07-31 16:33:45 +0200 | |
|---|---|---|
| committer | 2020-07-31 16:33:45 +0200 | |
| commit | c523f5a4e7d346a02528c9143767d0505664d0da (patch) | |
| tree | 1e8f5e99918eab3ebce79b2cb2a63503fafa5612 /lib/lib_rss.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/lib_rss.php')
| -rw-r--r-- | lib/lib_rss.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 52c986433..8a58d2124 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -74,15 +74,19 @@ function idn_to_puny($url) { return $url; } -function checkUrl($url) { +function checkUrl($url, $fixScheme = true) { + $url = trim($url); if ($url == '') { return ''; } - if (!preg_match('#^https?://#i', $url)) { - $url = 'http://' . $url; + if ($fixScheme && !preg_match('#^https?://#i', $url)) { + $url = 'https://' . ltrim($url, '/'); } + $url = idn_to_puny($url); //PHP bug #53474 IDN - if (filter_var($url, FILTER_VALIDATE_URL)) { + $urlRelaxed = str_replace('_', 'z', $url); //PHP discussion #64948 Underscore + + if (filter_var($urlRelaxed, FILTER_VALIDATE_URL)) { return $url; } else { return false; |
