aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-10-08 17:26:43 +0200
committerGravatar GitHub <noreply@github.com> 2017-10-08 17:26:43 +0200
commit1eb19409b5435546774425c00523b9f88d4fccf9 (patch)
tree9c30d510a3604826ebea1492276278ae905e6979 /app/Models/Feed.php
parent05228ed92fc26b17861c1d3b7939d6faaf5ec104 (diff)
CURLOPT_FOLLOWLOCATION open_basedir bug (#1657)
CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set https://github.com/FreshRSS/FreshRSS/issues/1655#issuecomment-334999448 https://stackoverflow.com/questions/6918623/curlopt-followlocation-cannot-be-activated
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 44d518a47..85273d3f7 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -481,18 +481,21 @@ class FreshRSS_Feed extends Minz_Model {
}
$ch = curl_init();
curl_setopt_array($ch, array(
- CURLOPT_URL => $hubJson['hub'],
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_USERAGENT => FRESHRSS_USERAGENT,
- CURLOPT_POSTFIELDS => http_build_query(array(
- 'hub.verify' => 'sync',
- 'hub.mode' => $state ? 'subscribe' : 'unsubscribe',
- 'hub.topic' => $url,
- 'hub.callback' => $callbackUrl,
- ))
- )
- );
+ CURLOPT_URL => $hubJson['hub'],
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_POSTFIELDS => http_build_query(array(
+ 'hub.verify' => 'sync',
+ 'hub.mode' => $state ? 'subscribe' : 'unsubscribe',
+ 'hub.topic' => $url,
+ 'hub.callback' => $callbackUrl,
+ )),
+ CURLOPT_USERAGENT => FRESHRSS_USERAGENT,
+ CURLOPT_MAXREDIRS => 10,
+ ));
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //Keep option separated for open_basedir bug
+ if (defined('CURLOPT_ENCODING')) {
+ curl_setopt($ch, CURLOPT_ENCODING, ''); //Enable all encodings
+ }
$response = curl_exec($ch);
$info = curl_getinfo($ch);