From d82da74363adf4d96eb8b3f61f6eee07ee363e3a Mon Sep 17 00:00:00 2001 From: wn_ Date: Sat, 23 Dec 2023 15:48:02 +0000 Subject: [PATCH] Clean up UrlHelper::resolve_redirects(). Also: this doesn't appear to be used... but maybe in some plugin? --- classes/UrlHelper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/UrlHelper.php b/classes/UrlHelper.php index e69085052..1bd7bfca1 100644 --- a/classes/UrlHelper.php +++ b/classes/UrlHelper.php @@ -205,15 +205,15 @@ class UrlHelper { $response = $client->request('HEAD', $url, [ GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => $timeout ?: Config::get(Config::FILE_FETCH_CONNECT_TIMEOUT), GuzzleHttp\RequestOptions::TIMEOUT => $timeout ?: Config::get(Config::FILE_FETCH_TIMEOUT), - GuzzleHttp\RequestOptions::ALLOW_REDIRECTS => ['max' => 10, 'track_redirects' => true, 'http_errors' => false], + GuzzleHttp\RequestOptions::ALLOW_REDIRECTS => ['max' => 10, 'track_redirects' => true], + GuzzleHttp\RequestOptions::HTTP_ERRORS => false, GuzzleHttp\RequestOptions::HEADERS => [ 'User-Agent' => Config::get_user_agent(), 'Connection' => 'close', ], ]); - } catch (GuzzleHttp\Exception\GuzzleException $ex) { - // TODO: catch just the "too many redirects" exception, and set a different 'error' for general issues - $span->setAttribute('error', 'too many redirects'); + } catch (Exception $ex) { + $span->setAttribute('error', (string) $ex); $span->end(); return false; }