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

LIBWWW BUG REPORT

From: Deshakulakarni, Chandra <Chandra_Deshakulakarni@bmc.com>
Date: Wed, 7 Mar 2001 14:45:37 -0600
Message-ID: <85BCB1287CF1D41197570090279A6A0D3384F1@ES02-AUS.bmc.com>
To: "'kahan@w3.org'" <kahan@w3.org>
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 GMT

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