From 9ebef12ab158e64675ec3d5861719ec95e08ffb4 Mon Sep 17 00:00:00 2001 From: uncleempty Date: Thu, 15 Jun 2023 14:11:37 +0200 Subject: [PATCH] chore: simplification --- common/http/class.Request.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/common/http/class.Request.php b/common/http/class.Request.php index 9c87a2e37..afa8d3a76 100755 --- a/common/http/class.Request.php +++ b/common/http/class.Request.php @@ -255,17 +255,18 @@ public function send(bool $followRedirects = false): common_http_Response $httpResponse->effectiveUrl = curl_getinfo($curlHandler, CURLINFO_EFFECTIVE_URL); $httpResponse->responseData = $responseData; - $fullInfo = curl_getinfo($curlHandler); + $redirectUrl = curl_getinfo($curlHandler, CURLINFO_REDIRECT_URL); //curl_setopt($curlHandler, ); curl_close($curlHandler); - if ($followRedirects && in_array($httpResponse->httpCode, self::REDIRECT_CODES, true)) { - $redirectUrl = $fullInfo['redirectUrl'] ?? ''; - if ($redirectUrl) { - $this->url = $redirectUrl; - $httpResponse = $this->send(); - } + if ( + $followRedirects + && $redirectUrl + && in_array($httpResponse->httpCode, self::REDIRECT_CODES, true) + ) { + $this->url = $redirectUrl; + $httpResponse = $this->send(); } return $httpResponse;