diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index 3bf43e6c07ec6..26a0a63378b94 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -192,7 +192,7 @@ protected function preventLocalAddress(string $uri, array $options): void { throw new LocalServerException('Could not detect any host'); } if (!$this->remoteHostValidator->isValid($host)) { - throw new LocalServerException('Host violates local access rules'); + throw new LocalServerException('Host "'.$host.'" violates local access rules'); } } diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index aecccc6ce9772..518281e4af01b 100644 --- a/lib/private/Http/Client/DnsPinMiddleware.php +++ b/lib/private/Http/Client/DnsPinMiddleware.php @@ -147,7 +147,7 @@ public function addDnsPinning() { foreach ($targetIps as $ip) { if ($this->ipAddressClassifier->isLocalAddress($ip)) { // TODO: continue with all non-local IPs? - throw new LocalServerException('Host violates local access rules'); + throw new LocalServerException('Host "'.$ip.'" ('.$hostName.':'.$port.') violates local access rules'); } $curlResolves["$hostName:$port"][] = $ip; } diff --git a/tests/lib/Http/Client/DnsPinMiddlewareTest.php b/tests/lib/Http/Client/DnsPinMiddlewareTest.php index 2fa868e6963d4..54071f37b1a82 100644 --- a/tests/lib/Http/Client/DnsPinMiddlewareTest.php +++ b/tests/lib/Http/Client/DnsPinMiddlewareTest.php @@ -287,7 +287,7 @@ static function (RequestInterface $request, array $options) { public function testRejectIPv4() { $this->expectException(LocalServerException::class); - $this->expectExceptionMessage('Host violates local access rules'); + $this->expectExceptionMessage('violates local access rules'); $mockHandler = new MockHandler([ static function (RequestInterface $request, array $options) { @@ -334,7 +334,7 @@ static function (RequestInterface $request, array $options) { public function testRejectIPv6() { $this->expectException(LocalServerException::class); - $this->expectExceptionMessage('Host violates local access rules'); + $this->expectExceptionMessage('violates local access rules'); $mockHandler = new MockHandler([ static function (RequestInterface $request, array $options) { @@ -381,7 +381,7 @@ static function (RequestInterface $request, array $options) { public function testRejectCanonicalName() { $this->expectException(LocalServerException::class); - $this->expectExceptionMessage('Host violates local access rules'); + $this->expectExceptionMessage('violates local access rules'); $mockHandler = new MockHandler([ static function (RequestInterface $request, array $options) {