What is PyCurl's default timeout

BorrajaX picture BorrajaX · Feb 7, 2013 · Viewed 8.3k times · Source

Well, I think the title of the question is very self explanatory, so you probably don't need to keep reading, but here it goes:

I have been working with PyCurl for a while, and I've always set my timeouts using

curlConnector = pycurl.Curl()
curlConnector.setopt(pycurl.CONNECTTIMEOUT, 30)

but I have started wondering what is the default timeout, or how to find it and I haven't seen any satisfactory answer so far.. If I don't manually specify it, what is the default timeout? Whatever comes from the socket? (Just in case it's relevant, I work on Ubuntu 12.04 and python2.7)

Answer

John Hazen picture John Hazen · Feb 7, 2013

I downloaded PyCurl. In the doc/ directory of the tarball, are a couple of doc files. One of these is doc/curlobject.html, which says setup "Corresponds to curl_easy_setopt in libcurl". Following that link gets you to http://curl.haxx.se/libcurl/c/curl_easy_setopt.html, which upon search for 'CONNECTTIMEOUT', says:

CURLOPT_CONNECTTIMEOUT

Pass a long. It should contain the maximum time in seconds that you allow the connection to the server to take. 
This only limits the connection phase, once it has connected, this option is of no more use. 
Set to zero to switch to the default built-in connection timeout - 300 seconds. 
See also the CURLOPT_TIMEOUT option.

So, I'd say the default timeout is 300 seconds.