Ticket #9072: 9072.diff
| File 9072.diff, 2.4 KB (added by jacobsantos, 4 years ago) |
|---|
-
http.php
963 963 if ( false === $arrURL ) 964 964 return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url)); 965 965 966 if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )966 if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] && 'ssl' != $arrURL['scheme'] ) 967 967 $url = str_replace($arrURL['scheme'], 'http', $url); 968 968 969 // stream_socket_client accepts ssl protocol for SSL. 970 $url = str_replace('https://', 'ssl://', $url); 971 969 972 // Convert Header array to string. 970 973 $strHeaders = ''; 971 974 if ( is_array( $r['headers'] ) ) … … 983 986 'header' => $strHeaders, 984 987 'timeout' => $r['timeout'], 985 988 'ssl' => array( 986 'verify_peer' => apply_filters('https_ssl_verify', $r['sslverify']),987 'verify_host' => apply_filters('https_ssl_verify', $r['sslverify'])988 )989 'verify_peer' => apply_filters('https_ssl_verify', $r['sslverify']), 990 'verify_host' => apply_filters('https_ssl_verify', $r['sslverify']) 991 ) 989 992 ) 990 993 ); 991 994 … … 995 998 $context = stream_context_create($arrContext); 996 999 997 1000 if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) 998 $handle = @ fopen($url, 'r', false, $context);1001 $handle = @stream_socket_client($url, $errorNum, $errorStr, $r['timeout'], STREAM_CLIENT_CONNECT, $context); 999 1002 else 1000 $handle = fopen($url, 'r', false, $context);1003 $handle = stream_socket_client($url, $errorNum, $errorStr, $r['timeout'], STREAM_CLIENT_CONNECT, $context); 1001 1004 1002 if ( ! $handle )1003 return new WP_Error('http_request_failed', sprintf(__(' Could not open handle for fopen() to %s'), $url));1005 if ( ! $handle ) 1006 return new WP_Error('http_request_failed', sprintf(__('HTTP socket error %d: %s for %s'), $errorNum, $errorStr, $url)); 1004 1007 1005 1008 // WordPress supports PHP 4.3, which has this function. Removed sanity 1006 1009 // checking for performance reasons. … … 1042 1045 * @return boolean False means this class can not be used, true means it can. 1043 1046 */ 1044 1047 function test() { 1045 if ( ! function_exists(' fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )1048 if ( ! function_exists('stream_socket_client') ) 1046 1049 return false; 1047 1050 1048 1051 if ( version_compare(PHP_VERSION, '5.0', '<') )
