aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Eugen Gorbunov <eugen.gorbunov.dev@gmail.com> 2024-09-21 12:34:38 +0400
committerGravatar GitHub <noreply@github.com> 2024-09-21 10:34:38 +0200
commite9398f3f8cb703ec68422509ff50c97beae83c4d (patch)
treeb81d85729cd7f70081a2ef252e4d1ca8ba6aac6f /app/Controllers
parente165cf6b4394118613d2eff36fc0a06c2c661641 (diff)
Add HTTP Headers option (#6820)
* Add new strings to lang files * Add HTTP headers field to feed forms * A few improvements --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers')
-rwxr-xr-xapp/Controllers/feedController.php4
-rw-r--r--app/Controllers/subscriptionController.php5
2 files changed, 9 insertions, 0 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 9c4860521..c2d25821d 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -178,6 +178,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$proxy_type = Minz_Request::paramString('proxy_type');
$request_method = Minz_Request::paramString('curl_method');
$request_fields = Minz_Request::paramString('curl_fields', true);
+ $headers = Minz_Request::paramTextToArray('http_headers');
$opts = [];
if ($proxy_type !== '') {
@@ -208,6 +209,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
}
}
+ if(!empty($headers)) {
+ $opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []);
+ }
$attributes = [
'curl_params' => empty($opts) ? null : $opts,
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index fe228829a..225e93f95 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -146,6 +146,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
$proxy_type = Minz_Request::paramString('proxy_type');
$request_method = Minz_Request::paramString('curl_method');
$request_fields = Minz_Request::paramString('curl_fields', true);
+ $headers = Minz_Request::paramTextToArray('http_headers');
$opts = [];
if ($proxy_type !== '') {
$opts[CURLOPT_PROXY] = $proxy_address;
@@ -177,6 +178,10 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
}
}
+ if(!empty($headers)) {
+ $opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []);
+ }
+
$feed->_attribute('curl_params', empty($opts) ? null : $opts);
$feed->_attribute('content_action', Minz_Request::paramString('content_action', true) ?: 'replace');