Re: Solution for possible crash if using SSL

Hello Heiner,

I saw your patch. One thing that worries me is that your patch blocks
all flushes that may be done in any host. Did you try to use the
host->forceWriteFlush variable instead, to do the same thing?

That is

if (host->force_writeFlush || targetNet == NULL)

instead of

if (in_flush || targetNet == NULL)

It looks like a better solution to me. Could you give it a try and then
report back to the list?

Thanks!

-Jose

In our previous episode, Kallweit, Heiner said:
> 
> I ran into serious trouble when using a CGI-programm that (not only)
> forwards
> requests via Libwww and SSL. Every 100th request I got a core dump.
> Eventually I found out that there is a recursive function call. To cut a
> long
> story short: HTHost_forceFlush -> HTTPEvent_Flush ->
> HTBufferWriter_lazyFlush
> -> HTSSLWriter_write -> HTSSLReader_read -> HTHost_forceFlush
> If your machine is fast enough (mine was) this can cause a stack overflow.
> I stopped the recursion by changing HTHost_forceFlush to the following:
> 
> PUBLIC int HTHost_forceFlush(HTHost * host)
> {
>     static BOOL in_flush=NO;
>     HTNet * targetNet = (HTNet *) HTList_lastObject(host->pipeline);
>     int ret;
>     if (in_flush || targetNet == NULL) return HT_ERROR;
>     HTTRACE(CORE_TRACE, "Host Event.. FLUSH passed to `%s\'\n" _
>  
> HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet))));
>     host->forceWriteFlush = in_flush = YES;
>     while ((ret = (*targetNet->event.cbf)(HTChannel_socket(host->channel),
> targetNet->event.param, Event_FLUSH))==HT_WOULD_BLOCK);
>     host->forceWriteFlush = in_flush = NO;
>     return ret;
> }

Received on Wednesday, 26 July 2000 11:21:06 UTC