From c4286730fa979184a991ac87eb77f56cad92d745 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 4 Sep 2023 15:18:37 +0200 Subject: [PATCH] enh: skip processing for empty response Signed-off-by: Daniel Kesselberg --- lib/private/Http/Client/DnsPinMiddleware.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index ee0ea053dcfe6..a59b1dd3c70e6 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($hostName, 0); + if (empty($targetIps)) { + throw new LocalServerException('No DNS record found for ' . $hostName); + } + $curlResolves = []; foreach ($ports as $port) {