diff --git a/config.default.ini.php b/config.default.ini.php index 147a0ca4..c1627aac 100644 --- a/config.default.ini.php +++ b/config.default.ini.php @@ -13,6 +13,7 @@ timezone = "UTC" [http] +timeout = 60 useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36" [cache] diff --git a/docs/03_For_Hosts/08_Custom_Configuration.md b/docs/03_For_Hosts/08_Custom_Configuration.md index d8583a06..afc5eb2e 100644 --- a/docs/03_For_Hosts/08_Custom_Configuration.md +++ b/docs/03_For_Hosts/08_Custom_Configuration.md @@ -17,6 +17,7 @@ __Notice__: If a parameter is not specified in your `config.ini.php` RSS-Bridge The configuration file is split into sections: * [system](#system) +* [http client](#http client) * [cache](#cache) * [proxy](#proxy) * [authentication](#authentication) @@ -25,6 +26,8 @@ The configuration file is split into sections: _System_: This section specifies system specific parameters +_Http client_: This section has http client options + _Cache_: This section is all about the caching behavior of RSS-Bridge _Proxy_: This section can be used to specify a proxy server for RSS-Bridge to utilize for fetching contents @@ -98,6 +101,21 @@ Allow users to disable proxy usage for specific requests. `false` = disabled (default) +## Http client + +This section provides the following parameters: + +- timeout +- useragent + +### timeout + +Default network timeout. + +### useragent + +Default user agent. + ## Authentication This section provides following parameters: diff --git a/lib/contents.php b/lib/contents.php index a5591c33..afbf7168 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -169,6 +169,7 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f } curl_setopt($ch, CURLOPT_USERAGENT, Configuration::getConfig('http', 'useragent')); + curl_setopt($ch, CURLOPT_TIMEOUT, Configuration::getConfig('http', 'timeout')); curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);