W3C home > Mailing lists > Public > www-talk@w3.org > November to December 1995

Re: what's a CGI to do?...

From: David Robinson <drtr1@cus.cam.ac.uk>
Date: Thu, 30 Nov 95 17:27 GMT
Message-Id: <m0tLClI-000DJLC@ursa.cus.cam.ac.uk>
To: dmk@allegra.att.com, www-talk@w3.org
Cc: drtr1@cus.cam.ac.uk
>...
>Let me paraphrase the problem.  NCSA httpd (and my server) allow a CGI
>to give a "local" Location: header that causes the server to process
>the resulting redirection without first sending anything to the client.
>Beyond that I think the "correct" behavior is undefined.  So I'm trying
>to define it.
>
>Some questions that come up are:
>
>1) What should the method be for the redirected request?
>(N.B.  I think the behavior should be consistent with what happens for a
>"full" URL that gets returned to a client.)

A "GET" method. It's the only useful behaviour; the CGI script has no means
for supplying content.

>2) If the method should indeed be POST, where does the content come from?
>(POST requires Content-Type and Content-Length headers.)

Logically, from the script that returned the Location: header. Unfortunately,
there is currently no way to arrange that.

>3) Should there be a way for a CGI to specify the method to use with a
>redirection?  If yes, only for local URLs, or for full ones, too?

You could do it for local URLs by having a Method: header, and taking
any content produced by the CGI script as input content for the redirected
request.

> 4) What environment should be passed to a CGI (like T2 above) that is
> reached via a redirection?
> (Here again, I think it should be the same as if a full URL got sent
> back to the client, and the client made a new request.)

Yes. That is what servers currently do on internal redirection. However, some
servers also pass the CGI variables for the original request prefixed by
REDIRECT_. e.g. Client requests http://foo.com/script?args
The server (perhaps because of script being a CGI script returning a
Location: /bar header) internally redirects this to the CGI script
http://foo.com/bar
then this script gets the environment variables
SCRIPT_NAME=/bar
QUERY_STRING=""
REDIRECT_SCRIPT_NAME=/script
REDIRECT_QUERY_STRING=args

 David.
Received on Thursday, 30 November 1995 12:28:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:18 GMT