From 2e0b27170c069ba3d4e99b25238c39e8b277e3a4 Mon Sep 17 00:00:00 2001 From: Quentin Dreyer Date: Wed, 2 Apr 2025 14:28:30 +0200 Subject: [PATCH] fix: handle default port override --- src/RedirectClientDecorator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/RedirectClientDecorator.php b/src/RedirectClientDecorator.php index e512a1a..cf8e020 100644 --- a/src/RedirectClientDecorator.php +++ b/src/RedirectClientDecorator.php @@ -43,6 +43,9 @@ public function sendRequest(RequestInterface $request): ResponseInterface $userInfo = $url['user'] . $url['pass'] ? ':' . $url['pass'] : ''; if (array_key_exists('scheme', $url) && $url['scheme'] !== $uri->getScheme()) { $uri = $uri->withScheme($url['scheme']); + if (!array_key_exists('port', $url)) { + $url['port'] = $url['scheme'] === 'https' ? 443 : 80; + } } if ($uri->getUserInfo() !== $userInfo) { $uri = $uri->withUserInfo($userInfo);