WordPress.org

Make WordPress Core

Ticket #18738: 18738-timeout_ms.patch

File 18738-timeout_ms.patch, 1.2 KB (added by mestovar, 18 months ago)

Uses ms timeout instead of seconds

  • class-http.php

     
    10731073                        $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify); 
    10741074                elseif ( ! $is_local ) 
    10751075                        $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify); 
    1076  
    1077                 // CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since 
    1078                 // a value of 0 will allow an unlimited timeout. 
    1079                 $timeout = (int) ceil( $r['timeout'] ); 
    1080                 curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout ); 
    1081                 curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout ); 
    1082  
     1076                 
     1077                // CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS expect integers. Have to use ceil 
     1078                // since a value of 0 will allow an unlimited timeout. 
     1079                $timeout = (int) ceil( $r['timeout'] * 1000 ); 
     1080                curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT_MS, $timeout); 
     1081                // CURLOPT_TIMEOUT_MS is a string for some reason, it should be 155 
     1082                curl_setopt( $handle, 155, $timeout ); 
     1083                 
    10831084                curl_setopt( $handle, CURLOPT_URL, $url); 
    10841085                curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); 
    10851086                curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false );