W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2001

Bug Report on NT

From: Deshakulakarni, Chandra <Chandra_Deshakulakarni@bmc.com>
Date: Fri, 9 Mar 2001 09:32:52 -0600
Message-ID: <85BCB1287CF1D41197570090279A6A0D338500@ES02-AUS.bmc.com>
To: "'www-lib@w3.org'" <www-lib@w3.org>
This bug happens only on NT, when libraries were compiled
with WWW_WIN_ASYNC flag defined.
I was trying HTTP Get from a valid DNS hostname. But that
host didn't have any running web-server. The HTTP Get was
trying to get a document from the default HTTP port. 

This is in HTEvtLst.c

******************* HTEvtLst.c ***************************************

#ifdef WWW_WIN_ASYNC

/* Only responsible for WM_TIMER and WSA_AsyncSelect */    	
PRIVATE LRESULT CALLBACK AsyncWindowProc(HWND hwnd, UINT uMsg, WPARAM
wParam, LPARAM lParam)
{
    WORD event;
    SOCKET sock;
    HTEventType type;
    ms_t now = HTGetTimeInMillis();

    /* timeout stuff */
    if (uMsg == WM_TIMER) {
	HTTimer_dispatch((HTTimer *)wParam);
	return (0);
    }

    if (uMsg != HTwinMsg)	/* not our async message */
    	return (DefWindowProc(hwnd, uMsg, wParam, lParam));

    event = LOWORD(lParam);

     
    sock = (SOCKET)wParam;
    switch (event) {
    case FD_READ: type = HTEvent_READ; break;
    case FD_WRITE: type = HTEvent_WRITE; break;
    case FD_ACCEPT: type = HTEvent_ACCEPT; break;
    case FD_CONNECT: type = HTEvent_CONNECT; break;
    case FD_OOB: type = HTEvent_OOB; break;
    /* JK: was returning HTEvent_CLOSE before, and this was a source of
       errors, as libwww detects the socket shutdown with a call to recv  */

    case FD_CLOSE: type = HTEvent_READ; break;
    default: HTDEBUGBREAK("Unknown event %d\n" _ event);
    }
       if (HTEventList_dispatch((int)sock, type, now) != HT_OK)
	       HTEndLoop = -1;
    return (0);
}

******************* END **********************************************

The code here never checks for error condition, which can be
obtained by
   WORD err = HIWORD(lParam);
   if ( err != 0 )
   {
     /* May be end the loop or pass the error back to the
        calling application. */
   }

Since, there was no web server, in this case, returns an 'err' value
of "ConnectionRefused".
Since the error is never caught, code goes in an infinite loop.

I couldn't figure out a way to gracefully report the error
condition back to the calling program.

I appreciate if anyone has a solution for this.

Thanks,

Chandra_Deshakulakarni@bmc.com
Received on Friday, 9 March 2001 10:34:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:38 GMT