Ticket #8476: 8476.4.diff
File 8476.4.diff, 2.3 KB (added by , 16 years ago) |
---|
-
http.php
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 … … 683 687 if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) 684 688 $strResponse = WP_Http::chunkTransferDecode($strResponse); 685 689 690 echo 'Fopen:'; 691 var_dump($strResponse); 692 686 693 return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response']); 687 694 } 688 695 … … 793 800 794 801 $strResponse = stream_get_contents($handle); 795 802 $meta = stream_get_meta_data($handle); 796 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);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 'Streams:'; 813 var_dump($strResponse); 800 814 801 815 fclose($handle); 802 816 … … 1017 1031 1018 1032 $theResponse = curl_exec( $handle ); 1019 1033 1034 echo 'Curl:'; 1035 var_dump($theResponse); 1036 1020 1037 if ( !empty($theResponse) ) { 1021 1038 $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE); 1022 1039 $theHeaders = trim( substr($theResponse, 0, $headerLength) ); … … 1031 1048 return new WP_Error('http_request_failed', $curl_error); 1032 1049 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) ) 1033 1050 return new WP_Error('http_request_failed', __('Too many redirects.')); 1034 1051 1035 1052 $theHeaders = array( 'headers' => array() ); 1036 1053 $theBody = ''; 1037 1054 }