cURL / Mailing Lists / curl-library / Single Mail


Re: OPENSOCKETFUNCTION hook not called for all socket creations on Windows

From: Christian Hägele <>
Date: Wed, 28 Dec 2011 13:39:01 +0100

Daniel Stenberg <daniel <at>> writes:

>I've written up a patch for this problem. See the attached file.
>I don't have or develop on Windows so I haven't been able to actually
> test oreven build this code to verify that it actually works as
> intended. Let me knowhow it works and what furthre tweaks we need to do!


I tested your patch (against current curl-7.23.1) and found two minor
issues in
asyn-thread.c. I have attached a patch with my corrections.
The patch works as intended. As it changes the public API (new value
CURLSOCKTYPE_DUMMY) there might be issues with existing applications,
(No big deal. Properly written applications should be fine)

Overall the change clarifies that the socket is a dummy-socket because of
the new
value in the OPENSOCKETFUNCTION. But as it is still a dummy-socket for a
windows-only workaround. There might be some better way to do it.
There are other dummy-sockets in curl which are not propagated to the
caller at
all (e.g. when checking for IPv6-support). A direct call to socket-syscall
made on the socket is closed right after usage.

I think a similar approach for the dummy-socket in asyn-thread.c would be a
better solution. That would make the code easier and the change-set
The only reason for the dummy socket is to have one socket in the
Curl_resolver_getsock() call. The better solution would be to work with the
situation that Curl_resolver_getsock() returns no sockets. (Which it does
non-windows platforms)



List admin:

Received on 2011-12-28