Re: a test result

Shel Kaphan said:
> 
> As it turns out, using the NCSA server (v 1.3) there is apparently no
> way for a CGI program to return the Location header with a 2xx status.

First, that statement is untrue. Secondly, this is a feature not a bug.

> If you generate a Location header, the server forces 302 status.

Yes. That is what outputting the string Location: is supposed to do; it 
lets you issue a redirect from a program, without the hassle of creating 
all your own headers yourself.

> Sounds like a patch is needed.  (maybe there are newer versions that
> already have this fixed?)

No, and no. Suppose this was patched. How would you ever issue a redirect?
You would have to generate all your own headers. Imagemap would stop 
working. Etc.

So here is the impossible program. As you can see it is not complicated:

======== begin nph-loc ========
#!/bin/sh
echo "HTTP 200 Hunky dory"
echo "Server: NCSA 1.3 via nph script"
echo "Location: http://some/location"
echo "MIME-version: 1.0"
echo "Content-type: text/html"
echo
echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN//2.0\">"
echo "<html><head><title>refute</title></head><body><p>"
echo "Hi there</p></body></html>
========== end nph-loc ===========

Save this out into your cgi-bin as nph-loc, telnet to your server and try it:

telnet info 80
Trying...
Connected to info.mcc.ac.uk.
Escape character is '^]'.
GET /cgi-bin/nph-loc HTTP/1.0

HTTP 200 Hunky dory
Server: NCSA 1.3 via nph script
Location: http://some/location
MIME-version: 1.0
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN//2.0">
<html><head><title>refute</title></head><body><p>
Hi there</body</html>

So, you have a location header and a 200 status. The client will of 
course do nothing with the Location header, because the status is not 
300 series.

Happy now?  ;-)

-- 
Chris Lilley, Technical Author
+-------------------------------------------------------------------+
|       Manchester and North HPC Training & Education Centre        |
+-------------------------------------------------------------------+
| Computer Graphics Unit,             Email: Chris.Lilley@mcc.ac.uk |
| Manchester Computing Centre,        Voice: +44 161 275 6045       |
| Oxford Road, Manchester, UK.          Fax: +44 161 275 6040       |
| M13 9PL                            BioMOO: ChrisL                 |
|     URI: http://info.mcc.ac.uk/CGU/staff/lilley/lilley.html       | 
+-------------------------------------------------------------------+

Received on Wednesday, 9 August 1995 12:05:39 UTC