From: Tim Düsterhus Date: Thu, 11 Feb 2021 14:40:43 +0000 (+0100) Subject: Add HttpFactory::makeClientWithTimeout() X-Git-Tag: 5.4.0_Alpha_1~284 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ba03dc81cfdbb3d25fcc8058e1859658f66c90d6;p=GitHub%2FWoltLab%2FWCF.git Add HttpFactory::makeClientWithTimeout() --- diff --git a/wcfsetup/install/files/lib/system/io/HttpFactory.class.php b/wcfsetup/install/files/lib/system/io/HttpFactory.class.php index a2da764c99..7e35ff3405 100644 --- a/wcfsetup/install/files/lib/system/io/HttpFactory.class.php +++ b/wcfsetup/install/files/lib/system/io/HttpFactory.class.php @@ -46,6 +46,20 @@ final class HttpFactory return self::$defaultClient; } + /** + * Creates a new HTTP client with the given $timeout as the maximum + * total transfer duration. + * + * @since 5.4 + * @see HttpFactory::makeClient() + */ + public static function makeClientWithTimeout(float $timeout): ClientInterface + { + return static::makeClient([ + RequestOptions::TIMEOUT => $timeout, + ]); + } + /** * Creates a new HTTP client. *