Re: Bug in HTTCP.c

Hello Jens,

Thanks for your patch.

I gave it a test under Win98. I still haven't commited it because I think
there's a bit more of work to do.

The problem is that the HTEvent_CONNECT event is being registred 
systematically every time we come to that part of HTDoConnect, but it
doesn't take into account errors generated by the connect call. I think
that in those cases we should unregister what we just registed.

I tested your patch with Amaya and looking at the libwww traces, I noticed
that when accesing the same page the code with your patch registred two
extra timers. It's the only side-effect I noticed so far.

I haven't had time to try adding an unregister call as described above to
see if it helps out.

I'll continue testing it and then, if I don't find anything else, I'll
commit it as it is.

Cheers!

-Jose

that In our previous episode, Jens Meggers said:
> 
> I found a serious bug in HTTCP.c for Win32 systems.
> 
> In HTDoConnect(), the connect command is done before the WSAAsyncSelect() that is called when HTHost_register(host, net, HTEvent_CONNECT); is executed. Although that is in line with the WinSock2 and Microsoft documentation, it does _not_ work all the time. I have done extensive tests on Win2000 and Win 4.0 SP5. In very rare cases, the connect is finished between the connect() command itself and the WSAAsyncSelect(). In this unlikely case, WinSock does not (always) send the FD_CONNECT message. As a result, when using the Async mode, the event loop hangs because there is no timeout procedure registered for FD_CONNECT.
> 
> Thus, I moved the HTHost_register in front of the connect command in HTDoConnect():
> 
> case TCP_NEED_CONNECT:

Received on Tuesday, 11 July 2000 06:16:02 UTC