Ticket #13841: 13841.6.diff
File 13841.6.diff, 1.3 KB (added by , 13 years ago) |
---|
-
wp-includes/class-http.php
697 697 return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); 698 698 699 699 while ( ! feof($handle) ) { 700 $info = stream_get_meta_data( $handle ); 701 if ( $info['timed_out'] ) 702 return new WP_Error('http_request_failed', __('Request timed out.')); 700 703 $block = fread( $handle, 4096 ); 701 704 if ( $bodyStarted ) { 702 705 fwrite( $stream_handle, $block ); … … 715 718 fclose( $stream_handle ); 716 719 717 720 } else { 718 while ( ! feof($handle) ) 721 while ( ! feof($handle) ) { 722 $info = stream_get_meta_data( $handle ); 723 if ( $info['timed_out'] ) 724 return new WP_Error('http_request_failed', __('Request timed out.')); 719 725 $strResponse .= fread( $handle, 4096 ); 726 } 720 727 721 728 $process = WP_Http::processResponse( $strResponse ); 722 729 unset( $strResponse ); … … 868 875 if ( ! empty($r['body'] ) ) 869 876 $arrContext['http']['content'] = $r['body']; 870 877 878 // timeouts with stream_context_create for some reason need to be half of what you expect 879 $arrContext['http']['timeout'] = $r['timeout'] / 2; 880 871 881 $context = stream_context_create($arrContext); 872 882 873 883 if ( !WP_DEBUG )