W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 1996

Redirection blues

From: Anselm Baird_Smith <abaird@www43.inria.fr>
Date: Wed, 18 Dec 1996 09:44:04 +0100 (MET)
Message-Id: <199612180844.JAA11744@www43.inria.fr>
To: bpm@techapp.com
Cc: www-jigsaw@w3.org
Brian Millett writes:
 > Hello,
 > 	Well after a bit of snooping around in the code & turning on
 > -trace, I found that the CgiResource was not returning a correct mime
 > header for the httpd (Jigsaw) server to handle.  What was missing was
 > "Content-length: 0"
 > ...
 > So I added the following to the handleCGIOutput method right after the
 > catches, before the return reply;
 > 
 > 
 > 	if ( reply.getStatus() == HTTP.MOVED_TEMPORARILY ) {
 > 	  String nocache[] = { "no-cache" };
 > 	  reply.setPragma(nocache);
 > 	  reply.setNoCache(null);
 > 	  reply.setContentLength(0);
 > 	}

I have a slight problem with this: the HTTP spec allows for a body in
a 302 reply, which means that the script emitting the redirect is
allowed to set Content-Length itself. I guess the code should read:

if ( reply.getStatus() == HTTP.MOVED_TEMPORARILY ) {
    if ( reply.getContentLength() < 0 ) {
        // The script didn't emit a content length [READ-ON]
        reply.setContentLength(0);
    }
}

Now, this doesn't work either. In fact your script should work even if
it doesn't emit a content length: in that case Jigsaw will chunk
encode the body (if the client is 1.1), or close the connection after
sending the reply (which is what should happen in your case). I'll try
it and fix it, will let you know.

Anselm.
Received on Wednesday, 18 December 1996 03:44:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:25 GMT