diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 161a5e9f..ca84c8da 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | |||
@@ -18,23 +18,31 @@ class HttpClientFactory | |||
18 | /** @var \GuzzleHttp\Cookie\CookieJar */ | 18 | /** @var \GuzzleHttp\Cookie\CookieJar */ |
19 | private $cookieJar; | 19 | private $cookieJar; |
20 | 20 | ||
21 | private $restrictedAccess; | ||
22 | |||
21 | /** | 23 | /** |
22 | * HttpClientFactory constructor. | 24 | * HttpClientFactory constructor. |
23 | * | 25 | * |
24 | * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber | 26 | * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber |
25 | * @param \GuzzleHttp\Cookie\CookieJar $cookieJar | 27 | * @param \GuzzleHttp\Cookie\CookieJar $cookieJar |
28 | * @param string $restrictedAccess | ||
26 | */ | 29 | */ |
27 | public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar) | 30 | public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess) |
28 | { | 31 | { |
29 | $this->authenticatorSubscriber = $authenticatorSubscriber; | 32 | $this->authenticatorSubscriber = $authenticatorSubscriber; |
30 | $this->cookieJar = $cookieJar; | 33 | $this->cookieJar = $cookieJar; |
34 | $this->restrictedAccess = $restrictedAccess; | ||
31 | } | 35 | } |
32 | 36 | ||
33 | /** | 37 | /** |
34 | * @return \GuzzleHttp\Client | 38 | * @return \GuzzleHttp\Client|null |
35 | */ | 39 | */ |
36 | public function buildHttpClient() | 40 | public function buildHttpClient() |
37 | { | 41 | { |
42 | if (0 === (int) $this->restrictedAccess) { | ||
43 | return null; | ||
44 | } | ||
45 | |||
38 | // we clear the cookie to avoid websites who use cookies for analytics | 46 | // we clear the cookie to avoid websites who use cookies for analytics |
39 | $this->cookieJar->clear(); | 47 | $this->cookieJar->clear(); |
40 | // need to set the (shared) cookie jar | 48 | // need to set the (shared) cookie jar |