Ticket #8476: 8476.6.diff
File 8476.6.diff, 1.8 KB (added by , 16 years ago) |
---|
-
http.php
396 396 $body = str_replace(array("\r\n", "\r"), "\n", $body); 397 397 // The body is not chunked encoding or is malformed. 398 398 if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) ) 399 return false;399 return $body; 400 400 401 401 $parsedBody = ''; 402 402 //$parsedHeaders = array(); Unsupported … … 672 672 if ( function_exists('stream_get_meta_data') ) { 673 673 $meta = stream_get_meta_data($handle); 674 674 $theHeaders = $meta['wrapper_data']; 675 if( isset( $meta['wrapper_data']['headers'] ) ) 676 $theHeaders = $meta['wrapper_data']['headers']; 675 677 } else { 678 if( ! isset( $http_response_header ) ) 679 global $http_response_header; 676 680 $theHeaders = $http_response_header; 677 681 } 678 682 … … 793 797 794 798 $strResponse = stream_get_contents($handle); 795 799 $meta = stream_get_meta_data($handle); 796 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);797 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']); 806 798 807 if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) 799 808 $strResponse = WP_Http::chunkTransferDecode($strResponse); 800 809 … … 1031 1040 return new WP_Error('http_request_failed', $curl_error); 1032 1041 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) ) 1033 1042 return new WP_Error('http_request_failed', __('Too many redirects.')); 1034 1043 1035 1044 $theHeaders = array( 'headers' => array() ); 1036 1045 $theBody = ''; 1037 1046 }