Make WordPress Core

Ticket #16920: 16920.2.patch

File 16920.2.patch, 2.2 KB (added by hakre, 14 years ago)

class-http.php - more replacements

  • wp-includes/class-http.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    293293                        $transports = WP_Http::_getTransport( $r );
    294294                } else {
    295295                        if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
    296                                 if ( ! version_compare(phpversion(), '5.1.2', '>=') )
    297                                         $r['body'] = _http_build_query( $r['body'], null, '&' );
    298                                 else
    299                                         $r['body'] = http_build_query( $r['body'], null, '&' );
     296                                $r['body'] = http_build_query( $r['body'], null, '&' );
    300297                                $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' );
    301298                                $r['headers']['Content-Length'] = strlen( $r['body'] );
    302299                        }
     
    11081105                if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
    11091106                        return false;
    11101107
    1111                 if ( version_compare(PHP_VERSION, '5.0', '<') )
    1112                         return false;
    1113 
    1114                 //HTTPS via Proxy was added in 5.1.0
    11151108                $is_ssl = isset($args['ssl']) && $args['ssl'];
    1116                 if ( $is_ssl && version_compare(PHP_VERSION, '5.1.0', '<') ) {
     1109                if ( $is_ssl ) {
    11171110                        $proxy = new WP_HTTP_Proxy();
    11181111                        /**
    11191112                         * No URL check, as its not currently passed to the ::test() function
     
    13291322
    13301323                if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
    13311324
    1332                         $isPHP5 = version_compare(PHP_VERSION, '5.0.0', '>=');
     1325                        curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
     1326                        curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
     1327                        curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
    13331328
    1334                         if ( $isPHP5 ) {
    1335                                 curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
    1336                                 curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
    1337                                 curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
    1338                         } else {
    1339                                 curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() .':'. $proxy->port() );
    1340                         }
    1341 
    13421329                        if ( $proxy->use_authentication() ) {
    1343                                 if ( $isPHP5 )
    1344                                         curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
    1345 
     1330                                curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
    13461331                                curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
    13471332                        }
    13481333                }