Re: Problem with redirect in libwww

On Wed, 2 Aug 1995, Douglas Rand wrote:
> Has anyone seen this,  or have a fix for it?  The library closes the initial
> stream,  but goes on to try and read the redirect.  This,  of course,  doesn't
> work.

Yes, I reported this a couple months ago. It only crashes on redirect when
in source mode, which is probably why it did not get noticed earlier.

Henrik Nielsen kindly provided me with a patch that fixed the problem, and
I am sure he fixed it in the upcoming version of the library too. Henrik
is on vacation until next week though, but I can't see why he would mind
if I posted it, so here it is (actually I don't have the original patch,
so I regenerated this from my source, but it should be right)...


*** HTTP.c.orig	Tue Mar 21 12:44:20 1995
--- HTTP.c	Wed Jul 12 08:24:46 1995
***************
*** 492,498 ****
  				     req->output_format, req->output_stream);
  	    PUTBLOCK(me->buffer, me->cnt);
  	} else {
! 	    if (req->output_format == WWW_SOURCE) {
  		me->target = HTMIMEConvert(req, NULL, WWW_MIME,
  					   req->output_format,
  					   req->output_stream);
--- 492,521 ----
  				     req->output_format, req->output_stream);
  	    PUTBLOCK(me->buffer, me->cnt);
  	} else {
! 	    if (me->status==200) {
! 		HTStream *s;
! 		if (req->output_format == WWW_SOURCE) {
! 		    me->target = HTMIMEConvert(req, NULL, WWW_MIME,
! 					       req->output_format,
! 					       req->output_stream);
! 		} else {
! 		    me->target = HTStreamStack(WWW_MIME, req->output_format,
! 					       req->output_stream, req, NO);
!
! 		    if (req->method==METHOD_GET && HTCacheDir &&
! 			(s = HTCacheWriter(req, NULL, WWW_MIME,
! 					   req->output_format,
! 					   req->output_stream))) {
! 			me->target = HTTee(me->target, s);
! 		    }
! 		}
! 	    } else {
! 		me->target = HTMIMEConvert(req,NULL, WWW_MIME, WWW_SOURCE,
! 					   req->output_flush);
! 	    }
!
! #if 0
!     if (req->output_format == WWW_SOURCE) {
  		me->target = HTMIMEConvert(req, NULL, WWW_MIME,
  					   req->output_format,
  					   req->output_stream);
***************
*** 516,521 ****
--- 539,545 ----
  					   WWW_SOURCE, req->output_flush ?
  					   req->output_flush : HTBlackHole());
  	    }
+ #endif
  	    if (!me->target)
  		me->target = HTBlackHole();			/* What else */
  	}

Received on Wednesday, 2 August 1995 15:35:23 UTC