From: Tim Düsterhus Date: Thu, 11 Feb 2021 14:43:56 +0000 (+0100) Subject: Use HttpFactory::makeClientWithTimeout() X-Git-Tag: 5.4.0_Alpha_1~283 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a5c975ba2f3c607d3c33707636ca38eb543cf80;p=GitHub%2FWoltLab%2FWCF.git Use HttpFactory::makeClientWithTimeout() --- 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), [