diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index 9a19bd5830ed2..4a0be3af4f1d6 100644 --- a/lib/private/Http/Client/DnsPinMiddleware.php +++ b/lib/private/Http/Client/DnsPinMiddleware.php @@ -25,6 +25,7 @@ */ namespace OC\Http\Client; +use OCP\Http\Client\LocalServerException; use Psr\Http\Message\RequestInterface; class DnsPinMiddleware { @@ -127,6 +128,10 @@ public function addDnsPinning() { $targetIps = $this->dnsResolve(idn_to_utf8($hostName, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46), 0); + if (empty($targetIps)) { + throw new LocalServerException('No DNS record found for ' . $hostName); + } + $curlResolves = []; foreach ($ports as $port) {