Bug Report on NT

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 UTC