diff --git a/src/DnsConnector.php b/src/DnsConnector.php index 90170e54..0dfd6585 100644 --- a/src/DnsConnector.php +++ b/src/DnsConnector.php @@ -35,6 +35,11 @@ public function connect($uri) $host = trim($parts['host'], '[]'); $connector = $this->connector; + // skip DNS lookup / URI manipulation if this URI already contains an IP + if (false !== filter_var($host, FILTER_VALIDATE_IP)) { + return $connector->connect($uri); + } + return $this ->resolveHostname($host) ->then(function ($ip) use ($connector, $host, $parts) { @@ -86,10 +91,6 @@ public function connect($uri) private function resolveHostname($host) { - if (false !== filter_var($host, FILTER_VALIDATE_IP)) { - return Promise\resolve($host); - } - $promise = $this->resolver->resolve($host); return new Promise\Promise(