diff --git a/includes/class/ApiHandler.php b/includes/class/ApiHandler.php index 8867a47..0c9c811 100644 --- a/includes/class/ApiHandler.php +++ b/includes/class/ApiHandler.php @@ -60,7 +60,13 @@ class ApiHandler { } private function baseurl() { - return $this->proto.'://['.$this->hostname.']:'.$this->port.$this->apiurl; + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + $ip = sprintf('[%s]', $this->hostname); // curl needs brackets for IPv6 + } else { + $ip = $this->hostname; + } + + return $this->proto.'://'.$ip.':'.$this->port.$this->apiurl; } private function go() {