aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Jules-Bertholet <jules.bertholet@gmail.com> 2021-03-09 14:51:09 -0500
committerGravatar GitHub <noreply@github.com> 2021-03-09 20:51:09 +0100
commit800a42172db1775aaa76f50446ed914ee0b5a80b (patch)
tree630a0cd33480909ce6f3954a24a2c18c6f343238 /app/Controllers/feedController.php
parent09b7e87532d030f6a1203a4f0fe5a9746bae694c (diff)
Add an option to set a custom user agent to retrieve individual feeds (#3494)
* Add an option to set a custom user agent to retrieve individual feeds This allows retrieving the original RSS feed when websites use services like FeedBurner. * Use !== instead of != in subscriptionController.php * Add proxy and user-agent to subscription/add Co-authored-by: Georgelemental <georgelemental@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 6c9b16ff4..63abc9f45 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -165,9 +165,25 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$http_auth = $user . ':' . $pass;
}
+ $useragent = Minz_Request::param('curl_params_useragent', '');
+ $proxy_address = Minz_Request::param('curl_params', '');
+ $proxy_type = Minz_Request::param('proxy_type', '');
+ $opts = [];
+ if ($proxy_address !== '' && $proxy_type !== '' && in_array($proxy_type, [0, 2, 4, 5, 6, 7])) {
+ $opts[CURLOPT_PROXY] = $proxy_address;
+ $opts[CURLOPT_PROXYTYPE] = intval($proxy_type);
+ }
+ if ($cookie !== '') {
+ $opts[CURLOPT_COOKIE] = $cookie;
+ }
+ if ($useragent !== '') {
+ $opts[CURLOPT_USERAGENT] = $useragent;
+ }
+
$attributes = array(
'ssl_verify' => null,
'timeout' => null,
+ 'curl_params' => empty($opts) ? null : $opts,
);
if (FreshRSS_Auth::hasAccess('admin')) {
$attributes['ssl_verify'] = Minz_Request::paramTernary('ssl_verify');