curl-and-python

Crash inside dup()

From: Gisle Vanem <gvanem_at_yahoo.no>
Date: Thu, 19 Dec 2013 17:24:48 +0100

In pycurl.c, dup() is called to presumably duplicate a socket.
But sockets and files cannot be intermingled like on Unix.
Can WSADuplicateSocket() be used instead?

Anyway, the dup() crashes deep inside Win-XP and gives me only
this call-stack:

  ntdll!KiFastSystemCallRet
  ntdll!ZwWaitForMultipleObjects+0xc
  kernel32!WaitForMultipleObjectsEx+0x12c
  ADVAPI32!WmipEventPump+0x230
  kernel32!BaseThreadStart+0x37

Not very helpful. I used something like this to test:

def socket_open(family, socktype, protocol, address):
   s = socket.socket (family, socktype, protocol)
   print ("s._sock: ", s._sock)
   return s

c = pycurl.Curl()
c.setopt(c.URL, 'http://10.0.0.10/')
c.setopt(c.VERBOSE,1)
c.setopt(c.OPENSOCKETFUNCTION, socket_open)
c.perform()
c.close()

Which produces this before the crash:
  ('s._sock: ', <socket object, fd=1444, family=2, type=1, protocol=0>)

The 1444 seems right and is the same arg as dup() is called with.

--gv

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-12-19