Ticket #13841: 13841.4.diff
File 13841.4.diff, 1.8 KB (added by , 14 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 ); … … 716 719 717 720 } else { 718 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 ); 720 726 721 727 $process = WP_Http::processResponse( $strResponse ); … … 868 874 if ( ! empty($r['body'] ) ) 869 875 $arrContext['http']['content'] = $r['body']; 870 876 877 // timeouts with stream_contect_create for some reason need to be half of what you expect 878 $arrContext['http']['timeout'] = $r['timeout'] / 2; 879 871 880 $context = stream_context_create($arrContext); 872 881 873 882 if ( !WP_DEBUG ) … … 915 924 else 916 925 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); 917 926 918 // Streams does not provide an error code which we can use to see why the request stream stop ed.927 // Streams does not provide an error code which we can use to see why the request stream stopped. 919 928 // We can however test to see if a location header is present and return based on that. 920 929 if ( isset($processedHeaders['headers']['location']) && 0 !== $args['_redirection'] ) 921 930 return new WP_Error('http_request_failed', __('Too many redirects.'));