curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Curl timeout option in milliseconds

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 15 Nov 2019 14:54:04 +0100 (CET)

> Cases 1, 2 and 3 work fine but timeout occurs wrongly in cases 4 and 5.
> Please correct me if my understanding here is wrong.

Didn't this change the behavior? Your original statement said sub second
timeouts still took a full second but in this output it looks like they failed
completely.

You also never answered my question about what resolver backend your build is
using but I think that the above behavior answers it for me with enough
certainty:

I think libcurl returns an error for you due to this condition:

https://github.com/curl/curl/blob/c6b70de24660673648a37be4d18638274d7f5741/lib/hostip.c#L662-L669

... this is because you've built libcurl to use the synchronous name resolver
and we can only time-out that with signal() and that function only has integer
second resolution. If you ask for a shorter timeout, that can't be fullfilled.

libcurl defaults to using the threaded resolver these days which will fire up
the resolver in a sepearate thread that can be abandonded easier and in less
than a second.

-- 
  / daniel.haxx.se | Get the best commercial curl support there is - from me
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-11-15