aboutsummaryrefslogtreecommitdiff
path: root/lib/contents.php
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2025-03-02 19:32:33 -0800
committerGravatar GitHub <noreply@github.com> 2025-03-02 19:32:33 -0800
commit8b16dd20f6544af3eedf286e23c0d34ab525736c (patch)
treeec284e22a046c4c8e9626e3fa64a000a2747bf84 /lib/contents.php
parentb183aa798af48af556496c42780d6e844172cf44 (diff)
parent00a24e2f694a319a5e6cb070dddfff2dae892378 (diff)
downloadrss-bridge-master.tar.gz
rss-bridge-master.tar.zst
rss-bridge-master.zip
Merge branch 'RSS-Bridge:master' into masterHEADmaster
Diffstat (limited to 'lib/contents.php')
-rw-r--r--lib/contents.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/contents.php b/lib/contents.php
index 56a3db20..b4d70817 100644
--- a/lib/contents.php
+++ b/lib/contents.php
@@ -24,6 +24,13 @@ function getContents(
// TODO: consider url validation at this point
+ $config = [
+ 'useragent' => Configuration::getConfig('http', 'useragent'),
+ 'timeout' => Configuration::getConfig('http', 'timeout'),
+ 'retries' => Configuration::getConfig('http', 'retries'),
+ 'curl_options' => $curlOptions,
+ ];
+
$httpHeadersNormalized = [];
foreach ($httpHeaders as $httpHeader) {
$parts = explode(':', $httpHeader);
@@ -69,13 +76,7 @@ function getContents(
'TE' => 'trailers',
];
- $config = [
- 'useragent' => Configuration::getConfig('http', 'useragent'),
- 'timeout' => Configuration::getConfig('http', 'timeout'),
- 'retries' => Configuration::getConfig('http', 'retries'),
- 'headers' => array_merge($defaultHttpHeaders, $httpHeadersNormalized),
- 'curl_options' => $curlOptions,
- ];
+ $config['headers'] = array_merge($defaultHttpHeaders, $httpHeadersNormalized);
$maxFileSize = Configuration::getConfig('http', 'max_filesize');
if ($maxFileSize) {
@@ -176,11 +177,9 @@ function getSimpleHTMLDOM(
}
/**
- * Gets contents from the Internet as simplhtmldom object. Contents are cached
+ * Fetch contents from the Internet as simplhtmldom object. Contents are cached
* and re-used for subsequent calls until the cache duration elapsed.
*
- * _Notice_: Cached contents are forcefully removed after 24 hours (86400 seconds).
- *
* @param string $url The URL.
* @param int $ttl Cache duration in seconds.
* @param array $header (optional) A list of cURL header.