diff --git wp-includes/class-http.php wp-includes/class-http.php
index 12e73bb..5b5c2b8 100644
|
|
class WP_Http { |
631 | 631 | $args['method'] = 'GET'; |
632 | 632 | } |
633 | 633 | |
634 | | return wp_remote_request( $redirect_location, $args ); |
| 634 | return wp_remote_request( $redirect_location, $args ); |
635 | 635 | } |
636 | 636 | } |
637 | 637 | |
… |
… |
class WP_Http_Fsockopen { |
852 | 852 | |
853 | 853 | $arrHeaders = WP_Http::processHeaders( $process['headers'] ); |
854 | 854 | |
| 855 | //Check the file was fully written to disk |
| 856 | if ( $r['stream'] && isset( $arrHeaders['headers']['content-length'] ) && (int)$arrHeaders['headers']['content-length'] > $bytes_written ) { |
| 857 | unlink( $r['filename'] ); |
| 858 | return new WP_Error( 'http_request_failed', __( 'Failed to write full file to disk.' ) ); |
| 859 | } |
| 860 | |
855 | 861 | $response = array( |
856 | 862 | 'headers' => $arrHeaders['headers'], |
857 | 863 | 'body' => null, // Not yet processed |
… |
… |
class WP_Http_Streams { |
1030 | 1036 | if ( ! $stream_handle ) |
1031 | 1037 | return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); |
1032 | 1038 | |
1033 | | stream_copy_to_stream( $handle, $stream_handle, $max_bytes ); |
| 1039 | $bytes_written = stream_copy_to_stream( $handle, $stream_handle, $max_bytes ); |
1034 | 1040 | |
1035 | 1041 | fclose( $stream_handle ); |
1036 | 1042 | $strResponse = ''; |
… |
… |
class WP_Http_Streams { |
1048 | 1054 | else |
1049 | 1055 | $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); |
1050 | 1056 | |
| 1057 | // Check the file was fully written to disk |
| 1058 | if ( $r['stream'] && isset( $processedHeaders['headers']['content-length'] ) ) { |
| 1059 | if ( (int)$processedHeaders['headers']['content-length'] > $bytes_written && ! ( $bytes_written === 1 && 0 === (int) $processedHeaders['headers']['content-length'] ) ) { // PHP Bug: http://bugs.php.net/bug.php?id=47997 fixed in 5.2.10 |
| 1060 | unlink( $r['filename'] ); |
| 1061 | return new WP_Error( 'http_request_failed', __( 'Failed to write full file to disk.' ) ); |
| 1062 | } |
| 1063 | } |
| 1064 | |
1051 | 1065 | $response = array( |
1052 | 1066 | 'headers' => $processedHeaders['headers'], |
1053 | 1067 | 'body' => null, |
… |
… |
class WP_Http_Curl { |
1318 | 1332 | |
1319 | 1333 | curl_close( $handle ); |
1320 | 1334 | |
1321 | | if ( $r['stream'] ) |
| 1335 | if ( $r['stream'] ) { |
1322 | 1336 | fclose( $this->stream_handle ); |
| 1337 | // Check the file was fully written to disk |
| 1338 | if ( isset( $theHeaders['headers']['content-length'] ) && (int) $theHeaders['headers']['content-length'] > filesize( $r['filename'] ) ) { |
| 1339 | unlink( $r['filename'] ); |
| 1340 | return new WP_Error( 'http_request_failed', __( 'Failed to write full file to disk.' ) ); |
| 1341 | } |
| 1342 | } |
1323 | 1343 | |
1324 | 1344 | $response = array( |
1325 | 1345 | 'headers' => $theHeaders['headers'], |