cURL / Mailing Lists / curl-library / Single Mail

curl-library

OPENSOCKETFUNCTION hook not called for all socket creations on Windows

From: Poul Thomas Lomholt <pt_at_lomholt.com>
Date: Wed, 14 Dec 2011 18:07:00 +0530

Hi, on Windows, libcurl does not seem to honor
the CURLOPT_OPENSOCKETFUNCTION hook for the 'dummy_sock' socket created
in init_resolve_thread() function. This socket is then later presented to
the CURLMOPT_SOCKETFUNCTION callback, but not having been created via the
OPENSOCKETFUNCTION callback causes me some headache. I am assuming the same
problem exists for the CURLOPT_CLOSESOCKETFUNCTION counterpart. This was
using libcurl 7.23.0 but the problem seems to exist also in 7.23.1 based on
inspection of the latest version of asyn-thread.c. Bug?

Some background:
I am trying to integrate libcurl with libev using the multicurl interface.
Libev insists on using file descriptors even on Windows and so it is
necessary to wrap every native socket handle with a call
to _open_osfhandle() / close(). In order to properly manage the lifetime of
all such fds my application uses
the CURLOPT_OPENSOCKETFUNCTION/ CURLOPT_CLOSESOCKETFUNCTION hooks to manage
the socket-fd associations, which then is used to look-up the fd from a
socket in the CURLMOPT_SOCKETFUNCTION callback.

I am considering switching to libevent(2) instead as it seems to have a
better impedance match with libcurl and Windows in general, but wanted to
at least give libev a last chance...

Cheers

Poul Thomas

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