Index: http.php
===================================================================
--- http.php	(revision 10528)
+++ http.php	(working copy)
@@ -963,9 +963,12 @@
 		if ( false === $arrURL )
 			return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
 
-		if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
+		if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] && 'ssl' != $arrURL['scheme'] )
 			$url = str_replace($arrURL['scheme'], 'http', $url);
 
+		// stream_socket_client accepts ssl protocol for SSL.
+		$url = str_replace('https://', 'ssl://', $url);
+
 		// Convert Header array to string.
 		$strHeaders = '';
 		if ( is_array( $r['headers'] ) )
@@ -983,9 +986,9 @@
 				'header' => $strHeaders,
 				'timeout' => $r['timeout'],
 				'ssl' => array(
-                                	'verify_peer' => apply_filters('https_ssl_verify', $r['sslverify']),
-	                                'verify_host' => apply_filters('https_ssl_verify', $r['sslverify'])
-	                        )
+						'verify_peer' => apply_filters('https_ssl_verify', $r['sslverify']),
+						'verify_host' => apply_filters('https_ssl_verify', $r['sslverify'])
+				)
 			)
 		);
 
@@ -995,12 +998,12 @@
 		$context = stream_context_create($arrContext);
 
 		if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
-			$handle = @fopen($url, 'r', false, $context);
+			$handle = @stream_socket_client($url, $errorNum, $errorStr, $r['timeout'], STREAM_CLIENT_CONNECT, $context);
 		else
-			$handle = fopen($url, 'r', false, $context);
+			$handle = stream_socket_client($url, $errorNum, $errorStr, $r['timeout'], STREAM_CLIENT_CONNECT, $context);
 
-		if ( ! $handle)
-			return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
+		if ( ! $handle )
+			return new WP_Error('http_request_failed', sprintf(__('HTTP socket error %d: %s for %s'), $errorNum, $errorStr, $url));
 
 		// WordPress supports PHP 4.3, which has this function. Removed sanity
 		// checking for performance reasons.
@@ -1042,7 +1045,7 @@
 	 * @return boolean False means this class can not be used, true means it can.
 	 */
 	function test() {
-		if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
+		if ( ! function_exists('stream_socket_client') )
 			return false;
 
 		if ( version_compare(PHP_VERSION, '5.0', '<') )
