- From: Jens Meggers <jens.meggers@firepad.com>
- Date: Wed, 13 Sep 2000 17:16:24 -0400 (EDT)
- To: "'www-lib@w3.org'" <www-lib@w3.org>
Hi all, I'm quite sure that I fixed a bug in libWWW. It appears under Win32 when using the async event handler. The bug goes back to a bug fix reported by Jose in 1998: http://lists.w3.org/Archives/Public/www-lib/1996AprJun/0138.html It has something to do with the "magic" code in PUBLIC int HTHost_register () reported in the referenced bug fix: #ifdef WWW_WIN_ASYNC /* Make sure we are registered for CLOSE on windows */ event = *(host->events+HTEvent_INDEX(HTEvent_CLOSE)); HTEvent_register(HTChannel_socket(host->channel), HTEvent_CLOSE, event); #endif /* WWW_WIN_ASYNC */ I understand that the code is neccessary to detect an (early) socket shutdown from the server or when using legacy HTTP versions. Thus, we need to keep it. However, the code makes neccessary to change as well the AsyncWindowProc() procedure in HTEvtLst.c as proposed in the referenced bug fix. Unfortunatly, the current version does not contain the last part of the fix that is proposed for AsyncWindowProc(): > And in AsyncWindowProc, I join FD_CLOSE and FD_READ ... If FD_CLOSE and FD_READ is not joined, it happens very frequently, that the close event is handled before the last read event. This ends up in partially transmitted HTTP responses and a HT_INTERRUPTED error message. I integrated that part as proposed and could fix that problem. However, there is a side effect, that comes up when integrating the CLOSE event in HTHost_register.c, as it is done in the current version. When the application selects a timeout with HTHost_setEventTimeout(), the timer and the corresponding windows messages are kept after finishing the requests. This ends up in a leaking timer messages whenever a request is done. Thus, I added a HTEvent_unregister() call for the close event in HTHost_clearChannel (HTHost * host, int status): PUBLIC BOOL HTHost_clearChannel (HTHost * host, int status) { if (host && host->channel) { HTChannel_setHost(host->channel, NULL); HTEvent_unregister(HTChannel_socket(host->channel), HTEvent_READ); HTEvent_unregister(HTChannel_socket(host->channel), HTEvent_WRITE); #ifdef WWW_WIN_ASYNC HTEvent_unregister(HTChannel_socket(host->channel), HTEvent_CLOSE); #endif /* WWW_WIN_ASYNC */ host->registeredFor = 0; Please drop me a note, I you think the bug fix is reasonable or not. Best Regards, Jens
Received on Friday, 15 September 2000 03:22:18 UTC