diff options
Diffstat (limited to 'lib/private/Http')
-rw-r--r-- | lib/private/Http/Client/DnsPinMiddleware.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index 019fde23723..900173bb506 100644 --- a/lib/private/Http/Client/DnsPinMiddleware.php +++ b/lib/private/Http/Client/DnsPinMiddleware.php @@ -112,15 +112,22 @@ class DnsPinMiddleware { $targetIps = $this->dnsResolve($hostName, 0); - foreach ($targetIps as $ip) { - $this->localAddressChecker->ThrowIfLocalIp($ip); + $curlResolves = []; - foreach ($ports as $port) { - $curlEntry = $hostName . ':' . $port . ':' . $ip; - $options['curl'][CURLOPT_RESOLVE][] = $curlEntry; + foreach ($ports as $port) { + $curlResolves["$hostName:$port"] = []; + + foreach ($targetIps as $ip) { + $this->localAddressChecker->ThrowIfLocalIp($ip); + $curlResolves["$hostName:$port"][] = $ip; } } + // Coalesce the per-host:port ips back into a comma separated list + foreach ($curlResolves as $hostport => $ips) { + $options['curl'][CURLOPT_RESOLVE][] = "$hostport:" . implode(',', $ips); + } + return $handler($request, $options); }; }; |