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

Re: Crashing in HTMIME

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Fri, 29 Jan 1999 18:35:22 -0500
To: www-lib@w3.org
Message-ID: <36B245BA.EF802BDA@w3.org>
To: olga <olga@goliath.eai.com>


olga wrote:

> It is possible that debug stack of the request is used several times.
> For example first time when 401 is returned by server, second time when 304 is
> returned by server.

I couldn't get it to crash but I found a very strange thing indeed - it
put the 401 response into the cache which obviously is wrong. Also -
there were some memory leaks where response headers were not freed.

Could I get you try this patch (which here leaves no problems in purify
what so ever)

If it works then I will commit it - sorry about these stupid bugs :(

Henrik
Index: HTTP.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTTP.c,v
retrieving revision 1.174
diff -c -r1.174 HTTP.c
*** HTTP.c	1999/01/27 13:56:31	1.174
--- HTTP.c	1999/01/29 23:31:25
***************
*** 755,761 ****
  				       HTRequest_debugStream(request),
  				       request, NO);
  	} else if (HTRequest_debugStream(request)) {
! 	    if (me->status == 201) HTResponse_setCachable(response, HT_CACHE_ETAG);
  	    me->target = HTStreamStack(WWW_MIME,
  				       HTRequest_debugFormat(request),
  				       HTRequest_debugStream(request),
--- 755,762 ----
  				       HTRequest_debugStream(request),
  				       request, NO);
  	} else if (HTRequest_debugStream(request)) {
! 	    HTResponse_setCachable(response,
! 				   (me->status == 201) ? HT_CACHE_ETAG : HT_NO_CACHE);
  	    me->target = HTStreamStack(WWW_MIME,
  				       HTRequest_debugFormat(request),
  				       HTRequest_debugStream(request),
***************
*** 765,771 ****
  	    **  We still need to parse the MIME part in order to find any
  	    **  valuable meta information which is needed from the response.
  	    */
! 	    if (me->status == 201) HTResponse_setCachable(response, HT_CACHE_ETAG);
  	    me->target = HTStreamStack(WWW_MIME,
  				       HTRequest_debugFormat(request),
  				       HTRequest_debugStream(request),
--- 766,773 ----
  	    **  We still need to parse the MIME part in order to find any
  	    **  valuable meta information which is needed from the response.
  	    */
! 	    HTResponse_setCachable(response,
! 				   (me->status == 201) ? HT_CACHE_ETAG : HT_NO_CACHE);
  	    me->target = HTStreamStack(WWW_MIME,
  				       HTRequest_debugFormat(request),
  				       HTRequest_debugStream(request),
Index: HTReqMan.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTReqMan.c,v
retrieving revision 2.74
diff -c -r2.74 HTReqMan.c
*** HTReqMan.c	1998/12/15 05:34:28	2.74
--- HTReqMan.c	1999/01/29 23:31:25
***************
*** 349,354 ****
--- 349,355 ----
  PUBLIC BOOL HTRequest_setResponse (HTRequest * me, HTResponse * response)
  {
      if (me) {
+ 	if (me->response) HTResponse_delete(me->response);
  	me->response = response;
  	return YES;
      }
Index: HTCache.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTCache.c,v
retrieving revision 2.58
diff -c -r2.58 HTCache.c
*** HTCache.c	1998/12/03 15:26:01	2.58
--- HTCache.c	1999/01/29 23:31:25
***************
*** 1439,1444 ****
--- 1439,1447 ----
  	
  	    /* Send the data down the pipe */
  	    status = (*target->isa->put_block)(target, buffer, status);
+ 
+ 	    /* Delete the response headers */ 
+ 	    HTRequest_setResponse(request, NULL);
  	    if (status == HT_LOADED) {
  		(*target->isa->flush)(target);
  		return YES;
Index: HTAnchor.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTAnchor.c,v
retrieving revision 1.82
diff -c -r1.82 HTAnchor.c
*** HTAnchor.c	1998/12/22 19:59:58	1.82
--- HTAnchor.c	1999/01/29 23:31:25
***************
*** 724,729 ****
--- 724,730 ----
  	    /*
  	    **  Inherit all the unparsed headers - we may need them later!
  	    */
+ 	    if (me->headers) HTAssocList_delete(me->headers);
  	    me->headers = HTResponse_handOverHeader(response);
  
  	    /*
Received on Friday, 29 January 1999 18:35:26 GMT

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