Ticket #13841: 13841.3.diff
File 13841.3.diff, 1.6 KB (added by , 14 years ago) |
---|
-
wp-includes/class-http.php
100 100 'sslverify' => true 101 101 ); 102 102 103 103 104 104 // Pre-parse for the HEAD checks. 105 105 $args = wp_parse_args( $args ); 106 106 … … 659 659 } 660 660 661 661 $strResponse = ''; 662 while ( ! feof($handle) ) 663 $strResponse .= fread($handle, 4096); 662 while ( ! feof($handle) ) { 663 $info = stream_get_meta_data( $handle ); 664 if ( $info['timed_out'] ) 665 return new WP_Error('http_request_failed', __('Request timed out.')); 666 $strResponse .= fread( $handle, 4096 ); 667 } 664 668 665 669 fclose($handle); 666 670 … … 814 818 if ( ! empty($r['body'] ) ) 815 819 $arrContext['http']['content'] = $r['body']; 816 820 821 // timeouts with stream_contect_create for some reason need to be half of what you expect 822 $arrContext['http']['timeout'] = $r['timeout'] / 2; 823 817 824 $context = stream_context_create($arrContext); 818 825 819 826 if ( !WP_DEBUG ) … … 845 852 else 846 853 $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); 847 854 848 // Streams does not provide an error code which we can use to see why the request stream stoped. 855 // Streams does not provide an error code which we can use to see why the request stream stoped. 849 856 // We can however test to see if a location header is present and return based on that. 850 857 if ( isset($processedHeaders['headers']['location']) && 0 !== $args['_redirection'] ) 851 858 return new WP_Error('http_request_failed', __('Too many redirects.'));