Changeset 9185
- Timestamp:
- 10/15/08 16:35:35 (2 months ago)
- Files:
-
- trunk/wp-admin/includes/file.php (modified) (1 diff)
- trunk/wp-includes/http.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/includes/file.php
r9165 r9185 424 424 function download_url( $url ) { 425 425 //WARNING: The file is not automatically deleted, The script must unlink() the file. 426 if ( ! $url )426 if ( ! $url ) 427 427 return new WP_Error('http_no_url', __('Invalid URL Provided')); 428 428 429 429 $tmpfname = wp_tempnam($url); 430 if ( ! $tmpfname )430 if ( ! $tmpfname ) 431 431 return new WP_Error('http_no_file', __('Could not create Temporary file')); 432 432 433 433 $handle = @fopen($tmpfname, 'w'); 434 if ( ! $handle )434 if ( ! $handle ) 435 435 return new WP_Error('http_no_file', __('Could not create Temporary file')); 436 436 437 437 $response = wp_remote_get($url); 438 438 439 if( $response['response']['code'] != '200' ){ 439 if ( is_wp_error($response) ) { 440 fclose($handle); 441 unlink($tmpfname); 442 return $response; 443 } 444 445 if ( $response['response']['code'] != '200' ){ 440 446 fclose($handle); 441 447 unlink($tmpfname); trunk/wp-includes/http.php
r9091 r9185 978 978 $theResponse = curl_exec( $handle ); 979 979 980 if ( $theResponse) {980 if ( !empty($theResponse) ) { 981 981 $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE); 982 982 $theHeaders = trim( substr($theResponse, 0, $headerLength) ); … … 988 988 $theHeaders = WP_Http::processHeaders($theHeaders); 989 989 } else { 990 if ( $curl_error = curl_error($handle) ) 991 return new WP_Error('http_request_failed', $curl_error); 990 992 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) ) 991 993 return new WP_Error('http_request_failed', __('Too many redirects.')); 994 992 995 $theHeaders = array( 'headers' => array() ); 993 996 $theBody = '';
