Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/private/Http/Client/DnsPinMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ public function addDnsPinning() {
}

$hostName = (string)$request->getUri()->getHost();
$port = $request->getUri()->getPort();
$requestPort = $request->getUri()->getPort();

$ports = [
'80',
'443',
];

if ($port !== null) {
$ports[] = (string)$port;
if ($requestPort !== null) {
$ports[] = (string)$requestPort;
}

$targetIps = $this->dnsResolve(idn_to_utf8($hostName), 0);
Expand All @@ -135,7 +135,8 @@ public function addDnsPinning() {
foreach ($targetIps as $ip) {
if ($this->ipAddressClassifier->isLocalAddress($ip)) {
// TODO: continue with all non-local IPs?
throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ':' . $port . ') violates local access rules');
// log requestPort because that's more relevant to the admin
throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ':' . $requestPort . ') violates local access rules');
}
$curlResolves["$hostName:$port"][] = $ip;
}
Expand Down
Loading