From 7ecaa893be05b35cc5224bb280b215998c388190 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 16 Jun 2025 17:34:04 +0200 Subject: [PATCH] [HttpClient] Limit curl's connection cache size --- Internal/CurlClientState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Internal/CurlClientState.php b/Internal/CurlClientState.php index 2a15248..e866786 100644 --- a/Internal/CurlClientState.php +++ b/Internal/CurlClientState.php @@ -50,7 +50,7 @@ public function __construct(int $maxHostConnections, int $maxPendingPushes) curl_multi_setopt($this->handle, \CURLMOPT_PIPELINING, \CURLPIPE_MULTIPLEX); } if (\defined('CURLMOPT_MAX_HOST_CONNECTIONS') && 0 < $maxHostConnections) { - $maxHostConnections = curl_multi_setopt($this->handle, \CURLMOPT_MAX_HOST_CONNECTIONS, $maxHostConnections) ? 4294967295 : $maxHostConnections; + $maxHostConnections = curl_multi_setopt($this->handle, \CURLMOPT_MAX_HOST_CONNECTIONS, $maxHostConnections) ? min(50 * $maxHostConnections, 4294967295) : $maxHostConnections; } if (\defined('CURLMOPT_MAXCONNECTS') && 0 < $maxHostConnections) { curl_multi_setopt($this->handle, \CURLMOPT_MAXCONNECTS, $maxHostConnections);