LIBWWW BUG REPORT

Hi,

I am a user of LIBWWW code. I noticed the following bug
in the code. It occurs only on NT.
I was trying HTTP Get from a valid DNS hostname. But it
didn't have any web-server.

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 )
   {
     /* Do something */
   }

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, with
the same thing repeating again and again.

I don't have the full understanding of the code. I didn't know
how to pass this error condition back to the calling program.

Please send me an e-mail at
   Chandra_Deshakulakarni@bmc.com
if you need any more details.

Thanks,

Chandra

Received on Thursday, 8 March 2001 03:16:53 UTC