Ticket #16606: 16606.5.diff
File 16606.5.diff, 3.8 KB (added by , 14 years ago) |
---|
-
wp-includes/class-http.php
746 746 * @return boolean False means this class can not be used, true means it can. 747 747 */ 748 748 function test( $args = array() ) { 749 if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours 749 // Doesn't exist 750 if ( !function_exists( 'fsockopen' ) ) 750 751 return false; 751 752 752 $is_ssl = isset($args['ssl']) && $args['ssl']; 753 // We disabled fsockopen because it's too slow 754 if ( false !== ( $option = get_option( 'disable_fsockopen' ) ) && time() - $option < 43200 ) // 12 hours 755 return false; 753 756 754 if ( ! $is_ssl && function_exists( 'fsockopen' ) ) 757 if ( isset( $args['ssl'] ) && $args['ssl'] ) { 758 // We need SSL. Check if it's available. 759 $use = extension_loaded( 'openssl' ); 760 } else { 761 // No SSL needed 755 762 $use = true; 756 elseif ( $is_ssl && extension_loaded('openssl') && function_exists( 'fsockopen' ) ) 757 $use = true; 758 else 759 $use = false; 763 } 760 764 761 return apply_filters( 'use_fsockopen_transport', $use, $args);765 return apply_filters( 'use_fsockopen_transport', $use, $args ); 762 766 } 763 767 } 764 768 … … 929 933 * 930 934 * @return boolean False means this class can not be used, true means it can. 931 935 */ 932 function test($args = array()) { 933 if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) 936 function test( $args = array() ) { 937 // Doesn't exist 938 if ( !function_exists( 'fopen' ) || ( function_exists( 'ini_get' ) && !ini_get( 'allow_url_fopen' ) ) ) 934 939 return false; 935 940 936 return apply_filters('use_streams_transport', true, $args); 941 if ( isset( $args['ssl'] ) && $args['ssl'] ) { 942 // We need SSL. Check if it's available. 943 $use = extension_loaded( 'openssl' ); 944 } else { 945 // No SSL needed 946 $use = true; 947 } 948 949 return apply_filters( 'use_streams_transport', $use, $args ); 937 950 } 938 951 } 939 952 … … 1096 1109 * 1097 1110 * @return boolean False means this class can not be used, true means it can. 1098 1111 */ 1099 function test($args = array()) { 1100 return apply_filters('use_http_extension_transport', function_exists('http_request'), $args ); 1112 function test( $args = array() ) { 1113 // Doesn't exist 1114 if ( !function_exists( 'http_request' ) ) 1115 return false; 1116 1117 if ( isset( $args['ssl'] ) && $args['ssl'] ) { 1118 // We need SSL. Check if it's available. 1119 if ( is_callable( 'curl_version' ) && $curl_version = curl_version() ) { 1120 // The HTTP Extensions is ultimately cURL based. See if we can detect the cURL SSL capability. 1121 $use = CURL_VERSION_SSL & $curl_version['features']; // bitwise 1122 } else { 1123 $use = extension_loaded( 'openssl' ); 1124 } 1125 } else { 1126 // No SSL needed 1127 $use = true; 1128 } 1129 1130 return apply_filters( 'use_http_extension_transport', (bool) $use, $args ); 1101 1131 } 1102 1132 } 1103 1133 … … 1312 1342 * 1313 1343 * @return boolean False means this class can not be used, true means it can. 1314 1344 */ 1315 function test($args = array()) { 1316 if ( function_exists('curl_init') && function_exists('curl_exec') ) 1317 return apply_filters('use_curl_transport', true, $args); 1345 function test( $args = array() ) { 1346 // Doesn't exist 1347 if ( !function_exists( 'curl_init' ) || !function_exists( 'curl_exec' ) ) 1348 return false; 1318 1349 1319 return false; 1350 if ( isset( $args['ssl'] ) && $args['ssl'] ) { 1351 // We need SSL. Check if it's available. 1352 if ( is_callable( 'curl_version' ) && $curl_version = curl_version() ) { 1353 $use = CURL_VERSION_SSL & $curl_version['features']; // bitwise 1354 } else { 1355 $use = extension_loaded( 'openssl' ); 1356 } 1357 } else { 1358 // No SSL needed 1359 $use = true; 1360 } 1361 1362 return apply_filters( 'use_curl_transport', (bool) $use, $args ); 1320 1363 } 1321 1364 } 1322 1365