From 4ddaf49f537b6e79aac3f11f98440329aa3221c5 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 25 Aug 2021 18:01:07 +0200 Subject: [PATCH] Revert setCookieJar() and add overwrite parameter fpr rare cases --- src/Factory/HTTPClientFactory.php | 3 +++ src/Network/HTTPClient.php | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Factory/HTTPClientFactory.php b/src/Factory/HTTPClientFactory.php index 7da2718d7..7f7d5e5d7 100644 --- a/src/Factory/HTTPClientFactory.php +++ b/src/Factory/HTTPClientFactory.php @@ -101,6 +101,9 @@ class HTTPClientFactory extends BaseFactory $resolver->setRequestTimeout(10); // if the file is too large then exit $resolver->setMaxResponseDataSize(1000000); + // Designate a temporary file that will store cookies during the session. + // Some websites test the browser for cookie support, so this enhances results. + $resolver->setCookieJar(get_temppath() . '/url_resolver.cookie', true); return new HTTPClient($logger, $this->profiler, $guzzle, $resolver); } diff --git a/src/Network/HTTPClient.php b/src/Network/HTTPClient.php index 72f11fa3e..f4293cd08 100644 --- a/src/Network/HTTPClient.php +++ b/src/Network/HTTPClient.php @@ -221,10 +221,6 @@ class HTTPClient implements IHTTPClient $url = trim($url, "'"); - // Designate a temporary file that will store cookies during the session. - // Some websites test the browser for cookie support, so this enhances results. - $this->resolver->setCookieJar(tempnam(get_temppath() , 'url_resolver-')); - $urlResult = $this->resolver->resolveURL($url); if ($urlResult->didErrorOccur()) {