Ticket #13841: 13841.7.diff
File 13841.7.diff, 1.6 KB (added by , 13 years ago) |
---|
-
wp-includes/class-http.php
697 697 if ( ! $stream_handle ) 698 698 return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); 699 699 700 while ( ! feof($handle) ) { 700 while ( ! feof( $handle ) ) { 701 $info = stream_get_meta_data( $handle ); 702 703 if ( $info['timed_out'] ) { 704 unset( $strResponse ); 705 fclose( $stream_handle ); 706 return new WP_Error( 'http_request_failed', __( 'Request timed out.' ) ); 707 } 708 701 709 $block = fread( $handle, 4096 ); 702 710 if ( $bodyStarted ) { 703 711 fwrite( $stream_handle, $block ); … … 716 724 fclose( $stream_handle ); 717 725 718 726 } else { 719 while ( ! feof($handle) ) 727 while ( ! feof( $handle ) ) { 728 $info = stream_get_meta_data( $handle ); 729 730 if ( $info['timed_out'] ) { 731 unset( $strResponse ); 732 fclose( $handle ); 733 return new WP_Error( 'http_request_failed', __( 'Request timed out.' ) ); 734 } 735 720 736 $strResponse .= fread( $handle, 4096 ); 737 } 721 738 722 739 $process = WP_Http::processResponse( $strResponse ); 723 740 unset( $strResponse ); … … 869 886 if ( ! empty($r['body'] ) ) 870 887 $arrContext['http']['content'] = $r['body']; 871 888 889 // timeouts with stream_context_create for some reason need to be half of what you expect 890 $arrContext['http']['timeout'] = $r['timeout'] / 2; 891 872 892 $context = stream_context_create($arrContext); 873 893 874 894 if ( !WP_DEBUG )