Ticket #8476: 8476.5.diff
File 8476.5.diff, 1.9 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']); 800 echo 'Raw: <pre>'; 801 var_dump($strResponse); 802 echo '</pre>'; 797 803 804 $processedHeaders = array(); 805 if( isset( $meta['wrapper_data']['headers'] ) ) 806 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']); 807 else 808 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); 809 798 810 if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) 799 811 $strResponse = WP_Http::chunkTransferDecode($strResponse); 812 echo 'end: <pre>'; 813 var_dump($strResponse); 814 echo '</pre>'; 800 815 801 816 fclose($handle); 802 817 … … 1031 1046 return new WP_Error('http_request_failed', $curl_error); 1032 1047 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) ) 1033 1048 return new WP_Error('http_request_failed', __('Too many redirects.')); 1034 1049 1035 1050 $theHeaders = array( 'headers' => array() ); 1036 1051 $theBody = ''; 1037 1052 }