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/subscriptionController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/Controllers/subscriptionController.php') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index bbefc2d68..cca41b004 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -143,6 +143,8 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $feed->_attributes('read_when_same_title_in_feed', $read_when_same_title_in_feed); $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', ''); @@ -154,6 +156,15 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { 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