WordPress.org

Make WordPress Core

Ticket #9754: should_decode.diff

File should_decode.diff, 3.0 KB (added by wnorris, 10 years ago)
  • wp-includes/http.php

     
    716716                if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] )
    717717                        $process['body'] = WP_Http::chunkTransferDecode($process['body']);
    718718
    719                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders) )
     719                if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) )
    720720                        $process['body'] = WP_Http_Encoding::decompress( $process['body'] );
    721721
    722722                return array('headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response'], 'cookies' => $arrHeaders['cookies']);
     
    830830                if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
    831831                        $strResponse = WP_Http::chunkTransferDecode($strResponse);
    832832
    833                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders) )
     833                if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
    834834                        $strResponse = WP_Http_Encoding::decompress( $strResponse );
    835835
    836836                return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
     
    998998                if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
    999999                        $strResponse = WP_Http::chunkTransferDecode($strResponse);
    10001000
    1001                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders) )
     1001                if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
    10021002                        $strResponse = WP_Http_Encoding::decompress( $strResponse );
    10031003
    10041004                return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
     
    11541154                                $theBody = http_chunked_decode($theBody);
    11551155                }
    11561156
    1157                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders) )
     1157                if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
    11581158                        $theBody = http_inflate( $theBody );
    11591159
    11601160                $theResponse = array();
     
    13371337
    13381338                curl_close( $handle );
    13391339
    1340                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders) )
     1340                if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
    13411341                        $theBody = WP_Http_Encoding::decompress( $theBody );
    13421342
    13431343                return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies']);