Configure timeout

This commit is contained in:
adev 2017-11-12 12:15:02 +01:00 committed by Jeremy Benoist
parent 5f08426201
commit 1048c9c4a8
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
2 changed files with 10 additions and 3 deletions

View file

@ -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'

View file

@ -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);
}