From 0ec65788f9a2fb3ab389d22c723e6b36d798a806 Mon Sep 17 00:00:00 2001 From: Roman D Date: Sat, 20 Aug 2022 13:06:24 +0300 Subject: Implemented advanced feed settings to allow cookies and HTTP redirects. (#4470) * Implemented advanced feed settings to allow cookies and HTTP redirects. * i18n fr Co-authored-by: Alexandre Alapetite --- app/Controllers/feedController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 95bca33eb..00759bd18 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -165,6 +165,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { $http_auth = $user . ':' . $pass; } + $cookie = Minz_Request::param('curl_params_cookie', ''); + $cookie_file = Minz_Request::paramBoolean('curl_params_cookiefile'); + $max_redirs = intval(Minz_Request::param('curl_params_redirects', 0)); $useragent = Minz_Request::param('curl_params_useragent', ''); $proxy_address = Minz_Request::param('curl_params', ''); $proxy_type = Minz_Request::param('proxy_type', ''); @@ -173,6 +176,18 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { $opts[CURLOPT_PROXY] = $proxy_address; $opts[CURLOPT_PROXYTYPE] = intval($proxy_type); } + if ($cookie !== '') { + $opts[CURLOPT_COOKIE] = $cookie; + } + if ($cookie_file) { + // Pass empty cookie file name to enable the libcurl cookie engine + // without reading any existing cookie data. + $opts[CURLOPT_COOKIEFILE] = ''; + } + if ($max_redirs != 0) { + $opts[CURLOPT_MAXREDIRS] = $max_redirs; + $opts[CURLOPT_FOLLOWLOCATION] = 1; + } if ($useragent !== '') { $opts[CURLOPT_USERAGENT] = $useragent; } -- cgit v1.2.3