cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Timeout question

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 25 Jul 2003 11:22:13 +0200 (CEST)

On Thu, 24 Jul 2003, Howell, Andrew wrote:

> I am using curl 7.10.5 for Win32 with SSL. I want to use '-m', the maximum
> timeout option but I see in the manual that it "doesn't work fully in win32
> systems."

Yep. And it is true... :-)

> I've looked around a few places but haven't found any further information;
> could someone please elaborate? Does this mean it is random, or perhaps it
> means it doesn't work under certain conditions (maybe it goes wrong if over
> a certain value etc.)
>
> If I don't use the option; will curl timeout at all in the event of a broken
> connection? I guess not.

I'll give you the long and detailed explanation:

The wording is a bit inexact on purpose, since the timeout option has been
working with different degrees of funtionality on windows over time.

In 7.10.5 (and a bunch of releases back in history) the only thing the timeout
is not capable of doing on windows is to cancel a slow name lookup (using
gethostbyname()). All other operations will be timed out on windows just like
on other operating systems.

The reason for the non-working cancelation is that the *nix version of libcurl
is using alarm() for this and there's no equivalent for this on windows. On
windows, curl will instead abort immediately after such a slow lookup returns.

The result when using -m on windows, is then that it may not abort the
operation with the same accuracy that it would on *nix systems, but there's no
risk in using it and the operations will usually be aborted on the requsted
time out.

A future version of libcurl will most likely use the 'ares' library for
asynchronous name lookups, and then this time out thing will get the same
accuracy on all platforms it builds on.

I hope this was detailed enough!

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-07-25