cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: curl-library Digest, Vol 53, Issue 4

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 6 Jan 2010 20:11:17 +0100 (CET)

On Mon, 4 Jan 2010, Adrian Michel wrote:

PLEASE don't reply to digest-mails. If you want to participate in list
discussions, switch to individual mails! And if you DO reply to digest mails,
please edit the subject to something sensible.

>> BTW, how do you force a slow name resolve for this problem to repeat?

> Here's how I reproduce the problem.
>
> I have an Apache http server running on the local box. When the hostname is
> in the hosts file everything works - I can access it from a browser, or post
> to it using libcurl, in which case I also get calls to the progress
> callback.
>
> If I remove the entry from "hosts" and try to post to it using libcurl, it
> takes about 15-20 seconds for the call to curl_easy_perform to return with
> an error CURLE_COULDNT_CONNECT, and during this time I don't get any calls
> to the progress callback.

That's not a slow name resolve then. Two things tell me this:

1 - CURLE_COULDNT_CONNECT is a failed TCP connect and that implies that the
     name was already resolved

2 - repeated resolves of the same name from the same machine VERY RARELY
     actually is slow since almost everything caches DNS requests (even
     negative results)

> It is possible that the wait doesn't happen in the dns resolver, but I
> couldn't tell you if that's the case, as I know almost nothing about the
> libcurl internals. Or maybe that's the intended behavior, in which case I
> will use the multiple threads method.

Your description here makes it sound as if the problem is rather while waiting
for the connect to happen or fail. I'll proceed with committing the previously
mentioned patch since I do believe it is still the right thing, and then I'll
read more code to see if I can understand why you don't get progress callbacks
during the connection phase.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-06