--- http.php	2011-01-27 06:29:07.000000000 +0100
+++ http.php	2011-07-01 13:53:41.000000000 +0200
@@ -387,7 +387,11 @@ class http_class
 			$this->OutputDebug('Connecting to '.$server_type.' server IP '.$ip.' port '.$port.'...');
 		if($ssl)
 			$ip="ssl://".$ip;
-		if(($this->connection=($this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0)
+#if(($this->connection=($this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0)
+		$opts["ssl"]["SNI_enabled"] = TRUE;
+		$opts["ssl"]["SNI_server_name"] = $domain;
+		$context = stream_context_create($opts);
+		if (($this->connection=(@stream_socket_client("$ip:$port", $errno, $error, $this->timeout ? $this->timeout : ini_get("default_socket_timeout"), STREAM_CLIENT_CONNECT, $context)))==0)
 		{
 			switch($errno)
 			{
