[BUG] Favicon retrieval doesn't respect curl_options #4951
Closed
Description
Describe the bug
When data/config.php
includes curl_options
, those settings are not used when FreshRSS retrieves a feed's favicon. For instance, if CURLOPT_PROXY
is defined, the proxy is not used, and a direct HTTP connection is made.
To Reproduce
Steps to reproduce the behavior:
- Define
curl_options
inconfig.php
. The following example will work if privoxy is running on the same host as FreshRSS.
'curl_options' =>
array (
CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_PROXY => 'localhost',
CURLOPT_PROXYPORT => 8118,
CURLOPT_RETURNTRANSFER => true,
),
- Try to add a new feed.
- The feed's icon is not requested through the proxy as indicated by the lack of activity in the proxy's log file.
Expected behavior
The settings in the config file should be respected, and the request should go through the proxy.
Screenshots
N/A
Environment information (please complete the following information):
- Device: N/A, happens from all devices
- OS: FreeBSD
- Browser: N/A, happens in all browsers
- FreshRSS version: 1.20.2
- Database version: PostgreSQL
- PHP version: PHP 8.0
- Installation type: Manual install
Additional context
It seems that the issue is with the implementation of the function downloadHttp
in favicons.php
. The following diff seems to fix it for me locally:
--- a/lib/favicons.php
+++ b/lib/favicons.php
@@ -28,6 +28,8 @@ function downloadHttp(&$url, $curlOptions = array()) {
return '';
}
$ch = curl_init($url);
+ FreshRSS_Context::initSystem();
+ curl_setopt_array($ch, FreshRSS_Context::$system_conf->curl_options);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
Metadata
Assignees
Labels
No labels