aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-03-05 16:45:06 +0100
committerGravatar GitHub <noreply@github.com> 2025-03-05 16:45:06 +0100
commitecdb63c33582963be055472a056c8e3e445fb5bf (patch)
treeada18f124616f7e28cca58b421f0749d3a1a8c41
parent9641f2a5a39d6022f1ac272c858b37fad39db84d (diff)
Fix regression cURL HTTP headers (#7403)
* Fix regression cURL HTTP headers fix https://github.com/FreshRSS/FreshRSS/issues/6712#issuecomment-2697961491 We would sometimes wrongly override the default HTTP headers of SimplePie https://github.com/FreshRSS/simplepie/pull/33 https://github.com/simplepie/simplepie/pull/912 * Sync SimplePie https://github.com/FreshRSS/simplepie/pull/33
-rwxr-xr-xapp/Controllers/feedController.php3
-rw-r--r--app/Controllers/subscriptionController.php2
-rw-r--r--lib/composer.json2
-rw-r--r--lib/simplepie/simplepie/src/File.php6
4 files changed, 10 insertions, 3 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 3ceb00f4a..e64607277 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -211,8 +211,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
}
}
+
+ $headers = array_filter(array_map('trim', $headers));
if (!empty($headers)) {
- $headers = array_filter(array_map('trim', $headers));
$opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []);
}
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index 800f6b7c9..08103bcbf 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -194,8 +194,8 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
}
}
+ $headers = array_filter(array_map('trim', $headers));
if (!empty($headers)) {
- $headers = array_filter(array_map('trim', $headers));
$opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []);
}
diff --git a/lib/composer.json b/lib/composer.json
index daa49bf26..c8cea3715 100644
--- a/lib/composer.json
+++ b/lib/composer.json
@@ -14,7 +14,7 @@
"marienfressinaud/lib_opml": "0.5.1",
"phpgt/cssxpath": "v1.3.0",
"phpmailer/phpmailer": "6.9.3",
- "simplepie/simplepie": "dev-freshrss#dd86e5e9efb8d082ebd214b81cc5aa746f02fc26"
+ "simplepie/simplepie": "dev-freshrss#d7e513f3366b8f26fd32643544f839d0a789abe8"
},
"config": {
"sort-packages": true,
diff --git a/lib/simplepie/simplepie/src/File.php b/lib/simplepie/simplepie/src/File.php
index 9099c8492..6f5f37c3c 100644
--- a/lib/simplepie/simplepie/src/File.php
+++ b/lib/simplepie/simplepie/src/File.php
@@ -115,6 +115,12 @@ class File implements Response
foreach ($headers as $key => $value) {
$headers2[] = "$key: $value";
}
+ if (isset($curl_options[CURLOPT_HTTPHEADER])) {
+ if (is_array($curl_options[CURLOPT_HTTPHEADER])) {
+ $headers2 = array_merge($headers2, $curl_options[CURLOPT_HTTPHEADER]);
+ }
+ unset($curl_options[CURLOPT_HTTPHEADER]);
+ }
if (version_compare(\SimplePie\Misc::get_curl_version(), '7.10.5', '>=')) {
curl_setopt($fp, CURLOPT_ENCODING, '');
}