cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: PacRunner libcurl plugin broken?

From: David Woodhouse <dwmw2_at_infradead.org>
Date: Mon, 06 Dec 2010 16:10:10 +0000

On Mon, 2010-12-06 at 13:45 +0000, David Woodhouse wrote:
> It seems to be reliably failing to load the PAC file on the first
> attempt.

I think this may be a curl bug.

We set up our new request and call curl_multi_add_handle(). It sets a
timer to happen in 1ms, and from that timeout we call
curl_multi_socket_all().

That call to curl_multi_socket_all() first sets up the connection and
changes the state from CURLM_STATE_INIT to CURLM_STATE_CONNECT, then
loops (on result==CURLM_CALL_MULTI_PERFORM) and tries to make the
connection.

It ends up in Curl_getaddrinfo() which calls init_resolve_thread() and
spawns a thread to go and look up the IP address to use.

curl_multi_socket_all() then returns zero.

The thread spawned by init_resolve_thread() then completes its task and
exits, but nobody ever tells us. So nothing happens to this connection
until later, when we try to make *another* request and finally call
curl_multi_socket_all() again.

Am I missing some way that the completion of the getaddrinfo thread is
supposed to poke us to call back into libcurl? Some hook we've failed to
register? Or were we supposed to *repeat* that 1ms timer until told
otherwise?

The PacRunner code in question is at
http://git.kernel.org/?p=network/connman/pacrunner.git;a=blob;f=plugins/curl.c;hb=HEAD

I'm using libcurl 7.21.0 on Fedora 14 x86_64.

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