cURL / Mailing Lists / curl-library / Single Mail


weird timer behavior when re-using existing connection

From: David Lasker <>
Date: Tue, 17 Jun 2008 13:00:21 -0700

Hi, I am brand-new, very newbie libcurl user, so this may be a dumb

I am using the curl_multi interface to do HTTP POSTs. I am using libcurl
7.18.2 with c-ares on Linux.

I am seeing some unexpected timer behavior when I make consecutive HTTP
POSTs to the same URL and the connection gets reused.

On the first HTTP POST, all looks good. My timer callback function is called
3 times with the following timeouts:

1. 0
2. 5000 (for the DNS lookup, I think)
3. 20000 (for the rest of the HTTP transaction)

On the 2nd POST, I get just one timer callback with the timeout set to zero.

If I call curl_multi_timeout instead of using the timer callback, it returns
-1 for the send POST.

If I delay the 2nd POST until the remote web server closes the connection,
or POST to a different URL (so there is no connection reuse) all works fine.

I realize there shouldn't be a DNS lookup or connection timeout on the 2nd
POST, but I expected to need a timeout while waiting for the response from
the remote web server?

Is this a bug, or am I doing something wrong?

Thanks for the help!

Received on 2008-06-17