]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
Add environment variables to control scripts/dev.sh behavior
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / HttpClientFactory.php
index 4899d3d41afbfeb1bd6589d653b47481bab9e0a4..b8e95381d1476d3c147fe5594e3e66f162e6fc43 100644 (file)
@@ -6,9 +6,9 @@ use GuzzleHttp\Client as GuzzleClient;
 use GuzzleHttp\Cookie\CookieJar;
 use GuzzleHttp\Event\SubscriberInterface;
 use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
-use Psr\Log\LoggerInterface;
 use Http\Client\HttpClient;
 use Http\HttplugBundle\ClientFactory\ClientFactory;
+use Psr\Log\LoggerInterface;
 
 /**
  * Builds and configures the HTTP client.
@@ -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);
         }