cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Adrian Michel <adrian_at_amichel.com>
Date: Mon, 4 Jan 2010 15:59:51 -0800

>
> > I applied the patch, but the progress callback function is
> not getting
> > called.
>
> Why doesn't the suggested patch work? Is it really the name
> resolve that is slow? Isn't the patched function the one that
> is called to do the name resolve? And if it uses the patched
> function, why isn't the fix good enough?
>

> Since you seem to be able to repeat this case, can't you just
> set a break-point and single-step through the function and
> see what happens?
>
> 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.

I traced through the hostares.c file and first
        line 220 - Curl_wait_for_resolv (line 220)
gets called, which starts the while loop, where
        line 132 - waitperform
gets called. waitperform returns almost immediately, then the test
        line 261 - if( conn->async.done )
evaluates to true, which causes the while loop to break, before reaching
        line 264 - Curl_pgrsUpdate ()
which is where I assume the progress callback gets called, but it never gets
there.

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.

Thanks

Adrian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2010-01-05