Make WordPress Core

Ticket #4779: 4779.encode.post.data.diff

File 4779.encode.post.data.diff, 1.2 KB (added by DD32, 16 years ago)
  • wp-includes/http.php

     
    170170         * @param string $url URI resource.
    171171         * @param str|array $args Optional. Override the defaults.
    172172         * @param string|array $headers Optional. Either the header string or array of Header name and value pairs. Expects sanitized.
    173          * @param string $body Optional. The body that should be sent. Expected to be already processed.
     173         * @param string $body Optional. The body that should be sent. Will be automatically escaped and processed.
    174174         * @return boolean
    175175         */
    176176        function request($url, $args = array(), $headers = null, $body = null) {
     
    195195                if ( ! isset($headers['user-agent']) || ! isset($headers['User-Agent']) )
    196196                        $headers['user-agent'] = $r['user-agent'];
    197197
    198                 if ( is_null($body) )
     198                if ( ! is_null($body) ) {
     199                        if ( ! is_string($body) )
     200                                $body = http_build_query($body);
     201                       
     202                        $transport = WP_Http::_postTransport();
     203                } else {
    199204                        $transport = WP_Http::_getTransport();
    200                 else
    201                         $transport = WP_Http::_postTransport();
     205                }
    202206
    203207                return $transport->request($url, $r, $headers, $body);
    204208        }