]> git.mxchange.org Git - friendica.git/blobdiff - src/Factory/HTTPClientFactory.php
Merge pull request #10807 from annando/emoji-media
[friendica.git] / src / Factory / HTTPClientFactory.php
index 040ad75141b37781ec88cd90b1b93ad88cd3c1f0..7db5ee7b921123b31b961f48d811b2703742ac2d 100644 (file)
@@ -5,9 +5,12 @@ namespace Friendica\Factory;
 use Friendica\App;
 use Friendica\BaseFactory;
 use Friendica\Core\Config\IConfig;
+use Friendica\Core\System;
 use Friendica\Network\HTTPClient;
 use Friendica\Network\IHTTPClient;
+use Friendica\Util\Crypto;
 use Friendica\Util\Profiler;
+use Friendica\Util\Strings;
 use GuzzleHttp\Client;
 use GuzzleHttp\HandlerStack;
 use GuzzleHttp\RequestOptions;
@@ -86,7 +89,7 @@ class HTTPClientFactory extends BaseFactory
                        RequestOptions::CONNECT_TIMEOUT  => 10,
                        RequestOptions::TIMEOUT          => $this->config->get('system', 'curl_timeout', 60),
                        // by default we will allow self-signed certs
-                       // but you can override this
+                       // but it can be overridden
                        RequestOptions::VERIFY  => (bool)$this->config->get('system', 'verifyssl'),
                        RequestOptions::PROXY   => $proxy,
                        RequestOptions::HEADERS => [
@@ -101,6 +104,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() .'/resolver-cookie-' . Strings::getRandomName(10));
 
                return new HTTPClient($logger, $this->profiler, $guzzle, $resolver);
        }