From: Andrew Dolgov Date: Wed, 27 Mar 2013 08:21:26 +0000 (+0400) Subject: fetch_file_contents: fix fetching protected feeds when password has special characters X-Git-Tag: 1.7.6~256 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d3911f80ca897db3644ed1381209533a94a4e5d8;p=tt-rss.git fetch_file_contents: fix fetching protected feeds when password has special characters --- diff --git a/include/functions.php b/include/functions.php index 66e9c137..c0fccf25 100644 --- a/include/functions.php +++ b/include/functions.php @@ -287,8 +287,6 @@ } function fetch_file_contents($url, $type = false, $login = false, $pass = false, $post_query = false, $timeout = false) { - $login = urlencode($login); - $pass = urlencode($pass); global $fetch_last_error; @@ -350,11 +348,13 @@ return $contents; } else { - if ($login && $pass ){ + if ($login && $pass){ $url_parts = array(); preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts); + $pass = urlencode($pass); + if ($url_parts[1] && $url_parts[2]) { $url = $url_parts[1] . "://$login:$pass@" . $url_parts[2]; }