WordPress.org

Plugin Directory

Changeset 549330


Ignore:
Timestamp:
05/26/12 19:03:33 (23 months ago)
Author:
alexdunae
Message:

Set timeout in wp_remote_get instead of via filter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-smushit/trunk/wp-smushit.php

    r549329 r549330  
    296296     
    297297    if ( function_exists('wp_remote_get') ) { 
    298         add_filter('http_request_timeout', 'wp_smushit_http_request_timeout'); 
    299         $response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA)); 
     298        $response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA, 'timeout' => 20)); 
    300299 
    301300        if( is_wp_error( $response ) ) { 
     
    304303 
    305304        $data = wp_remote_retrieve_body($response); 
    306         remove_filter('http_request_timeout', 'wp_smushit_http_request_timeout'); 
    307305    } else { 
    308306        wp_die( __('WP Smush.it requires WordPress 2.8 or greater', WP_SMUSHIT_DOMAIN) ); 
     
    386384} 
    387385 
    388 /** 
    389  * http_request_timeout filter -- bumped up to 25 seconds for larger images 
    390  */ 
    391 function wp_smushit_http_request_timeout($time) { 
    392     return 25; 
    393 } 
    394  
    395  
    396386if ( function_exists( 'wp_basename' ) === false ) { 
    397387  /** 
Note: See TracChangeset for help on using the changeset viewer.