• Resolved David Bee

    (@davidbawiec)


    Hey! Great plugin. Nice work on it. I’ve found a bug that I want to report.

    In /lib/ajax.php you define 'timeout' => 300, // 300-second timeout instead of the default 5s. This is great. However, certain themes/plugins modify the cURL timeout settings using the http_api_curl action. Since your plugin never taps into this, the overridden settings are used. In some cases could be a mere 15s. This results in a cURL error 28 being generated after said 15 seconds (or whatever overridden value was used).

    Fixing this is easy enough using the following code:

    function change_http_curl_timeout_for_code_profiler( $handle, $parsed_args, $url ) {
    	if ( str_contains( $url, 'CODE_PROFILER_PRO_ON' ) ) {
    		curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 300 );
    		curl_setopt( $handle, CURLOPT_TIMEOUT, 300 );
    	}
    }
    
    add_action( 'http_api_curl', 'change_http_curl_timeout_for_code_profiler', 1000, 3 );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Missing cURL override generates an Error 500’ is closed to new replies.