WordPress.org

Make WordPress Core

Changeset 10642


Ignore:
Timestamp:
02/24/2009 07:37:02 PM (9 years ago)
Author:
westi
Message:

Refactor the ssl blacklisting support info the individual test functions. Fixes #9078 props sivel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/http.php

    r10639 r10642  
    229229
    230230        if ( is_null($working_transport) ) {
    231             if ( true === WP_Http_ExtHttp::test() ) {
     231            if ( true === WP_Http_ExtHttp::test($args) ) {
    232232                $working_transport['exthttp'] = new WP_Http_ExtHttp();
    233233                $blocking_transport[] = &$working_transport['exthttp'];
    234             } else if ( true === WP_Http_Curl::test() ) {
     234            } else if ( true === WP_Http_Curl::test($args) ) {
    235235                $working_transport['curl'] = new WP_Http_Curl();
    236236                $blocking_transport[] = &$working_transport['curl'];
    237             } else if ( true === WP_Http_Streams::test() ) {
     237            } else if ( true === WP_Http_Streams::test($args) ) {
    238238                $working_transport['streams'] = new WP_Http_Streams();
    239239                $blocking_transport[] = &$working_transport['streams'];
    240             } else if ( true === WP_Http_Fopen::test() && ( isset($args['ssl']) && !$args['ssl'] ) ) {
     240            } else if ( true === WP_Http_Fopen::test($args) ) {
    241241                $working_transport['fopen'] = new WP_Http_Fopen();
    242242                $blocking_transport[] = &$working_transport['fopen'];
    243             } else if ( true === WP_Http_Fsockopen::test() && ( isset($args['ssl']) && !$args['ssl'] ) ) {
     243            } else if ( true === WP_Http_Fsockopen::test($args) ) {
    244244                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
    245245                $blocking_transport[] = &$working_transport['fsockopen'];
     
    280280
    281281        if ( is_null($working_transport) ) {
    282             if ( true === WP_Http_ExtHttp::test() ) {
     282            if ( true === WP_Http_ExtHttp::test($args) ) {
    283283                $working_transport['exthttp'] = new WP_Http_ExtHttp();
    284284                $blocking_transport[] = &$working_transport['exthttp'];
    285             } else if ( true === WP_Http_Curl::test() ) {
     285            } else if ( true === WP_Http_Curl::test($args) ) {
    286286                $working_transport['curl'] = new WP_Http_Curl();
    287287                $blocking_transport[] = &$working_transport['curl'];
    288             } else if ( true === WP_Http_Streams::test() ) {
     288            } else if ( true === WP_Http_Streams::test($args) ) {
    289289                $working_transport['streams'] = new WP_Http_Streams();
    290290                $blocking_transport[] = &$working_transport['streams'];
    291             } else if ( true === WP_Http_Fsockopen::test() && ( isset($args['ssl']) && !$args['ssl'] ) ) {
     291            } else if ( true === WP_Http_Fsockopen::test($args) ) {
    292292                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
    293293                $blocking_transport[] = &$working_transport['fsockopen'];
     
    387387            $r['ssl'] = false;
    388388
     389                // Determine if this request is to OUR install of WordPress
     390                if ( stristr(get_bloginfo('url'), $arrURL['host']) )
     391                        $r['local'] = true;
     392                else
     393                        $r['local'] = false;
     394
    389395        if ( is_null( $r['headers'] ) )
    390396            $r['headers'] = array();
     
    847853     * @return boolean False means this class can not be used, true means it can.
    848854     */
    849     function test() {
     855    function test($args = array()) {
    850856        if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
    851857            return false;
    852858
    853         if ( function_exists( 'fsockopen' ) )
     859        if ( function_exists( 'fsockopen' ) && ( isset($args['ssl']) && !$args['ssl'] ) )
    854860            return apply_filters('use_fsockopen_transport', true);
    855861
     
    964970            return false;
    965971
    966         return apply_filters('use_fopen_transport', true);
     972                if (
     973                                ( isset($args['ssl']) && !$args['ssl'] ) ||
     974                                ( isset($args['local']) && $args['local'] == true && apply_filters('https_local_ssl_verify', true) != true ) ||
     975                                ( isset($args['local']) && $args['local'] == false && apply_filters('https_ssl_verify', true) != true ) ||
     976                                ( isset($args['sslverify']) && !$args['sslverify'] )
     977                        )
     978                return apply_filters('use_fopen_transport', true);
     979
     980        return false;
    967981    }
    968982}
     
    10951109     * @return boolean False means this class can not be used, true means it can.
    10961110     */
    1097     function test() {
     1111    function test($args = array()) {
    10981112        if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
    10991113            return false;
     
    12221236     * @return boolean False means this class can not be used, true means it can.
    12231237     */
    1224     function test() {
     1238    function test($args = array()) {
    12251239        if ( function_exists('http_request') )
    12261240            return apply_filters('use_http_extension_transport', true);
     
    13751389     * @return boolean False means this class can not be used, true means it can.
    13761390     */
    1377     function test() {
     1391    function test($args = array()) {
    13781392        if ( function_exists('curl_init') && function_exists('curl_exec') )
    13791393            return  apply_filters('use_curl_transport', true);
Note: See TracChangeset for help on using the changeset viewer.