W3C home > Mailing lists > Public > www-lib@w3.org > July to September 1995

Re: Problem with redirect in libwww

From: Matthew Freedman <mattf@cac.washington.edu>
Date: Wed, 2 Aug 1995 12:34:57 -0700 (PDT)
To: Douglas Rand <Douglas.Rand@elric.boston.sgi.com>
Cc: www-lib@w3.org
Message-Id: <Pine.ULT.3.92.950802122456.26465J-100000@elvis.cac.washington.edu>
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 GMT

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