Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Classes/Provider/CloudflareProxyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Exception\TransferException;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
Expand Down Expand Up @@ -178,9 +179,17 @@ protected function getClient(string $zoneId): Client
protected function initializeClient(string $zoneId, string $apiToken)
{
$httpOptions = $GLOBALS['TYPO3_CONF_VARS']['HTTP'];
if (isset($httpOptions['handler']) && empty($httpOptions['handler'])) {
// let guzzle choose hander
unset($httpOptions['handler']);
if (isset($httpOptions['handler'])) {
if (is_array($httpOptions['handler'] && !empty($httpOptions['handler']))) {
$stack = HandlerStack::create();
foreach ($httpOptions['handler'] as $handler) {
$stack->push($handler);
}
$httpOptions['handler'] = $stack;
}
else {
unset($httpOptions['handler']);
}
}
$httpOptions['base_uri'] = str_replace('{zoneId}', $zoneId, $this->baseUrl);
$httpOptions['headers']['Content-Type'] = 'application/json';
Expand Down
13 changes: 13 additions & 0 deletions Classes/Provider/FastlyProxyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

class FastlyProxyProvider implements ProxyProviderInterface
{
Expand Down Expand Up @@ -92,6 +93,18 @@ protected function getClient()
protected function initializeClient($serviceId, $apiToken)
{
$httpOptions = $GLOBALS['TYPO3_CONF_VARS']['HTTP'];
if (isset($httpOptions['handler'])) {
if (is_array($httpOptions['handler'] && !empty($httpOptions['handler']))) {
$stack = HandlerStack::create();
foreach ($httpOptions['handler'] as $handler) {
$stack->push($handler);
}
$httpOptions['handler'] = $stack;
}
else {
unset($httpOptions['handler']);
}
}
$httpOptions['verify'] = filter_var($httpOptions['verify'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ?? $httpOptions['verify'];
$httpOptions['base_uri'] = str_replace('{serviceId}', $serviceId, $this->baseUrl);
$httpOptions['headers']['Fastly-Key'] = $apiToken;
Expand Down