Make WordPress Core

Ticket #16978: 16978.patch

File 16978.patch, 1.2 KB (added by hakre, 14 years ago)

Make it filterabled (and bugfix)

  • wp-includes/class-http.php

     
    218218         * @return array|object Array containing 'headers', 'body', 'response', 'cookies'. A WP_Error instance upon error
    219219         */
    220220        private function _dispatch_request($url, $args) {
    221                 static $transports = null;
    222                 if ( is_null($transports) )
    223                         $transports = array();
     221                static $transports = array();
    224222
    225                 $request_order = isset($r['blocking']) && !$r['blocking'] ?
    226                                                         array('curl', 'streams', 'fsockopen', 'exthttp') : // non-blocking order
    227                                                         array('exthttp', 'curl', 'streams', 'fsockopen'); // blocking order
     223                // default transports order
     224                $request_order = $args['blocking'] ?
     225                                                        array( 'exthttp', 'curl', 'streams', 'fsockopen' ): // blocking order
     226                                                        array( 'curl', 'streams', 'fsockopen', 'exthttp' ); // non-blocking order
    228227
     228                $request_order = apply_filters( 'http_get_transports', $request_order, $url, $args );
     229
    229230                // Loop over each transport on each HTTP request looking for one which will serve this requests needs
    230231                foreach ( $request_order as $transport ) {
    231232                        $class = 'WP_HTTP_' . $transport;