WordPress.org

Make WordPress Core

Ticket #4779: 4779.r8547.diff

File 4779.r8547.diff, 1.1 KB (added by santosj, 6 years ago)

Combines fix for #7456 and fixes HTTP extension chunk format. Converts chunk to unchunked body.

  • http.php

     
    44 * 
    55 * Will eventually replace and standardize the WordPress HTTP requests made. 
    66 * 
     7 * @link http://trac.wordpress.org/ticket/4779 HTTP API Proposal 
     8 * 
    79 * @package WordPress 
    810 * @subpackage HTTP 
    911 * @since 2.7 
     
    666668                $context = stream_context_create($arrContext); 
    667669 
    668670                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) 
    669                         $handle = @fopen($url, 'r'); 
     671                        $handle = @fopen($url, 'r', false, $context); 
    670672                else 
    671                         $handle = fopen($url, 'r'); 
     673                        $handle = fopen($url, 'r', false, $context); 
    672674 
    673675                if ( ! $handle) 
    674676                        return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); 
     
    794796 
    795797                list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2); 
    796798                $theHeaders = WP_Http::processHeaders($theHeaders); 
     799                $theBody = http_chunked_decode($theBody); 
    797800 
    798801                $theResponse = array(); 
    799802                $theResponse['code'] = $info['response_code'];