W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

bug in HTTCP.c

From: Jens Meggers <jens@meggers.com>
Date: Fri, 4 Aug 2000 16:59:12 +0200
Message-ID: <001401bffe24$8dd70520$1002a8c0@pille>
To: <www-lib@w3.org>

sorry for being just a few hours too late for the last release, but think that I found a bug in HTTCP.c:

When requesting for an URL to a host that exists, but has not service running, the request is not finished in non-blocking mode. This causes the event loop not to return and requests hang.
Try fro example the url
When HTDoConnect() enters the state TCP_NEED_CONNECT, it starts connect(). On Win32, the results is always WSA_WOULDBLOCK because the TCP connection is not initiated immediatly. The event system simply calls that code portion again after receiving a FD_CONNECT event. Thus, the conenct() is called again and again, always returning WSA_WOULDBLOCK. It seems that the retry-counter of HTHost.c provides the right solution to stop connection retries after some time, however the counter seems not to be used and is not set up.
I fixed the problem by setting a default value for the retry counter in HTHost_new():

  if (pres) pres->retry = 3;

     return pres; 

and changed the beginning of TCP_NEED_CONNECT part of HTDoConnect()  to


  // for each connection attempt, decrease the retry value
  HTHost_decreaseRetry (host);

  if (!HTHost_retry(host)) {
   host->tcpstate = TCP_ERROR;

     HTHost_register(host, net, HTEvent_CONNECT);

I'm not sure how this is realted with non-blocking mode on Unix. I guess that the problem is the same when connect() returns EINPROGRESS.


Received on Friday, 4 August 2000 11:00:27 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:53 UTC