Make WordPress Core

Changeset 10117


Ignore:
Timestamp:
12/07/2008 08:30:59 PM (16 years ago)
Author:
ryan
Message:

Fix raw_response code in Streams transport. Props jacobsantos. fixes #8476

File:
1 edited

Legend:

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

    r10087 r10117  
    397397        // The body is not chunked encoding or is malformed.
    398398        if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) )
    399             return false;
     399            return $body;
    400400
    401401        $parsedBody = '';
     
    673673            $meta = stream_get_meta_data($handle);
    674674            $theHeaders = $meta['wrapper_data'];
     675            if( isset( $meta['wrapper_data']['headers'] ) )
     676                $theHeaders = $meta['wrapper_data']['headers'];
    675677        } else {
     678            if( ! isset( $http_response_header ) )
     679                global $http_response_header;
    676680            $theHeaders = $http_response_header;
    677681        }
     
    794798        $strResponse = stream_get_contents($handle);
    795799        $meta = stream_get_meta_data($handle);
    796         $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
     800
     801        $processedHeaders = array();
     802        if( isset( $meta['wrapper_data']['headers'] ) )
     803            $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']);
     804        else
     805            $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
    797806
    798807        if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
     
    10321041            if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )
    10331042                return new WP_Error('http_request_failed', __('Too many redirects.'));
    1034            
     1043
    10351044            $theHeaders = array( 'headers' => array() );
    10361045            $theBody = '';
Note: See TracChangeset for help on using the changeset viewer.