aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoradev <adev2000@gmail.com>2017-11-12 12:15:02 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-28 11:42:27 +0200
commit1048c9c4a811821b00cc04bfec905bebcc22bac4 (patch)
treee1897ef094ecda927f3fcf7ffce33a0d7772f4a9
parent5f08426201c336f96d593954fb45b284d7e60f4a (diff)
downloadwallabag-1048c9c4a811821b00cc04bfec905bebcc22bac4.tar.gz
wallabag-1048c9c4a811821b00cc04bfec905bebcc22bac4.tar.zst
wallabag-1048c9c4a811821b00cc04bfec905bebcc22bac4.zip
Configure timeout
-rw-r--r--app/config/config.yml3
-rw-r--r--src/Wallabag/CoreBundle/Helper/HttpClientFactory.php10
2 files changed, 10 insertions, 3 deletions
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:
375 clients: 375 clients:
376 wallabag_core: 376 wallabag_core:
377 factory: 'wallabag_core.http_client_factory' 377 factory: 'wallabag_core.http_client_factory'
378 config:
379 defaults:
380 timeout: 10
378 plugins: ['httplug.plugin.logger'] 381 plugins: ['httplug.plugin.logger']
379 wallabag_core.entry.download_images: 382 wallabag_core.entry.download_images:
380 factory: 'httplug.factory.auto' 383 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
60 $this->logger->log('debug', 'Restricted access config enabled?', ['enabled' => (int) $this->restrictedAccess]); 60 $this->logger->log('debug', 'Restricted access config enabled?', ['enabled' => (int) $this->restrictedAccess]);
61 61
62 if (0 === (int) $this->restrictedAccess) { 62 if (0 === (int) $this->restrictedAccess) {
63 return new GuzzleAdapter(new GuzzleClient()); 63 return new GuzzleAdapter(new GuzzleClient($config));
64 } 64 }
65 65
66 // we clear the cookie to avoid websites who use cookies for analytics 66 // we clear the cookie to avoid websites who use cookies for analytics
67 $this->cookieJar->clear(); 67 $this->cookieJar->clear();
68 // need to set the (shared) cookie jar 68 if (!isset($config['defaults']['cookies'])) {
69 $guzzle = new GuzzleClient(['defaults' => ['cookies' => $this->cookieJar]]); 69 // need to set the (shared) cookie jar
70 $config['defaults']['cookies'] = $this->cookieJar;
71 }
72
73 $guzzle = new GuzzleClient($config);
70 foreach ($this->subscribers as $subscriber) { 74 foreach ($this->subscribers as $subscriber) {
71 $guzzle->getEmitter()->attach($subscriber); 75 $guzzle->getEmitter()->attach($subscriber);
72 } 76 }