private function filterHost(string $host): string
    {
        return preg_replace_callback(
            '/(?:[^'.self::UNRESERVED.self::SUB_DELIMS.':%\[\]]+|%(?![A-Fa-f0-9]{2}))/',
            function (array $match) {
                return rawurlencode($match[0]);
            },
            $host
        );
    }