Still about server mode in libwwww 5.0a...

Hi,

I'm not yet familiar with the library internals, so I have to ask
second opinion here. I hope someone could verify whether these are
real potential problems or just my misunderstanding about the library
functions...

1. Suspicious use of HTTee in HTMIME.c
--------------------------------------

The following code fragment appears in the pumpData function

	} else if (HTResponse_isCachable(me->response)) {
	    HTStream * cache = HTStreamStack(WWW_CACHE, me->target_format,
					     me->target, request, NO);
	    if (cache) me->target = HTTee(me->target, cache, NULL);
	}

What seems to happen, is that me->target stream will appear on *both*
Tee streams, and when the Tee is destroyed, this stream will get *TWO*
calls for its _free method! The first works, but the second will
totally mess things up (as the stream structure does not exist
anymore)...

Any suggestions how to fix this?

2. HTRequest_dup appears very dangerous in HTReqMan.c
-----------------------------------------------------

I cannot see how a total crash can be avoided, if any call to
HTRequest_dup or HTRequest_dupInternal is made, because

 - both make a blind of copy of the HTRequest structure (copying *ALL*
   miscellaneous pointers to other structures as is),

 - HTRequest_dupInternal calls HTRequest_clear, which calls
   HTResponce_delete, if response pointer existed. However, nothing
   removes the original response pointer in the original HTRequest,
   which now points to freed structure...

 - in both cases a lot of other pointers are duplicated, and it seems
   that a great havoc will occur when the original and duplicate are
   ultimately released by a call to HTRequest_delete!!!!

To me it looks like HTRequest_dup* should, either

 - NULL all pointers

or

 - make duplicates of the referenced structures

or

 - if referenced structs support reference counting, it should be
   applied

or

 - combination of above

--
Markku Savela (msa@hemuli.tte.vtt.fi),     Technical Research Centre of Finland
Multimedia Systems, P.O.Box 1203,FIN-02044 VTT,http://www.vtt.fi/tte/staff/msa/

Received on Tuesday, 12 November 1996 06:38:59 UTC