From 5a5c975ba2f3c607d3c33707636ca38eb543cf80 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 11 Feb 2021 15:43:56 +0100 Subject: [PATCH] Use HttpFactory::makeClientWithTimeout() --- .../install/files/lib/action/AbstractOauth2Action.class.php | 4 +--- wcfsetup/install/files/lib/action/ImageProxyAction.class.php | 4 +--- .../lib/system/background/job/DownloadRankImageJob.class.php | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php b/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php index 7bee94bdd4..a08d5c4a85 100644 --- a/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php +++ b/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php @@ -52,9 +52,7 @@ abstract class AbstractOauth2Action extends AbstractAction final protected function getHttpClient(): ClientInterface { if (!$this->httpClient) { - $this->httpClient = HttpFactory::makeClient([ - RequestOptions::TIMEOUT => 5, - ]); + $this->httpClient = HttpFactory::makeClientWithTimeout(5); } return $this->httpClient; diff --git a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php index d672723422..36514de4c3 100644 --- a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php @@ -105,9 +105,7 @@ class ImageProxyAction extends AbstractAction // download image try { - $client = HttpFactory::makeClient([ - RequestOptions::TIMEOUT => 10, - ]); + $client = HttpFactory::makeClientWithTimeout(10); $request = new Request('GET', $url, [ 'via' => '1.1 wsc', 'accept' => 'image/*', diff --git a/wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php b/wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php index 485957403a..e7006cec40 100644 --- a/wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php +++ b/wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php @@ -64,9 +64,7 @@ class DownloadRankImageJob extends AbstractBackgroundJob $extension = \pathinfo(Url::parse($rank->rankImage)['path'], \PATHINFO_EXTENSION); if (\in_array($extension, ['gif', 'png', 'jpg', 'jpeg', 'svg', 'webp'])) { - $http = HttpFactory::makeClient([ - RequestOptions::TIMEOUT => 10, - ]); + $http = HttpFactory::makeClientWithTimeout(10); $imageDest = WCF_DIR . UserRank::RANK_IMAGE_DIR . $rank->rankID . '-rankImage.' . $extension; $http->send(new Request('GET', $rank->rankImage), [ -- 2.20.1