Make HTTP client timeout configurable
This commit is contained in:
@@ -13,20 +13,6 @@ use Kanboard\Job\HttpAsyncJob;
|
|||||||
*/
|
*/
|
||||||
class Client extends Base
|
class Client extends Base
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* HTTP connection timeout in seconds
|
|
||||||
*
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
const HTTP_TIMEOUT = 10;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of maximum redirections for the HTTP client
|
|
||||||
*
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
const HTTP_MAX_REDIRECTS = 2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP client user agent
|
* HTTP client user agent
|
||||||
*
|
*
|
||||||
@@ -225,8 +211,8 @@ class Client extends Base
|
|||||||
'http' => [
|
'http' => [
|
||||||
'method' => $method,
|
'method' => $method,
|
||||||
'protocol_version' => 1.1,
|
'protocol_version' => 1.1,
|
||||||
'timeout' => self::HTTP_TIMEOUT,
|
'timeout' => HTTP_TIMEOUT,
|
||||||
'max_redirects' => self::HTTP_MAX_REDIRECTS,
|
'max_redirects' => HTTP_MAX_REDIRECTS,
|
||||||
'header' => implode("\r\n", $headers),
|
'header' => implode("\r\n", $headers),
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'ignore_errors' => $raiseForErrors,
|
'ignore_errors' => $raiseForErrors,
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ defined('BRUTEFORCE_LOCKDOWN_DURATION') or define('BRUTEFORCE_LOCKDOWN_DURATION'
|
|||||||
defined('SESSION_DURATION') or define('SESSION_DURATION', 0);
|
defined('SESSION_DURATION') or define('SESSION_DURATION', 0);
|
||||||
|
|
||||||
// HTTP Client
|
// HTTP Client
|
||||||
|
defined('HTTP_TIMEOUT') or define('HTTP_TIMEOUT', 10);
|
||||||
|
defined('HTTP_MAX_REDIRECTS') or define('HTTP_MAX_REDIRECTS', 3);
|
||||||
defined('HTTP_PROXY_HOSTNAME') or define('HTTP_PROXY_HOSTNAME', '');
|
defined('HTTP_PROXY_HOSTNAME') or define('HTTP_PROXY_HOSTNAME', '');
|
||||||
defined('HTTP_PROXY_PORT') or define('HTTP_PROXY_PORT', '3128');
|
defined('HTTP_PROXY_PORT') or define('HTTP_PROXY_PORT', '3128');
|
||||||
defined('HTTP_PROXY_USERNAME') or define('HTTP_PROXY_USERNAME', '');
|
defined('HTTP_PROXY_USERNAME') or define('HTTP_PROXY_USERNAME', '');
|
||||||
|
|||||||
Reference in New Issue
Block a user