From 9c2f318ee18c9628ec2ddb5bd7abe3e2e360c8de Mon Sep 17 00:00:00 2001
From: Mathias Brodala <noreply@example.com>
Date: Fri, 8 Jul 2022 09:08:28 +0000
Subject: [PATCH] [TASK] Name custom handlers in HTTP stack

The Guzzle handler stack allows for pushing handlers/middlewares with a
name which simplifies debugging. A possibly defined handler name is now
pushed onto the stack as well.

Resolves: #97873
Releases: main, 11.5
Change-Id: I94ecbe7bc26f550111407f19f71add3ca7c3a6b2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75050
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
---
 typo3/sysext/core/Classes/Http/Client/GuzzleClientFactory.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/core/Classes/Http/Client/GuzzleClientFactory.php b/typo3/sysext/core/Classes/Http/Client/GuzzleClientFactory.php
index 11073e06f0da..e7b2c8997f82 100644
--- a/typo3/sysext/core/Classes/Http/Client/GuzzleClientFactory.php
+++ b/typo3/sysext/core/Classes/Http/Client/GuzzleClientFactory.php
@@ -37,8 +37,8 @@ class GuzzleClientFactory
 
         if (isset($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']) && is_array($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'])) {
             $stack = HandlerStack::create();
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'] ?? [] as $handler) {
-                $stack->push($handler);
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'] ?? [] as $name => $handler) {
+                $stack->push($handler, (string)$name);
             }
             $httpOptions['handler'] = $stack;
         }
-- 
GitLab