Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libcurl - Strange timeout after 5 seconds

I'm using libcurl to communicate with Twitter and Identi.ca. Everything works perfectly as long as my connection isn't busy. But if I'm downloading a large file, the curl requests timeout after 5 seconds.

I've set the following options on the curl handle:

curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 15);

and they make no difference, curl_easy_perform() always returns after 5 seconds. The CURLINFO_RESPONSE_CODE and CURLINFO_HTTP_CONNECTCODE values are always both zero.

Any ideas? Are there any other timeouts I need to set, or is there any reason why the above don't take effect?

EDIT: The return value of curl_easy_perform is CURLE_OPERATION_TIMEDOUT

like image 828
Kazade Avatar asked May 01 '26 03:05

Kazade


1 Answers

I'd say it is because one out of two reasons:

  1. You don't show us the complete program here so you have a set timeout option somewhere else that instructs libcurl to timeout.

  2. Your libcurl version has a bug that makes it misbehave. You didn't say which libcurl version on what platform you're using.

To get really good help, provide a complete source code that repeats the problem against a public URL.

like image 177
Daniel Stenberg Avatar answered May 02 '26 17:05

Daniel Stenberg