aboutsummaryrefslogtreecommitdiff
path: root/lib/favicons.php
diff options
context:
space:
mode:
authorGravatar vrachnis <vrachnis@users.noreply.github.com> 2023-05-25 08:27:52 +0100
committerGravatar GitHub <noreply@github.com> 2023-05-25 09:27:52 +0200
commitdf80913747795e330af5c90e6d1b782b3d6d8f07 (patch)
tree07a69cdfa71fa0cefc5bfcab13b3d9a420c6d4a7 /lib/favicons.php
parent445cc23abdda5767b622d70cf7b5eb5310dcf908 (diff)
Fix favicon fetching while using proxies (#5421)
* Fix favicon fetching while using proxies This ensures that if curl_options are defined in config.php, those settings are respected while fetching favicons. Fixes FreshRSS#4951 * Change options priority * Credits keep alphabticorder --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'lib/favicons.php')
-rw-r--r--lib/favicons.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/favicons.php b/lib/favicons.php
index 960a72afc..b5c70d975 100644
--- a/lib/favicons.php
+++ b/lib/favicons.php
@@ -28,7 +28,7 @@ function isImgMime(string $content): bool {
function downloadHttp(string &$url, array $curlOptions = []): string {
syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url);
$url = checkUrl($url);
- if (!$url) {
+ if ($url == false) {
return '';
}
/** @var CurlHandle $ch */
@@ -41,9 +41,19 @@ function downloadHttp(string &$url, array $curlOptions = []): string {
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => '', //Enable all encodings
]);
+
+ FreshRSS_Context::initSystem();
+ $system_conf = FreshRSS_Context::$system_conf;
+ if (isset($system_conf)) {
+ curl_setopt_array($ch, $system_conf->curl_options);
+ }
+
curl_setopt_array($ch, $curlOptions);
- /** @var string $response */
+
$response = curl_exec($ch);
+ if (!is_string($response)) {
+ $response = '';
+ }
$info = curl_getinfo($ch);
curl_close($ch);
if (!empty($info['url'])) {