From: adev Date: Sun, 12 Nov 2017 11:15:02 +0000 (+0100) Subject: Configure timeout X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=1048c9c4a811821b00cc04bfec905bebcc22bac4;hp=5f08426201c336f96d593954fb45b284d7e60f4a;p=github%2Fwallabag%2Fwallabag.git Configure timeout --- diff --git a/app/config/config.yml b/app/config/config.yml index 309945c5..bbcc682f 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -375,6 +375,9 @@ httplug: clients: wallabag_core: factory: 'wallabag_core.http_client_factory' + config: + defaults: + timeout: 10 plugins: ['httplug.plugin.logger'] wallabag_core.entry.download_images: factory: 'httplug.factory.auto' diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 4899d3d4..3e19a7be 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php @@ -60,13 +60,17 @@ class HttpClientFactory implements ClientFactory $this->logger->log('debug', 'Restricted access config enabled?', ['enabled' => (int) $this->restrictedAccess]); if (0 === (int) $this->restrictedAccess) { - return new GuzzleAdapter(new GuzzleClient()); + return new GuzzleAdapter(new GuzzleClient($config)); } // we clear the cookie to avoid websites who use cookies for analytics $this->cookieJar->clear(); - // need to set the (shared) cookie jar - $guzzle = new GuzzleClient(['defaults' => ['cookies' => $this->cookieJar]]); + if (!isset($config['defaults']['cookies'])) { + // need to set the (shared) cookie jar + $config['defaults']['cookies'] = $this->cookieJar; + } + + $guzzle = new GuzzleClient($config); foreach ($this->subscribers as $subscriber) { $guzzle->getEmitter()->attach($subscriber); }