From d2f1cbfcb1da1277b0be0e527956a4f932bce00a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 14 Aug 2019 10:10:27 +0300 Subject: af_zz_imgproxy: redirect to cached_url (3!!) --- plugins/af_zz_imgproxy/init.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'plugins/af_zz_imgproxy/init.php') diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index 319fccee8..3c9744666 100755 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -111,21 +111,22 @@ class Af_Zz_ImgProxy extends Plugin { } private function rewrite_url_if_needed($url, $all_remote = false) { - $scheme = parse_url($url, PHP_URL_SCHEME); + /* we don't need to handle URLs where local cache already exists, tt-rss rewrites those automatically */ + if (!$this->cache->exists(sha1($url))) { - if ($all_remote) { - $host = parse_url($url, PHP_URL_HOST); - $self_host = parse_url(get_self_url_prefix(), PHP_URL_HOST); + $scheme = parse_url($url, PHP_URL_SCHEME); - $is_remote = $host != $self_host; - } else { - $is_remote = false; - } + if ($all_remote) { + $host = parse_url($url, PHP_URL_HOST); + $self_host = parse_url(get_self_url_prefix(), PHP_URL_HOST); + + $is_remote = $host != $self_host; + } else { + $is_remote = false; + } - if (($scheme != 'https' && $scheme != "") || $is_remote) { - if (strpos($url, "data:") !== 0) { - /* we don't need to handle URLs where local cache already exists, tt-rss rewrites those automatically */ - if (!$this->cache->exists(sha1($url))) { + if (($scheme != 'https' && $scheme != "") || $is_remote) { + if (strpos($url, "data:") !== 0) { $parts = parse_url($url); foreach (explode(" " , $this->ssl_known_whitelist) as $host) { -- cgit v1.2.3