Ticket #9078: 9078.2.diff
File 9078.2.diff, 7.2 KB (added by , 16 years ago) |
---|
-
wp-includes/http.php
228 228 static $working_transport, $blocking_transport, $nonblocking_transport; 229 229 230 230 if ( is_null($working_transport) ) { 231 if ( true === WP_Http_ExtHttp::test( ) && apply_filters('use_http_extension_transport', true) ) {231 if ( true === WP_Http_ExtHttp::test($args) ) { 232 232 $working_transport['exthttp'] = new WP_Http_ExtHttp(); 233 233 $blocking_transport[] = &$working_transport['exthttp']; 234 } else if ( true === WP_Http_Curl::test( ) && apply_filters('use_curl_transport', true) ) {234 } else if ( true === WP_Http_Curl::test($args) ) { 235 235 $working_transport['curl'] = new WP_Http_Curl(); 236 236 $blocking_transport[] = &$working_transport['curl']; 237 } else if ( true === WP_Http_Streams::test( ) && apply_filters('use_streams_transport', true) ) {237 } else if ( true === WP_Http_Streams::test($args) ) { 238 238 $working_transport['streams'] = new WP_Http_Streams(); 239 239 $blocking_transport[] = &$working_transport['streams']; 240 } else if ( true === WP_Http_Fopen::test( ) && apply_filters('use_fopen_transport', true) && ( isset($args['ssl']) && !$args['ssl']) ) {240 } else if ( true === WP_Http_Fopen::test($args) ) { 241 241 $working_transport['fopen'] = new WP_Http_Fopen(); 242 242 $blocking_transport[] = &$working_transport['fopen']; 243 } else if ( true === WP_Http_Fsockopen::test( ) && apply_filters('use_fsockopen_transport', true) && ( isset($args['ssl']) && !$args['ssl']) ) {243 } else if ( true === WP_Http_Fsockopen::test($args) ) { 244 244 $working_transport['fsockopen'] = new WP_Http_Fsockopen(); 245 245 $blocking_transport[] = &$working_transport['fsockopen']; 246 246 } … … 279 279 static $working_transport, $blocking_transport, $nonblocking_transport; 280 280 281 281 if ( is_null($working_transport) ) { 282 if ( true === WP_Http_ExtHttp::test( ) && apply_filters('use_http_extension_transport', true) ) {282 if ( true === WP_Http_ExtHttp::test($args) ) { 283 283 $working_transport['exthttp'] = new WP_Http_ExtHttp(); 284 284 $blocking_transport[] = &$working_transport['exthttp']; 285 } else if ( true === WP_Http_Curl::test( ) && apply_filters('use_curl_transport', true) ) {285 } else if ( true === WP_Http_Curl::test($args) ) { 286 286 $working_transport['curl'] = new WP_Http_Curl(); 287 287 $blocking_transport[] = &$working_transport['curl']; 288 } else if ( true === WP_Http_Streams::test( ) && apply_filters('use_streams_transport', true) ) {288 } else if ( true === WP_Http_Streams::test($args) ) { 289 289 $working_transport['streams'] = new WP_Http_Streams(); 290 290 $blocking_transport[] = &$working_transport['streams']; 291 } else if ( true === WP_Http_Fsockopen::test( ) && apply_filters('use_fsockopen_transport', true) && ( isset($args['ssl']) && !$args['ssl']) ) {291 } else if ( true === WP_Http_Fsockopen::test($args) ) { 292 292 $working_transport['fsockopen'] = new WP_Http_Fsockopen(); 293 293 $blocking_transport[] = &$working_transport['fsockopen']; 294 294 } … … 382 382 else 383 383 $r['ssl'] = false; 384 384 385 // Determine if this request is to OUR install of WordPress 386 if ( stristr(get_bloginfo('url'), $arrURL['host']) ) 387 $r['local'] = true; 388 else 389 $r['local'] = false; 390 385 391 if ( is_null( $r['headers'] ) ) 386 392 $r['headers'] = array(); 387 393 … … 793 799 * @static 794 800 * @return boolean False means this class can not be used, true means it can. 795 801 */ 796 function test( ) {797 if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours802 function test($args = array()) { 803 if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 && true != apply_filters('use_fsockopen_transport', true) ) // 12 hours 798 804 return false; 799 805 800 if ( function_exists( 'fsockopen' ) ) 801 return true; 806 if ( function_exists( 'fsockopen' ) ) { 807 if ( isset($args['ssl']) && !$args['ssl'] ) 808 return true; 809 } 802 810 803 811 return false; 804 812 } … … 906 914 * @static 907 915 * @return boolean False means this class can not be used, true means it can. 908 916 */ 909 function test() { 910 if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) 911 return false; 917 function test($args = array()) { 918 if ( function_exists('fopen') && (function_exists('ini_get') && true == ini_get('allow_url_fopen')) && true == apply_filters('use_fopen_transport', true) ) { 919 if ( 920 ( isset($args['ssl']) && !$args['ssl'] ) || 921 ( isset($args['local']) && $args['local'] == true && apply_filters('https_local_ssl_verify', true) != true ) || 922 ( isset($args['local']) && $args['local'] == false && apply_filters('https_ssl_verify', true) != true ) || 923 ( isset($args['sslverify']) && !$args['sslverify'] ) 924 ) 925 return true; 926 } 912 927 913 return true;928 return false; 914 929 } 915 930 } 916 931 … … 1041 1056 * 1042 1057 * @return boolean False means this class can not be used, true means it can. 1043 1058 */ 1044 function test( ) {1045 if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )1059 function test($args = array()) { 1060 if ( ! function_exists('fopen') && (function_exists('ini_get') && true != ini_get('allow_url_fopen')) && true != apply_filters('use_streams_transport', true) ) 1046 1061 return false; 1047 1062 1048 1063 if ( version_compare(PHP_VERSION, '5.0', '<') ) 1049 1064 return false; 1050 1065 1051 return true; 1066 if ( 1067 ( isset($args['ssl']) && !$args['ssl'] ) || 1068 ( isset($args['local']) && $args['local'] == true && apply_filters('https_local_ssl_verify', true) != true ) || 1069 ( isset($args['local']) && $args['local'] == false && apply_filters('https_ssl_verify', true) != true ) || 1070 ( isset($args['sslverify']) && !$args['sslverify'] ) 1071 ) 1072 return true; 1073 1074 return false; 1052 1075 } 1053 1076 } 1054 1077 … … 1166 1189 * 1167 1190 * @return boolean False means this class can not be used, true means it can. 1168 1191 */ 1169 function test() { 1170 if ( function_exists('http_request') ) 1171 return true; 1192 function test($args = array()) { 1193 if ( function_exists('http_request') && true == apply_filters('use_http_extension_transport', true) ) 1194 if ( 1195 ( isset($args['ssl']) && !$args['ssl'] ) || 1196 ( isset($args['local']) && $args['local'] == true && apply_filters('https_local_ssl_verify', true) != true ) || 1197 ( isset($args['local']) && $args['local'] == false && apply_filters('https_ssl_verify', true) != true ) || 1198 ( isset($args['sslverify']) && !$args['sslverify'] ) 1199 ) 1200 return true; 1172 1201 1173 1202 return false; 1174 1203 } … … 1318 1347 * 1319 1348 * @return boolean False means this class can not be used, true means it can. 1320 1349 */ 1321 function test() { 1322 if ( function_exists('curl_init') && function_exists('curl_exec') ) 1323 return true; 1350 function test($args = array()) { 1351 if ( function_exists('curl_init') && function_exists('curl_exec') && true == apply_filters('use_curl_transport', true) ) 1352 if ( 1353 ( isset($args['ssl']) && !$args['ssl'] ) || 1354 ( isset($args['local']) && $args['local'] == true && apply_filters('https_local_ssl_verify', true) != true ) || 1355 ( isset($args['local']) && $args['local'] == false && apply_filters('https_ssl_verify', true) != true ) || 1356 ( isset($args['sslverify']) && !$args['sslverify'] ) 1357 ) 1358 return true; 1324 1359 1325 1360 return false; 1326 1361 }