curl / Mailing Lists / curl-library / Single Mail


RE: curl_easy_perform blocks when ifdown the ntwk interface

From: Daniel Stenberg via curl-library <>
Date: Sat, 17 Nov 2018 11:54:08 +0100 (CET)

On Tue, 13 Nov 2018, Matthews, Jeremy via curl-library wrote:

> Well, curl_easy_perform did appear to block. When the interface was down,
> the function did not return, let alone return an error code.
> I have made this change:
> < curl_easy_setopt(mhCurl, CURLOPT_CONNECTTIMEOUT, f_lTimeoutSec);
> ---
>> curl_easy_setopt(mhCurl, CURLOPT_TIMEOUT, f_lTimeoutSec);
> ...and curl_easy_perform now returns and with the expected return code of 45

I'm not sure I understand your exact steps to reproduce this.

When do you take down the interface? The connect timeout is only applied to
the connection phase, so if curl first connects to a host and you *then* take
down the network, curl won't trigger any timeouts. You need another timeout
for that, like the CURLOPT_TIMEOUT you mention here.

If you take down the interface *before* you try to connect, then the connect
timeout should apply but then I also imagine that the connect attempt should
just fail hard even before the timeout can trigger.

(and please switch off digest mode for the mailing list when participating in
discussions, or at least remove all superfluous contents from mails)

Received on 2018-11-17