From 9c33074bdcfb9b8ef9c43f2485ff24dd08b2a506 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Thu, 29 Dec 2022 19:44:49 +0100 Subject: [PATCH] Allow HTTP requests to hosts in local hosts file --- src/Network/HTTPClient/Client/HttpClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Network/HTTPClient/Client/HttpClient.php b/src/Network/HTTPClient/Client/HttpClient.php index 32a1a22fc..76af18497 100644 --- a/src/Network/HTTPClient/Client/HttpClient.php +++ b/src/Network/HTTPClient/Client/HttpClient.php @@ -69,7 +69,7 @@ class HttpClient implements ICanSendHttpRequests $this->logger->debug('Request start.', ['url' => $url, 'method' => $method]); $host = parse_url($url, PHP_URL_HOST); - if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA)) { + if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA) && !gethostbyname($host)) { $this->logger->debug('URL cannot be resolved.', ['url' => $url, 'callstack' => System::callstack(20)]); $this->profiler->stopRecording(); return CurlResult::createErrorCurl($url);