From 304df9553de7fc4597f6db4b202350a3cf48212f Mon Sep 17 00:00:00 2001 From: Pierre Martel Date: Thu, 19 Jul 2018 13:20:33 +0200 Subject: [PATCH] Add curl timeout option --- src/FeedsFactory.php | 6 ++++++ src/config/feeds.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/FeedsFactory.php b/src/FeedsFactory.php index ae88bca..308cba7 100644 --- a/src/FeedsFactory.php +++ b/src/FeedsFactory.php @@ -43,6 +43,9 @@ public function make($feed_url = [], $limit = 0, $force_feed = false, $options = } else { $this->simplepie->strip_attributes(false); } + if (isset($this->config['curl.timeout']) && is_int($this->config['curl.timeout'])) { + $this->simplepie->set_timeout($this->config['curl.timeout']); + } if (isset($options) && is_array($options)) { if (isset($options['curl.options']) && is_array($options['curl.options'])) { $this->simplepie->set_curl_options($this->simplepie->curl_options + $options['curl.options']); @@ -53,6 +56,9 @@ public function make($feed_url = [], $limit = 0, $force_feed = false, $options = if (isset($options['strip_attribute.tags']) && is_array($options['strip_attribute.tags'])) { $this->simplepie->strip_attributes($options['strip_attribute.tags']); } + if (isset($options['curl.timeout']) && is_int($options['curl.timeout'])) { + $this->simplepie->set_timeout($options['curl.timeout']); + } } $this->simplepie->init(); diff --git a/src/config/feeds.php b/src/config/feeds.php index b44d053..56e15bf 100644 --- a/src/config/feeds.php +++ b/src/config/feeds.php @@ -93,5 +93,7 @@ | */ 'curl.options' => null, + + 'curl.timeout' => null, ];