WordPress.org

Make WordPress Core

Changeset 8524


Ignore:
Timestamp:
08/01/08 23:13:48 (7 years ago)
Author:
ryan
Message:

Fixes process headers for fopen header return, fixes HTTP extension response array. Also adds Curl implementation and allows for it to be used when using headers. Props santosj. see #4779

File:
1 edited

Legend:

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

    r8523 r8524  
    8989 
    9090        if ( is_null($working_transport) ) { 
    91             if ( true === WP_Http_Streams::test() ) 
     91            if ( true === WP_Http_ExtHttp::test() ) 
     92                $working_transport = new WP_Http_ExtHttp(); 
     93            else if ( true === WP_Http_Curl::test() ) 
     94                $working_transport = new WP_Http_Curl(); 
     95            else if ( true === WP_Http_Streams::test() ) 
    9296                $working_transport = new WP_Http_Streams(); 
    93             else if ( true === WP_Http_ExtHttp::test() ) 
    94                 $working_transport = new WP_Http_ExtHttp(); 
    9597            else if ( true === WP_Http_Fopen::test() ) 
    9698                $working_transport = new WP_Http_Fopen(); 
     
    120122 
    121123        if ( is_null($working_transport) ) { 
    122             if ( true === WP_Http_Streams::test() ) 
     124            if ( true === WP_Http_ExtHttp::test() ) 
     125                $working_transport = new WP_Http_ExtHttp(); 
     126            else if ( true === WP_Http_Streams::test() ) 
    123127                $working_transport = new WP_Http_Streams(); 
    124             else if ( true === WP_Http_ExtHttp::test() ) 
    125                 $working_transport = new WP_Http_ExtHttp(); 
    126128            else if ( true === WP_Http_Fsockopen::test() ) 
    127129                $working_transport = new WP_Http_Fsockopen(); 
     
    194196            $headers['user-agent'] = $r['user-agent']; 
    195197 
    196         if ( is_null($body) || count($headers) > 1 ) 
     198        if ( is_null($body) ) 
    197199            $transport = WP_Http::_getTransport(); 
    198200        else 
    199201            $transport = WP_Http::_postTransport(); 
    200202 
    201         return $transport->request($url, $headers, $body, $r); 
     203        return $transport->request($url, $r, $headers, $body); 
    202204    } 
    203205 
     
    219221        $defaults = array('method' => 'POST'); 
    220222        $r = wp_parse_args( $args, $defaults ); 
    221         return $this->request($url, $headers, $body, $r); 
     223        return $this->request($url, $r, $headers, $body); 
    222224    } 
    223225 
     
    239241        $defaults = array('method' => 'GET'); 
    240242        $r = wp_parse_args( $args, $defaults ); 
    241         return $this->request($url, $headers, $body, $r); 
     243        return $this->request($url, $r, $headers, $body); 
    242244    } 
    243245 
     
    695697     * @param string $url 
    696698     * @param str|array $args Optional. Override the defaults. 
    697      * @param string|array $headers Optional. Either the header string or array of Header name and value pairs. Expects sanitized. 
     699     * @param array $headers Optional. Either the header string or array of Header name and value pairs. Expects sanitized. 
    698700     * @param string $body Optional. The body that should be sent. Expected to be already processed. 
    699701     * @return array 'headers', 'body', and 'response' keys. 
     
    937939    $objFetchSite = _wp_http_get_object(); 
    938940 
    939     return $objFetchSite->request($url, $headers, $body, $args); 
     941    return $objFetchSite->request($url, $args, $headers, $body); 
    940942} 
    941943 
     
    956958    $objFetchSite = _wp_http_get_object(); 
    957959 
    958     return $objFetchSite->get($url, $headers, $body, $args); 
     960    return $objFetchSite->get($url, $args, $headers, $body); 
    959961} 
    960962 
     
    975977    $objFetchSite = _wp_http_get_object(); 
    976978 
    977     return $objFetchSite->post($url, $headers, $body, $args); 
     979    return $objFetchSite->post($url, $args, $headers, $body); 
    978980} 
    979981 
     
    994996    $objFetchSite = _wp_http_get_object(); 
    995997 
    996     return $objFetchSite->head($url, $headers, $body, $args); 
     998    return $objFetchSite->head($url, $args, $headers, $body); 
    997999} 
    9981000 
Note: See TracChangeset for help on using the changeset viewer.