mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Merge pull request #27814 from nextcloud/backport/27758/stable22
[stable22] Fix DnsPinMiddleware resolve pinning bug
This commit is contained in:
commit
3f212b8857
1 changed files with 12 additions and 5 deletions
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue