Ticket #13841: 13841.8.diff
File 13841.8.diff, 1.6 KB (added by , 13 years ago) |
---|
-
wp-includes/class-http.php
743 743 if ( ! $stream_handle ) 744 744 return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); 745 745 746 while ( ! feof($handle) ) { 746 while ( ! feof( $handle ) ) { 747 $info = stream_get_meta_data( $handle ); 748 749 if ( $info['timed_out'] ) { 750 unset( $strResponse ); 751 fclose( $stream_handle ); 752 fclose( $handle ); 753 return new WP_Error( 'http_request_failed', __( 'Request timed out.' ) ); 754 } 755 747 756 $block = fread( $handle, 4096 ); 748 757 if ( $bodyStarted ) { 749 758 fwrite( $stream_handle, $block ); … … 762 771 fclose( $stream_handle ); 763 772 764 773 } else { 765 while ( ! feof($handle) ) 774 while ( ! feof( $handle ) ) { 775 $info = stream_get_meta_data( $handle ); 776 777 if ( $info['timed_out'] ) { 778 unset( $strResponse ); 779 fclose( $handle ); 780 return new WP_Error( 'http_request_failed', __( 'Request timed out.' ) ); 781 } 782 766 783 $strResponse .= fread( $handle, 4096 ); 784 } 767 785 768 786 $process = WP_Http::processResponse( $strResponse ); 769 787 unset( $strResponse ); … … 915 933 if ( ! empty($r['body'] ) ) 916 934 $arrContext['http']['content'] = $r['body']; 917 935 936 // timeouts with stream_context_create for some reason need to be half of what you expect 937 $arrContext['http']['timeout'] = $r['timeout'] / 2; 938 918 939 $context = stream_context_create($arrContext); 919 940 920 941 if ( !WP_DEBUG )